network-manager-applet r983 - in trunk: . src/connection-editor src/gconf-helpers



Author: dcbw
Date: Mon Oct 27 17:13:24 2008
New Revision: 983
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=983&view=rev

Log:
2008-10-27  Dan Williams  <dcbw redhat com>

	* src/connection-editor/nm-connection-editor.c
		- Don't allow editing of read-only connections

	* src/gconf-helpers/gconf-helpers.c
		- Don't read or save the connection setting's 'read-only' value to GConf



Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/gconf-helpers/gconf-helpers.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	Mon Oct 27 17:13:24 2008
@@ -167,6 +167,7 @@
 system_checkbutton_toggled_cb (GtkWidget *widget, NMConnectionEditor *editor)
 {
 	gboolean req_privs = FALSE;
+	NMSettingConnection *s_con;
 
 	/* If the connection was originally a system connection, obviously
 	 * privileges are required to change it.  If it was originally a user
@@ -185,6 +186,11 @@
 	else
 		g_object_set (editor->system_gnome_action, "polkit-action", NULL, NULL);
 
+	/* Can't ever modify read-only connections */
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
+	if (nm_setting_connection_get_read_only (s_con))
+		gtk_widget_set_sensitive (editor->ok_button, FALSE);
+
 	connection_editor_validate (editor);
 }
 
@@ -220,8 +226,16 @@
 static void
 update_sensitivity (NMConnectionEditor *editor, PolKitResult pk_result)
 {
+	NMSettingConnection *s_con;
 	gboolean denied = FALSE;
 
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
+	/* Can't ever modify read-only connections */
+	if (nm_setting_connection_get_read_only (s_con)) {
+		set_editor_sensitivity (editor, FALSE);
+		return;
+	}
+
 	if (pk_result == POLKIT_RESULT_UNKNOWN)
 		pk_result = polkit_gnome_action_get_polkit_result (editor->system_gnome_action);
 

Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.c	Mon Oct 27 17:13:24 2008
@@ -954,6 +954,11 @@
 	if (secret)
 		return;
 
+	/* Don't read the NMSettingConnection object's 'read-only' property */
+	if (   NM_IS_SETTING_CONNECTION (setting)
+	    && !strcmp (key, NM_SETTING_CONNECTION_READ_ONLY))
+		return;
+
 	/* Some keys (like certs) aren't read directly from GConf but are handled
 	 * separately.
 	 */
@@ -1290,6 +1295,11 @@
 	if (secret)
 		return;
 
+	/* Don't write the NMSettingConnection object's 'read-only' property */
+	if (   NM_IS_SETTING_CONNECTION (setting)
+	    && !strcmp (key, NM_SETTING_CONNECTION_READ_ONLY))
+		return;
+
 	/* If the value is the default value, remove the item from GConf */
 	pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), key);
 	if (pspec) {



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