[gnome-control-center/wip/gbsneto/connection-editor: 45/53] network: Move checkboxes to Details page



commit 38f5fd356d066b73c54af959eedb740926cc801b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun May 21 14:00:24 2017 -0300

    network: Move checkboxes to Details page
    
    In the advanced connection editor dialog, currently, the
    options to share a connection with all users and to connect
    automatically are inside the Identity page.
    
    The redesigned connection editor, however, features these
    options in the Details page as per the mockup [1].
    
    Fix this by moving these options to the Details page.
    
    [1] 
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/network/aday2/network-wires.png
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779841

 panels/network/connection-editor/ce-page-details.c |   33 ++++++++++++++++++
 .../network/connection-editor/ce-page-ethernet.c   |   32 -----------------
 panels/network/connection-editor/ce-page-vpn.c     |   21 -----------
 panels/network/connection-editor/ce-page-wifi.c    |   31 -----------------
 panels/network/connection-editor/details-page.ui   |   36 ++++++++++++++++++++
 panels/network/connection-editor/ethernet-page.ui  |   36 --------------------
 panels/network/connection-editor/vpn-page.ui       |   16 ---------
 panels/network/connection-editor/wifi-page.ui      |   36 --------------------
 8 files changed, 69 insertions(+), 172 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-details.c 
b/panels/network/connection-editor/ce-page-details.c
index 0f96f40..644555e 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -112,8 +112,24 @@ out:
 }
 
 static void
+all_user_changed (GtkToggleButton *b, CEPageDetails *page)
+{
+        gboolean all_users;
+        NMSettingConnection *sc;
+
+        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+        all_users = gtk_toggle_button_get_active (b);
+
+        g_object_set (sc, "permissions", NULL, NULL);
+        if (!all_users)
+                nm_setting_connection_add_permission (sc, "user", g_get_user_name (), NULL);
+}
+
+static void
 connect_details_page (CEPageDetails *page)
 {
+        NMSettingConnection *sc;
+        GtkWidget *widget;
         guint speed;
         guint strength;
         NMDeviceState state;
@@ -198,6 +214,23 @@ connect_details_page (CEPageDetails *page)
         else
                 panel_set_device_widget_details (CE_PAGE (page)->builder, "last_used", NULL);
 
+        /* Auto connect check */
+        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+                                                     "auto_connect_check"));
+        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+        g_object_bind_property (sc, "autoconnect",
+                                widget, "active",
+                                G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+        g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
+
+        /* All users check */
+        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+                                                     "all_user_check"));
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
+                                      nm_setting_connection_get_num_permissions (sc) == 0);
+        g_signal_connect (widget, "toggled",
+                          G_CALLBACK (all_user_changed), page);
+        g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
 }
 
 static void
diff --git a/panels/network/connection-editor/ce-page-ethernet.c 
b/panels/network/connection-editor/ce-page-ethernet.c
index 69866f6..2163cdb 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -34,20 +34,6 @@
 G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
 
 static void
-all_user_changed (GtkToggleButton *b, CEPageEthernet *page)
-{
-        gboolean all_users;
-        NMSettingConnection *sc;
-
-        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
-        all_users = gtk_toggle_button_get_active (b);
-
-        g_object_set (sc, "permissions", NULL, NULL);
-        if (!all_users)
-                nm_setting_connection_add_permission (sc, "user", g_get_user_name (), NULL);
-}
-
-static void
 mtu_changed (GtkSpinButton *mtu, CEPageEthernet *page)
 {
         if (gtk_spin_button_get_value_as_int (mtu) == 0)
@@ -60,11 +46,9 @@ static void
 connect_ethernet_page (CEPageEthernet *page)
 {
         NMSettingWired *setting = page->setting_wired;
-        NMSettingConnection *sc;
         int mtu_def;
         char **mac_list;
         const char *s_mac_str;
-        GtkWidget *widget;
         const gchar *name;
         const gchar *cloned_mac;
 
@@ -96,22 +80,6 @@ connect_ethernet_page (CEPageEthernet *page)
 
         g_signal_connect_swapped (page->name, "changed", G_CALLBACK (ce_page_changed), page);
         g_signal_connect_swapped (page->mtu, "value-changed", G_CALLBACK (ce_page_changed), page);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
-                                                     "auto_connect_check"));
-        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
-        g_object_bind_property (sc, "autoconnect",
-                                widget, "active",
-                                G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-        g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
-                                                     "all_user_check"));
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
-                                      nm_setting_connection_get_num_permissions (sc) == 0);
-        g_signal_connect (widget, "toggled",
-                          G_CALLBACK (all_user_changed), page);
-        g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
 }
 
 static void
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index 6305116..bb45416 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -31,20 +31,6 @@
 
 G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE)
 
-static void
-all_user_changed (GtkToggleButton *b, CEPageVpn *page)
-{
-        gboolean all_users;
-        NMSettingConnection *sc;
-
-        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
-        all_users = gtk_toggle_button_get_active (b);
-
-        g_object_set (sc, "permissions", NULL, NULL);
-        if (!all_users)
-                nm_setting_connection_add_permission (sc, "user", g_get_user_name (), NULL);
-}
-
 /* Hack to make the plugin-provided editor widget fit in better with
  * the control center by changing
  *
@@ -125,13 +111,6 @@ connect_vpn_page (CEPageVpn *page)
         name = nm_setting_connection_get_id (page->setting_connection);
         gtk_entry_set_text (page->name, name);
         g_signal_connect_swapped (page->name, "changed", G_CALLBACK (ce_page_changed), page);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
-                                                     "all_user_check"));
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
-                                      nm_setting_connection_get_num_permissions (page->setting_connection) 
== 0);
-        g_signal_connect (widget, "toggled",
-                          G_CALLBACK (all_user_changed), page);
 }
 
 static gboolean
diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c
index 34505f0..08e8e37 100644
--- a/panels/network/connection-editor/ce-page-wifi.c
+++ b/panels/network/connection-editor/ce-page-wifi.c
@@ -34,23 +34,8 @@
 G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
 
 static void
-all_user_changed (GtkToggleButton *b, CEPageWifi *page)
-{
-        gboolean all_users;
-        NMSettingConnection *sc;
-
-        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
-        all_users = gtk_toggle_button_get_active (b);
-
-        g_object_set (sc, "permissions", NULL, NULL);
-        if (!all_users)
-                nm_setting_connection_add_permission (sc, "user", g_get_user_name (), NULL);
-}
-
-static void
 connect_wifi_page (CEPageWifi *page)
 {
-        NMSettingConnection *sc;
         GtkWidget *widget;
         GBytes *ssid;
         gchar *utf8_ssid;
@@ -104,22 +89,6 @@ connect_wifi_page (CEPageWifi *page)
         cloned_mac = nm_setting_wireless_get_cloned_mac_address (page->setting);
         gtk_entry_set_text (GTK_ENTRY (widget), cloned_mac ? cloned_mac : "");
         g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
-                                                     "auto_connect_check"));
-        sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
-        g_object_bind_property (sc, "autoconnect",
-                                widget, "active",
-                                G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-        g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
-
-        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
-                                                     "all_user_check"));
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
-                                      nm_setting_connection_get_num_permissions (sc) == 0);
-        g_signal_connect (widget, "toggled",
-                          G_CALLBACK (all_user_changed), page);
-        g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
 }
 
 static void
diff --git a/panels/network/connection-editor/details-page.ui 
b/panels/network/connection-editor/details-page.ui
index b28a407..9afd3a8 100644
--- a/panels/network/connection-editor/details-page.ui
+++ b/panels/network/connection-editor/details-page.ui
@@ -319,5 +319,41 @@
         <property name="height">1</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkCheckButton" id="auto_connect_check">
+        <property name="label" translatable="yes">Connect _automatically</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="valign">end</property>
+        <property name="use_underline">True</property>
+        <property name="xalign">0</property>
+        <property name="draw_indicator">True</property>
+        <property name="margin_top">12</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">9</property>
+        <property name="width">2</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="all_user_check">
+        <property name="label" translatable="yes">Make available to _other users</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="xalign">0</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">10</property>
+        <property name="width">2</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/panels/network/connection-editor/ethernet-page.ui 
b/panels/network/connection-editor/ethernet-page.ui
index af7564a..eb1bfb0 100644
--- a/panels/network/connection-editor/ethernet-page.ui
+++ b/panels/network/connection-editor/ethernet-page.ui
@@ -212,42 +212,6 @@
       </packing>
     </child>
     <child>
-      <object class="GtkCheckButton" id="all_user_check">
-        <property name="label" translatable="yes">Make available to other _users</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_underline">True</property>
-        <property name="xalign">0</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">6</property>
-        <property name="width">2</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="auto_connect_check">
-        <property name="label" translatable="yes">Connect _automatically</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="valign">end</property>
-        <property name="vexpand">True</property>
-        <property name="use_underline">True</property>
-        <property name="xalign">0</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">5</property>
-        <property name="width">2</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
       <placeholder/>
     </child>
     <child>
diff --git a/panels/network/connection-editor/vpn-page.ui b/panels/network/connection-editor/vpn-page.ui
index d080252..589b199 100644
--- a/panels/network/connection-editor/vpn-page.ui
+++ b/panels/network/connection-editor/vpn-page.ui
@@ -51,22 +51,6 @@
       </packing>
     </child>
     <child>
-      <object class="GtkCheckButton" id="all_user_check">
-        <property name="label" translatable="yes">Make available to other _users</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_underline">True</property>
-        <property name="xalign">0</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
       <object class="GtkLabel" id="failure_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
diff --git a/panels/network/connection-editor/wifi-page.ui b/panels/network/connection-editor/wifi-page.ui
index 576e96d..96d2bfb 100644
--- a/panels/network/connection-editor/wifi-page.ui
+++ b/panels/network/connection-editor/wifi-page.ui
@@ -136,41 +136,5 @@
         <property name="height">1</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkCheckButton" id="all_user_check">
-        <property name="label" translatable="yes">Make available to _other users</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_underline">True</property>
-        <property name="xalign">0</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">6</property>
-        <property name="width">2</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="auto_connect_check">
-        <property name="label" translatable="yes">Connect _automatically</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="valign">end</property>
-        <property name="vexpand">True</property>
-        <property name="use_underline">True</property>
-        <property name="xalign">0</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">5</property>
-        <property name="width">2</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
   </object>
 </interface>


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