diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-07-11 16:14:34 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-09-06 12:53:15 +0200 |
commit | e1bd85725106ee84a996823d8d5459b4e46eff26 (patch) | |
tree | 8652c50b59a08ef5c71a8b3ad18f649c7778bcc0 | |
parent | 3bc93f792bc6cb2b8291da74717076bcdf5245d2 (diff) |
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
-rw-r--r-- | examples/cm/call/conn.c | 3 | ||||
-rw-r--r-- | examples/cm/contactlist/conn.c | 3 | ||||
-rw-r--r-- | telepathy-glib/presence-mixin.c | 41 | ||||
-rw-r--r-- | telepathy-glib/presence-mixin.h | 2 | ||||
-rw-r--r-- | tests/lib/contacts-conn.c | 3 |
5 files changed, 19 insertions, 33 deletions
diff --git a/examples/cm/call/conn.c b/examples/cm/call/conn.c index bc35a853d..87c548537 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 651d796ac..b233b2526 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 e4819038d..f5776e5eb 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 @@ -160,8 +159,7 @@ * callback is responsible for ensuring that this does any cleanup that * may be necessary. * - * Returns: (transfer full): The contact presence on success, %NULL with - * error set on error + * Returns: (transfer full): The contact presence, must not be %NULL. */ /** @@ -851,19 +849,6 @@ construct_presence_value_array (TpPresenceStatus *status, return presence; } -static void -construct_presence_hash_foreach ( - GHashTable *presence_hash, - const TpPresenceStatusSpec *supported_statuses, - TpHandle handle, - TpPresenceStatus *status) -{ - GValueArray *presence; - - presence = construct_presence_value_array (status, supported_statuses); - g_hash_table_insert (presence_hash, GUINT_TO_POINTER (handle), presence); -} - static GHashTable * construct_presence_hash (const TpPresenceStatusSpec *supported_statuses, GHashTable *contact_statuses) @@ -877,8 +862,12 @@ construct_presence_hash (const TpPresenceStatusSpec *supported_statuses, g_hash_table_iter_init (&iter, contact_statuses); while (g_hash_table_iter_next (&iter, &key, &value)) - construct_presence_hash_foreach (presence_hash, supported_statuses, - GPOINTER_TO_UINT (key), value); + { + GValueArray *presence; + + presence = construct_presence_value_array (value, supported_statuses); + g_hash_table_insert (presence_hash, key, presence); + } return presence_hash; } @@ -928,12 +917,15 @@ tp_presence_mixin_get_presences ( return; } - contact_statuses = mixin_cls->get_contact_statuses (obj, contacts, &error); + contact_statuses = mixin_cls->get_contact_statuses (obj, contacts); if (!contact_statuses) { - dbus_g_method_return_error (context, error); - g_error_free (error); + GError e = { TP_ERROR, TP_ERROR_CONFUSED, + "TpPresenceMixin::get_contact_statuses returned NULL - Broken CM" }; + + g_warning ("%s", e.message); + dbus_g_method_return_error (context, &e); return; } @@ -977,14 +969,11 @@ 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; - - contact_statuses = mixin_cls->get_contact_statuses (obj, contacts, &error); + contact_statuses = mixin_cls->get_contact_statuses (obj, contacts); if (contact_statuses == NULL) { - DEBUG ("get_contact_statuses failed: %s", error->message); - g_error_free (error); + g_warning ("get_contact_statuses returned NULL"); } else { diff --git a/telepathy-glib/presence-mixin.h b/telepathy-glib/presence-mixin.h index bda9bc104..f94bf6579 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 49b8c47d7..cda0020ac 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, |