[network-manager-applet/lr/connection-mtu-rh1177582] editor: allow setting MTU for any connection



commit 1b277e83c84063dbf12babd3e3599a178eaa19db
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Jan 6 19:14:27 2015 +0100

    editor: allow setting MTU for any connection
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1177582

 src/connection-editor/ce-page-ethernet.ui   |   56 ----------------
 src/connection-editor/ce-page-general.ui    |   91 ++++++++++++++++++++++-----
 src/connection-editor/ce-page-infiniband.ui |   58 -----------------
 src/connection-editor/ce-page-vlan.ui       |   58 -----------------
 src/connection-editor/ce-page-wifi.ui       |   57 -----------------
 src/connection-editor/page-bond.c           |    8 +++
 src/connection-editor/page-ethernet.c       |   13 ----
 src/connection-editor/page-general.c        |   19 ++++++
 src/connection-editor/page-infiniband.c     |   13 ----
 src/connection-editor/page-vlan.c           |   28 +--------
 src/connection-editor/page-wifi.c           |   14 ----
 11 files changed, 104 insertions(+), 311 deletions(-)
---
diff --git a/src/connection-editor/ce-page-ethernet.ui b/src/connection-editor/ce-page-ethernet.ui
index e619da8..f1b94cf 100644
--- a/src/connection-editor/ce-page-ethernet.ui
+++ b/src/connection-editor/ce-page-ethernet.ui
@@ -226,61 +226,5 @@
         <property name="y_options"/>
       </packing>
     </child>
-    <child>
-      <object class="GtkLabel" id="label28">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">_MTU:</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">ethernet_mtu</property>
-      </object>
-      <packing>
-        <property name="top_attach">6</property>
-        <property name="bottom_attach">7</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options"/>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkHBox" id="hbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkSpinButton" id="ethernet_mtu">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="adjustment">adjustment1</property>
-            <property name="climb_rate">1</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="label29">
-            <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">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="right_attach">2</property>
-        <property name="top_attach">6</property>
-        <property name="bottom_attach">7</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options">GTK_FILL</property>
-      </packing>
-    </child>
   </object>
 </interface>
diff --git a/src/connection-editor/ce-page-general.ui b/src/connection-editor/ce-page-general.ui
index 5683b2f..96a44af 100644
--- a/src/connection-editor/ce-page-general.ui
+++ b/src/connection-editor/ce-page-general.ui
@@ -1,6 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkAdjustment" id="connection_mtu_adjustment">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkListStore" id="dependent_vpn_model">
     <columns>
       <!-- column-name gchararray -->
@@ -13,7 +18,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">12</property>
-    <property name="n_rows">5</property>
+    <property name="n_rows">6</property>
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
     <child>
@@ -27,6 +32,8 @@
         <property name="draw_indicator">True</property>
       </object>
       <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">2</property>
         <property name="top_attach">2</property>
         <property name="bottom_attach">3</property>
         <property name="x_options">GTK_FILL</property>
@@ -48,6 +55,8 @@
         </child>
       </object>
       <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">2</property>
         <property name="top_attach">3</property>
         <property name="bottom_attach">4</property>
         <property name="y_options"/>
@@ -65,6 +74,8 @@
         <property name="draw_indicator">True</property>
       </object>
       <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">2</property>
         <property name="top_attach">1</property>
         <property name="bottom_attach">2</property>
         <property name="y_options">GTK_FILL</property>
@@ -82,45 +93,93 @@
         <property name="draw_indicator">True</property>
       </object>
       <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">2</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
     <child>
-      <object class="GtkBox" id="box2">
+      <object class="GtkLabel" id="firewall_zone_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Firewall _zone:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">4</property>
+        <property name="bottom_attach">5</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="firewall_zone_alignment">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">4</property>
+        <property name="bottom_attach">5</property>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="connection_mtu_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_MTU:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">connection_mtu</property>
+      </object>
+      <packing>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="connection_mtu_box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="valign">start</property>
-        <property name="vexpand">True</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkLabel" id="firewall_zone_label">
+          <object class="GtkSpinButton" id="connection_mtu">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Firewall _zone:</property>
-            <property name="use_underline">True</property>
+            <property name="can_focus">True</property>
+            <property name="adjustment">connection_mtu_adjustment</property>
+            <property name="climb_rate">1</property>
           </object>
           <packing>
-            <property name="expand">False</property>
+            <property name="expand">True</property>
             <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
-          <object class="GtkAlignment" id="firewall_zone_alignment">
+          <object class="GtkLabel" id="connection_mtu_units">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">bytes</property>
           </object>
           <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
             <property name="position">1</property>
           </packing>
         </child>
       </object>
       <packing>
-        <property name="top_attach">4</property>
-        <property name="bottom_attach">5</property>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="y_options"/>
       </packing>
     </child>
   </object>
diff --git a/src/connection-editor/ce-page-infiniband.ui b/src/connection-editor/ce-page-infiniband.ui
index 7773eee..b378bd0 100644
--- a/src/connection-editor/ce-page-infiniband.ui
+++ b/src/connection-editor/ce-page-infiniband.ui
@@ -78,64 +78,6 @@
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkHBox" id="hbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkSpinButton" id="infiniband_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>
-            <property name="climb_rate">1</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="label29">
-            <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">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <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="x_options">GTK_FILL</property>
-        <property name="y_options">GTK_FILL</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="infiniband_mtu_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">_MTU:</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">infiniband_mtu</property>
-      </object>
-      <packing>
-        <property name="top_attach">2</property>
-        <property name="bottom_attach">3</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options"/>
-      </packing>
-    </child>
   </object>
   <object class="GtkListStore" id="infiniband_mode_model">
     <columns>
diff --git a/src/connection-editor/ce-page-vlan.ui b/src/connection-editor/ce-page-vlan.ui
index 27b5265..d0848bb 100644
--- a/src/connection-editor/ce-page-vlan.ui
+++ b/src/connection-editor/ce-page-vlan.ui
@@ -80,64 +80,6 @@
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="vlan_mtu_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">_MTU:</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">vlan_mtu</property>
-      </object>
-      <packing>
-        <property name="top_attach">4</property>
-        <property name="bottom_attach">5</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkHBox" id="hbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkSpinButton" id="vlan_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">adjustment2</property>
-            <property name="climb_rate">1</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="label29">
-            <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">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="right_attach">2</property>
-        <property name="top_attach">4</property>
-        <property name="bottom_attach">5</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options">GTK_FILL</property>
-      </packing>
-    </child>
-    <child>
       <object class="GtkLabel" id="vlan_id_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
diff --git a/src/connection-editor/ce-page-wifi.ui b/src/connection-editor/ce-page-wifi.ui
index e2e544b..acccb40 100644
--- a/src/connection-editor/ce-page-wifi.ui
+++ b/src/connection-editor/ce-page-wifi.ui
@@ -61,63 +61,6 @@
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
     <child>
-      <object class="GtkHBox" id="wifi_mtu_hbox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkSpinButton" id="wifi_mtu">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="adjustment">adjustment1</property>
-            <property name="climb_rate">1</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="mtu_units">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">bytes</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="right_attach">2</property>
-        <property name="top_attach">9</property>
-        <property name="bottom_attach">10</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options">GTK_FILL</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="wifi_mtu_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">_MTU:</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">wifi_mtu</property>
-      </object>
-      <packing>
-        <property name="top_attach">9</property>
-        <property name="bottom_attach">10</property>
-        <property name="x_options">GTK_FILL</property>
-        <property name="y_options"/>
-      </packing>
-    </child>
-    <child>
       <object class="GtkAlignment" id="wifi_device_mac_alignment">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index d05b0b7..bfbc49a 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -39,6 +39,7 @@ G_DEFINE_TYPE (CEPageBond, ce_page_bond, CE_TYPE_PAGE_MASTER)
 
 typedef struct {
        NMSettingBond *setting;
+       NMSettingWired *wired;
 
        int slave_arptype;
 
@@ -446,6 +447,12 @@ ce_page_bond_new (NMConnection *connection,
                nm_connection_add_setting (connection, NM_SETTING (priv->setting));
        }
 
+       priv->wired = nm_connection_get_setting_wired (connection);
+       if (!priv->setting) {
+               priv->wired = NM_SETTING_WIRED (nm_setting_wired_new ());
+               nm_connection_add_setting (connection, NM_SETTING (priv->wired));
+       }
+
        g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
 
        return CE_PAGE (self);
@@ -593,6 +600,7 @@ bond_connection_new (GtkWindow *parent,
                                             settings,
                                             user_data);
        nm_connection_add_setting (connection, nm_setting_bond_new ());
+       nm_connection_add_setting (connection, nm_setting_wired_new ());
 
        /* Find an available interface name */
        connections = nm_remote_settings_list_connections (settings);
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index 16c8204..afe6a69 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -48,7 +48,6 @@ typedef struct {
        GtkComboBox *speed;
        GtkToggleButton *duplex;
        GtkToggleButton *autonegotiate;
-       GtkSpinButton *mtu;
 } CEPageEthernetPrivate;
 
 #define PORT_DEFAULT  0
@@ -91,7 +90,6 @@ ethernet_private_init (CEPageEthernet *self)
        priv->speed = GTK_COMBO_BOX (gtk_builder_get_object (builder, "ethernet_speed"));
        priv->duplex = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "ethernet_duplex"));
        priv->autonegotiate = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "ethernet_autonegotiate"));
-       priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "ethernet_mtu"));
 }
 
 static void
@@ -109,7 +107,6 @@ populate_ui (CEPageEthernet *self)
        const char *duplex;
        int port_idx = PORT_DEFAULT;
        int speed_idx;
-       int mtu_def;
        char **mac_list;
        const GByteArray *s_mac;
        char *s_mac_str;
@@ -174,14 +171,6 @@ populate_ui (CEPageEthernet *self)
        ce_page_mac_to_entry (nm_setting_wired_get_cloned_mac_address (setting),
                              ARPHRD_ETHER, priv->cloned_mac);
        g_signal_connect (priv->cloned_mac, "changed", G_CALLBACK (stuff_changed), self);
-
-       /* MTU */
-       mtu_def = ce_get_property_default (NM_SETTING (setting), NM_SETTING_WIRED_MTU);
-       g_signal_connect (priv->mtu, "output",
-                         G_CALLBACK (ce_spin_output_with_automatic),
-                         GINT_TO_POINTER (mtu_def));
-
-       gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
 }
 
 static void
@@ -200,7 +189,6 @@ finish_setup (CEPageEthernet *self, gpointer unused, GError *error, gpointer use
        g_signal_connect (priv->speed, "changed", G_CALLBACK (stuff_changed), self);
        g_signal_connect (priv->duplex, "toggled", 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);
 
        /* Hide widgets we don't yet support */
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "ethernet_port_label"));
@@ -317,7 +305,6 @@ ui_to_setting (CEPageEthernet *self)
                      NM_SETTING_WIRED_SPEED, speed,
                      NM_SETTING_WIRED_DUPLEX, gtk_toggle_button_get_active (priv->duplex) ? "full" : "half",
                      NM_SETTING_WIRED_AUTO_NEGOTIATE, gtk_toggle_button_get_active (priv->autonegotiate),
-                     NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (priv->mtu),
                      NULL);
 
        if (device_mac)
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 37fb8c2..ce9c01a 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -49,6 +49,8 @@ typedef struct {
        GtkWidget *autoconnect;
        GtkWidget *all_checkbutton;
 
+       GtkSpinButton *mtu;
+
        gboolean setup_finished;
 } CEPageGeneralPrivate;
 
@@ -147,6 +149,9 @@ general_private_init (CEPageGeneral *self)
 
        priv->autoconnect = GTK_WIDGET (gtk_builder_get_object (builder, "connection_autoconnect"));
        priv->all_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "system_checkbutton"));
+
+       /* MTU */
+       priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "connection_mtu"));
 }
 
 static void
@@ -224,6 +229,7 @@ populate_ui (CEPageGeneral *self)
        GSList *con_list, *l;
        GtkTreeIter iter;
        gboolean global_connection = TRUE;
+       int mtu_def;
 
        /* Zones are filled when got them from firewalld */
        if (priv->got_zones)
@@ -273,6 +279,13 @@ populate_ui (CEPageGeneral *self)
                global_connection = FALSE;
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_checkbutton), global_connection);
 
+       /* MTU */
+       mtu_def = 0;
+       g_signal_connect (priv->mtu, "output",
+                         G_CALLBACK (ce_spin_output_with_automatic),
+                         GINT_TO_POINTER (mtu_def));
+       gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_connection_get_mtu (priv->setting));
+
        stuff_changed (NULL, self);
 }
 
@@ -299,6 +312,8 @@ finish_setup (CEPageGeneral *self, gpointer unused, GError *error, gpointer user
 
        g_signal_connect (priv->autoconnect, "toggled", G_CALLBACK (stuff_changed), self);
        g_signal_connect (priv->all_checkbutton, "toggled", G_CALLBACK (stuff_changed), self);
+
+       g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
 }
 
 CEPage *
@@ -352,6 +367,7 @@ ui_to_setting (CEPageGeneral *self)
        char *uuid = NULL;
        GtkTreeIter iter;
        gboolean autoconnect = FALSE, everyone = FALSE;
+       guint32 mtu;
 
        /* We can't take and save zone until the combo was properly initialized. Zones
         * are received from FirewallD asynchronously; got_zones indicates we are ready.
@@ -386,6 +402,9 @@ ui_to_setting (CEPageGeneral *self)
                /* Only visible to this user */
                nm_setting_connection_add_permission (priv->setting, "user", g_get_user_name (), NULL);
        }
+
+       mtu = (guint32) gtk_spin_button_get_value_as_int (priv->mtu);
+       g_object_set (priv->setting, NM_SETTING_CONNECTION_MTU, mtu, NULL);
 }
 
 static gboolean
diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c
index 937da39..67a8cee 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -43,7 +43,6 @@ typedef struct {
        GtkComboBoxText *device_mac;  /* Permanent MAC of the device */
 
        GtkComboBox *transport_mode;
-       GtkSpinButton *mtu;
 } CEPageInfinibandPrivate;
 
 #define TRANSPORT_MODE_DATAGRAM  0
@@ -73,7 +72,6 @@ infiniband_private_init (CEPageInfiniband *self)
        gtk_label_set_mnemonic_widget (label, GTK_WIDGET (priv->device_mac));
 
        priv->transport_mode = GTK_COMBO_BOX (gtk_builder_get_object (builder, "infiniband_mode"));
-       priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "infiniband_mtu"));
 }
 
 static void
@@ -89,7 +87,6 @@ populate_ui (CEPageInfiniband *self)
        NMSettingInfiniband *setting = priv->setting;
        const char *mode;
        int mode_idx = TRANSPORT_MODE_DATAGRAM;
-       int mtu_def;
        char **mac_list;
        const GByteArray *s_mac;
        char *s_mac_str;
@@ -114,14 +111,6 @@ populate_ui (CEPageInfiniband *self)
        g_free (s_mac_str);
        g_strfreev (mac_list);
        g_signal_connect (priv->device_mac, "changed", G_CALLBACK (stuff_changed), self);
-
-       /* MTU */
-       mtu_def = ce_get_property_default (NM_SETTING (setting), NM_SETTING_INFINIBAND_MTU);
-       g_signal_connect (priv->mtu, "output",
-                         G_CALLBACK (ce_spin_output_with_automatic),
-                         GINT_TO_POINTER (mtu_def));
-
-       gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_infiniband_get_mtu (setting));
 }
 
 static void
@@ -135,7 +124,6 @@ finish_setup (CEPageInfiniband *self, gpointer unused, GError *error, gpointer u
        populate_ui (self);
 
        g_signal_connect (priv->transport_mode, "changed", G_CALLBACK (stuff_changed), self);
-       g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
 }
 
 CEPage *
@@ -198,7 +186,6 @@ ui_to_setting (CEPageInfiniband *self)
 
        g_object_set (priv->setting,
                      NM_SETTING_INFINIBAND_MAC_ADDRESS, device_mac,
-                     NM_SETTING_INFINIBAND_MTU, (guint32) gtk_spin_button_get_value_as_int (priv->mtu),
                      NM_SETTING_INFINIBAND_TRANSPORT_MODE, mode,
                      NULL);
 
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index 6fa6cc5..ea9a539 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -56,7 +56,6 @@ typedef struct {
        GtkSpinButton *id_entry;
        GtkEntry *name_entry;
        GtkEntry *cloned_mac;
-       GtkSpinButton *mtu;
 
        char *last_parent;
        int last_id;
@@ -87,7 +86,6 @@ vlan_private_init (CEPageVlan *self)
        priv->id_entry = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "vlan_id_entry"));
        priv->name_entry = GTK_ENTRY (gtk_builder_get_object (builder, "vlan_name_entry"));
        priv->cloned_mac = GTK_ENTRY (gtk_builder_get_object (builder, "vlan_cloned_mac_entry"));
-       priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "vlan_mtu"));
 }
 
 static void
@@ -191,12 +189,9 @@ parent_changed (GtkWidget *widget, gpointer user_data)
        parent_id = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent));
        if (parent_id > -1 && priv->parents[parent_id]->device != NULL) {
                gtk_widget_set_sensitive (GTK_WIDGET (priv->cloned_mac), TRUE);
-               gtk_widget_set_sensitive (GTK_WIDGET (priv->mtu), TRUE);
        } else {
                gtk_widget_set_sensitive (GTK_WIDGET (priv->cloned_mac), FALSE);
                gtk_entry_set_text (priv->cloned_mac, "");
-               gtk_widget_set_sensitive (GTK_WIDGET (priv->mtu), FALSE);
-               gtk_spin_button_set_value (priv->mtu, 1500);
        }
 
        sync_iface (self, priv->parent_entry);
@@ -348,7 +343,7 @@ populate_ui (CEPageVlan *self)
        NMConnection *parent_connection = NULL;
        NMDevice *device, *parent_device = NULL;
        const char *parent, *iface, *current_parent;
-       int i, mtu_def, mtu_val;
+       int i;
 
        devices = get_vlan_devices (self);
 
@@ -440,20 +435,6 @@ populate_ui (CEPageVlan *self)
        }
        g_signal_connect (priv->cloned_mac, "changed", G_CALLBACK (stuff_changed), self);
 
-       /* MTU */
-       if (NM_IS_SETTING_WIRED (priv->s_hw)) {
-               mtu_def = ce_get_property_default (priv->s_hw, NM_SETTING_WIRED_MTU);
-               mtu_val = nm_setting_wired_get_mtu (NM_SETTING_WIRED (priv->s_hw));
-       } else {
-               mtu_def = mtu_val = 1500;
-       }
-       g_signal_connect (priv->mtu, "output",
-                         G_CALLBACK (ce_spin_output_with_automatic),
-                         GINT_TO_POINTER (mtu_def));
-
-       gtk_spin_button_set_value (priv->mtu, (gdouble) mtu_val);
-       g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
-
        g_slist_free (devices);
 }
 
@@ -519,8 +500,6 @@ ui_to_setting (CEPageVlan *self)
        const char *iface;
        char *tmp_parent_iface = NULL;
        GType hwtype;
-       gboolean mtu_set;
-       int mtu;
 
        parent_id = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent));
        if (parent_id == -1) {
@@ -575,10 +554,8 @@ ui_to_setting (CEPageVlan *self)
 
        if (hwtype != G_TYPE_NONE) {
                cloned_mac = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, NULL);
-               mtu_set = g_ascii_isdigit (*gtk_entry_get_text (GTK_ENTRY (priv->mtu)));
-               mtu = gtk_spin_button_get_value_as_int (priv->mtu);
 
-               if (cloned_mac || mtu_set) {
+               if (cloned_mac) {
                        if (!priv->s_hw) {
                                priv->s_hw = g_object_new (hwtype, NULL);
                                nm_connection_add_setting (connection, priv->s_hw);
@@ -586,7 +563,6 @@ ui_to_setting (CEPageVlan *self)
 
                        g_object_set (priv->s_hw,
                                      NM_SETTING_WIRED_CLONED_MAC_ADDRESS, cloned_mac,
-                                     NM_SETTING_WIRED_MTU, (guint32) mtu,
                                      NULL);
 
                        if (cloned_mac)
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index dbf4e20..bd800fa 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -51,7 +51,6 @@ typedef struct {
        GtkSpinButton *channel;
        GtkSpinButton *rate;
        GtkSpinButton *tx_power;
-       GtkSpinButton *mtu;
 
        GtkSizeGroup *group;
 
@@ -108,10 +107,6 @@ wifi_private_init (CEPageWifi *self)
        priv->tx_power = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "wifi_tx_power"));
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "tx_power_units"));
        gtk_size_group_add_widget (priv->group, widget);
-
-       priv->mtu      = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "wifi_mtu"));
-       widget = GTK_WIDGET (gtk_builder_get_object (builder, "mtu_units"));
-       gtk_size_group_add_widget (priv->group, widget);
 }
 
 static gboolean
@@ -303,7 +298,6 @@ populate_ui (CEPageWifi *self)
        int band_idx = 0;
        int rate_def;
        int tx_power_def;
-       int mtu_def;
        char *utf8_ssid;
        char **mac_list;
        const GByteArray *s_mac, *s_bssid;
@@ -324,12 +318,6 @@ populate_ui (CEPageWifi *self)
                          GINT_TO_POINTER (tx_power_def));
        g_signal_connect_swapped (priv->tx_power, "value-changed", G_CALLBACK (ce_page_changed), self);
 
-       mtu_def = ce_get_property_default (NM_SETTING (setting), NM_SETTING_WIRELESS_MTU);
-       g_signal_connect (priv->mtu, "output",
-                         G_CALLBACK (ce_spin_output_with_automatic),
-                         GINT_TO_POINTER (mtu_def));
-       g_signal_connect_swapped (priv->mtu, "value-changed", G_CALLBACK (ce_page_changed), self);
-
        g_object_get (setting,
                      NM_SETTING_WIRELESS_SSID, &ssid,
                      NM_SETTING_WIRELESS_MODE, &mode,
@@ -416,7 +404,6 @@ populate_ui (CEPageWifi *self)
 
        gtk_spin_button_set_value (priv->rate, (gdouble) nm_setting_wireless_get_rate (setting));
        gtk_spin_button_set_value (priv->tx_power, (gdouble) nm_setting_wireless_get_tx_power (setting));
-       gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_wireless_get_mtu (setting));
 }
 
 static void
@@ -552,7 +539,6 @@ ui_to_setting (CEPageWifi *self)
                      NM_SETTING_WIRELESS_CHANNEL, gtk_spin_button_get_value_as_int (priv->channel),
                      NM_SETTING_WIRELESS_RATE, gtk_spin_button_get_value_as_int (priv->rate),
                      NM_SETTING_WIRELESS_TX_POWER, gtk_spin_button_get_value_as_int (priv->tx_power),
-                     NM_SETTING_WIRELESS_MTU, gtk_spin_button_get_value_as_int (priv->mtu),
                      NULL);
 
        if (ssid)


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