[empathy] Use Folks to check if a TpConnection can alias and group personas.



commit a4cd05f5f8aeb4067652e4806f0e125b221d8ad1
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Tue Oct 12 22:45:53 2010 -0700

    Use Folks to check if a TpConnection can alias and group personas.
    
    Helps bgo#625969.

 libempathy-gtk/empathy-individual-menu.c |    7 ++-----
 libempathy/empathy-utils.c               |   28 ++++++++++++++++++++++++++++
 libempathy/empathy-utils.h               |    2 ++
 3 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index b1237cf..e3159b4 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 e6dc343..6bbd53f 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 7b9f897..3c89962 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]