[gnome-control-center] network: Update Proxy section widgets



commit b64c605e69944f848d1d4ca0a5099a2b67e87730
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jul 21 11:13:03 2017 -0300

    network: Update Proxy section widgets
    
    According to the lastest mockups [1], the Proxy section is now
    composed of a row with the state of the proxy, and a settings
    button that leads to a dialog where one can configure the different
    proxy settings.
    
    This commit ports the current code to do that, and various changes
    took place to made this happen. Namely:
    
     * A new ProxyMode enum was added to improve readability and
       improve the semantic of the code. No more random numbers
       are present.
    
     * The current widgets for editing proxy settings were repacked
       into a GtkStack (so that we keep an homogeneous sizing), and
       the GtkStack itself was moved into a new dialog. With that,
       we can just set the stack page, rather than controlling the
       visibility of all individual widgets.
    
     * Many unused widgets were removed.
    
     * The combo box was replaced by 3 radio buttons. Now, there's
       no need to deal with GtkTreeIters anymore. Another refactoring
       of the code that led to more readable and smaller code.
    
    Overall, these changes made the code be more readable, smaller
    codebase with a smaller surface for mistakes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785581

 panels/network/net-proxy.c      |  250 ++++++-------
 panels/network/network-proxy.ui |  800 +++++++++++++++++++--------------------
 2 files changed, 516 insertions(+), 534 deletions(-)
---
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index fd4873f..d1b4602 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -29,14 +29,49 @@
 
 #define NET_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_PROXY, NetProxyPrivate))
 
+typedef enum
+{
+        MODE_DISABLED,
+        MODE_MANUAL,
+        MODE_AUTOMATIC,
+        N_MODES
+} ProxyMode;
+
 struct _NetProxyPrivate
 {
         GSettings        *settings;
         GtkBuilder       *builder;
+        GtkToggleButton  *mode_radios[3];
 };
 
 G_DEFINE_TYPE (NetProxy, net_proxy, NET_TYPE_OBJECT)
 
+static const gchar *
+panel_get_string_for_value (ProxyMode mode)
+{
+        switch (mode) {
+        case MODE_DISABLED:
+                return _("Off");
+        case MODE_MANUAL:
+                return _("Manual");
+        case MODE_AUTOMATIC:
+                return _("Automatic");
+        default:
+                g_assert_not_reached ();
+        }
+}
+
+static inline void
+panel_update_status_label (NetProxy  *self,
+                           ProxyMode  mode)
+{
+        GtkLabel *label;
+
+        /* update the label */
+        label = GTK_LABEL (gtk_builder_get_object (self->priv->builder, "status_label"));
+        gtk_label_set_label (label, panel_get_string_for_value (mode));
+}
+
 static void
 check_wpad_warning (NetProxy *proxy)
 {
@@ -50,7 +85,7 @@ check_wpad_warning (NetProxy *proxy)
 
         /* check we're using 'Automatic' */
         mode = g_settings_get_enum (proxy->priv->settings, "mode");
-        if (mode != 2)
+        if (mode != MODE_AUTOMATIC)
                 goto out;
 
         /* see if the PAC is blank */
@@ -93,120 +128,72 @@ settings_changed_cb (GSettings *settings,
 }
 
 static void
-panel_proxy_mode_combo_setup_widgets (NetProxy *proxy, guint value)
+panel_proxy_mode_setup_widgets (NetProxy *proxy, ProxyMode value)
 {
-        GtkWidget *widget;
+        GtkStack *stack;
 
-        /* hide or show the PAC text box */
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_url"));
-        gtk_widget_set_visible (widget, value == 2);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "entry_proxy_url"));
-        gtk_widget_set_visible (widget, value == 2);
+        stack = GTK_STACK (gtk_builder_get_object (proxy->priv->builder, "stack"));
 
-        /* hide or show the manual entry text boxes */
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_http"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "entry_proxy_http"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "spinbutton_proxy_http"));
-        gtk_widget_set_visible (widget, value == 1);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_https"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "entry_proxy_https"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "spinbutton_proxy_https"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_ftp"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "entry_proxy_ftp"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "spinbutton_proxy_ftp"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_socks"));
-        gtk_widget_set_visible (widget, value == 1);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "entry_proxy_socks"));
-        gtk_widget_set_visible (widget, value == 1);
-        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);
+        /* hide or show the PAC text box */
+        switch (value) {
+        case MODE_DISABLED:
+                gtk_stack_set_visible_child_name (stack, "disabled");
+                break;
+        case MODE_MANUAL:
+                gtk_stack_set_visible_child_name (stack, "manual");
+                break;
+        case MODE_AUTOMATIC:
+                gtk_stack_set_visible_child_name (stack, "automatic");
+                break;
+        default:
+                g_assert_not_reached ();
+        }
 
         /* perhaps show the wpad warning */
         check_wpad_warning (proxy);
 }
 
 static void
-panel_set_value_for_combo (NetProxy *proxy, GtkComboBox *combo_box, gint value)
+panel_proxy_mode_radio_changed_cb (GtkToggleButton *radio,
+                                   NetProxy        *proxy)
 {
-        gboolean ret;
-        gint value_tmp;
-        GtkTreeIter iter;
-        GtkTreeModel *model;
-
-        /* get entry */
-        model = gtk_combo_box_get_model (combo_box);
-        ret = gtk_tree_model_get_iter_first (model, &iter);
-        if (!ret)
+        ProxyMode value;
+
+        if (!gtk_toggle_button_get_active (radio))
                 return;
 
-        /* try to make the UI match the setting */
-        do {
-                gtk_tree_model_get (model, &iter,
-                                    1, &value_tmp,
-                                    -1);
-                if (value == value_tmp) {
-                        gtk_combo_box_set_active_iter (combo_box, &iter);
-                        break;
-                }
-        } while (gtk_tree_model_iter_next (model, &iter));
+        /* get selected radio */
+        if (radio == proxy->priv->mode_radios[MODE_DISABLED])
+                value = MODE_DISABLED;
+        else if (radio == proxy->priv->mode_radios[MODE_MANUAL])
+                value = MODE_MANUAL;
+        else if (radio == proxy->priv->mode_radios[MODE_AUTOMATIC])
+                value = MODE_AUTOMATIC;
+        else
+                g_assert_not_reached ();
+
+        /* set */
+        g_settings_set_enum (proxy->priv->settings, "mode", value);
 
         /* hide or show the correct widgets */
-        panel_proxy_mode_combo_setup_widgets (proxy, value);
+        panel_proxy_mode_setup_widgets (proxy, value);
+
+        /* status label */
+        panel_update_status_label (proxy, value);
 }
 
 static void
-panel_proxy_mode_combo_changed_cb (GtkWidget *widget, NetProxy *proxy)
+show_dialog_cb (GtkWidget *button,
+                NetProxy  *self)
 {
-        gboolean ret;
-        gint value;
-        GtkTreeIter iter;
-        GtkTreeModel *model;
+        GtkWidget *toplevel;
+        GtkWindow *dialog;
 
-        /* no selection */
-        ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
-        if (!ret)
-                return;
-
-        /* get entry */
-        model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-        gtk_tree_model_get (model, &iter,
-                            1, &value,
-                            -1);
+        toplevel = gtk_widget_get_toplevel (button);
+        dialog = GTK_WINDOW (gtk_builder_get_object (self->priv->builder, "dialog"));
 
-        /* set */
-        g_settings_set_enum (proxy->priv->settings, "mode", value);
-
-        /* hide or show the correct widgets */
-        panel_proxy_mode_combo_setup_widgets (proxy, value);
+        gtk_window_set_transient_for (dialog, GTK_WINDOW (toplevel));
+        gtk_window_present (dialog);
 }
 
 static GtkWidget *
@@ -217,13 +204,9 @@ net_proxy_add_to_stack (NetObject    *object,
         GtkWidget *widget;
         NetProxy *proxy = NET_PROXY (object);
 
-        /* add widgets to size group */
         widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "heading_proxy_method"));
+                                                     "main_widget"));
         gtk_size_group_add_widget (heading_size_group, widget);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "grid5"));
         gtk_stack_add_named (stack, widget, net_object_get_id (object));
         return widget;
 }
@@ -302,11 +285,12 @@ set_ignore_hosts (const GValue       *value,
 static void
 net_proxy_init (NetProxy *proxy)
 {
-        GError *error = NULL;
-        gint value;
-        GSettings *settings_tmp;
         GtkAdjustment *adjustment;
+        GSettings *settings_tmp;
+        ProxyMode value;
         GtkWidget *widget;
+        GError *error = NULL;
+        guint i;
 
         proxy->priv = NET_PROXY_GET_PRIVATE (proxy);
 
@@ -328,12 +312,6 @@ net_proxy_init (NetProxy *proxy)
 
         /* actions */
         value = g_settings_get_enum (proxy->priv->settings, "mode");
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "combobox_proxy_mode"));
-        panel_set_value_for_combo (proxy, GTK_COMBO_BOX (widget), value);
-        g_signal_connect (widget, "changed",
-                          G_CALLBACK (panel_proxy_mode_combo_changed_cb),
-                          proxy);
 
         /* bind the proxy values */
         widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
@@ -398,20 +376,6 @@ net_proxy_init (NetProxy *proxy)
                          G_SETTINGS_BIND_DEFAULT);
         g_object_unref (settings_tmp);
 
-        /* set header to something sane */
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "image_proxy_device"));
-        gtk_image_set_from_icon_name (GTK_IMAGE (widget),
-                                      "preferences-system-network",
-                                      GTK_ICON_SIZE_DIALOG);
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "label_proxy_device"));
-        gtk_label_set_label (GTK_LABEL (widget),
-                             _("Proxy"));
-        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder,
-                                                     "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"));
@@ -420,11 +384,41 @@ net_proxy_init (NetProxy *proxy)
                                       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"));
-        if (widget != NULL)
-                gtk_widget_hide (widget);
+        /* radio buttons */
+        proxy->priv->mode_radios[MODE_DISABLED] =
+                GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_none"));
+        proxy->priv->mode_radios[MODE_MANUAL] =
+                GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_manual"));
+        proxy->priv->mode_radios[MODE_AUTOMATIC] =
+                GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->priv->builder, "radio_automatic"));
+
+        /* setup the radio before connecting to the :toggled signal */
+        gtk_toggle_button_set_active (proxy->priv->mode_radios[value], TRUE);
+        panel_proxy_mode_setup_widgets (proxy, value);
+        panel_update_status_label (proxy, value);
+
+        for (i = MODE_DISABLED; i < N_MODES; i++) {
+                g_signal_connect (proxy->priv->mode_radios[i],
+                                  "toggled",
+                                  G_CALLBACK (panel_proxy_mode_radio_changed_cb),
+                                  proxy);
+        }
+
+        /* show dialog button */
+        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder, "dialog_button"));
+
+        g_signal_connect (widget,
+                          "clicked",
+                          G_CALLBACK (show_dialog_cb),
+                          proxy);
+
+        /* prevent the dialog from being destroyed */
+        widget = GTK_WIDGET (gtk_builder_get_object (proxy->priv->builder, "dialog"));
+
+        g_signal_connect (widget,
+                          "delete-event",
+                          G_CALLBACK (gtk_widget_hide_on_delete),
+                          widget);
 }
 
 NetProxy *
diff --git a/panels/network/network-proxy.ui b/panels/network/network-proxy.ui
index 9cf51b6..232c4d0 100644
--- a/panels/network/network-proxy.ui
+++ b/panels/network/network-proxy.ui
@@ -17,477 +17,465 @@
     <property name="upper">65535</property>
     <property name="step_increment">1</property>
   </object>
-  <object class="GtkListStore" id="liststore_proxy_method">
-    <columns>
-      <!-- column-name text -->
-      <column type="gchararray"/>
-      <!-- column-name type -->
-      <column type="gint"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" context="proxy method">None</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="proxy method">Manual</col>
-        <col id="1">1</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="proxy method">Automatic</col>
-        <col id="1">2</col>
-      </row>
-    </data>
-  </object>
-      <object class="GtkGrid" id="grid5">
+  <object class="GtkFrame" id="main_widget">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkListBox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="valign">start</property>
-        <property name="border_width">12</property>
-        <property name="row_spacing">10</property>
-        <property name="column_spacing">6</property>
+        <property name="selection_mode">none</property>
         <child>
-          <object class="GtkAlignment" id="alignment_proxy_switch">
+          <object class="GtkListBoxRow">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="halign">end</property>
-            <property name="valign">start</property>
+            <property name="activatable">False</property>
             <child>
-              <placeholder/>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">2</property>
-            <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="heading_proxy_method">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_Method</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">combobox_proxy_mode</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBoxText" id="combobox_proxy_mode">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="entry_text_column">0</property>
-            <property name="id_column">1</property>
-            <property name="model">liststore_proxy_method</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-            <property name="width">2</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="heading_proxy_url">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_Configuration URL</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_proxy_url</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_proxy_url">
-            <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">2</property>
-            <property name="width">2</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="heading_proxy_http">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_HTTP Proxy</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_proxy_http</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="heading_proxy_https">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">H_TTPS Proxy</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_proxy_https</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">4</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="heading_proxy_ftp">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_FTP Proxy</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_proxy_ftp</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">5</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="heading_proxy_socks">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_Socks Host</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_proxy_socks</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">6</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </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">False</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="label">WPAD warning…</property>
-            <property name="wrap">True</property>
-            <property name="width_chars">50</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">8</property>
-            <property name="width">3</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_proxy_http">
-            <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">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkSpinButton" id="spinbutton_proxy_http">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="invisible_char">●</property>
-            <property name="xalign">1</property>
-            <property name="invisible_char_set">True</property>
-            <property name="adjustment">adjustment_proxy_port_http</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="spinbutton_proxy_http-accessible">
-                <property name="accessible-name" translatable="yes">HTTP proxy port</property>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">12</property>
+                <property name="margin">12</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">Network Proxy</property>
+                    <property name="xalign">0.0</property>
+                    <attributes>
+                      <attribute name="weight" value="bold" />
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="status_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <style>
+                      <class name="dim-label" />
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="dialog_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">emblem-system-symbolic</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
             </child>
           </object>
-          <packing>
-            <property name="left_attach">2</property>
-            <property name="top_attach">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_proxy_https">
-            <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">4</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_proxy_ftp">
-            <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">5</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_proxy_socks">
-            <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">6</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </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>
+      </object>
+    </child>
+  </object>
+  <object class="GtkDialog" id="dialog">
+    <property name="use_header_bar">1</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">18</property>
+    <property name="default_height">350</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="window_position">center</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="title" translatable="yes">Network Proxy</property>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">0</property>
+        <property name="spacing">6</property>
         <child>
-          <object class="GtkSpinButton" id="spinbutton_proxy_https">
+          <object class="GtkRadioButton" id="radio_automatic">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="invisible_char">●</property>
-            <property name="xalign">1</property>
-            <property name="invisible_char_set">True</property>
-            <property name="adjustment">adjustment_proxy_port_https</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="spinbutton_proxy_https-accessible">
-                <property name="accessible-name" translatable="yes">HTTPS proxy port</property>
-              </object>
-            </child>
+            <property name="label" translatable="yes">Automatic</property>
+            <property name="receives_default">False</property>
+            <property name="draw_indicator">True</property>
+            <property name="group">radio_none</property>
           </object>
-          <packing>
-            <property name="left_attach">2</property>
-            <property name="top_attach">4</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="spinbutton_proxy_ftp">
+          <object class="GtkRadioButton" id="radio_manual">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="invisible_char">●</property>
-            <property name="xalign">1</property>
-            <property name="invisible_char_set">True</property>
-            <property name="adjustment">adjustment_proxy_port_ftp</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="spinbutton_proxy_ftp-accessible">
-                <property name="accessible-name" translatable="yes">FTP proxy port</property>
-              </object>
-            </child>
+            <property name="label" translatable="yes">Manual</property>
+            <property name="receives_default">False</property>
+            <property name="draw_indicator">True</property>
+            <property name="group">radio_none</property>
           </object>
-          <packing>
-            <property name="left_attach">2</property>
-            <property name="top_attach">5</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="spinbutton_proxy_socks">
+          <object class="GtkRadioButton" id="radio_none">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="invisible_char">●</property>
-            <property name="xalign">1</property>
-            <property name="invisible_char_set">True</property>
-            <property name="adjustment">adjustment_proxy_port_socks</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="spinbutton_proxy_socks-accessible">
-                <property name="accessible-name" translatable="yes">Socks proxy port</property>
-              </object>
-            </child>
+            <property name="label" translatable="yes">Disabled</property>
+            <property name="receives_default">False</property>
+            <property name="draw_indicator">True</property>
           </object>
-          <packing>
-            <property name="left_attach">2</property>
-            <property name="top_attach">6</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box1">
+          <object class="GtkStack" id="stack">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="spacing">6</property>
+            <property name="transition_type">crossfade</property>
+
+            <!-- Disabled (empty box) -->
             <child>
-              <object class="GtkImage" id="image_proxy_device">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="halign">end</property>
-                <property name="valign">start</property>
-                <property name="xalign">1</property>
-                <property name="pixel_size">48</property>
-                <property name="icon_name">preferences-system-network</property>
-                <property name="icon-size">6</property>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="name">disabled</property>
               </packing>
             </child>
+
+            <!-- Manual -->
             <child>
-              <object class="GtkVBox" id="vbox13">
+              <object class="GtkGrid" id="grid6">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="valign">start</property>
-                <property name="hexpand">True</property>
-                <property name="spacing">3</property>
+                <property name="border_width">12</property>
+                <property name="row_spacing">10</property>
+                <property name="column_spacing">6</property>
                 <child>
-                  <object class="GtkLabel" id="label_proxy_device">
+                  <object class="GtkAlignment" id="alignment_proxy_switch">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label">Proxy</property>
-                    <property name="ellipsize">end</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                      <attribute name="scale" value="1.2"/>
-                    </attributes>
+                    <property name="halign">end</property>
+                    <property name="valign">start</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label_proxy_status">
+                  <object class="GtkLabel" id="heading_proxy_http">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label">Not connected</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">_HTTP Proxy</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_proxy_http</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="heading_proxy_https">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">H_TTPS Proxy</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_proxy_https</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="heading_proxy_ftp">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">_FTP Proxy</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_proxy_ftp</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">5</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="heading_proxy_socks">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">_Socks Host</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_proxy_socks</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">6</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </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="GtkEntry" id="entry_proxy_http">
+                    <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">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinbutton_proxy_http">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</property>
+                    <property name="xalign">1</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">adjustment_proxy_port_http</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="spinbutton_proxy_http-accessible">
+                        <property name="accessible-name" translatable="yes">HTTP proxy port</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_proxy_https">
+                    <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">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_proxy_ftp">
+                    <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">5</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_proxy_socks">
+                    <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">6</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </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>
+                    <property name="invisible_char">●</property>
+                    <property name="xalign">1</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">adjustment_proxy_port_https</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="spinbutton_proxy_https-accessible">
+                        <property name="accessible-name" translatable="yes">HTTPS proxy port</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinbutton_proxy_ftp">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</property>
+                    <property name="xalign">1</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">adjustment_proxy_port_ftp</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="spinbutton_proxy_ftp-accessible">
+                        <property name="accessible-name" translatable="yes">FTP proxy port</property>
+                      </object>
+                    </child>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinbutton_proxy_socks">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</property>
+                    <property name="xalign">1</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">adjustment_proxy_port_socks</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="spinbutton_proxy_socks-accessible">
+                        <property name="accessible-name" translatable="yes">Socks proxy port</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">6</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="name">manual</property>
               </packing>
             </child>
+
+            <!-- Automatic -->
             <child>
-              <object class="GtkSwitch" id="device_proxy_off_switch">
+              <object class="GtkGrid">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="halign">end</property>
-                <property name="valign">center</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">12</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="heading_proxy_url">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">_Configuration URL</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_proxy_url</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="top_attach">0</property>
+                    <property name="left_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_proxy_url">
+                    <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="top_attach">0</property>
+                    <property name="left_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label_proxy_warning">
+                    <property name="visible">False</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label">WPAD warning…</property>
+                    <property name="wrap">True</property>
+                    <property name="width_chars">50</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="left_attach">0</property>
+                    <property name="width">2</property>
+                  </packing>
+                </child>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="name">automatic</property>
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-            <property name="width">3</property>
-            <property name="height">1</property>
-          </packing>
         </child>
       </object>
-  <object class="GtkSizeGroup" id="sizegroup3">
-    <widgets>
-      <widget name="combobox_proxy_mode"/>
-      <widget name="entry_proxy_url"/>
-    </widgets>
+    </child>
   </object>
 </interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]