[network-manager-applet/fg/c-e-ethernet-link: 3/3] c-e: show link negotiation settings in UI



commit b966e7bdeed9c8ffaa211ce26a358740605da98b
Author: Francesco Giudici <fgiudici redhat com>
Date:   Fri Nov 25 12:58:05 2016 +0100

    c-e: show link negotiation settings in UI

 src/connection-editor/ce-page-ethernet.ui |   24 ++++++++++---------
 src/connection-editor/page-ethernet.c     |   35 +++++++++++++++++-----------
 2 files changed, 34 insertions(+), 25 deletions(-)
---
diff --git a/src/connection-editor/ce-page-ethernet.ui b/src/connection-editor/ce-page-ethernet.ui
index d9a0dad..11542fc 100644
--- a/src/connection-editor/ce-page-ethernet.ui
+++ b/src/connection-editor/ce-page-ethernet.ui
@@ -116,11 +116,12 @@
         <property name="xalign">0</property>
         <property name="label" translatable="yes">_Speed:</property>
         <property name="use_underline">True</property>
+       <property name="margin_left">26</property>
         <property name="mnemonic_widget">ethernet_speed</property>
       </object>
       <packing>
-        <property name="top_attach">1</property>
-        <property name="bottom_attach">2</property>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
         <property name="x_options">GTK_FILL</property>
         <property name="y_options"/>
       </packing>
@@ -140,8 +141,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="right_attach">2</property>
-        <property name="top_attach">1</property>
-        <property name="bottom_attach">2</property>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
         <property name="y_options"/>
       </packing>
     </child>
@@ -152,11 +153,12 @@
         <property name="xalign">0</property>
         <property name="label" translatable="yes">_Duplex:</property>
         <property name="use_underline">True</property>
+       <property name="margin_left">26</property>
         <property name="mnemonic_widget">ethernet_duplex</property>
       </object>
       <packing>
-        <property name="top_attach">2</property>
-        <property name="bottom_attach">3</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
         <property name="x_options">GTK_FILL</property>
         <property name="y_options"/>
       </packing>
@@ -176,14 +178,14 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="right_attach">2</property>
-        <property name="top_attach">2</property>
-        <property name="bottom_attach">3</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
         <property name="y_options"/>
       </packing>
     </child>
     <child>
       <object class="GtkCheckButton" id="ethernet_autonegotiate">
-        <property name="label" translatable="yes">Aut_onegotiate</property>
+        <property name="label" translatable="yes">Automatic link negotiation</property>
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="receives_default">False</property>
@@ -192,8 +194,8 @@
       </object>
       <packing>
         <property name="right_attach">2</property>
-        <property name="top_attach">3</property>
-        <property name="bottom_attach">4</property>
+        <property name="top_attach">1</property>
+        <property name="bottom_attach">2</property>
         <property name="x_options">GTK_FILL</property>
         <property name="y_options"/>
       </packing>
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index f019247..ce6ded7 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -115,6 +115,26 @@ stuff_changed (GtkWidget *w, gpointer user_data)
 }
 
 static void
+link_special_toggled_cb (GtkWidget *widget, gpointer user_data)
+{
+       CEPageEthernet *self = CE_PAGE_ETHERNET (user_data);
+       CEPageEthernetPrivate *priv = CE_PAGE_ETHERNET_GET_PRIVATE (self);
+       gboolean enabled;
+
+       enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+
+       if (enabled) {
+               gtk_combo_box_set_active (priv->speed, SPEED_DEFAULT);
+               gtk_combo_box_set_active (priv->duplex, DUPLEX_DEFAULT);
+       }
+
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->speed), !enabled);
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->duplex), !enabled);
+
+       stuff_changed (NULL, self);
+}
+
+static void
 wol_special_toggled_cb (GtkWidget *widget, gpointer user_data)
 {
        CEPageEthernet *self = CE_PAGE_ETHERNET (user_data);
@@ -283,10 +303,10 @@ finish_setup (CEPageEthernet *self, gpointer unused, GError *error, gpointer use
 
        populate_ui (self);
 
+       g_signal_connect (priv->autonegotiate, "toggled", G_CALLBACK (link_special_toggled_cb), self);
        g_signal_connect (priv->port, "changed", G_CALLBACK (stuff_changed), self);
        g_signal_connect (priv->speed, "changed", G_CALLBACK (stuff_changed), self);
        g_signal_connect (priv->duplex, "changed", G_CALLBACK (stuff_changed), self);
-       g_signal_connect (priv->autonegotiate, "toggled", G_CALLBACK (stuff_changed), self);
        g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
 
        g_signal_connect (priv->wol_default,   "toggled", G_CALLBACK (wol_special_toggled_cb), self);
@@ -308,19 +328,6 @@ finish_setup (CEPageEthernet *self, gpointer unused, GError *error, gpointer use
        gtk_widget_hide (widget);
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_port"));
        gtk_widget_hide (widget);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_speed_label"));
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_speed"));
-       gtk_widget_hide (widget);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_duplex_label"));
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_duplex"));
-       gtk_widget_hide (widget);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_autonegotiate"));
-       gtk_widget_hide (widget);
 }
 
 CEPage *


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