[PATCH] editor: fix "Available to all users" checkbox initial state.



On Fri, 11 Mar 2011 09:49:24 +0100 Michael Biebl wrote:
> the "available to all users" checkbox is also set
> for every connection, even the private ones.

This patch should fix it.

-- 
WBR, Mikhail Efremov
From 6055b12a8726a631ddc5aa98a131659ba610a3e6 Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <sem altlinux org>
Date: Fri, 11 Mar 2011 19:05:28 +0300
Subject: [PATCH] editor: fix "Available to all users" checkbox initial state.

---
 src/connection-editor/nm-connection-editor.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index de61656..9793eca 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -461,6 +461,7 @@ populate_connection_ui (NMConnectionEditor *editor)
 	NMSettingConnection *s_con;
 	GtkWidget *name;
 	GtkWidget *autoconnect;
+	gboolean system_connection = TRUE;
 
 	name = GTK_WIDGET (gtk_builder_get_object (editor->builder, "connection_name"));
 	autoconnect = GTK_WIDGET (gtk_builder_get_object (editor->builder, "connection_autoconnect"));
@@ -472,6 +473,9 @@ populate_connection_ui (NMConnectionEditor *editor)
 		gtk_entry_set_text (GTK_ENTRY (name), id);
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autoconnect),
 		                              nm_setting_connection_get_autoconnect (s_con));
+
+		if (nm_setting_connection_get_num_permissions (s_con))
+			system_connection = FALSE;
 	} else {
 		gtk_entry_set_text (GTK_ENTRY (name), NULL);
 	}
@@ -481,7 +485,7 @@ populate_connection_ui (NMConnectionEditor *editor)
 
 	g_signal_connect (editor->all_checkbutton, "toggled", G_CALLBACK (all_checkbutton_toggled_cb), editor);
 
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->all_checkbutton), TRUE);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->all_checkbutton), system_connection);
 
 	connection_editor_validate (editor);
 }
-- 
1.7.4.1



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