network-manager-applet r1020 - in trunk: . src/connection-editor



Author: dcbw
Date: Fri Nov 14 19:57:06 2008
New Revision: 1020
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1020&view=rev

Log:
2008-11-14  Dan Williams  <dcbw redhat com>

	* src/connection-editor/nm-connection-list.c
		- Pass system settings 'CanModify' property along to the connection
			editor window

	* src/connection-editor/nm-connection-editor.c
	  src/connection-editor/nm-connection-editor.h
		- (nm_connection_editor_new): track whether system settings can actually
			add conenctions or not
		- (populate_connection_ui, set_editor_sensitivity): don't enable the
			system settings checkbox if system settings can't be modified



Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/connection-editor/nm-connection-editor.h
   trunk/src/connection-editor/nm-connection-list.c

Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c	(original)
+++ trunk/src/connection-editor/nm-connection-editor.c	Fri Nov 14 19:57:06 2008
@@ -215,7 +215,8 @@
 	widget = glade_xml_get_widget (editor->xml, "connection_name");
 	gtk_widget_set_sensitive (widget, sensitive);
 
-	gtk_widget_set_sensitive (GTK_WIDGET (editor->system_checkbutton), sensitive);
+	if (editor->system_settings_can_modify)
+		gtk_widget_set_sensitive (GTK_WIDGET (editor->system_checkbutton), sensitive);
 
 	for (iter = editor->pages; iter; iter = g_slist_next (iter)) {
 		widget = ce_page_get_page (CE_PAGE (iter->data));
@@ -401,13 +402,18 @@
 }
 
 NMConnectionEditor *
-nm_connection_editor_new (NMConnection *connection)
+nm_connection_editor_new (NMConnection *connection,
+                          gboolean system_settings_can_modify)
 {
 	NMConnectionEditor *editor;
 
 	g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
 
 	editor = g_object_new (NM_TYPE_CONNECTION_EDITOR, NULL);
+	if (!editor)
+		return NULL;
+
+	editor->system_settings_can_modify = system_settings_can_modify;
 	nm_connection_editor_set_connection (editor, connection);
 
 	return editor;
@@ -444,6 +450,9 @@
 
 	g_signal_connect_swapped (name, "changed", G_CALLBACK (connection_editor_validate), editor);
 	g_signal_connect_swapped (autoconnect, "toggled", G_CALLBACK (connection_editor_validate), editor);
+
+	if (!editor->system_settings_can_modify)
+		gtk_widget_set_sensitive (editor->system_checkbutton, FALSE);
 	g_signal_connect (editor->system_checkbutton, "toggled", G_CALLBACK (system_checkbutton_toggled_cb), editor);
 
 	if (editor->orig_scope == NM_CONNECTION_SCOPE_SYSTEM)

Modified: trunk/src/connection-editor/nm-connection-editor.h
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.h	(original)
+++ trunk/src/connection-editor/nm-connection-editor.h	Fri Nov 14 19:57:06 2008
@@ -47,6 +47,7 @@
 	PolKitGnomeAction *system_gnome_action;
 
 	GtkWidget *system_checkbutton;
+	gboolean system_settings_can_modify;
 
 	GSList *pages;
 	GladeXML *xml;
@@ -63,7 +64,8 @@
 } NMConnectionEditorClass;
 
 GType               nm_connection_editor_get_type (void);
-NMConnectionEditor *nm_connection_editor_new (NMConnection *connection);
+NMConnectionEditor *nm_connection_editor_new (NMConnection *connection,
+                                              gboolean system_settings_can_modify);
 
 void                nm_connection_editor_present (NMConnectionEditor *editor);
 void                nm_connection_editor_run (NMConnectionEditor *editor);

Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c	(original)
+++ trunk/src/connection-editor/nm-connection-list.c	Fri Nov 14 19:57:06 2008
@@ -970,7 +970,8 @@
 		return;
 	}
 
-	editor = nm_connection_editor_new (connection);
+	editor = nm_connection_editor_new (connection,
+	                                   nm_dbus_settings_system_get_can_modify (info->list->system_settings));
 	g_signal_connect (G_OBJECT (editor), "done", G_CALLBACK (add_done_cb), info);
 	g_hash_table_insert (info->list->editors, connection, editor);
 
@@ -1055,7 +1056,8 @@
 	}
 
 	connection = nm_gconf_connection_duplicate (nm_exported_connection_get_connection (exported));
-	editor = nm_connection_editor_new (connection);
+	editor = nm_connection_editor_new (connection,
+	                                   nm_dbus_settings_system_get_can_modify (info->list->system_settings));
 	g_object_unref (connection);
 
 	edit_info = g_new (EditConnectionInfo, 1);
@@ -1234,7 +1236,8 @@
 		return;
 	}
 
-	editor = nm_connection_editor_new (connection);
+	editor = nm_connection_editor_new (connection,
+	                                   nm_dbus_settings_system_get_can_modify (info->list->system_settings));
 	g_signal_connect (G_OBJECT (editor), "done", G_CALLBACK (add_done_cb), info);
 	g_hash_table_insert (info->list->editors, connection, editor);
 



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