Fixes #317097
2007-01-06 Diego Escalante <diego@aureal.com.pe> Fixes #317097 * gnome-network-preferences.c: * gnome-network-preferences.glade: added 'Use same proxy for all protocols' option. svn path=/trunk/; revision=7049
This commit is contained in:
parent
721d95b138
commit
fe82582ade
3 changed files with 130 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-01-06 Diego Escalante <diego@aureal.com.pe>
|
||||||
|
|
||||||
|
Fixes #317097
|
||||||
|
|
||||||
|
* gnome-network-preferences.c:
|
||||||
|
* gnome-network-preferences.glade: added 'Use same proxy for all
|
||||||
|
protocols' option.
|
||||||
|
|
||||||
2006-12-08 Kjartan Maraas <kmaraas@gnome.org>
|
2006-12-08 Kjartan Maraas <kmaraas@gnome.org>
|
||||||
|
|
||||||
* gnome-network-preferences.c: (cb_add_url):
|
* gnome-network-preferences.c: (cb_add_url):
|
||||||
|
|
|
@ -47,6 +47,7 @@ static GEnumValue proxytype_values[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define USE_PROXY_KEY "/system/http_proxy/use_http_proxy"
|
#define USE_PROXY_KEY "/system/http_proxy/use_http_proxy"
|
||||||
|
#define USE_SAME_PROXY_KEY "/system/http_proxy/use_same_proxy"
|
||||||
#define HTTP_PROXY_HOST_KEY "/system/http_proxy/host"
|
#define HTTP_PROXY_HOST_KEY "/system/http_proxy/host"
|
||||||
#define HTTP_PROXY_PORT_KEY "/system/http_proxy/port"
|
#define HTTP_PROXY_PORT_KEY "/system/http_proxy/port"
|
||||||
#define HTTP_USE_AUTH_KEY "/system/http_proxy/use_authentication"
|
#define HTTP_USE_AUTH_KEY "/system/http_proxy/use_authentication"
|
||||||
|
@ -55,11 +56,17 @@ static GEnumValue proxytype_values[] = {
|
||||||
#define IGNORE_HOSTS_KEY "/system/http_proxy/ignore_hosts"
|
#define IGNORE_HOSTS_KEY "/system/http_proxy/ignore_hosts"
|
||||||
#define PROXY_MODE_KEY "/system/proxy/mode"
|
#define PROXY_MODE_KEY "/system/proxy/mode"
|
||||||
#define SECURE_PROXY_HOST_KEY "/system/proxy/secure_host"
|
#define SECURE_PROXY_HOST_KEY "/system/proxy/secure_host"
|
||||||
|
#define OLD_SECURE_PROXY_HOST_KEY "/system/proxy/old_secure_host"
|
||||||
#define SECURE_PROXY_PORT_KEY "/system/proxy/secure_port"
|
#define SECURE_PROXY_PORT_KEY "/system/proxy/secure_port"
|
||||||
|
#define OLD_SECURE_PROXY_PORT_KEY "/system/proxy/old_secure_port"
|
||||||
#define FTP_PROXY_HOST_KEY "/system/proxy/ftp_host"
|
#define FTP_PROXY_HOST_KEY "/system/proxy/ftp_host"
|
||||||
|
#define OLD_FTP_PROXY_HOST_KEY "/system/proxy/old_ftp_host"
|
||||||
#define FTP_PROXY_PORT_KEY "/system/proxy/ftp_port"
|
#define FTP_PROXY_PORT_KEY "/system/proxy/ftp_port"
|
||||||
|
#define OLD_FTP_PROXY_PORT_KEY "/system/proxy/old_ftp_port"
|
||||||
#define SOCKS_PROXY_HOST_KEY "/system/proxy/socks_host"
|
#define SOCKS_PROXY_HOST_KEY "/system/proxy/socks_host"
|
||||||
|
#define OLD_SOCKS_PROXY_HOST_KEY "/system/proxy/old_socks_host"
|
||||||
#define SOCKS_PROXY_PORT_KEY "/system/proxy/socks_port"
|
#define SOCKS_PROXY_PORT_KEY "/system/proxy/socks_port"
|
||||||
|
#define OLD_SOCKS_PROXY_PORT_KEY "/system/proxy/old_socks_port"
|
||||||
#define PROXY_AUTOCONFIG_URL_KEY "/system/proxy/autoconfig_url"
|
#define PROXY_AUTOCONFIG_URL_KEY "/system/proxy/autoconfig_url"
|
||||||
|
|
||||||
static GtkWidget *details_dialog = NULL;
|
static GtkWidget *details_dialog = NULL;
|
||||||
|
@ -247,6 +254,79 @@ cb_http_details_button_clicked (GtkWidget *button,
|
||||||
gtk_widget_show_all (widget);
|
gtk_widget_show_all (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cb_use_same_proxy_checkbutton_clicked (GtkWidget *checkbutton,
|
||||||
|
GladeXML *dialog)
|
||||||
|
{
|
||||||
|
GConfClient *client;
|
||||||
|
gboolean same_proxy;
|
||||||
|
gchar *http_proxy;
|
||||||
|
gint http_port;
|
||||||
|
|
||||||
|
client = gconf_client_get_default ();
|
||||||
|
same_proxy = gconf_client_get_bool (client, USE_SAME_PROXY_KEY, NULL);
|
||||||
|
|
||||||
|
http_proxy = gconf_client_get_string (client, HTTP_PROXY_HOST_KEY, NULL);
|
||||||
|
http_port = gconf_client_get_int (client, HTTP_PROXY_PORT_KEY, NULL);
|
||||||
|
|
||||||
|
if (same_proxy)
|
||||||
|
{
|
||||||
|
/* Save the old values */
|
||||||
|
gconf_client_set_string (client, OLD_SECURE_PROXY_HOST_KEY,
|
||||||
|
gconf_client_get_string (client, SECURE_PROXY_HOST_KEY, NULL), NULL);
|
||||||
|
gconf_client_set_int (client, OLD_SECURE_PROXY_PORT_KEY,
|
||||||
|
gconf_client_get_int (client, SECURE_PROXY_PORT_KEY, NULL), NULL);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, OLD_FTP_PROXY_HOST_KEY,
|
||||||
|
gconf_client_get_string (client, FTP_PROXY_HOST_KEY, NULL), NULL);
|
||||||
|
gconf_client_set_int (client, OLD_FTP_PROXY_PORT_KEY,
|
||||||
|
gconf_client_get_int (client, FTP_PROXY_PORT_KEY, NULL), NULL);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, OLD_SOCKS_PROXY_HOST_KEY,
|
||||||
|
gconf_client_get_string (client, SOCKS_PROXY_HOST_KEY, NULL), NULL);
|
||||||
|
gconf_client_set_int (client, OLD_SOCKS_PROXY_PORT_KEY,
|
||||||
|
gconf_client_get_int (client, SOCKS_PROXY_PORT_KEY, NULL), NULL);
|
||||||
|
|
||||||
|
/* Set the new values */
|
||||||
|
gconf_client_set_string (client, SECURE_PROXY_HOST_KEY, http_proxy, NULL);
|
||||||
|
gconf_client_set_int (client, SECURE_PROXY_PORT_KEY, http_port, NULL);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, FTP_PROXY_HOST_KEY, http_proxy, NULL);
|
||||||
|
gconf_client_set_int (client, FTP_PROXY_PORT_KEY, http_port, NULL);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, SOCKS_PROXY_HOST_KEY, http_proxy, NULL);
|
||||||
|
gconf_client_set_int (client, SOCKS_PROXY_PORT_KEY, http_port, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
gconf_client_set_string (client, SECURE_PROXY_HOST_KEY,
|
||||||
|
gconf_client_get_string (client, OLD_SECURE_PROXY_HOST_KEY, NULL), NULL);
|
||||||
|
gconf_client_set_int (client, SECURE_PROXY_PORT_KEY,
|
||||||
|
gconf_client_get_int (client, OLD_SECURE_PROXY_PORT_KEY, NULL), NULL);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, FTP_PROXY_HOST_KEY,
|
||||||
|
gconf_client_get_string (client, OLD_FTP_PROXY_HOST_KEY, NULL), NULL);
|
||||||
|
gconf_client_set_int (client, FTP_PROXY_PORT_KEY,
|
||||||
|
gconf_client_get_int (client, OLD_FTP_PROXY_PORT_KEY, NULL), NULL);
|
||||||
|
|
||||||
|
gconf_client_set_string (client, SOCKS_PROXY_HOST_KEY,
|
||||||
|
gconf_client_get_string (client, OLD_SOCKS_PROXY_HOST_KEY, NULL), NULL);
|
||||||
|
gconf_client_set_int (client, SOCKS_PROXY_PORT_KEY,
|
||||||
|
gconf_client_get_int (client, OLD_SOCKS_PROXY_PORT_KEY, NULL), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the proxy entries insensitive if we are using the same proxy for all */
|
||||||
|
gtk_widget_set_sensitive (WID ("secure_host_entry"), !same_proxy);
|
||||||
|
gtk_widget_set_sensitive (WID ("secure_port_spinbutton"), !same_proxy);
|
||||||
|
gtk_widget_set_sensitive (WID ("ftp_host_entry"), !same_proxy);
|
||||||
|
gtk_widget_set_sensitive (WID ("ftp_port_spinbutton"), !same_proxy);
|
||||||
|
gtk_widget_set_sensitive (WID ("socks_host_entry"), !same_proxy);
|
||||||
|
gtk_widget_set_sensitive (WID ("socks_port_spinbutton"), !same_proxy);
|
||||||
|
|
||||||
|
g_object_unref (client);
|
||||||
|
}
|
||||||
|
|
||||||
static GConfValue *
|
static GConfValue *
|
||||||
extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig)
|
extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig)
|
||||||
{
|
{
|
||||||
|
@ -289,6 +369,8 @@ proxy_mode_radiobutton_clicked_cb (GtkWidget *widget,
|
||||||
|
|
||||||
gtk_widget_set_sensitive (WID ("manual_box"),
|
gtk_widget_set_sensitive (WID ("manual_box"),
|
||||||
mode == PROXYMODE_MANUAL);
|
mode == PROXYMODE_MANUAL);
|
||||||
|
gtk_widget_set_sensitive (WID ("same_proxy_checkbutton"),
|
||||||
|
mode == PROXYMODE_MANUAL);
|
||||||
gtk_widget_set_sensitive (WID ("auto_box"),
|
gtk_widget_set_sensitive (WID ("auto_box"),
|
||||||
mode == PROXYMODE_AUTO);
|
mode == PROXYMODE_AUTO);
|
||||||
client = gconf_client_get_default ();
|
client = gconf_client_get_default ();
|
||||||
|
@ -337,6 +419,15 @@ setup_dialog (GladeXML *dialog)
|
||||||
PROXY_MODE_KEY, mode_group, mode_type,
|
PROXY_MODE_KEY, mode_group, mode_type,
|
||||||
TRUE, NULL));
|
TRUE, NULL));
|
||||||
|
|
||||||
|
/* Use same proxy for all protocols */
|
||||||
|
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_boolean (NULL,
|
||||||
|
USE_SAME_PROXY_KEY, WID ("same_proxy_checkbutton"), NULL));
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (WID ("same_proxy_checkbutton")),
|
||||||
|
"toggled",
|
||||||
|
G_CALLBACK (cb_use_same_proxy_checkbutton_clicked),
|
||||||
|
dialog);
|
||||||
|
|
||||||
/* Http */
|
/* Http */
|
||||||
port_value = gconf_client_get_int (client, HTTP_PROXY_PORT_KEY, NULL);
|
port_value = gconf_client_get_int (client, HTTP_PROXY_PORT_KEY, NULL);
|
||||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (WID ("http_port_spinbutton")), (gdouble) port_value);
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (WID ("http_port_spinbutton")), (gdouble) port_value);
|
||||||
|
@ -385,6 +476,17 @@ setup_dialog (GladeXML *dialog)
|
||||||
NULL, SOCKS_PROXY_PORT_KEY, WID ("socks_port_spinbutton"),
|
NULL, SOCKS_PROXY_PORT_KEY, WID ("socks_port_spinbutton"),
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
|
/* Set the proxy entries insensitive if we are using the same proxy for all */
|
||||||
|
if (gconf_client_get_bool (client, USE_SAME_PROXY_KEY, NULL))
|
||||||
|
{
|
||||||
|
gtk_widget_set_sensitive (WID ("secure_host_entry"), FALSE);
|
||||||
|
gtk_widget_set_sensitive (WID ("secure_port_spinbutton"), FALSE);
|
||||||
|
gtk_widget_set_sensitive (WID ("ftp_host_entry"), FALSE);
|
||||||
|
gtk_widget_set_sensitive (WID ("ftp_port_spinbutton"), FALSE);
|
||||||
|
gtk_widget_set_sensitive (WID ("socks_host_entry"), FALSE);
|
||||||
|
gtk_widget_set_sensitive (WID ("socks_port_spinbutton"), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Autoconfiguration */
|
/* Autoconfiguration */
|
||||||
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string (
|
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string (
|
||||||
NULL, PROXY_AUTOCONFIG_URL_KEY, WID ("autoconfig_entry"),
|
NULL, PROXY_AUTOCONFIG_URL_KEY, WID ("autoconfig_entry"),
|
||||||
|
|
|
@ -135,6 +135,26 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCheckButton" id="same_proxy_checkbutton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">Use the same proxy for all protocols</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="manual_box">
|
<widget class="GtkHBox" id="manual_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue