[glib/gdbus-codegen] GDBusObjectManagerServer: make export() return whether the object was removed
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/gdbus-codegen] GDBusObjectManagerServer: make export() return whether the object was removed
- Date: Wed, 20 Apr 2011 19:35:03 +0000 (UTC)
commit f0eeadf30672ba60e3aae8964c1c0d3ef9fef733
Author: David Zeuthen <davidz redhat com>
Date: Wed Apr 20 11:54:24 2011 -0400
GDBusObjectManagerServer: make export() return whether the object was removed
This is useful in conjunction with g_warn_if_fail().
Signed-off-by: David Zeuthen <davidz redhat com>
gio/gdbusobjectmanagerserver.c | 18 +++++++++++++-----
gio/gdbusobjectmanagerserver.h | 2 +-
2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c
index c31b2ba..1f348f2 100644
--- a/gio/gdbusobjectmanagerserver.c
+++ b/gio/gdbusobjectmanagerserver.c
@@ -531,17 +531,22 @@ g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager,
* Note that @object_path must be in the hierarchy rooted by the
* object path for @manager.
*
+ * Returns: %TRUE if object at @object_path was removed, %FALSE otherwise.
+ *
* Since: 2.30
*/
-void
+gboolean
g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager,
- const gchar *object_path)
+ const gchar *object_path)
{
RegistrationData *data;
+ gboolean ret;
- g_return_if_fail (G_IS_DBUS_OBJECT_MANAGER_SERVER (manager));
- g_return_if_fail (g_variant_is_object_path (object_path));
- g_return_if_fail (g_str_has_prefix (object_path, manager->priv->object_path_ending_in_slash));
+ g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_SERVER (manager), FALSE);
+ g_return_val_if_fail (g_variant_is_object_path (object_path), FALSE);
+ g_return_val_if_fail (g_str_has_prefix (object_path, manager->priv->object_path_ending_in_slash), FALSE);
+
+ ret = FALSE;
data = g_hash_table_lookup (manager->priv->map_object_path_to_data, object_path);
if (data != NULL)
@@ -560,7 +565,10 @@ g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager,
g_ptr_array_unref (interface_names);
g_hash_table_remove (manager->priv->map_object_path_to_data, object_path);
+ ret = TRUE;
}
+
+ return ret;
}
diff --git a/gio/gdbusobjectmanagerserver.h b/gio/gdbusobjectmanagerserver.h
index 67eb626..5d6d11a 100644
--- a/gio/gdbusobjectmanagerserver.h
+++ b/gio/gdbusobjectmanagerserver.h
@@ -76,7 +76,7 @@ void g_dbus_object_manager_server_export (GDBu
GDBusObjectSkeleton *object);
void g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager,
GDBusObjectSkeleton *object);
-void g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager,
+gboolean g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager,
const gchar *object_path);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]