[gnome-control-center] network: Add an 'Ignore Hosts' entry to the proxy page
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Add an 'Ignore Hosts' entry to the proxy page
- Date: Wed, 17 Oct 2012 16:20:23 +0000 (UTC)
commit 56f3f84e197c051f347f15a71d56cb584faafd13
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 16 22:25:18 2012 -0400
network: Add an 'Ignore Hosts' entry to the proxy page
This is needed in many situations where proxies are set up
manually.
https://bugzilla.gnome.org/show_bug.cgi?id=658155
panels/network/net-proxy.c | 53 +++++++++++++++++++++++++++++++++++++++
panels/network/network-proxy.ui | 33 ++++++++++++++++++++++++
2 files changed, 86 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index 6fd2388..9940b4e 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -141,6 +141,12 @@ panel_proxy_mode_combo_setup_widgets (NetProxy *proxy, guint value)
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"spinbutton_proxy_socks"));
gtk_widget_set_visible (widget, value == 1);
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ "heading_proxy_ignore"));
+ gtk_widget_set_visible (widget, value == 1);
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ "entry_proxy_ignore"));
+ gtk_widget_set_visible (widget, value == 1);
/* perhaps show the wpad warning */
check_wpad_warning (proxy);
@@ -250,6 +256,45 @@ net_proxy_class_init (NetProxyClass *klass)
g_type_class_add_private (klass, sizeof (NetProxyPrivate));
}
+static gboolean
+get_ignore_hosts (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ int i;
+ gsize n = 0, avlen;
+ gchar buffer[10240];
+ gchar *p = buffer;
+ const gchar **av = g_variant_get_strv (variant, &avlen);
+
+ if (avlen > 0) {
+ n = g_strlcpy (p, av[0], sizeof buffer);
+ for (i = 1; i < avlen; i ++)
+ n += g_snprintf (p + n, sizeof (buffer) - n, ", %s", av[i]);
+ }
+ g_free (av);
+ g_value_set_string (value, buffer);
+
+ return TRUE;
+}
+
+static GVariant *
+set_ignore_hosts (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *result;
+ const gchar *sv;
+ gchar **av;
+
+ sv = g_value_get_string (value);
+ av = g_strsplit (sv, ",", 0);
+ result = g_variant_new_strv ((const gchar * const *)av, -1);
+ g_strfreev (av);
+
+ return result;
+}
+
static void
net_proxy_init (NetProxy *proxy)
{
@@ -369,6 +414,14 @@ net_proxy_init (NetProxy *proxy)
"label_proxy_status"));
gtk_label_set_label (GTK_LABEL (widget), "");
+ /* bind the proxy ignore hosts */
+ widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
+ "entry_proxy_ignore"));
+ g_settings_bind_with_mapping (proxy->priv->settings, "ignore-hosts",
+ widget, "text",
+ G_SETTINGS_BIND_DEFAULT, get_ignore_hosts, set_ignore_hosts,
+ NULL, NULL);
+
/* hide the switch until we get some more detail in the mockup */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
"device_proxy_off_switch"));
diff --git a/panels/network/network-proxy.ui b/panels/network/network-proxy.ui
index 310c689..0a4c649 100644
--- a/panels/network/network-proxy.ui
+++ b/panels/network/network-proxy.ui
@@ -280,6 +280,25 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="heading_proxy_ignore">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Ignore Hosts</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_proxy_ignore</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="label_proxy_warning">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -368,6 +387,20 @@
</packing>
</child>
<child>
+ <object class="GtkEntry" id="entry_proxy_ignore">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkSpinButton" id="spinbutton_proxy_https">
<property name="visible">True</property>
<property name="can_focus">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]