[RFC 1/2] gdbus: Add g_dbus_flush_properties()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In some situations, it may be useful to be sure that all the
properties updates for a object are sent.
---
 gdbus/gdbus.h  |  2 ++
 gdbus/object.c | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 8b13393..ed280e4 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -299,6 +299,8 @@ void g_dbus_emit_property_changed(DBusConnection *connection,
 gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
 				const char *interface, DBusMessageIter *iter);
 
+gboolean g_dbus_flush_properties(DBusConnection *connection, const char *path);
+
 gboolean g_dbus_attach_object_manager(DBusConnection *connection);
 gboolean g_dbus_detach_object_manager(DBusConnection *connection);
 
diff --git a/gdbus/object.c b/gdbus/object.c
index 2f8ef45..14b6803 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1751,6 +1751,25 @@ gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
 	return TRUE;
 }
 
+gboolean g_dbus_flush_properties(DBusConnection *connection, const char *path)
+{
+	struct generic_data *data;
+
+	if (path == NULL)
+		return FALSE;
+
+	if (!dbus_connection_get_object_path_data(connection, path,
+					(void **) &data) || data == NULL)
+		return FALSE;
+
+	if (data->process_id)
+		g_source_remove(data->process_id);
+
+	process_changes(data);
+
+	return TRUE;
+}
+
 gboolean g_dbus_attach_object_manager(DBusConnection *connection)
 {
 	struct generic_data *data;
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux