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.
This commit is contained in:
Dan Winship 2014-10-21 09:18:47 -04:00
parent 5d66f91de8
commit 1f8ec6122e
2 changed files with 21 additions and 2 deletions

View file

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

View file

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