diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-10-23 08:49:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-10-26 00:51:12 +0800 |
commit | 19cee3614902c50d3aafc3c7eb83fa2a4b85196c (patch) | |
tree | df110d17b148e16c8fd604903fcada4125c4266c /modules/mail | |
parent | ad6059bc0d63ab8503fe631dd3583c6ef8816b54 (diff) | |
download | gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.tar gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.tar.gz gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.tar.bz2 gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.tar.lz gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.tar.xz gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.tar.zst gsoc2013-evolution-19cee3614902c50d3aafc3c7eb83fa2a4b85196c.zip |
Use EProxyPreferences in EPreferencesWindow.
Replaces EMNetworkPrefs.
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/Makefile.am | 3 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 16 | ||||
-rw-r--r-- | modules/mail/em-network-prefs.c | 539 | ||||
-rw-r--r-- | modules/mail/em-network-prefs.h | 104 |
4 files changed, 15 insertions, 647 deletions
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am index 29e8388109..0ae18df31e 100644 --- a/modules/mail/Makefile.am +++ b/modules/mail/Makefile.am @@ -37,8 +37,7 @@ module_mail_la_SOURCES = \ em-composer-prefs.h \ em-mailer-prefs.c \ em-mailer-prefs.h \ - em-network-prefs.c \ - em-network-prefs.h + $(NULL) module_mail_la_LIBADD = \ $(top_builddir)/libemail-engine/libemail-engine.la \ diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 4c4a1447c5..1ec00a3f55 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -58,7 +58,6 @@ #include "em-account-prefs.h" #include "em-composer-prefs.h" #include "em-mailer-prefs.h" -#include "em-network-prefs.h" #define E_MAIL_SHELL_BACKEND_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -508,6 +507,18 @@ mail_shell_backend_changes_committed_cb (EMailConfigWindow *window, g_object_unref (service); } +static GtkWidget * +mail_shell_backend_create_proxy_page (EPreferencesWindow *window) +{ + EShell *shell; + ESourceRegistry *registry; + + shell = e_preferences_window_get_shell (window); + registry = e_shell_get_registry (shell); + + return e_proxy_preferences_new (registry); +} + static void mail_shell_backend_constructed (GObject *object) { @@ -571,13 +582,14 @@ mail_shell_backend_constructed (GObject *object) em_composer_prefs_new, 400); + /* This page is encapsulated by EProxyPreferences. */ e_preferences_window_add_page ( E_PREFERENCES_WINDOW (preferences_window), "system-network-proxy", "preferences-system-network-proxy", _("Network Preferences"), NULL, - em_network_prefs_new, + mail_shell_backend_create_proxy_page, 500); mail_session = e_mail_backend_get_session (E_MAIL_BACKEND (object)); diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c deleted file mode 100644 index 9da5708cc0..0000000000 --- a/modules/mail/em-network-prefs.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Veerapuram Varadhan <vvaradhan@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "em-network-prefs.h" - -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> - -#include <glib/gstdio.h> -#include <gdk/gdkkeysyms.h> - -#include <e-util/e-util-private.h> - -#include <mail/em-config.h> -#include <mail/em-folder-selection-button.h> -#include <mail/e-mail-junk-options.h> - -#define d(x) - -#define SETTINGS_KEY_NAME "evo-proxy-settings-key-name" -#define SET_KEY_NAME(_widget, _key) g_object_set_data_full (G_OBJECT (_widget), SETTINGS_KEY_NAME, g_strdup (_key), g_free) - -G_DEFINE_TYPE ( - EMNetworkPrefs, - em_network_prefs, - GTK_TYPE_VBOX) - -static void -em_network_prefs_class_init (EMNetworkPrefsClass *class) -{ -} - -static void -em_network_prefs_init (EMNetworkPrefs *prefs) -{ -} - -static void -toggle_button_toggled (GtkToggleButton *toggle, - EMNetworkPrefs *prefs) -{ - const gchar *key; - - key = g_object_get_data ((GObject *) toggle, SETTINGS_KEY_NAME); - g_settings_set_boolean (prefs->proxy_settings, key, gtk_toggle_button_get_active (toggle)); - if (toggle == prefs->use_auth) { - gboolean sensitivity = gtk_toggle_button_get_active (prefs->use_auth); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_auth_user, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_auth_pwd, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->auth_user, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->auth_pwd, sensitivity); - } -} - -static void -toggle_button_init (EMNetworkPrefs *prefs, - GtkToggleButton *toggle, - const gchar *key) -{ - gboolean bval; - - bval = g_settings_get_boolean (prefs->proxy_settings, key); - gtk_toggle_button_set_active (toggle, bval); - - SET_KEY_NAME (toggle, key); - g_signal_connect ( - toggle, "toggled", - G_CALLBACK (toggle_button_toggled), prefs); - - if (!g_settings_is_writable (prefs->proxy_settings, key)) - gtk_widget_set_sensitive ((GtkWidget *) toggle, FALSE); -} - -static GtkWidget * -emnp_widget_glade (EConfig *ec, - EConfigItem *item, - GtkWidget *parent, - GtkWidget *old, - gint position, - gpointer data) -{ - EMNetworkPrefs *prefs = data; - - return e_builder_get_widget (prefs->builder, item->label); -} - -static void -emnp_set_sensitiveness (EMNetworkPrefs *prefs, - NetworkConfigProxyType type, - gboolean sensitivity) -{ -#if 0 - if (type == NETWORK_PROXY_AUTOCONFIG) { - gtk_widget_set_sensitive ((GtkWidget *) prefs->auto_proxy_url, sensitivity); - d (g_print ("Setting sensitivity of autoconfig to: %d\n", sensitivity)); - } else -#endif - if (type == NETWORK_PROXY_MANUAL) { - gboolean state; - - gtk_widget_set_sensitive ((GtkWidget *) prefs->http_host, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->https_host, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->ignore_hosts, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->use_auth, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->http_port, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->https_port, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_ignore_hosts, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_http_host, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_http_port, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_https_host, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_https_port, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->socks_host, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->socks_port, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_socks_host, sensitivity); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_socks_port, sensitivity); - - state = sensitivity && gtk_toggle_button_get_active (prefs->use_auth); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_auth_user, state); - gtk_widget_set_sensitive ((GtkWidget *) prefs->lbl_auth_pwd, state); - gtk_widget_set_sensitive ((GtkWidget *) prefs->auth_user, state); - gtk_widget_set_sensitive ((GtkWidget *) prefs->auth_pwd, state); - - d (g_print ("Setting sensitivity of manual proxy to: %d\n", sensitivity)); - } -} - -static void -notify_proxy_type_changed (GtkWidget *widget, - EMNetworkPrefs *prefs) -{ - gint type; - - if (gtk_toggle_button_get_active (prefs->sys_proxy)) - type = NETWORK_PROXY_SYS_SETTINGS; - else if (gtk_toggle_button_get_active (prefs->no_proxy)) - type = NETWORK_PROXY_DIRECT_CONNECTION; - else if (gtk_toggle_button_get_active (prefs->manual_proxy)) - type = NETWORK_PROXY_MANUAL; - else -#if 0 - type = NETWORK_PROXY_AUTOCONFIG; -#else - type = NETWORK_PROXY_SYS_SETTINGS; -#endif - - g_settings_set_int (prefs->proxy_settings, "proxy-type", type); - - if (type == NETWORK_PROXY_DIRECT_CONNECTION || - type == NETWORK_PROXY_SYS_SETTINGS) { - emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE); - emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, FALSE); - } else if (type == NETWORK_PROXY_AUTOCONFIG) { - emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE); - emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, TRUE); - } else if (type == NETWORK_PROXY_MANUAL) { - emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, FALSE); - emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, TRUE); - } - - if (type != NETWORK_PROXY_DIRECT_CONNECTION) - g_settings_set_boolean (prefs->proxy_settings, "use-http-proxy", TRUE); - else if (type != NETWORK_PROXY_SYS_SETTINGS) - g_settings_set_boolean (prefs->proxy_settings, "use-http-proxy", FALSE); -} - -static void -widget_entry_changed_cb (GtkWidget *widget, - gpointer user_data) -{ - const gchar *key; - const gchar *value; - gint port = -1; - GSettings *proxy_settings = user_data; - - g_return_if_fail (proxy_settings != NULL); - - key = g_object_get_data (G_OBJECT (widget), SETTINGS_KEY_NAME); - g_return_if_fail (key != NULL); - - /* - * Do not change the order of comparison - - * GtkSpinButton is an extended form of GtkEntry - */ - if (GTK_IS_SPIN_BUTTON (widget)) { - port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); - g_settings_set_int (proxy_settings, key, port); - d (g_print ("%s:%s: %s is SpinButton: value = [%d]\n", G_STRLOC, G_STRFUNC, key, port)); - } else if (GTK_IS_ENTRY (widget)) { - value = gtk_entry_get_text (GTK_ENTRY (widget)); - g_settings_set_string (proxy_settings, key, value); - d (g_print ("%s:%s: %s is Entry: value = [%s]\n", G_STRLOC, G_STRFUNC, key, value)); - } -} - -static void -ignore_hosts_entry_changed_cb (GtkWidget *widget, - gpointer user_data) -{ - const gchar *key; - const gchar *value; - gchar **split; - GPtrArray *ptrs; - GSettings *proxy_settings = user_data; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_ENTRY (widget)); - g_return_if_fail (proxy_settings != NULL); - - key = g_object_get_data (G_OBJECT (widget), SETTINGS_KEY_NAME); - g_return_if_fail (key != NULL); - - ptrs = g_ptr_array_new_with_free_func (g_free); - - /* transform comma-separated list of ignore_hosts to a string-list */ - value = gtk_entry_get_text (GTK_ENTRY (widget)); - split = g_strsplit (value ? value : "", ",", -1); - if (split) { - gint ii; - - for (ii = 0; split[ii]; ii++) { - const gchar *tmp = split[ii]; - - if (tmp && *tmp) { - gchar *val = g_strstrip (g_strdup (tmp)); - - if (val && *val) - g_ptr_array_add (ptrs, val); - else - g_free (val); - } - } - - g_strfreev (split); - } - - /* NULL-terminated array of strings */ - g_ptr_array_add (ptrs, NULL); - - g_settings_set_strv (proxy_settings, key, (const gchar * const *) ptrs->pdata); - - g_ptr_array_free (ptrs, TRUE); -} - -/* plugin meta-data */ -static EMConfigItem emnp_items[] = { - { E_CONFIG_BOOK, (gchar *) "", (gchar *) "network_preferences_toplevel", emnp_widget_glade }, - { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) "vboxNetworkGeneral", emnp_widget_glade }, - { E_CONFIG_SECTION, (gchar *) "00.general/00.proxy", (gchar *) "proxy-vbox", emnp_widget_glade }, -}; - -static void -emnp_free (EConfig *ec, - GSList *items, - gpointer data) -{ - /* the prefs data is freed automagically */ - - g_slist_free (items); -} - -static void -emnp_set_markups (EMNetworkPrefs *prefs) -{ - GtkWidget *child; - - child = gtk_bin_get_child (GTK_BIN (prefs->sys_proxy)); - gtk_label_set_use_markup (GTK_LABEL (child), TRUE); - - child = gtk_bin_get_child (GTK_BIN (prefs->no_proxy)); - gtk_label_set_use_markup (GTK_LABEL (child), TRUE); - - child = gtk_bin_get_child (GTK_BIN (prefs->manual_proxy)); - gtk_label_set_use_markup (GTK_LABEL (child), TRUE); -} - -static void -em_network_prefs_construct (EMNetworkPrefs *prefs) -{ - GtkWidget *toplevel; - GSList *l; - gchar **ignore; - gchar *buf; - EMConfig *ec; - EMConfigTargetPrefs *target; - gboolean locked; - gint i, val, port; - - prefs->proxy_settings = g_settings_new ("org.gnome.evolution.shell.network-config"); - g_object_set_data_full (G_OBJECT (prefs), "proxy-settings-obj", prefs->proxy_settings, g_object_unref); - - /* Make sure our custom widget classes are registered with - * GType before we load the GtkBuilder definition file. */ - E_TYPE_MAIL_JUNK_OPTIONS; - EM_TYPE_FOLDER_SELECTION_BUTTON; - - prefs->builder = gtk_builder_new (); - e_load_ui_builder_definition (prefs->builder, "mail-config.ui"); - - /** @HookPoint-EMConfig: Network Preferences - * @Id: org.gnome.evolution.mail.networkPrefs - * @Class: org.gnome.evolution.mail.config:1.0 - * @Target: EMConfigTargetPrefs - * - * The network preferences settings page. - */ - ec = em_config_new ("org.gnome.evolution.mail.networkPrefs"); - l = NULL; - for (i = 0; i < G_N_ELEMENTS (emnp_items); i++) - l = g_slist_prepend (l, &emnp_items[i]); - e_config_add_items ((EConfig *) ec, l, emnp_free, prefs); - - /* Proxy tab */ - - /* Default Behavior */ - locked = !g_settings_is_writable (prefs->proxy_settings, "proxy-type"); - - val = g_settings_get_int (prefs->proxy_settings, "proxy-type"); - - /* no auto-proxy at the moment */ - if (val == NETWORK_PROXY_AUTOCONFIG) - val = NETWORK_PROXY_SYS_SETTINGS; - - prefs->sys_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoSysSettings")); - gtk_toggle_button_set_active (prefs->sys_proxy, val == NETWORK_PROXY_SYS_SETTINGS); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->sys_proxy, FALSE); - - d (g_print ("Sys settings ----!!! \n")); - - prefs->no_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoNoProxy")); - gtk_toggle_button_set_active (prefs->no_proxy, val == NETWORK_PROXY_DIRECT_CONNECTION); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->no_proxy, FALSE); - - d (g_print ("No proxy settings ----!!! \n")); - - /* no auto-proxy at the moment */ -#if 0 - prefs->auto_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoAutoConfig")); - prefs->auto_proxy_url = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtAutoConfigUrl")); - - gtk_toggle_button_set_active (prefs->auto_proxy, val == NETWORK_PROXY_AUTOCONFIG); - - SET_KEY_NAME (prefs->auto_proxy_url, "autoconfig-url"); - g_signal_connect ( - prefs->auto_proxy_url, "changed", - G_CALLBACK (widget_entry_changed_cb), prefs->proxy_settings); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->auto_proxy, FALSE); -#endif - - d (g_print ("Auto config settings ----!!! \n")); - - prefs->manual_proxy = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "rdoManualProxy")); - prefs->http_host = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtHttpHost")); - prefs->https_host = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtHttpsHost")); - prefs->socks_host = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtSocksHost")); - prefs->ignore_hosts = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtIgnoreHosts")); - prefs->http_port = GTK_SPIN_BUTTON (e_builder_get_widget (prefs->builder, "spnHttpPort")); - prefs->https_port = GTK_SPIN_BUTTON (e_builder_get_widget (prefs->builder, "spnHttpsPort")); - prefs->socks_port = GTK_SPIN_BUTTON (e_builder_get_widget (prefs->builder, "spnSocksPort")); - prefs->lbl_http_host = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpHost")); - prefs->lbl_http_port = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpPort")); - prefs->lbl_https_host = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpsHost")); - prefs->lbl_https_port = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblHttpsPort")); - prefs->lbl_socks_host = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblSocksHost")); - prefs->lbl_socks_port = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblSocksPort")); - prefs->lbl_ignore_hosts = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblIgnoreHosts")); - prefs->use_auth = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "chkUseAuth")); - toggle_button_init (prefs, prefs->use_auth, "use-authentication"); - prefs->lbl_auth_user = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblAuthUser")); - prefs->lbl_auth_pwd = GTK_LABEL (e_builder_get_widget (prefs->builder, "lblAuthPwd")); - prefs->auth_user = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtAuthUser")); - prefs->auth_pwd = GTK_ENTRY (e_builder_get_widget (prefs->builder, "txtAuthPwd")); - - /* Manual proxy options */ - SET_KEY_NAME (prefs->http_host, "http-host"); - g_signal_connect ( - prefs->http_host, "changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->https_host, "secure-host"); - g_signal_connect ( - prefs->https_host, "changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->ignore_hosts, "ignore-hosts"); - g_signal_connect ( - prefs->ignore_hosts, "changed", - G_CALLBACK (ignore_hosts_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->http_port, "http-port"); - g_signal_connect ( - prefs->http_port, "value_changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->https_port, "secure-port"); - g_signal_connect ( - prefs->https_port, "value_changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->socks_host, "socks-host"); - g_signal_connect ( - prefs->socks_host, "changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->socks_port, "socks-port"); - g_signal_connect ( - prefs->socks_port, "value_changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->auth_user, "authentication-user"); - g_signal_connect ( - prefs->auth_user, "changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - SET_KEY_NAME (prefs->auth_pwd, "authentication-password"); - g_signal_connect ( - prefs->auth_pwd, "changed", - G_CALLBACK (widget_entry_changed_cb), - prefs->proxy_settings); - - gtk_toggle_button_set_active (prefs->manual_proxy, val == NETWORK_PROXY_MANUAL); - g_signal_connect ( - prefs->sys_proxy, "toggled", - G_CALLBACK (notify_proxy_type_changed), prefs); - g_signal_connect ( - prefs->no_proxy, "toggled", - G_CALLBACK (notify_proxy_type_changed), prefs); -#if 0 - g_signal_connect ( - prefs->auto_proxy, "toggled", - G_CALLBACK (notify_proxy_type_changed), prefs); -#endif - g_signal_connect ( - prefs->manual_proxy, "toggled", - G_CALLBACK (notify_proxy_type_changed), prefs); - - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->manual_proxy, FALSE); - d (g_print ("Manual settings ----!!! \n")); - - buf = g_settings_get_string (prefs->proxy_settings, "http-host"); - gtk_entry_set_text (prefs->http_host, buf ? buf : ""); - g_free (buf); - - buf = g_settings_get_string (prefs->proxy_settings, "secure-host"); - gtk_entry_set_text (prefs->https_host, buf ? buf : ""); - g_free (buf); - - buf = g_settings_get_string (prefs->proxy_settings, "socks-host"); - gtk_entry_set_text (prefs->socks_host, buf ? buf : ""); - g_free (buf); - - buf = NULL; - ignore = g_settings_get_strv (prefs->proxy_settings, "ignore-hosts"); - if (ignore) { - /* reconstruct comma-separated list */ - buf = g_strjoinv (",", ignore); - g_strfreev (ignore); - } - - gtk_entry_set_text (prefs->ignore_hosts, buf ? buf : ""); - g_free (buf); - - buf = g_settings_get_string (prefs->proxy_settings, "authentication-user"); - gtk_entry_set_text (prefs->auth_user, buf ? buf : ""); - g_free (buf); - - buf = g_settings_get_string (prefs->proxy_settings, "authentication-password"); - gtk_entry_set_text (prefs->auth_pwd, buf ? buf : ""); - g_free (buf); - - port = g_settings_get_int (prefs->proxy_settings, "http-port"); - gtk_spin_button_set_value (prefs->http_port, (gdouble) port); - - port = g_settings_get_int (prefs->proxy_settings, "secure-port"); - gtk_spin_button_set_value (prefs->https_port, (gdouble) port); - - port = g_settings_get_int (prefs->proxy_settings, "socks-port"); - gtk_spin_button_set_value (prefs->socks_port, (gdouble) port); - - emnp_set_markups (prefs); - - if (val == NETWORK_PROXY_DIRECT_CONNECTION || - val == NETWORK_PROXY_SYS_SETTINGS) { - emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE); - emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, FALSE); - } else if (val == NETWORK_PROXY_AUTOCONFIG) { - emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, FALSE); - emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, TRUE); - } else if (val == NETWORK_PROXY_MANUAL) { - emnp_set_sensitiveness (prefs, NETWORK_PROXY_AUTOCONFIG, FALSE); - emnp_set_sensitiveness (prefs, NETWORK_PROXY_MANUAL, TRUE); - } - - /* get our toplevel widget */ - target = em_config_target_new_prefs (ec); - e_config_set_target ((EConfig *) ec, (EConfigTarget *) target); - toplevel = e_config_create_widget ((EConfig *) ec); - gtk_container_add (GTK_CONTAINER (prefs), toplevel); -} - -GtkWidget * -em_network_prefs_new (EPreferencesWindow *window) -{ - EMNetworkPrefs *new; - - new = (EMNetworkPrefs *) g_object_new (em_network_prefs_get_type (), NULL); - em_network_prefs_construct (new); - - return (GtkWidget *) new; -} diff --git a/modules/mail/em-network-prefs.h b/modules/mail/em-network-prefs.h deleted file mode 100644 index 8fd062f502..0000000000 --- a/modules/mail/em-network-prefs.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Veerapuram Varadhan <vvaradhan@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef EM_NETWORK_PREFS_H -#define EM_NETWORK_PREFS_H - -#include <gtk/gtk.h> -#include <e-util/e-util.h> - -/* Standard GObject macros */ -#define EM_TYPE_NETWORK_PREFS \ - (em_network_prefs_get_type ()) -#define EM_NETWORK_PREFS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), EM_TYPE_NETWORK_PREFS, EMNetworkPrefs)) -#define EM_NETWORK_PREFS_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), EM_TYPE_NETWORK_PREFS, EMNetworkPrefsClass)) -#define EM_IS_NETWORK_PREFS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), EM_TYPE_NETWORK_PREFS)) -#define EM_IS_NETWORK_PREFS_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), EM_TYPE_NETWORK_PREFS)) -#define EM_NETWORK_PREFS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), EM_TYPE_NETWORK_PREFS, EMNetworkPrefsClass)) - -G_BEGIN_DECLS - -typedef struct _EMNetworkPrefs EMNetworkPrefs; -typedef struct _EMNetworkPrefsClass EMNetworkPrefsClass; - -typedef enum { - NETWORK_PROXY_SYS_SETTINGS, - NETWORK_PROXY_DIRECT_CONNECTION, - NETWORK_PROXY_MANUAL, - NETWORK_PROXY_AUTOCONFIG -} NetworkConfigProxyType; - -struct _EMNetworkPrefs { - GtkBox parent_object; - - GSettings *proxy_settings; - - GtkBuilder *builder; - - /* Default Behavior */ - GtkToggleButton *sys_proxy; - GtkToggleButton *no_proxy; - GtkToggleButton *manual_proxy; - GtkToggleButton *use_auth; - - GtkEntry *http_host; - GtkEntry *https_host; - GtkEntry *socks_host; - GtkEntry *ignore_hosts; - GtkEntry *auth_user; - GtkEntry *auth_pwd; - - GtkLabel *lbl_http_host; - GtkLabel *lbl_http_port; - GtkLabel *lbl_https_host; - GtkLabel *lbl_https_port; - GtkLabel *lbl_socks_host; - GtkLabel *lbl_socks_port; - GtkLabel *lbl_ignore_hosts; - GtkLabel *lbl_auth_user; - GtkLabel *lbl_auth_pwd; - - GtkSpinButton *http_port; - GtkSpinButton *https_port; - GtkSpinButton *socks_port; -}; - -struct _EMNetworkPrefsClass { - GtkBoxClass parent_class; -}; - -GType em_network_prefs_get_type (void); -GtkWidget *em_network_prefs_new (EPreferencesWindow *window); - -G_END_DECLS - -#endif /* EM_NETWORK_PREFS_H */ |