[folks] Use TpConnection::dup_contact_by_id_async()
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Use TpConnection::dup_contact_by_id_async()
- Date: Tue, 22 May 2012 14:48:40 +0000 (UTC)
commit 5204c80c7f3556b31bd0cc4ef51e1fd6e6ec5db7
Author: Xavier Claessens <xavier claessens collabora co uk>
Date: Tue May 22 16:12:41 2012 +0200
Use TpConnection::dup_contact_by_id_async()
No need to use C wrapper for that anymore
backends/telepathy/lib/tp-lowlevel.c | 105 -------------------------
backends/telepathy/lib/tp-lowlevel.h | 15 ----
backends/telepathy/lib/tpf-persona-store.vala | 7 +-
3 files changed, 2 insertions(+), 125 deletions(-)
---
diff --git a/backends/telepathy/lib/tp-lowlevel.c b/backends/telepathy/lib/tp-lowlevel.c
index aef97e1..29c31a9 100644
--- a/backends/telepathy/lib/tp-lowlevel.c
+++ b/backends/telepathy/lib/tp-lowlevel.c
@@ -102,111 +102,6 @@ folks_tp_lowlevel_connection_get_alias_flags_finish (
}
static void
-get_contacts_by_id_cb (TpConnection *conn,
- guint n_contacts,
- TpContact * const *contacts,
- const gchar * const *requested_ids,
- GHashTable *failed_id_errors,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
-{
- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-
- if (error != NULL)
- {
- g_simple_async_result_set_from_error (simple, error);
- }
- else
- {
- GList *contact_list = NULL;
- guint i;
-
- for (i = 0; i < n_contacts; i++)
- contact_list = g_list_prepend (contact_list,
- g_object_ref (contacts[i]));
-
- g_simple_async_result_set_op_res_gpointer (simple, contact_list, NULL);
- }
-
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
-}
-
-/**
- * folks_tp_lowlevel_connection_get_contacts_by_id_async:
- * @conn: the connection to use
- * @contact_ids: (array length=contact_ids_length) (element-type utf8): the
- * contact IDs to get
- * @contact_ids_length: number of IDs in @contact_ids
- * @features: (array length=features_length): the features to use
- * @features_length: number of features in @features
- * @callback: function to call on completion
- * @user_data: user data to pass to @callback
- *
- * Get an array of #TpContact<!-- -->s for the given contact IDs.
- */
-void
-folks_tp_lowlevel_connection_get_contacts_by_id_async (
- TpConnection *conn,
- const char **contact_ids,
- guint contact_ids_length,
- guint *features,
- guint features_length,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- GSimpleAsyncResult *result;
-
- result = g_simple_async_result_new (G_OBJECT (conn), callback, user_data,
- folks_tp_lowlevel_connection_get_contacts_by_id_finish);
-
- tp_connection_get_contacts_by_id (conn,
- contact_ids_length,
- contact_ids,
- features_length,
- features,
- get_contacts_by_id_cb,
- result,
- NULL,
- G_OBJECT (conn));
-}
-
-/**
- * folks_tp_lowlevel_connection_get_contacts_by_id_finish:
- * @result: the async result
- * @error: a #GError, or %NULL
- *
- * Finish an operation started with
- * folks_tp_lowlevel_connection_get_contacts_by_id_async().
- *
- * Return value: (element-type TelepathyGLib.Contact) (transfer full): a list of
- * #TpContact<!-- -->s
- */
-GList *
-folks_tp_lowlevel_connection_get_contacts_by_id_finish (
- GAsyncResult *result,
- GError **error)
-{
- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
- TpConnection *conn;
-
- g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
-
- conn = TP_CONNECTION (g_async_result_get_source_object (result));
- g_return_val_if_fail (TP_IS_CONNECTION (conn), FALSE);
-
- if (g_simple_async_result_propagate_error (simple, error))
- return NULL;
-
- g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (conn),
- folks_tp_lowlevel_connection_get_contacts_by_id_finish), NULL);
-
- return g_simple_async_result_get_op_res_gpointer (
- G_SIMPLE_ASYNC_RESULT (result));
-}
-
-static void
set_contact_alias_cb (TpConnection *conn,
const GError *error,
gpointer user_data,
diff --git a/backends/telepathy/lib/tp-lowlevel.h b/backends/telepathy/lib/tp-lowlevel.h
index e2b4e90..334fe22 100644
--- a/backends/telepathy/lib/tp-lowlevel.h
+++ b/backends/telepathy/lib/tp-lowlevel.h
@@ -52,21 +52,6 @@ folks_tp_lowlevel_connection_get_alias_flags_finish (
GAsyncResult *result,
GError **error);
-void
-folks_tp_lowlevel_connection_get_contacts_by_id_async (
- TpConnection *conn,
- const char **contact_ids,
- guint contact_ids_length,
- guint *features,
- guint features_length,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-GList *
-folks_tp_lowlevel_connection_get_contacts_by_id_finish (
- GAsyncResult *result,
- GError **error);
-
G_END_DECLS
#endif /* FOLKS_TP_LOWLEVEL_H */
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 82d12d3..cb04c0d 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -1124,11 +1124,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private async Persona _ensure_persona_for_id (string contact_id)
throws GLib.Error
{
- GLib.List<TelepathyGLib.Contact> contacts =
- yield FolksTpLowlevel.connection_get_contacts_by_id_async (
- this._conn, {contact_id}, {});
-
- return this._ensure_persona_for_contact (contacts.data);
+ var contact = yield this._conn.dup_contact_by_id_async (contact_id, {});
+ return this._ensure_persona_for_contact (contact);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]