Bugzilla – Attachment 221992 Details for
Bug 350513
gnome proxy settings dialog input disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
gnome-control-center-system-proxy-configuration.patch
gnome-control-center-system-proxy-configuration.patch (text/plain), 14.68 KB, created by
Federico Mena Quintero
on 2008-06-13 09:47:30 UTC
(
hide
)
Description:
gnome-control-center-system-proxy-configuration.patch
Filename:
MIME Type:
Creator:
Federico Mena Quintero
Created:
2008-06-13 09:47:30 UTC
Size:
14.68 KB
patch
obsolete
>From 4cb70bde30d3dacb45a0674aae6f22bd739a2e3b Mon Sep 17 00:00:00 2001 >From: Federico Mena Quintero <federico@novell.com> >Date: Fri, 13 Jun 2008 03:55:41 -0500 >Subject: [PATCH 1/2] Integrate GNOME's proxy configuration with openSUSE's > This is documented in http://en.opensuse.org/GNOME/Proxy_configuration > >Signed-off-by: Federico Mena Quintero <federico@novell.com> >--- > capplets/network/gnome-network-preferences.c | 149 ++++++++++++++++------ > capplets/network/gnome-network-preferences.glade | 24 +++- > 2 files changed, 129 insertions(+), 44 deletions(-) > >diff --git a/capplets/network/gnome-network-preferences.c b/capplets/network/gnome-network-preferences.c >index 9176476..11fd88e 100644 >--- a/capplets/network/gnome-network-preferences.c >+++ b/capplets/network/gnome-network-preferences.c >@@ -32,19 +32,11 @@ > #include "capplet-util.h" > #include "gconf-property-editor.h" > >-enum ProxyMode >-{ >- PROXYMODE_NONE, >- PROXYMODE_MANUAL, >- PROXYMODE_AUTO >-}; >- >-static GEnumValue proxytype_values[] = { >- { PROXYMODE_NONE, "PROXYMODE_NONE", "none"}, >- { PROXYMODE_MANUAL, "PROXYMODE_MANUAL", "manual"}, >- { PROXYMODE_AUTO, "PROXYMODE_AUTO", "auto"}, >- { 0, NULL, NULL } >-}; >+/* Novell extension */ >+#define KEY_USE_SYSTEM_SETTINGS "/system/proxy/use_system_settings" /* string */ >+#define VAL_USE_SYSTEM_SETTINGS_ONLY_IF_NOT_SET "only_if_mode_not_set" >+#define VAL_USE_SYSTEM_SETTINGS_SYSTEM_VALUES "system_values" >+#define VAL_USE_SYSTEM_SETTINGS_USER_VALUES "user_values" > > #define USE_PROXY_KEY "/system/http_proxy/use_http_proxy" > #define USE_SAME_PROXY_KEY "/system/http_proxy/use_same_proxy" >@@ -363,29 +355,40 @@ static void > proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, > GladeXML *dialog) > { >- GSList *mode_group; >- int mode; >- GConfClient *client; >- >- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget))) >- return; >- >- mode_group = g_slist_copy (gtk_radio_button_get_group >- (GTK_RADIO_BUTTON (WID ("none_radiobutton")))); >- mode_group = g_slist_reverse (mode_group); >- mode = g_slist_index (mode_group, widget); >- g_slist_free (mode_group); >- >- gtk_widget_set_sensitive (WID ("manual_box"), >- mode == PROXYMODE_MANUAL); >- gtk_widget_set_sensitive (WID ("same_proxy_checkbutton"), >- mode == PROXYMODE_MANUAL); >- gtk_widget_set_sensitive (WID ("auto_box"), >- mode == PROXYMODE_AUTO); >+ GConfClient *client; >+ gboolean manual_box_sensitive, auto_box_sensitive; >+ >+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget))) >+ return; >+ > client = gconf_client_get_default (); >- gconf_client_set_bool (client, USE_PROXY_KEY, >- mode == PROXYMODE_AUTO || mode == PROXYMODE_MANUAL, NULL); >- g_object_unref (client); >+ manual_box_sensitive = auto_box_sensitive = FALSE; >+ >+ if (widget == WID ("system_radiobutton")) { >+ gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_SYSTEM_VALUES, NULL); >+ } else if (widget == WID ("none_radiobutton")) { >+ gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_USER_VALUES, NULL); >+ gconf_client_set_string (client, PROXY_MODE_KEY, "none", NULL); >+ gconf_client_set_bool (client, USE_PROXY_KEY, FALSE, NULL); >+ } else if (widget == WID ("manual_radiobutton")) { >+ manual_box_sensitive = TRUE; >+ >+ gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_USER_VALUES, NULL); >+ gconf_client_set_string (client, PROXY_MODE_KEY, "manual", NULL); >+ gconf_client_set_bool (client, USE_PROXY_KEY, TRUE, NULL); >+ } else if (widget == WID ("auto_radiobutton")) { >+ auto_box_sensitive = TRUE; >+ >+ gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_USER_VALUES, NULL); >+ gconf_client_set_string (client, PROXY_MODE_KEY, "auto", NULL); >+ gconf_client_set_bool (client, USE_PROXY_KEY, TRUE, NULL); >+ } >+ >+ gtk_widget_set_sensitive (WID ("manual_box"), manual_box_sensitive); >+ gtk_widget_set_sensitive (WID ("same_proxy_checkbutton"), manual_box_sensitive); >+ gtk_widget_set_sensitive (WID ("auto_box"), auto_box_sensitive); >+ >+ g_object_unref (client); > } > > static void >@@ -399,34 +402,96 @@ connect_sensitivity_signals (GladeXML *dialog, GSList *mode_group) > } > } > >+static GtkWidget * >+get_radio_for_mode (GladeXML *dialog, const char *mode_str) >+{ >+ if (!mode_str) >+ return WID ("none_radiobutton"); >+ else if (strcmp (mode_str, "none") == 0) >+ return WID ("none_radiobutton"); >+ else if (strcmp (mode_str, "manual") == 0) >+ return WID ("manual_radiobutton"); >+ else if (strcmp (mode_str, "auto") == 0) >+ return WID ("auto_radiobutton"); >+ else >+ return WID ("none_radiobutton"); >+} >+ >+static void >+mode_set_initial_value (GladeXML *dialog, GConfClient *client) >+{ >+ char *use_system_settings; >+ GConfValue *mode_value; >+ gboolean use_system_if_mode_not_set; >+ gboolean use_mode; >+ GtkWidget *radiobutton; >+ >+ radiobutton = NULL; >+ >+ use_system_settings = gconf_client_get_string (client, KEY_USE_SYSTEM_SETTINGS, NULL); >+ mode_value = gconf_client_get_without_default (client, PROXY_MODE_KEY, NULL); >+ >+ use_system_if_mode_not_set = FALSE; >+ use_mode = FALSE; >+ >+ if (!use_system_settings) >+ use_system_if_mode_not_set = TRUE; >+ else { >+ if (strcmp (use_system_settings, VAL_USE_SYSTEM_SETTINGS_ONLY_IF_NOT_SET) == 0) >+ use_system_if_mode_not_set = TRUE; >+ else if (strcmp (use_system_settings, VAL_USE_SYSTEM_SETTINGS_SYSTEM_VALUES) == 0) >+ radiobutton = WID ("system_radiobutton"); >+ else if (strcmp (use_system_settings, VAL_USE_SYSTEM_SETTINGS_USER_VALUES) == 0) >+ use_mode = TRUE; >+ >+ g_free (use_system_settings); >+ } >+ >+ if (use_system_if_mode_not_set) { >+ if (mode_value) >+ use_mode = TRUE; >+ else >+ radiobutton = WID ("system_radiobutton"); >+ } >+ >+ if (use_mode) { >+ if (!mode_value || mode_value->type != GCONF_VALUE_STRING) >+ radiobutton = WID ("none_radiobutton"); >+ else >+ radiobutton = get_radio_for_mode (dialog, gconf_value_get_string (mode_value)); >+ } >+ >+ if (radiobutton) >+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton), TRUE); >+ >+ if (mode_value) >+ gconf_value_free (mode_value); >+} >+ > static void > setup_dialog (GladeXML *dialog) > { > GConfPropertyEditor *peditor; > GSList *mode_group; >- GType mode_type = 0; > GConfClient *client; > gint port_value; > >- mode_type = g_enum_register_static ("NetworkPreferencesProxyType", >- proxytype_values); > > /* There's a bug in peditors that cause them to not initialize the entry > * correctly. */ > client = gconf_client_get_default (); > > /* Hackety hack */ >+ gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("system_radiobutton"))->child), TRUE); > gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("none_radiobutton"))->child), TRUE); > gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("manual_radiobutton"))->child), TRUE); > gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("auto_radiobutton"))->child), TRUE); > > /* Mode */ >- mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("none_radiobutton"))); >+ mode_set_initial_value (dialog, client); >+ mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("system_radiobutton"))); > connect_sensitivity_signals (dialog, mode_group); > >- peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_select_radio_with_enum (NULL, >- PROXY_MODE_KEY, mode_group, mode_type, >- TRUE, NULL)); > > /* Use same proxy for all protocols */ > peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_boolean (NULL, >diff --git a/capplets/network/gnome-network-preferences.glade b/capplets/network/gnome-network-preferences.glade >index 1ab334e..d37baec 100644 >--- a/capplets/network/gnome-network-preferences.glade >+++ b/capplets/network/gnome-network-preferences.glade >@@ -85,6 +85,25 @@ > <property name="spacing">18</property> > > <child> >+ <widget class="GtkRadioButton" id="system_radiobutton"> >+ <property name="visible">True</property> >+ <property name="can_focus">True</property> >+ <property name="label" translatable="yes"><b>Use the s_ystem's proxy settings</b></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> > <widget class="GtkRadioButton" id="none_radiobutton"> > <property name="visible">True</property> > <property name="can_focus">True</property> >@@ -95,6 +114,7 @@ > <property name="active">False</property> > <property name="inconsistent">False</property> > <property name="draw_indicator">True</property> >+ <property name="group">system_radiobutton</property> > </widget> > <packing> > <property name="padding">0</property> >@@ -126,7 +146,7 @@ > <property name="active">False</property> > <property name="inconsistent">False</property> > <property name="draw_indicator">True</property> >- <property name="group">none_radiobutton</property> >+ <property name="group">system_radiobutton</property> > </widget> > <packing> > <property name="padding">0</property> >@@ -669,7 +689,7 @@ > <property name="active">False</property> > <property name="inconsistent">False</property> > <property name="draw_indicator">True</property> >- <property name="group">none_radiobutton</property> >+ <property name="group">system_radiobutton</property> > </widget> > <packing> > <property name="padding">0</property> >-- >1.5.4.5 > > >From ed0ada43be0102fbecc3d2a38cfb5ce69406581e Mon Sep 17 00:00:00 2001 >From: Federico Mena Quintero <federico@novell.com> >Date: Fri, 13 Jun 2008 04:23:41 -0500 >Subject: [PATCH 2/2] bnc350513 - Manual config widgets are disabled at startup > 2008-06-13 Federico Mena Quintero <federico@novell.com> > > https://bugzilla.novell.com/show_bug.cgi?id=350513 - Widgets for > manual proxy configuration are disabled on startup, even if Manual > configuration was selected. > > * gnome-network-preferences.c > (set_sensitivity_based_on_active_radiobutton): New function; > extract the sensitivity logic from proxy_mode_radiobutton_clicked_cb(). > (mode_set_initial_value): Set the initial sensitivity of the data > widgets with the function above. > (proxy_mode_radiobutton_clicked_cb): Use > set_sensitivity_based_on_active_radiobutton() instead of setting > the sensitivity here directly. > (connect_mode_radiobuttons): Renamed from > connect_sensitivity_signals() as the callback doesn't really have > to do with sensitivity. > >Signed-off-by: Federico Mena Quintero <federico@novell.com> >--- > capplets/network/gnome-network-preferences.c | 41 +++++++++++++++++--------- > 1 files changed, 27 insertions(+), 14 deletions(-) > >diff --git a/capplets/network/gnome-network-preferences.c b/capplets/network/gnome-network-preferences.c >index 11fd88e..7c90181 100644 >--- a/capplets/network/gnome-network-preferences.c >+++ b/capplets/network/gnome-network-preferences.c >@@ -352,17 +352,34 @@ extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig) > } > > static void >+set_sensitivity_based_on_active_radiobutton (GladeXML *dialog, GtkWidget *active_radio) >+{ >+ gboolean manual_box_sensitive, auto_box_sensitive; >+ >+ g_assert (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (active_radio))); >+ >+ manual_box_sensitive = auto_box_sensitive = FALSE; >+ >+ if (active_radio == WID ("manual_radiobutton")) >+ manual_box_sensitive = TRUE; >+ else if (active_radio == WID ("auto_radiobutton")) >+ auto_box_sensitive = TRUE; >+ >+ gtk_widget_set_sensitive (WID ("manual_box"), manual_box_sensitive); >+ gtk_widget_set_sensitive (WID ("same_proxy_checkbutton"), manual_box_sensitive); >+ gtk_widget_set_sensitive (WID ("auto_box"), auto_box_sensitive); >+} >+ >+static void > proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, > GladeXML *dialog) > { > GConfClient *client; >- gboolean manual_box_sensitive, auto_box_sensitive; >- >+ > if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget))) > return; > > client = gconf_client_get_default (); >- manual_box_sensitive = auto_box_sensitive = FALSE; > > if (widget == WID ("system_radiobutton")) { > gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_SYSTEM_VALUES, NULL); >@@ -371,28 +388,22 @@ proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, > gconf_client_set_string (client, PROXY_MODE_KEY, "none", NULL); > gconf_client_set_bool (client, USE_PROXY_KEY, FALSE, NULL); > } else if (widget == WID ("manual_radiobutton")) { >- manual_box_sensitive = TRUE; >- > gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_USER_VALUES, NULL); > gconf_client_set_string (client, PROXY_MODE_KEY, "manual", NULL); > gconf_client_set_bool (client, USE_PROXY_KEY, TRUE, NULL); > } else if (widget == WID ("auto_radiobutton")) { >- auto_box_sensitive = TRUE; >- > gconf_client_set_string (client, KEY_USE_SYSTEM_SETTINGS, VAL_USE_SYSTEM_SETTINGS_USER_VALUES, NULL); > gconf_client_set_string (client, PROXY_MODE_KEY, "auto", NULL); > gconf_client_set_bool (client, USE_PROXY_KEY, TRUE, NULL); > } > >- gtk_widget_set_sensitive (WID ("manual_box"), manual_box_sensitive); >- gtk_widget_set_sensitive (WID ("same_proxy_checkbutton"), manual_box_sensitive); >- gtk_widget_set_sensitive (WID ("auto_box"), auto_box_sensitive); >+ set_sensitivity_based_on_active_radiobutton (dialog, widget); > > g_object_unref (client); > } > > static void >-connect_sensitivity_signals (GladeXML *dialog, GSList *mode_group) >+connect_mode_radiobuttons (GladeXML *dialog, GSList *mode_group) > { > for (; mode_group != NULL; mode_group = mode_group->next) > { >@@ -416,7 +427,7 @@ get_radio_for_mode (GladeXML *dialog, const char *mode_str) > else > return WID ("none_radiobutton"); > } >- >+ > static void > mode_set_initial_value (GladeXML *dialog, GConfClient *client) > { >@@ -461,8 +472,10 @@ mode_set_initial_value (GladeXML *dialog, GConfClient *client) > radiobutton = get_radio_for_mode (dialog, gconf_value_get_string (mode_value)); > } > >- if (radiobutton) >+ if (radiobutton) { > gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton), TRUE); >+ set_sensitivity_based_on_active_radiobutton (dialog, radiobutton); >+ } > > if (mode_value) > gconf_value_free (mode_value); >@@ -490,7 +503,7 @@ setup_dialog (GladeXML *dialog) > /* Mode */ > mode_set_initial_value (dialog, client); > mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("system_radiobutton"))); >- connect_sensitivity_signals (dialog, mode_group); >+ connect_mode_radiobuttons (dialog, mode_group); > > > /* Use same proxy for all protocols */ >-- >1.5.4.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 350513
: 221992