summaryrefslogtreecommitdiffstats
path: root/gdbus
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-10-12 10:55:37 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-11-26 12:58:00 +0100
commitf9f49f5d420a094b5da4bebbdbc18e98a03789d3 (patch)
tree5e9a43b80b367bb7d26b04e93f1770079e72a3a5 /gdbus
parent031189ffea24eac1a9e335ab98d4a12d1e536a89 (diff)
downloadofono-f9f49f5d420a094b5da4bebbdbc18e98a03789d3.tar.bz2
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.
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/gdbus.h2
-rw-r--r--gdbus/object.c19
2 files changed, 21 insertions, 0 deletions
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index a96c97f7..82519470 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -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
}
diff --git a/gdbus/object.c b/gdbus/object.c
index 7acb5635..aa38c07c 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -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;
+}