[network-manager-applet] connection-editor: Support carrier-detect



commit e61f097ee72098a301484036a04995e511664d98
Author: Dan Winship <danw gnome org>
Date:   Tue Feb 19 11:21:04 2013 -0500

    connection-editor: Support carrier-detect
    
    Add a carrier-detect combobox to the Ethernet, InfiniBand, and VLAN
    pages.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694186

 src/connection-editor/ce-page-ethernet.ui   |  456 +++++++++++++++------------
 src/connection-editor/ce-page-infiniband.ui |   73 ++++-
 src/connection-editor/ce-page-vlan.ui       |   65 ++++-
 src/connection-editor/page-ethernet.c       |   39 +++
 src/connection-editor/page-infiniband.c     |   39 +++
 src/connection-editor/page-vlan.c           |   41 +++
 6 files changed, 502 insertions(+), 211 deletions(-)
---
diff --git a/src/connection-editor/ce-page-ethernet.ui b/src/connection-editor/ce-page-ethernet.ui
index 48039cb..5f3f3ff 100644
--- a/src/connection-editor/ce-page-ethernet.ui
+++ b/src/connection-editor/ce-page-ethernet.ui
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
@@ -6,7 +6,23 @@
     <property name="upper">10000</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
-    <property name="page_size">0</property>
+  </object>
+  <object class="GtkListStore" id="ethernet_carrier_model">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Yes</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Only on activation</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">No</col>
+      </row>
+    </data>
   </object>
   <object class="GtkListStore" id="model1">
     <columns>
@@ -54,220 +70,270 @@
       </row>
     </data>
   </object>
-      <object class="GtkTable" id="EthernetPage">
+  <object class="GtkTable" id="EthernetPage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="n_rows">8</property>
+    <property name="n_columns">2</property>
+    <property name="column_spacing">12</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="ethernet_port_label">
         <property name="visible">True</property>
-        <property name="border_width">12</property>
-        <property name="n_rows">6</property>
-        <property name="n_columns">2</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="ethernet_port_label">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">_Port:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">ethernet_port</property>
-          </object>
-          <packing>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options"></property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBox" id="ethernet_port">
-            <property name="visible">True</property>
-            <property name="model">model1</property>
-            <child>
-              <object class="GtkCellRendererText" id="renderer1"/>
-              <attributes>
-                <attribute name="text">0</attribute>
-              </attributes>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="right_attach">2</property>
-            <property name="y_options">GTK_FILL</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="ethernet_speed_label">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">_Speed:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">ethernet_speed</property>
-          </object>
-          <packing>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options"></property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBox" id="ethernet_speed">
-            <property name="visible">True</property>
-            <property name="model">model2</property>
-            <child>
-              <object class="GtkCellRendererText" id="renderer2"/>
-              <attributes>
-                <attribute name="text">0</attribute>
-              </attributes>
-            </child>
-          </object>
-          <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="y_options"></property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="ethernet_duplex">
-            <property name="label" translatable="yes">Full duple_x</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="draw_indicator">True</property>
-          </object>
-          <packing>
-            <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"></property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="ethernet_autonegotiate">
-            <property name="label" translatable="yes">Aut_onegotiate</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="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="right_attach">2</property>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options"></property>
-          </packing>
-        </child>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Port:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">ethernet_port</property>
+      </object>
+      <packing>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="ethernet_port">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">model1</property>
         <child>
-          <object class="GtkLabel" id="ethernet_device_mac_label">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">_Device MAC address:</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"></property>
-          </packing>
+          <object class="GtkCellRendererText" id="renderer1"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
         </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="ethernet_speed_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Speed:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">ethernet_speed</property>
+      </object>
+      <packing>
+        <property name="top_attach">1</property>
+        <property name="bottom_attach">2</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="ethernet_speed">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">model2</property>
         <child>
-          <object class="GtkAlignment" id="ethernet_device_mac_alignment">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <child>
-              <placeholder/>
-            </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="y_options"></property>
-          </packing>
+          <object class="GtkCellRendererText" id="renderer2"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
         </child>
+      </object>
+      <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="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="ethernet_duplex">
+        <property name="label" translatable="yes">Full duple_x</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.0</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <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"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="ethernet_autonegotiate">
+        <property name="label" translatable="yes">Aut_onegotiate</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.0</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="right_attach">2</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>
+    </child>
+    <child>
+      <object class="GtkLabel" id="ethernet_device_mac_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Device MAC address:</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="ethernet_device_mac_alignment">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
         <child>
-          <object class="GtkLabel" id="label27">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">C_loned MAC address:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">ethernet_cloned_mac</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"></property>
-          </packing>
+          <placeholder/>
         </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="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label27">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">C_loned MAC address:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">ethernet_cloned_mac</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="GtkEntry" id="ethernet_cloned_mac">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="tooltip_text" translatable="yes">The MAC address entered here will be used as 
hardware address for the network device this connection is activated on.  This feature is known as MAC 
cloning or spoofing.  Example: 00:11:22:33:44:55</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+        <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="GtkEntry" id="ethernet_cloned_mac">
+          <object class="GtkSpinButton" id="ethernet_mtu">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="tooltip_text" translatable="yes">The MAC address entered here will be used as 
hardware address for the network device this connection is activated on.  This feature is known as MAC 
cloning or spoofing.  Example: 00:11:22:33:44:55</property>
+            <property name="adjustment">adjustment1</property>
+            <property name="climb_rate">1</property>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="right_attach">2</property>
-            <property name="top_attach">5</property>
-            <property name="bottom_attach">6</property>
-            <property name="y_options"></property>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label28">
+          <object class="GtkLabel" id="label29">
             <property name="visible">True</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>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">bytes</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"></property>
+            <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>
+    <child>
+      <object class="GtkLabel" id="ethernet_carrier_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Carrier de_tect:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">ethernet_carrier</property>
+      </object>
+      <packing>
+        <property name="top_attach">7</property>
+        <property name="bottom_attach">8</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="ethernet_carrier">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">ethernet_carrier_model</property>
         <child>
-          <object class="GtkHBox" id="hbox1">
-            <property name="visible">True</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="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label29">
-                <property name="visible">True</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>
+          <object class="GtkCellRendererText" id="renderer3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
         </child>
       </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">7</property>
+        <property name="bottom_attach">8</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+  </object>
 </interface>
diff --git a/src/connection-editor/ce-page-infiniband.ui b/src/connection-editor/ce-page-infiniband.ui
index 0941b46..1c85d3d 100644
--- a/src/connection-editor/ce-page-infiniband.ui
+++ b/src/connection-editor/ce-page-infiniband.ui
@@ -1,11 +1,34 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">65520</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkListStore" id="infiniband_carrier_model">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Yes</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Only on activation</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">No</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkTable" id="InfinibandPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">12</property>
-    <property name="n_rows">3</property>
+    <property name="n_rows">4</property>
     <property name="n_columns">2</property>
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
@@ -19,7 +42,7 @@
       </object>
       <packing>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -34,7 +57,7 @@
         <property name="top_attach">1</property>
         <property name="bottom_attach">2</property>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -51,7 +74,7 @@
         <property name="right_attach">2</property>
         <property name="top_attach">1</property>
         <property name="bottom_attach">2</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -128,14 +151,44 @@
         <property name="top_attach">2</property>
         <property name="bottom_attach">3</property>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="infiniband_carrier_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Carrier de_tect:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">infiniband_carrier</property>
+      </object>
+      <packing>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="infiniband_carrier">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">infiniband_carrier_model</property>
+        <child>
+          <object class="GtkCellRendererText" id="renderer3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
-  </object>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">65520</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
   </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 081c8de..0442dea 100644
--- a/src/connection-editor/ce-page-vlan.ui
+++ b/src/connection-editor/ce-page-vlan.ui
@@ -1,11 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkAdjustment" id="adjustment2">
     <property name="upper">100</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkListStore" id="vlan_carrier_model">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Yes</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Only on activation</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">No</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkAdjustment" id="vlan_id_adjustment">
     <property name="upper">4095</property>
     <property name="step_increment">1</property>
@@ -15,7 +33,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="n_columns">2</property>
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
@@ -29,7 +47,7 @@
       </object>
       <packing>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -45,7 +63,7 @@
         <property name="top_attach">2</property>
         <property name="bottom_attach">3</property>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -61,7 +79,7 @@
         <property name="top_attach">3</property>
         <property name="bottom_attach">4</property>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -92,7 +110,7 @@
         <property name="top_attach">4</property>
         <property name="bottom_attach">5</property>
         <property name="x_options">GTK_FILL</property>
-        <property name="y_options"></property>
+        <property name="y_options"/>
       </packing>
     </child>
     <child>
@@ -199,6 +217,41 @@
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkLabel" id="vlan_carrier_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Carrier de_tect:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">vlan_carrier</property>
+      </object>
+      <packing>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="vlan_carrier">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">vlan_carrier_model</property>
+        <child>
+          <object class="GtkCellRendererText" id="renderer3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
   </object>
   <object class="GtkListStore" id="vlan_name_type_model">
     <columns>
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index 74d6bd3..e479232 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -53,6 +53,7 @@ typedef struct {
        GtkToggleButton *duplex;
        GtkToggleButton *autonegotiate;
        GtkSpinButton *mtu;
+       GtkComboBox *carrier_detect;
 
        gboolean disposed;
 } CEPageEthernetPrivate;
@@ -69,6 +70,10 @@ typedef struct {
 #define SPEED_1000    3
 #define SPEED_10000   4
 
+#define CARRIER_DETECT_YES         0
+#define CARRIER_DETECT_ON_ACTIVATE 1
+#define CARRIER_DETECT_NO          2
+
 static void
 ethernet_private_init (CEPageEthernet *self)
 {
@@ -103,6 +108,7 @@ ethernet_private_init (CEPageEthernet *self)
        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"));
+       priv->carrier_detect = GTK_COMBO_BOX (gtk_builder_get_object (builder, "ethernet_carrier"));
 }
 
 static void
@@ -124,6 +130,8 @@ populate_ui (CEPageEthernet *self)
        char **mac_list;
        const GByteArray *s_mac;
        char *s_mac_str;
+       int carrier_detect_idx = CARRIER_DETECT_YES;
+       const char *carrier_detect;
 
        /* Port */
        port = nm_setting_wired_get_port (setting);
@@ -193,6 +201,18 @@ populate_ui (CEPageEthernet *self)
                          GINT_TO_POINTER (mtu_def));
 
        gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
+
+       /* Carrier detect */
+       carrier_detect = nm_setting_wired_get_carrier_detect (setting);
+       if (carrier_detect) {
+               if (!strcmp (carrier_detect, "yes"))
+                       carrier_detect_idx = CARRIER_DETECT_YES;
+               else if (!strcmp (carrier_detect, "on-activate"))
+                       carrier_detect_idx = CARRIER_DETECT_ON_ACTIVATE;
+               else if (!strcmp (carrier_detect, "no"))
+                       carrier_detect_idx = CARRIER_DETECT_NO;
+       }
+       gtk_combo_box_set_active (priv->carrier_detect, carrier_detect_idx);
 }
 
 static void
@@ -212,6 +232,7 @@ finish_setup (CEPageEthernet *self, gpointer unused, GError *error, gpointer use
        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);
+       g_signal_connect (priv->carrier_detect, "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"));
@@ -277,6 +298,7 @@ ui_to_setting (CEPageEthernet *self)
        GByteArray *device_mac = NULL;
        GByteArray *cloned_mac = NULL;
        GtkWidget *entry;
+       const char *carrier_detect;
 
        /* Port */
        switch (gtk_combo_box_get_active (priv->port)) {
@@ -316,6 +338,22 @@ ui_to_setting (CEPageEthernet *self)
                break;
        }
 
+       /* Carrier detect */
+       switch (gtk_combo_box_get_active (priv->carrier_detect)) {
+       case CARRIER_DETECT_YES:
+               carrier_detect = "yes";
+               break;
+       case CARRIER_DETECT_ON_ACTIVATE:
+               carrier_detect = "on-activate";
+               break;
+       case CARRIER_DETECT_NO:
+               carrier_detect = "no";
+               break;
+       default:
+               carrier_detect = NULL;
+               break;
+       }
+
        entry = gtk_bin_get_child (GTK_BIN (priv->device_mac));
        if (entry)
                device_mac = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, NULL);
@@ -329,6 +367,7 @@ ui_to_setting (CEPageEthernet *self)
                      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),
+                     NM_SETTING_WIRED_CARRIER_DETECT, carrier_detect,
                      NULL);
 
        if (device_mac)
diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c
index aa2fe09..dedd368 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -48,11 +48,16 @@ typedef struct {
 
        GtkComboBox *transport_mode;
        GtkSpinButton *mtu;
+       GtkComboBox *carrier_detect;
 } CEPageInfinibandPrivate;
 
 #define TRANSPORT_MODE_DATAGRAM  0
 #define TRANSPORT_MODE_CONNECTED 1
 
+#define CARRIER_DETECT_YES         0
+#define CARRIER_DETECT_ON_ACTIVATE 1
+#define CARRIER_DETECT_NO          2
+
 static void
 infiniband_private_init (CEPageInfiniband *self)
 {
@@ -83,6 +88,7 @@ infiniband_private_init (CEPageInfiniband *self)
 
        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"));
+       priv->carrier_detect = GTK_COMBO_BOX (gtk_builder_get_object (builder, "infiniband_carrier"));
 }
 
 static void
@@ -102,6 +108,8 @@ populate_ui (CEPageInfiniband *self)
        char **mac_list;
        const GByteArray *s_mac;
        char *s_mac_str;
+       int carrier_detect_idx = CARRIER_DETECT_YES;
+       const char *carrier_detect;
 
        /* Port */
        mode = nm_setting_infiniband_get_transport_mode (setting);
@@ -131,6 +139,18 @@ populate_ui (CEPageInfiniband *self)
                          GINT_TO_POINTER (mtu_def));
 
        gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_infiniband_get_mtu (setting));
+
+       /* Carrier detect */
+       carrier_detect = nm_setting_infiniband_get_carrier_detect (setting);
+       if (carrier_detect) {
+               if (!strcmp (carrier_detect, "yes"))
+                       carrier_detect_idx = CARRIER_DETECT_YES;
+               else if (!strcmp (carrier_detect, "on-activate"))
+                       carrier_detect_idx = CARRIER_DETECT_ON_ACTIVATE;
+               else if (!strcmp (carrier_detect, "no"))
+                       carrier_detect_idx = CARRIER_DETECT_NO;
+       }
+       gtk_combo_box_set_active (priv->carrier_detect, carrier_detect_idx);
 }
 
 static void
@@ -145,6 +165,7 @@ finish_setup (CEPageInfiniband *self, gpointer unused, GError *error, gpointer u
 
        g_signal_connect (priv->transport_mode, "changed", G_CALLBACK (stuff_changed), self);
        g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
+       g_signal_connect (priv->carrier_detect, "changed", G_CALLBACK (stuff_changed), self);
 }
 
 CEPage *
@@ -193,6 +214,7 @@ ui_to_setting (CEPageInfiniband *self)
        const char *mode;
        GByteArray *device_mac = NULL;
        GtkWidget *entry;
+       const char *carrier_detect;
 
        /* Transport mode */
        if (gtk_combo_box_get_active (priv->transport_mode) == TRANSPORT_MODE_CONNECTED)
@@ -200,6 +222,22 @@ ui_to_setting (CEPageInfiniband *self)
        else
                mode = "datagram";
 
+       /* Carrier detect */
+       switch (gtk_combo_box_get_active (priv->carrier_detect)) {
+       case CARRIER_DETECT_YES:
+               carrier_detect = "yes";
+               break;
+       case CARRIER_DETECT_ON_ACTIVATE:
+               carrier_detect = "on-activate";
+               break;
+       case CARRIER_DETECT_NO:
+               carrier_detect = "no";
+               break;
+       default:
+               carrier_detect = NULL;
+               break;
+       }
+
        entry = gtk_bin_get_child (GTK_BIN (priv->device_mac));
        if (entry)
                device_mac = nm_utils_hwaddr_atoba (gtk_entry_get_text (GTK_ENTRY (entry)),
@@ -209,6 +247,7 @@ ui_to_setting (CEPageInfiniband *self)
                      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,
+                     NM_SETTING_INFINIBAND_CARRIER_DETECT, carrier_detect,
                      NULL);
 
        if (device_mac)
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index ef55327..a60704f 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -57,11 +57,16 @@ typedef struct {
        GtkEntry *name_entry;
        GtkEntry *cloned_mac;
        GtkSpinButton *mtu;
+       GtkComboBox *carrier_detect;
 
        char *last_parent;
        int last_id;
 } CEPageVlanPrivate;
 
+#define CARRIER_DETECT_YES         0
+#define CARRIER_DETECT_ON_ACTIVATE 1
+#define CARRIER_DETECT_NO          2
+
 static void
 vlan_private_init (CEPageVlan *self)
 {
@@ -93,6 +98,7 @@ vlan_private_init (CEPageVlan *self)
        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"));
+       priv->carrier_detect = GTK_COMBO_BOX (gtk_builder_get_object (builder, "vlan_carrier"));
 }
 
 static void
@@ -342,6 +348,8 @@ populate_ui (CEPageVlan *self)
        NMDevice *device, *parent_device = NULL;
        const char *parent, *iface, *current_parent;
        int i, mtu_def, mtu_val;
+       int carrier_detect_idx = CARRIER_DETECT_YES;
+       const char *carrier_detect;
 
        devices = get_vlan_devices (self);
 
@@ -447,16 +455,32 @@ populate_ui (CEPageVlan *self)
        gtk_spin_button_set_value (priv->mtu, (gdouble) mtu_val);
        g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
 
+       /* Carrier detect */
+       carrier_detect = nm_setting_vlan_get_carrier_detect (priv->setting);
+       if (carrier_detect) {
+               if (!strcmp (carrier_detect, "yes"))
+                       carrier_detect_idx = CARRIER_DETECT_YES;
+               else if (!strcmp (carrier_detect, "on-activate"))
+                       carrier_detect_idx = CARRIER_DETECT_ON_ACTIVATE;
+               else if (!strcmp (carrier_detect, "no"))
+                       carrier_detect_idx = CARRIER_DETECT_NO;
+       }
+       gtk_combo_box_set_active (priv->carrier_detect, carrier_detect_idx);
+
        g_slist_free (devices);
 }
 
 static void
 finish_setup (CEPageVlan *self, gpointer unused, GError *error, gpointer user_data)
 {
+       CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self);
+
        if (error)
                return;
 
        populate_ui (self);
+
+       g_signal_connect (priv->carrier_detect, "changed", G_CALLBACK (stuff_changed), self);
 }
 
 CEPage *
@@ -514,6 +538,7 @@ ui_to_setting (CEPageVlan *self)
        GType hwtype;
        gboolean mtu_set;
        int mtu;
+       const char *carrier_detect;
 
        parent_id = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent));
        if (parent_id == -1) {
@@ -560,10 +585,26 @@ ui_to_setting (CEPageVlan *self)
        iface = gtk_entry_get_text (priv->name_entry);
        vid = gtk_spin_button_get_value_as_int (priv->id_entry);
 
+       switch (gtk_combo_box_get_active (priv->carrier_detect)) {
+       case CARRIER_DETECT_YES:
+               carrier_detect = "yes";
+               break;
+       case CARRIER_DETECT_ON_ACTIVATE:
+               carrier_detect = "on-activate";
+               break;
+       case CARRIER_DETECT_NO:
+               carrier_detect = "no";
+               break;
+       default:
+               carrier_detect = NULL;
+               break;
+       }
+
        g_object_set (priv->setting,
                      NM_SETTING_VLAN_PARENT, parent_uuid ? parent_uuid : parent_iface,
                      NM_SETTING_VLAN_INTERFACE_NAME, iface,
                      NM_SETTING_VLAN_ID, vid,
+                     NM_SETTING_VLAN_CARRIER_DETECT, carrier_detect,
                      NULL);
 
        if (hwtype != G_TYPE_NONE) {


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