aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2010-10-13 13:45:53 +0800
committerTravis Reitter <travis.reitter@collabora.co.uk>2010-10-16 05:14:45 +0800
commita4cd05f5f8aeb4067652e4806f0e125b221d8ad1 (patch)
tree777a41c69dff847e47ad3d29797fa9c50b1825e9
parent4f39984ad575e8ee643e3cf52ad519386c23009e (diff)
downloadgsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.tar
gsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.tar.gz
gsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.tar.bz2
gsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.tar.lz
gsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.tar.xz
gsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.tar.zst
gsoc2013-empathy-a4cd05f5f8aeb4067652e4806f0e125b221d8ad1.zip
Use Folks to check if a TpConnection can alias and group personas.
Helps bgo#625969.
-rw-r--r--libempathy-gtk/empathy-individual-menu.c7
-rw-r--r--libempathy/empathy-utils.c28
-rw-r--r--libempathy/empathy-utils.h2
3 files changed, 32 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index b1237cf8b..e3159b401 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -822,15 +822,12 @@ empathy_individual_edit_menu_item_new (FolksIndividual *individual)
if (empathy_individual_manager_initialized ())
{
TpConnection *connection;
- EmpathyIndividualManagerFlags flags;
manager = empathy_individual_manager_dup_singleton ();
connection = empathy_contact_get_connection (contact);
- flags = empathy_individual_manager_get_flags_for_connection (
- manager, connection);
- enable = (flags & EMPATHY_INDIVIDUAL_MANAGER_CAN_ALIAS ||
- flags & EMPATHY_INDIVIDUAL_MANAGER_CAN_GROUP);
+ enable = (empathy_connection_can_alias_personas (connection) &&
+ empathy_connection_can_group_personas (connection));
g_object_unref (manager);
}
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index e6dc34303..6bbd53f86 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -822,6 +822,34 @@ empathy_connection_can_add_personas (TpConnection *connection)
FOLKS_MAYBE_BOOL_TRUE);
}
+gboolean
+empathy_connection_can_alias_personas (TpConnection *connection)
+{
+ FolksPersonaStore *persona_store;
+
+ g_return_val_if_fail (TP_IS_CONNECTION (connection), FALSE);
+
+ persona_store = FOLKS_PERSONA_STORE (
+ empathy_get_persona_store_for_connection (connection));
+
+ return (folks_persona_store_get_can_alias_personas (persona_store) ==
+ FOLKS_MAYBE_BOOL_TRUE);
+}
+
+gboolean
+empathy_connection_can_group_personas (TpConnection *connection)
+{
+ FolksPersonaStore *persona_store;
+
+ g_return_val_if_fail (TP_IS_CONNECTION (connection), FALSE);
+
+ persona_store = FOLKS_PERSONA_STORE (
+ empathy_get_persona_store_for_connection (connection));
+
+ return (folks_persona_store_get_can_group_personas (persona_store) ==
+ FOLKS_MAYBE_BOOL_TRUE);
+}
+
gchar *
empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert)
{
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 7b9f897fb..3c89962c1 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -102,6 +102,8 @@ EmpathyContact * empathy_contact_dup_from_folks_individual (FolksIndividual *ind
TpChannelGroupChangeReason tp_channel_group_change_reason_from_folks_groups_change_reason (FolksGroupableChangeReason reason);
TpfPersonaStore * empathy_get_persona_store_for_connection (TpConnection *connection);
gboolean empathy_connection_can_add_personas (TpConnection *connection);
+gboolean empathy_connection_can_alias_personas (TpConnection *connection);
+gboolean empathy_connection_can_group_personas (TpConnection *connection);
gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert);