[gnome-control-center] network: Set the org.gnome.system.proxy.http 'enabled' key if the user sets a HTTP proxy
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Set the org.gnome.system.proxy.http 'enabled' key if the user sets a HTTP proxy
- Date: Thu, 1 Sep 2011 13:30:18 +0000 (UTC)
commit 8055e736422dbce2ddc926cefdf8ffb41d8de65d
Author: Richard Hughes <richard hughsie com>
Date: Thu Sep 1 14:23:51 2011 +0100
network: Set the org.gnome.system.proxy.http 'enabled' key if the user sets a HTTP proxy
panels/network/cc-network-panel.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index f837426..97621bf 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -3114,6 +3114,20 @@ stop_hotspot (GtkButton *button, CcNetworkPanel *panel)
gtk_window_present (GTK_WINDOW (dialog));
}
+static GVariant *
+bind_settings_enabled_cb (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ const gchar *str;
+ GSettings *settings = G_SETTINGS (user_data);
+
+ /* only set to enabled if there is a host in the combobox */
+ str = g_value_get_string (value);
+ g_settings_set_string (settings, "host", str);
+ return g_variant_new_boolean (str != NULL && str[0] != '\0');
+}
+
static void
cc_network_panel_init (CcNetworkPanel *panel)
{
@@ -3171,9 +3185,13 @@ cc_network_panel_init (CcNetworkPanel *panel)
settings_tmp = g_settings_get_child (panel->priv->proxy_settings, "http");
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"entry_proxy_http"));
- g_settings_bind (settings_tmp, "host",
- widget, "text",
- G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind_with_mapping (settings_tmp, "enabled",
+ widget, "text",
+ G_SETTINGS_BIND_SET,
+ NULL,
+ bind_settings_enabled_cb,
+ settings_tmp,
+ NULL);
adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
"adjustment_proxy_port_http"));
g_settings_bind (settings_tmp, "port",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]