[network-manager-applet/jk/editor-bridge-igmp-snoop-bgo744853] editor: allow setting multicast_snooping option for bridges (bgo #744853)



commit 79171316e03c3cc03aa19c77d3ca12580696d5eb
Author: Jiří Klimeš <jklimes redhat com>
Date:   Fri Feb 27 10:06:07 2015 +0100

    editor: allow setting multicast_snooping option for bridges (bgo #744853)

 src/connection-editor/ce-page-bridge.ui |   52 ++++++++++++++++++++-----------
 src/connection-editor/page-bridge.c     |   13 ++++++-
 2 files changed, 45 insertions(+), 20 deletions(-)
---
diff --git a/src/connection-editor/ce-page-bridge.ui b/src/connection-editor/ce-page-bridge.ui
index 53ffdf1..7561232 100644
--- a/src/connection-editor/ce-page-bridge.ui
+++ b/src/connection-editor/ce-page-bridge.ui
@@ -174,8 +174,8 @@
         <property name="mnemonic_widget">bridge_priority</property>
       </object>
       <packing>
-        <property name="top_attach">5</property>
-        <property name="bottom_attach">6</property>
+        <property name="top_attach">6</property>
+        <property name="bottom_attach">7</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
@@ -214,8 +214,8 @@
         <property name="mnemonic_widget">bridge_forward_delay</property>
       </object>
       <packing>
-        <property name="top_attach">6</property>
-        <property name="bottom_attach">7</property>
+        <property name="top_attach">7</property>
+        <property name="bottom_attach">8</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
@@ -229,8 +229,8 @@
         <property name="mnemonic_widget">bridge_hello_time</property>
       </object>
       <packing>
-        <property name="top_attach">7</property>
-        <property name="bottom_attach">8</property>
+        <property name="top_attach">8</property>
+        <property name="bottom_attach">9</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
@@ -272,8 +272,8 @@
       <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="top_attach">7</property>
+        <property name="bottom_attach">8</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
@@ -315,14 +315,14 @@
       <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="top_attach">8</property>
+        <property name="bottom_attach">9</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
     <child>
-      <object class="GtkCheckButton" id="bridge_stp_checkbox">
-        <property name="label" translatable="yes">Enable _STP (Spanning Tree Protocol)</property>
+      <object class="GtkCheckButton" id="bridge_mcast_snoop_checkbox">
+        <property name="label" translatable="yes">Enable I_GMP snooping</property>
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="receives_default">False</property>
@@ -337,6 +337,22 @@
       </packing>
     </child>
     <child>
+      <object class="GtkCheckButton" id="bridge_stp_checkbox">
+        <property name="label" translatable="yes">Enable _STP (Spanning Tree Protocol)</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="xalign">0</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="right_attach">2</property>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkSpinButton" id="bridge_priority">
         <property name="visible">True</property>
         <property name="can_focus">True</property>
@@ -348,8 +364,8 @@
       <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="top_attach">6</property>
+        <property name="bottom_attach">7</property>
       </packing>
     </child>
     <child>
@@ -362,8 +378,8 @@
         <property name="mnemonic_widget">bridge_max_age</property>
       </object>
       <packing>
-        <property name="top_attach">8</property>
-        <property name="bottom_attach">9</property>
+        <property name="top_attach">9</property>
+        <property name="bottom_attach">10</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
@@ -405,8 +421,8 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="right_attach">2</property>
-        <property name="top_attach">8</property>
-        <property name="bottom_attach">9</property>
+        <property name="top_attach">9</property>
+        <property name="bottom_attach">10</property>
         <property name="y_options">GTK_FILL</property>
       </packing>
     </child>
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index 605bb0f..9f2a3f0 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -38,6 +38,7 @@ typedef struct {
        GtkWindow *toplevel;
 
        GtkSpinButton *ageing_time;
+       GtkCheckButton *mcast_snoop;
        GtkCheckButton *stp;
        GtkSpinButton *priority;
        GtkSpinButton *forward_delay;
@@ -55,6 +56,7 @@ bridge_private_init (CEPageBridge *self)
        builder = CE_PAGE (self)->builder;
 
        priv->ageing_time = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bridge_ageing_time"));
+       priv->mcast_snoop = GTK_CHECK_BUTTON (gtk_builder_get_object (builder, 
"bridge_mcast_snoop_checkbox"));
        priv->stp = GTK_CHECK_BUTTON (gtk_builder_get_object (builder, "bridge_stp_checkbox"));
        priv->priority = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bridge_priority"));
        priv->forward_delay = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bridge_forward_delay"));
@@ -96,7 +98,7 @@ populate_ui (CEPageBridge *self)
 {
        CEPageBridgePrivate *priv = CE_PAGE_BRIDGE_GET_PRIVATE (self);
        NMSettingBridge *s_bridge = priv->setting;
-       gboolean stp;
+       gboolean stp, mcast_snoop;
        int priority, forward_delay, hello_time, max_age;
        int ageing_time;
 
@@ -107,6 +109,11 @@ populate_ui (CEPageBridge *self)
                          G_CALLBACK (stuff_changed),
                          self);
 
+       /* Multicast snooping */
+       mcast_snoop = nm_setting_bridge_get_multicast_snooping (s_bridge);
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->mcast_snoop), mcast_snoop);
+       g_signal_connect (priv->mcast_snoop, "toggled", G_CALLBACK (stuff_changed), self);
+
        /* STP */
        g_signal_connect (priv->stp, "toggled",
                          G_CALLBACK (stp_toggled),
@@ -225,12 +232,14 @@ ui_to_setting (CEPageBridge *self)
 {
        CEPageBridgePrivate *priv = CE_PAGE_BRIDGE_GET_PRIVATE (self);
        int ageing_time, priority, forward_delay, hello_time, max_age;
-       gboolean stp;
+       gboolean stp, mcast_snoop;
 
        ageing_time = gtk_spin_button_get_value_as_int (priv->ageing_time);
+       mcast_snoop = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->mcast_snoop));
        stp = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->stp));
        g_object_set (G_OBJECT (priv->setting),
                      NM_SETTING_BRIDGE_AGEING_TIME, ageing_time,
+                     NM_SETTING_BRIDGE_MULTICAST_SNOOPING, mcast_snoop,
                      NM_SETTING_BRIDGE_STP, stp,
                      NULL);
 


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