From 1f8ec6122e5ae950da7eb3e6b145609f08685c71 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 21 Oct 2014 09:18:47 -0400 Subject: [PATCH] libnm: fix NMActiveConnection:specific-object-path NMActiveConnection:specific-object was renamed to NMActiveConnection:specific-object-path in 677314c5, but it didn't actually work, because of assumptions NMObject makes. Fix that. --- libnm/nm-active-connection.c | 20 +++++++++++++++++++- libnm/nm-object.c | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index a64877be23..742b270cc6 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -459,6 +459,24 @@ get_property (GObject *object, } } +static gboolean +demarshal_specific_object_path (NMObject *object, GParamSpec *pspec, GVariant *value, gpointer field) +{ + char **param = (char **) field; + + /* We have to demarshal this manually, because the D-Bus property name + * ("SpecificObject"), doesn't match the object property name + * ("specific-object-path"). (The name "specific-object" is reserved for + * future use as an NMObject-valued property.) + */ + if (!g_variant_is_of_type (value, G_VARIANT_TYPE_OBJECT_PATH)) + return FALSE; + + g_free (*param); + *param = g_variant_dup_string (value, NULL); + return TRUE; +} + static void init_dbus (NMObject *object) { @@ -468,7 +486,7 @@ init_dbus (NMObject *object) { NM_ACTIVE_CONNECTION_ID, &priv->id }, { NM_ACTIVE_CONNECTION_UUID, &priv->uuid }, { NM_ACTIVE_CONNECTION_TYPE, &priv->type }, - { NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, &priv->specific_object_path }, + { "specific-object", &priv->specific_object_path, demarshal_specific_object_path }, { NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE }, { NM_ACTIVE_CONNECTION_STATE, &priv->state }, { NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default }, diff --git a/libnm/nm-object.c b/libnm/nm-object.c index 0e82861fc4..65186577eb 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -69,6 +69,7 @@ typedef struct { } PropertyInfo; static void reload_complete (NMObject *object); +static gboolean demarshal_generic (NMObject *object, GParamSpec *pspec, GVariant *value, gpointer field); typedef struct { GDBusConnection *connection; @@ -1185,7 +1186,7 @@ handle_property_changed (NMObject *self, const char *dbus_name, } pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (self)), prop_name); - if (!pspec) { + if (!pspec && pi->func == demarshal_generic) { dbgmsg ("%s: property '%s' changed but wasn't defined by object type %s.", __func__, prop_name,