[gnome-control-center/wip/networking2: 25/36] network: Improve layout of the ethernet identity page



commit 9ebdc9afcbe3c0ceee60899ee47d3375f8795083
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 6 20:04:11 2013 -0500

    network: Improve layout of the ethernet identity page
    
    Move the 'bytes' label out to a third column, and hide
    it if the MTU is set to automatic. Based on review feedback.

 .../network/connection-editor/ce-page-ethernet.c   |   14 +-
 .../network/connection-editor/ce-page-ethernet.h   |    5 +-
 panels/network/connection-editor/ethernet-page.ui  |  234 ++++++--------------
 3 files changed, 83 insertions(+), 170 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-ethernet.c b/panels/network/connection-editor/ce-page-ethernet.c
index b924320..9d8a90a 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -48,6 +48,15 @@ all_user_changed (GtkToggleButton *b, CEPageEthernet *page)
 }
 
 static void
+mtu_changed (GtkSpinButton *mtu, CEPageEthernet *page)
+{
+        if (gtk_spin_button_get_value_as_int (mtu) == 0)
+                gtk_widget_hide (page->mtu_label);
+        else
+                gtk_widget_show (page->mtu_label);
+}
+
+static void
 connect_ethernet_page (CEPageEthernet *page)
 {
         NMSettingWired *setting = page->setting_wired;
@@ -82,8 +91,10 @@ connect_ethernet_page (CEPageEthernet *page)
         g_signal_connect (page->mtu, "output",
                           G_CALLBACK (ce_spin_output_with_default),
                           GINT_TO_POINTER (mtu_def));
-
         gtk_spin_button_set_value (page->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
+        g_signal_connect (page->mtu, "value-changed",
+                          G_CALLBACK (mtu_changed), page);
+        mtu_changed (page->mtu, 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);
@@ -192,6 +203,7 @@ ce_page_ethernet_new (NMConnection     *connection,
         page->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_mac"));
         page->cloned_mac = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac"));
         page->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "spin_mtu"));
+        page->mtu_label = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "label_mtu"));
 
         page->setting_connection = nm_connection_get_setting_connection (connection);
         page->setting_wired = nm_connection_get_setting_wired (connection);
diff --git a/panels/network/connection-editor/ce-page-ethernet.h b/panels/network/connection-editor/ce-page-ethernet.h
index 3f0942e..daa24a2 100644
--- a/panels/network/connection-editor/ce-page-ethernet.h
+++ b/panels/network/connection-editor/ce-page-ethernet.h
@@ -51,11 +51,8 @@ struct _CEPageEthernet
         GtkEntry        *name;
         GtkComboBoxText *device_mac;
         GtkEntry        *cloned_mac;
-        GtkComboBox     *port;
-        GtkComboBox     *speed;
-        GtkToggleButton *duplex;
-        GtkToggleButton *autonegotiate;
         GtkSpinButton   *mtu;
+        GtkWidget       *mtu_label;
 };
 
 struct _CEPageEthernetClass
diff --git a/panels/network/connection-editor/ethernet-page.ui b/panels/network/connection-editor/ethernet-page.ui
index 82692ab..d081079 100644
--- a/panels/network/connection-editor/ethernet-page.ui
+++ b/panels/network/connection-editor/ethernet-page.ui
@@ -64,70 +64,30 @@
     <property name="row_spacing">10</property>
     <property name="column_spacing">6</property>
     <child>
-      <object class="GtkLabel" id="heading_mtu">
+      <object class="GtkLabel" id="heading_name">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="xalign">1</property>
-        <property name="label" translatable="yes">M_TU</property>
+        <property name="label" translatable="yes">_Name</property>
         <property name="use_underline">True</property>
-        <property name="mnemonic_widget">spin_mtu</property>
+        <property name="mnemonic_widget">entry_name</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">7</property>
+        <property name="top_attach">0</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkBox" id="box1">
+      <object class="GtkEntry" id="entry_name">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkSpinButton" id="spin_mtu">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="invisible_char">â</property>
-            <property name="adjustment">adjustment1</property>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_mtu">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">bytes</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">â</property>
       </object>
       <packing>
         <property name="left_attach">1</property>
-        <property name="top_attach">7</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="heading_cloned_mac">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Cloned Address</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">entry_cloned_mac</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">6</property>
+        <property name="top_attach">0</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
@@ -143,22 +103,7 @@
       </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="GtkEntry" id="entry_cloned_mac">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="hexpand">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="top_attach">1</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
@@ -171,7 +116,7 @@
         <property name="entry_text_column">0</property>
         <property name="id_column">1</property>
         <child internal-child="entry">
-          <object class="GtkEntry" id="comboboxtext-entry2">
+          <object class="GtkEntry" id="comboboxtext-entry">
             <property name="can_focus">False</property>
             <property name="invisible_char">â</property>
           </object>
@@ -179,191 +124,150 @@
       </object>
       <packing>
         <property name="left_attach">1</property>
-        <property name="top_attach">5</property>
+        <property name="top_attach">1</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="heading_port">
+      <object class="GtkEntry" id="entry_cloned_mac">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">1</property>
-        <property name="label" translatable="yes">_Port</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">combo_port</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="invisible_char">â</property>
+        <property name="invisible_char_set">True</property>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="heading_speed">
+      <object class="GtkLabel" id="heading_mtu">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="xalign">1</property>
-        <property name="label" translatable="yes">_Speed</property>
+        <property name="label" translatable="yes">M_TU</property>
         <property name="use_underline">True</property>
-        <property name="mnemonic_widget">combo_speed</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
+        <property name="top_attach">3</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkCheckButton" id="check_duplex">
-        <property name="label" translatable="yes">_Full duplex</property>
+      <object class="GtkLabel" id="heading_cloned_mac">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
+        <property name="can_focus">False</property>
+        <property name="valign">center</property>
+        <property name="xalign">1</property>
+        <property name="label" translatable="yes">_Cloned Address</property>
         <property name="use_underline">True</property>
-        <property name="xalign">0</property>
-        <property name="draw_indicator">True</property>
       </object>
       <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">3</property>
+        <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="GtkCheckButton" id="check_renegotiate">
-        <property name="label" translatable="yes">_Automatic renegotiation</property>
+      <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">1</property>
+        <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="GtkComboBox" id="combo_port">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="model">model1</property>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">1</property>
-        <property name="width">1</property>
+        <property name="width">2</property>
         <property name="height">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkComboBox" id="combo_speed">
+      <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">False</property>
-        <property name="model">model2</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">1</property>
-        <property name="top_attach">2</property>
-        <property name="width">1</property>
+        <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>
-      <object class="GtkLabel" id="heading_name">
+      <object class="GtkLabel" id="label_mtu">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="xalign">1</property>
-        <property name="label" translatable="yes">_Name</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">entry_name</property>
+        <property name="label" translatable="yes">bytes</property>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
+        <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_name">
+      <object class="GtkSpinButton" id="spin_mtu">
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="invisible_char">â</property>
+        <property name="invisible_char_set">True</property>
+        <property name="adjustment">adjustment1</property>
       </object>
       <packing>
         <property name="left_attach">1</property>
-        <property name="top_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="label1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </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>
+      <placeholder/>
     </child>
     <child>
-      <object class="GtkLabel" id="label2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </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>
+      <placeholder/>
     </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">8</property>
-        <property name="width">2</property>
-        <property name="height">1</property>
-      </packing>
+      <placeholder/>
     </child>
     <child>
-      <object class="GtkCheckButton" id="all_user_check">
-        <property name="label" translatable="yes">Make available to other _users</property>
+      <placeholder/>
+    </child>
+    <child>
+      <object class="GtkLabel" id="filler">
         <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>
+        <property name="can_focus">False</property>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">9</property>
-        <property name="width">2</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>
   </object>
+  <object class="GtkSizeGroup" id="sizegroup1">
+    <widgets>
+      <widget name="label_mtu"/>
+      <widget name="filler"/>
+    </widgets>
+  </object>
 </interface>



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