NetworkManager r4289 - in trunk: . libnm-glib
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4289 - in trunk: . libnm-glib
- Date: Fri, 14 Nov 2008 19:54:10 +0000 (UTC)
Author: dcbw
Date: Fri Nov 14 19:54:10 2008
New Revision: 4289
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4289&view=rev
Log:
2008-11-14 Dan Williams <dcbw redhat com>
* libnm-glib/libnm_glib.ver
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add libnm-glib bits for CanModify
Modified:
trunk/ChangeLog
trunk/libnm-glib/libnm_glib.ver
trunk/libnm-glib/nm-dbus-settings-system.c
trunk/libnm-glib/nm-dbus-settings-system.h
Modified: trunk/libnm-glib/libnm_glib.ver
==============================================================================
--- trunk/libnm-glib/libnm_glib.ver (original)
+++ trunk/libnm-glib/libnm_glib.ver Fri Nov 14 19:54:10 2008
@@ -46,6 +46,7 @@
nm_dbus_settings_get_type;
nm_dbus_settings_new;
nm_dbus_settings_system_add_connection;
+ nm_dbus_settings_system_get_can_modify;
nm_dbus_settings_system_get_type;
nm_dbus_settings_system_get_unmanaged_devices;
nm_dbus_settings_system_new;
Modified: trunk/libnm-glib/nm-dbus-settings-system.c
==============================================================================
--- trunk/libnm-glib/nm-dbus-settings-system.c (original)
+++ trunk/libnm-glib/nm-dbus-settings-system.c Fri Nov 14 19:54:10 2008
@@ -40,6 +40,9 @@
gboolean got_hostname;
char *hostname;
+ gboolean got_can_modify;
+ gboolean can_modify;
+
gboolean disposed;
} NMDBusSettingsSystemPrivate;
@@ -47,6 +50,7 @@
PROP_0,
PROP_UNMANAGED_DEVICES,
PROP_HOSTNAME,
+ PROP_CAN_MODIFY,
LAST_PROP
};
@@ -201,12 +205,44 @@
return priv->hostname;
}
+gboolean
+nm_dbus_settings_system_get_can_modify (NMDBusSettingsSystem *self)
+{
+ NMDBusSettingsSystemPrivate *priv;
+ GValue value = { 0, };
+ GError *err = NULL;
+
+ g_return_val_if_fail (NM_IS_DBUS_SETTINGS_SYSTEM (self), FALSE);
+
+ priv = NM_DBUS_SETTINGS_SYSTEM_GET_PRIVATE (self);
+
+ if (priv->got_can_modify)
+ return priv->can_modify;
+
+ if (!dbus_g_proxy_call (priv->props_proxy, "Get", &err,
+ G_TYPE_STRING, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
+ G_TYPE_STRING, "CanModify",
+ G_TYPE_INVALID,
+ G_TYPE_VALUE, &value,
+ G_TYPE_INVALID)) {
+ g_warning ("Could not retrieve can-modify: %s", err->message);
+ g_error_free (err);
+ return FALSE;
+ }
+
+ priv->can_modify = g_value_get_boolean (&value);
+ g_value_unset (&value);
+
+ return priv->can_modify;
+}
+
static void
proxy_properties_changed (DBusGProxy *proxy,
GHashTable *properties,
gpointer user_data)
{
NMDBusSettingsSystem *self = NM_DBUS_SETTINGS_SYSTEM (user_data);
+ NMDBusSettingsSystemPrivate * priv = NM_DBUS_SETTINGS_SYSTEM_GET_PRIVATE (self);
GValue *value;
value = (GValue *) g_hash_table_lookup (properties, "UnmanagedDevices");
@@ -220,6 +256,12 @@
update_hostname (self, value);
g_object_notify (G_OBJECT (self), NM_DBUS_SETTINGS_SYSTEM_HOSTNAME);
}
+
+ value = (GValue *) g_hash_table_lookup (properties, "CanModify");
+ if (value) {
+ priv->can_modify = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (self), NM_DBUS_SETTINGS_SYSTEM_CAN_MODIFY);
+ }
}
static void
@@ -303,6 +345,9 @@
case PROP_HOSTNAME:
g_value_set_string (value, nm_dbus_settings_system_get_hostname (self));
break;
+ case PROP_CAN_MODIFY:
+ g_value_set_boolean (value, nm_dbus_settings_system_get_can_modify (self));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -336,5 +381,13 @@
"Configured hostname",
NULL,
G_PARAM_READABLE));
+
+ g_object_class_install_property
+ (object_class, PROP_HOSTNAME,
+ g_param_spec_boolean (NM_DBUS_SETTINGS_SYSTEM_CAN_MODIFY,
+ "Can modify",
+ "Can modify",
+ FALSE,
+ G_PARAM_READABLE));
}
Modified: trunk/libnm-glib/nm-dbus-settings-system.h
==============================================================================
--- trunk/libnm-glib/nm-dbus-settings-system.h (original)
+++ trunk/libnm-glib/nm-dbus-settings-system.h Fri Nov 14 19:54:10 2008
@@ -37,6 +37,7 @@
#define NM_DBUS_SETTINGS_SYSTEM_UNMANAGED_DEVICES "unmanaged-devices"
#define NM_DBUS_SETTINGS_SYSTEM_HOSTNAME "hostname"
+#define NM_DBUS_SETTINGS_SYSTEM_CAN_MODIFY "can-modify"
typedef struct {
NMDBusSettings parent;
@@ -62,6 +63,8 @@
const char *hostname,
GError **err);
+gboolean nm_dbus_settings_system_get_can_modify (NMDBusSettingsSystem *self);
+
G_END_DECLS
#endif /* NM_DBUS_SETTINGS_SYSTEM_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]