[network-manager-applet] editor: save bonding mode in nm-connection-editor



commit 25def14c9ddb5c6d1ac43d23df11f1a2b32ec2a8
Author: Jiří Klimeš <jklimes redhat com>
Date:   Wed Jul 10 16:10:32 2013 +0200

    editor: save bonding mode in nm-connection-editor
    
    In addition, only allow MII monitoring for "balance-tlb" and "balance-alb"
    modes.
    
    RHEL6:
    https://bugzilla.redhat.com/show_bug.cgi?id=953076

 src/connection-editor/page-bond.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index 8538e91..0db3fca 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -131,6 +131,22 @@ connection_added (CEPageMaster *master, NMConnection *connection)
 }
 
 static void
+bonding_mode_changed (GtkComboBox *combo, gpointer user_data)
+{
+       CEPageBond *self = user_data;
+       CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);
+
+       /* balance-tlb and balance-alb work only with MII monitoring */
+       if (   gtk_combo_box_get_active (combo) == MODE_BALANCE_TLB
+           || gtk_combo_box_get_active (combo) == MODE_BALANCE_ALB) {
+               gtk_combo_box_set_active (priv->monitoring, MONITORING_MII);
+               gtk_widget_set_sensitive (GTK_WIDGET (priv->monitoring), FALSE);
+       } else {
+               gtk_widget_set_sensitive (GTK_WIDGET (priv->monitoring), TRUE);
+       }
+}
+
+static void
 monitoring_mode_changed (GtkComboBox *combo, gpointer user_data)
 {
        CEPageBond *self = user_data;
@@ -273,6 +289,10 @@ populate_ui (CEPageBond *self)
                        mode_idx = MODE_BALANCE_ALB;
        }
        gtk_combo_box_set_active (priv->mode, mode_idx);
+       g_signal_connect (priv->mode, "changed",
+                         G_CALLBACK (bonding_mode_changed),
+                         self);
+       bonding_mode_changed (priv->mode, self);
 
        /* Monitoring mode/frequency */
        frequency = nm_setting_bond_get_option_by_name (setting, NM_SETTING_BOND_OPTION_ARP_INTERVAL);
@@ -454,6 +474,9 @@ ui_to_setting (CEPageBond *self)
        downdelay = gtk_entry_get_text (GTK_ENTRY (priv->downdelay));
        targets = uglify_targets (gtk_entry_get_text (priv->arp_targets));
 
+       /* Set bond mode */
+       nm_setting_bond_add_option (priv->setting, NM_SETTING_BOND_OPTION_MODE, mode);
+
        switch (gtk_combo_box_get_active (priv->monitoring)) {
        case MONITORING_MII:
                nm_setting_bond_add_option (priv->setting, NM_SETTING_BOND_OPTION_MIIMON, frequency);


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