[network-manager-applet] editor: fix Apply button polkit usage switching from system -> user



commit 0a5715bc2196e79ef76bf1f51dc8b455ce66e093
Author: Dan Williams <dcbw redhat com>
Date:   Mon Sep 21 12:04:07 2009 -0700

    editor: fix Apply button polkit usage switching from system -> user

 src/connection-editor/nm-connection-editor.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 561634c..f27c10e 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -251,13 +251,17 @@ can_modify_changed_cb (NMRemoteSettingsSystem *settings,
 static void
 system_checkbutton_toggled_cb (GtkWidget *widget, NMConnectionEditor *editor)
 {
-	/* Whether the Apply button uses system settings permissions as part of
-	 * it's sensitivity determination depends on whether the system checkbutton
-	 * is toggled or not.
+	gboolean use_polkit = TRUE;
+
+	/* The only time the Apply button does not need to use polkit is when the
+	 * original connection scope was USER and the "system" checkbutton is
+	 * unchecked.
 	 */
-	ce_polkit_button_set_use_polkit (CE_POLKIT_BUTTON (editor->ok_button),
-	                                 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
+	if (   !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))
+	    && (editor->orig_scope == NM_CONNECTION_SCOPE_USER))
+		use_polkit = FALSE;
 
+	ce_polkit_button_set_use_polkit (CE_POLKIT_BUTTON (editor->ok_button), use_polkit);
 	connection_editor_validate (editor);
 }
 



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