NetworkManager r4286 - in trunk: . introspection system-settings/src



Author: dcbw
Date: Fri Nov 14 18:24:38 2008
New Revision: 4286
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4286&view=rev

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

	* introspection/nm-settings-system.xml
	  system-settings/src/dbus-settings.c
	  system-settings/src/dbus-settings.h
		- Add a "CanModify" property to indicate if any plugins support
			connection modification



Modified:
   trunk/ChangeLog
   trunk/introspection/nm-settings-system.xml
   trunk/system-settings/src/dbus-settings.c
   trunk/system-settings/src/dbus-settings.h

Modified: trunk/introspection/nm-settings-system.xml
==============================================================================
--- trunk/introspection/nm-settings-system.xml	(original)
+++ trunk/introspection/nm-settings-system.xml	Fri Nov 14 18:24:38 2008
@@ -38,6 +38,12 @@
       </tp:docstring>
     </property>
 
+    <property name="CanModify" type="b" access="read">
+      <tp:docstring>
+        If true, adding and modifying connections is supported.
+      </tp:docstring>
+    </property>
+
     <property name="UnmanagedDevices" type="ao" access="read">
       <tp:docstring>
         The list of HAL UDIs of devices that should not be managed by NetworkManager.
@@ -54,3 +60,4 @@
 
   </interface>
 </node>
+

Modified: trunk/system-settings/src/dbus-settings.c
==============================================================================
--- trunk/system-settings/src/dbus-settings.c	(original)
+++ trunk/system-settings/src/dbus-settings.c	Fri Nov 14 18:24:38 2008
@@ -75,6 +75,7 @@
 	PROP_0,
 	PROP_UNMANAGED_DEVICES,
 	PROP_HOSTNAME,
+	PROP_CAN_MODIFY,
 
 	LAST_PROP
 };
@@ -222,6 +223,27 @@
 	return devices;
 }
 
+static NMSystemConfigInterface *
+get_first_plugin_by_capability (NMSysconfigSettings *self,
+                                guint32 capability)
+{
+	NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
+	GSList *iter;
+
+	g_return_val_if_fail (self != NULL, NULL);
+
+	/* Do any of the plugins support setting the hostname? */
+	for (iter = priv->plugins; iter; iter = iter->next) {
+		NMSystemConfigInterfaceCapabilities caps = NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE;
+
+		g_object_get (G_OBJECT (iter->data), NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES, &caps, NULL);
+		if (caps & capability)
+			return NM_SYSTEM_CONFIG_INTERFACE (iter->data);
+	}
+
+	return NULL;
+}
+
 static void
 get_property (GObject *object, guint prop_id,
 			  GValue *value, GParamSpec *pspec)
@@ -230,6 +252,7 @@
 	NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
 	GSList *iter;
 
+
 	switch (prop_id) {
 	case PROP_UNMANAGED_DEVICES:
 		g_value_take_boxed (value, get_unmanaged_devices (self));
@@ -261,6 +284,9 @@
 		if (!g_value_get_string (value))
 			g_value_set_static_string (value, "");
 		break;
+	case PROP_CAN_MODIFY:
+		g_value_set_boolean (value, !!get_first_plugin_by_capability (self, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS));
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -298,6 +324,14 @@
 							 NULL,
 							 G_PARAM_READABLE));
 
+	g_object_class_install_property
+		(object_class, PROP_CAN_MODIFY,
+		 g_param_spec_boolean (NM_SYSCONFIG_SETTINGS_CAN_MODIFY,
+							 "CanModify",
+							 "Can modify",
+							 FALSE,
+							 G_PARAM_READABLE));
+
 	/* signals */
 	signals[PROPERTIES_CHANGED] = 
 	                g_signal_new ("properties-changed",
@@ -493,27 +527,6 @@
 	return TRUE;
 }
 
-static NMSystemConfigInterface *
-get_first_plugin_by_capability (NMSysconfigSettings *self,
-                                guint32 capability)
-{
-	NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
-	GSList *iter;
-
-	g_return_val_if_fail (self != NULL, NULL);
-
-	/* Do any of the plugins support setting the hostname? */
-	for (iter = priv->plugins; iter; iter = iter->next) {
-		NMSystemConfigInterfaceCapabilities caps = NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE;
-
-		g_object_get (G_OBJECT (iter->data), NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES, &caps, NULL);
-		if (caps & capability)
-			return NM_SYSTEM_CONFIG_INTERFACE (iter->data);
-	}
-
-	return NULL;
-}
-
 static gboolean
 impl_settings_add_connection (NMSysconfigSettings *self,
 						GHashTable *hash,

Modified: trunk/system-settings/src/dbus-settings.h
==============================================================================
--- trunk/system-settings/src/dbus-settings.h	(original)
+++ trunk/system-settings/src/dbus-settings.h	Fri Nov 14 18:24:38 2008
@@ -44,6 +44,7 @@
 
 #define NM_SYSCONFIG_SETTINGS_UNMANAGED_DEVICES "unmanaged-devices"
 #define NM_SYSCONFIG_SETTINGS_HOSTNAME "hostname"
+#define NM_SYSCONFIG_SETTINGS_CAN_MODIFY "can-modify"
 
 struct _NMSysconfigSettings
 {



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