From f2337f7207ef2a20ce5f6b7128ecb636fe6eec5f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 11 Jul 2012 16:14:34 +0200 Subject: [PATCH] TpPresenceMixinGetContactStatusesFunc: remove the GError argument It is useless since handles are already guaranteed to be valid. https://bugs.freedesktop.org/show_bug.cgi?id=21796 --- examples/cm/call/conn.c | 3 +-- examples/cm/contactlist/conn.c | 3 +-- telepathy-glib/presence-mixin.c | 48 ++++++++++++--------------------------- telepathy-glib/presence-mixin.h | 2 +- tests/lib/contacts-conn.c | 3 +-- 5 files changed, 19 insertions(+), 40 deletions(-) diff --git a/examples/cm/call/conn.c b/examples/cm/call/conn.c index bc35a85..87c5485 100644 --- a/examples/cm/call/conn.c +++ b/examples/cm/call/conn.c @@ -242,8 +242,7 @@ status_available (GObject *object, static GHashTable * get_contact_statuses (GObject *object, - const GArray *contacts, - GError **error) + const GArray *contacts) { ExampleCallConnection *self = EXAMPLE_CALL_CONNECTION (object); diff --git a/examples/cm/contactlist/conn.c b/examples/cm/contactlist/conn.c index 651d796..b233b25 100644 --- a/examples/cm/contactlist/conn.c +++ b/examples/cm/contactlist/conn.c @@ -313,8 +313,7 @@ status_available (GObject *object, static GHashTable * get_contact_statuses (GObject *object, - const GArray *contacts, - GError **error) + const GArray *contacts) { ExampleContactListConnection *self = EXAMPLE_CONTACT_LIST_CONNECTION (object); diff --git a/telepathy-glib/presence-mixin.c b/telepathy-glib/presence-mixin.c index e481903..593a85e 100644 --- a/telepathy-glib/presence-mixin.c +++ b/telepathy-glib/presence-mixin.c @@ -150,7 +150,6 @@ * TpPresenceMixinGetContactStatusesFunc: * @obj: An object with this mixin. * @contacts: An array of #TpHandle for the contacts to get presence status for - * @error: Used to return a Telepathy D-Bus error if %NULL is returned * * Signature of the callback used to get the stored presence status of * contacts. The returned hash table should have contact handles mapped to @@ -928,14 +927,7 @@ tp_presence_mixin_get_presences ( return; } - contact_statuses = mixin_cls->get_contact_statuses (obj, contacts, &error); - - if (!contact_statuses) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } + contact_statuses = mixin_cls->get_contact_statuses (obj, contacts); presence_hash = construct_presence_hash (mixin_cls->statuses, contact_statuses); @@ -977,35 +969,25 @@ tp_presence_mixin_fill_contact_attributes (GObject *obj, TpPresenceMixinClass *mixin_cls = TP_PRESENCE_MIXIN_CLASS (G_OBJECT_GET_CLASS (obj)); GHashTable *contact_statuses; - GError *error = NULL; + GHashTableIter iter; + gpointer key, value; - contact_statuses = mixin_cls->get_contact_statuses (obj, contacts, &error); + contact_statuses = mixin_cls->get_contact_statuses (obj, contacts); - if (contact_statuses == NULL) + g_hash_table_iter_init (&iter, contact_statuses); + while (g_hash_table_iter_next (&iter, &key, &value)) { - DEBUG ("get_contact_statuses failed: %s", error->message); - g_error_free (error); + TpHandle handle = GPOINTER_TO_UINT (key); + TpPresenceStatus *status = value; + GValueArray *presence = construct_presence_value_array ( + status, mixin_cls->statuses); + + tp_contacts_mixin_set_contact_attribute (attributes_hash, handle, + TP_TOKEN_CONNECTION_INTERFACE_PRESENCE_PRESENCE, + tp_g_value_slice_new_take_boxed (G_TYPE_VALUE_ARRAY, presence)); } - else - { - GHashTableIter iter; - gpointer key, value; - g_hash_table_iter_init (&iter, contact_statuses); - while (g_hash_table_iter_next (&iter, &key, &value)) - { - TpHandle handle = GPOINTER_TO_UINT (key); - TpPresenceStatus *status = value; - GValueArray *presence = construct_presence_value_array ( - status, mixin_cls->statuses); - - tp_contacts_mixin_set_contact_attribute (attributes_hash, handle, - TP_TOKEN_CONNECTION_INTERFACE_PRESENCE_PRESENCE, - tp_g_value_slice_new_take_boxed (G_TYPE_VALUE_ARRAY, presence)); - } - - g_hash_table_unref (contact_statuses); - } + g_hash_table_unref (contact_statuses); } /** diff --git a/telepathy-glib/presence-mixin.h b/telepathy-glib/presence-mixin.h index bda9bc1..f94bf65 100644 --- a/telepathy-glib/presence-mixin.h +++ b/telepathy-glib/presence-mixin.h @@ -74,7 +74,7 @@ typedef gboolean (*TpPresenceMixinStatusAvailableFunc) (GObject *obj, guint which); typedef GHashTable *(*TpPresenceMixinGetContactStatusesFunc) (GObject *obj, - const GArray *contacts, GError **error); + const GArray *contacts); typedef gboolean (*TpPresenceMixinSetOwnStatusFunc) (GObject *obj, const TpPresenceStatus *status, GError **error); diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c index 49b8c47..cda0020 100644 --- a/tests/lib/contacts-conn.c +++ b/tests/lib/contacts-conn.c @@ -460,8 +460,7 @@ my_status_available (GObject *object, static GHashTable * my_get_contact_statuses (GObject *object, - const GArray *contacts, - GError **error) + const GArray *contacts) { TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (object); GHashTable *result = g_hash_table_new_full (g_direct_hash, g_direct_equal, -- 1.7.9.5