[network-manager-pptp] properties: disable security and stateful encryption if MPPE isn't turned on



commit 79c1fb949af51bbb6549f6ed983299d06ef600d7
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Thu Feb 17 12:06:42 2011 +0100

    properties: disable security and stateful encryption if MPPE isn't turned on

 properties/advanced-dialog.c |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index f271d0e..3c5b23b 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -109,6 +109,20 @@ handle_mppe_changed (GtkWidget *check, gboolean is_init, GtkBuilder *builder)
 
 	use_mppe = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
 
+	/* (De)-sensitize MPPE related stuff */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_label"));
+	gtk_widget_set_sensitive (widget, use_mppe);
+
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_combo"));
+	if (!use_mppe)
+		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); /* default */
+	gtk_widget_set_sensitive (widget, use_mppe);
+
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_stateful_mppe"));
+	if (!use_mppe)
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+	gtk_widget_set_sensitive (widget, use_mppe);
+
 	/* At dialog-setup time, don't touch the auth methods if MPPE is disabled
 	 * since that could overwrite the user's previously chosen auth methods.
 	 * But ensure that at init time if MPPE is on that incompatible auth methods
@@ -140,19 +154,6 @@ handle_mppe_changed (GtkWidget *check, gboolean is_init, GtkBuilder *builder)
 
 		valid = gtk_tree_model_iter_next (model, &iter);
 	}
-
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_label"));
-	gtk_widget_set_sensitive (widget, use_mppe);
-
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_mppe_security_combo"));
-	if (!use_mppe)
-		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); /* default */
-	gtk_widget_set_sensitive (widget, use_mppe);
-
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_allow_stateful_mppe"));
-	if (!use_mppe)
-		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
-	gtk_widget_set_sensitive (widget, use_mppe);
 }
 
 static void
@@ -254,10 +255,13 @@ check_toggled_cb (GtkCellRendererToggle *cell, gchar *path_str, gpointer user_da
 
 		valid = gtk_tree_model_iter_next (model, &iter);
 	}
+	/* Make sure MPPE is non-sensitive if MSCHAP and MSCHAPv2 are disabled */
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ppp_use_mppe"));
 	if (!mschap_state && !mschap2_state) {
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
 		gtk_widget_set_sensitive (widget, FALSE);
+		/* Make sure also MPPE security combo and stateful checkbox are non-sensitive */
+		mppe_toggled_cb (widget, builder);
 	} else
 		gtk_widget_set_sensitive (widget, TRUE);
 }



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