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



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4286 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-11-14 18:24:38 +00:00
parent 7118676968
commit c531e1cd9e
4 changed files with 50 additions and 21 deletions

View file

@ -1,3 +1,11 @@
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
2008-11-14 Dan Williams <dcbw@redhat.com>
Relicense libnm-glib to LGPLv2+ with agreement from contributors

View file

@ -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>

View file

@ -75,6 +75,7 @@ enum {
PROP_0,
PROP_UNMANAGED_DEVICES,
PROP_HOSTNAME,
PROP_CAN_MODIFY,
LAST_PROP
};
@ -222,6 +223,27 @@ get_unmanaged_devices (NMSysconfigSettings *self)
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 @@ get_property (GObject *object, guint prop_id,
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 @@ get_property (GObject *object, guint prop_id,
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 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
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 @@ nm_sysconfig_settings_is_device_managed (NMSysconfigSettings *self,
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,

View file

@ -44,6 +44,7 @@ typedef struct _NMSysconfigSettingsClass NMSysconfigSettingsClass;
#define NM_SYSCONFIG_SETTINGS_UNMANAGED_DEVICES "unmanaged-devices"
#define NM_SYSCONFIG_SETTINGS_HOSTNAME "hostname"
#define NM_SYSCONFIG_SETTINGS_CAN_MODIFY "can-modify"
struct _NMSysconfigSettings
{