gdbus: Add g_dbus_get_properties function

This function can be used to construct custom D-Bus messages containing
the properties for a specific interface on a given path.
This commit is contained in:
Johan Hedberg 2012-10-12 10:55:37 +02:00 committed by Marcel Holtmann
parent 031189ffea
commit f9f49f5d42
2 changed files with 21 additions and 0 deletions

View File

@ -257,6 +257,8 @@ void g_dbus_pending_property_error(DBusConnection *connection,
void g_dbus_emit_property_changed(DBusConnection *connection,
const char *path, const char *interface,
const char *name);
gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
const char *interface, DBusMessageIter *iter);
#ifdef __cplusplus
}

View File

@ -1615,3 +1615,22 @@ void g_dbus_emit_property_changed(DBusConnection *connection,
return;
}
}
gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
const char *interface, DBusMessageIter *iter)
{
struct generic_data *data;
struct interface_data *iface;
if (!dbus_connection_get_object_path_data(connection, path,
(void **) &data) || data == NULL)
return FALSE;
iface = find_interface(data->interfaces, interface);
if (iface == NULL)
return FALSE;
append_properties(iface, iter);
return TRUE;
}