[folks] Telepathy: use can_set_contact_alias() instead of fetching flags
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Telepathy: use can_set_contact_alias() instead of fetching flags
- Date: Tue, 1 Oct 2013 15:23:46 +0000 (UTC)
commit 64bca7fa674595f531d77aaf8c31253dc944413c
Author: Xavier Claessens <xavier claessens collabora co uk>
Date: Fri Sep 27 16:21:48 2013 -0400
Telepathy: use can_set_contact_alias() instead of fetching flags
backends/telepathy/lib/tp-lowlevel.c | 71 -------------------------
backends/telepathy/lib/tp-lowlevel.h | 11 ----
backends/telepathy/lib/tpf-persona-store.vala | 31 +----------
3 files changed, 2 insertions(+), 111 deletions(-)
---
diff --git a/backends/telepathy/lib/tp-lowlevel.c b/backends/telepathy/lib/tp-lowlevel.c
index 29c31a9..da5052c 100644
--- a/backends/telepathy/lib/tp-lowlevel.c
+++ b/backends/telepathy/lib/tp-lowlevel.c
@@ -31,77 +31,6 @@
#include "tp-lowlevel.h"
static void
-connection_get_alias_flags_cb (TpConnection *conn,
- guint flags,
- 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
- {
- g_simple_async_result_set_op_res_gpointer (simple,
- GUINT_TO_POINTER (flags), NULL);
- }
-
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
-}
-
-void
-folks_tp_lowlevel_connection_get_alias_flags_async (
- TpConnection *conn,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- GSimpleAsyncResult *result;
-
- result = g_simple_async_result_new (G_OBJECT (conn), callback, user_data,
- folks_tp_lowlevel_connection_get_alias_flags_finish);
-
- tp_cli_connection_interface_aliasing_call_get_alias_flags (conn, -1,
- connection_get_alias_flags_cb, result, NULL, G_OBJECT (conn));
-}
-
-/**
- * folks_tp_lowlevel_connection_get_alias_flags_finish:
- * @result: a #GAsyncResult
- * @error: return location for a #GError, or %NULL
- *
- * Determine the alias-related capabilities of the #TpConnection.
- *
- * Returns: the #TpConnectionAliasFlags
- */
-TpConnectionAliasFlags
-folks_tp_lowlevel_connection_get_alias_flags_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 0;
-
- g_return_val_if_fail (g_simple_async_result_is_valid (result,
- G_OBJECT (conn), folks_tp_lowlevel_connection_get_alias_flags_finish),
- 0);
-
- return (TpConnectionAliasFlags) (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 334fe22..0bc15e6 100644
--- a/backends/telepathy/lib/tp-lowlevel.h
+++ b/backends/telepathy/lib/tp-lowlevel.h
@@ -41,17 +41,6 @@ folks_tp_lowlevel_connection_set_contact_alias_finish (
GAsyncResult *result,
GError **error);
-void
-folks_tp_lowlevel_connection_get_alias_flags_async (
- TpConnection *conn,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-TpConnectionAliasFlags
-folks_tp_lowlevel_connection_get_alias_flags_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 2514a68..b5b0ac6 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -758,6 +758,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
TelepathyGLib.Connection.get_feature_quark_contact_groups (),
TelepathyGLib.Connection.get_feature_quark_contact_info (),
TelepathyGLib.Connection.get_feature_quark_connected (),
+ TelepathyGLib.Connection.get_feature_quark_aliasing (),
0
});
@@ -784,34 +785,6 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._conn.notify["contact-list-state"].connect (
this._contact_list_state_changed_cb);
- /* FIXME: TpConnection still does not have high-level API for this.
- * See fd.o#14540 */
- /* We have to do this before emitting the self persona so that code which
- * checks the self persona's writeable fields gets correct values. */
- var flags = 0;
-
- try
- {
- flags = yield FolksTpLowlevel.connection_get_alias_flags_async (
- this._conn);
-
- /* It's possible for the connection to have disconnected while in
- * the async function call. (See bgo#683093.) If so, bail. */
- if (this._conn == null)
- {
- return;
- }
- }
- catch (GLib.Error e)
- {
- GLib.warning (
- /* Translators: the first parameter is the display name for
- * the Telepathy account, and the second is an error
- * message. */
- _("Failed to determine whether we can set aliases on Telepathy account '%s': %s"),
- this.display_name, e.message);
- }
-
/* Emit all the notifications after the 'yield' just in case the
* connection disappears during it. This makes cleaning up easier. */
this.freeze_notify ();
@@ -846,7 +819,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var new_can_alias = MaybeBool.FALSE;
- if ((flags & ConnectionAliasFlags.CONNECTION_ALIAS_FLAG_USER_SET) > 0)
+ if (this._conn.can_set_contact_alias ())
{
new_can_alias = MaybeBool.TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]