[empathy] empathy-roster-model-manager: added xmpp-local contacts support empathy-roster-view: removed xmpp-lo



commit f253f50e656142d48b7feecf2678fa12cc9bf2db
Author: Laurent Contzen <lcontzen gmail com>
Date:   Sun Jul 8 13:54:08 2012 +0200

    empathy-roster-model-manager: added xmpp-local contacts support empathy-roster-view: removed xmpp-local contacts support
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680302

 libempathy-gtk/empathy-roster-model-manager.c |   33 +++++++++++++++++++++++++
 libempathy-gtk/empathy-roster-view.c          |   25 -------------------
 2 files changed, 33 insertions(+), 25 deletions(-)
---
diff --git a/libempathy-gtk/empathy-roster-model-manager.c b/libempathy-gtk/empathy-roster-model-manager.c
index 7d74732..cb8a112 100644
--- a/libempathy-gtk/empathy-roster-model-manager.c
+++ b/libempathy-gtk/empathy-roster-model-manager.c
@@ -27,6 +27,10 @@
 
 #include "empathy-roster-model.h"
 
+#include <glib/gi18n-lib.h>
+
+#include <libempathy/empathy-utils.h>
+
 static void roster_model_iface_init (EmpathyRosterModelInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EmpathyRosterModelManager,
@@ -49,11 +53,34 @@ enum
 static guint signals[LAST_SIGNAL];
 */
 
+#define PEOPLE_NEARBY _("People Nearby")
+
 struct _EmpathyRosterModelManagerPriv
 {
   EmpathyIndividualManager *manager;
 };
 
+static gboolean
+is_xmpp_local_contact (FolksIndividual *individual)
+{
+  EmpathyContact *contact;
+  TpConnection *connection;
+  const gchar *protocol_name = NULL;
+  gboolean result;
+
+  contact = empathy_contact_dup_from_folks_individual (individual);
+
+  if (contact == NULL)
+    return FALSE;
+
+  connection = empathy_contact_get_connection (contact);
+  protocol_name = tp_connection_get_protocol_name (connection);
+  result = !tp_strdiff (protocol_name, "local-xmpp");
+  g_object_unref (contact);
+
+  return result;
+}
+
 static void
 members_changed_cb (EmpathyIndividualManager *manager,
     const gchar *message,
@@ -223,6 +250,12 @@ empathy_roster_model_manager_get_groups_for_individual (EmpathyRosterModel *mode
   GList *groups_list = NULL;
   GeeSet *groups_set;
 
+  if (is_xmpp_local_contact (individual))
+    {
+      groups_list = g_list_prepend (groups_list, PEOPLE_NEARBY);
+      return groups_list;
+    }
+
   groups_set = folks_group_details_get_groups (FOLKS_GROUP_DETAILS (individual));
   if (gee_collection_get_size (GEE_COLLECTION (groups_set)) > 0)
     {
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index 42b8afe..3fc664c 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -173,27 +173,6 @@ roster_contact_changed_cb (GtkWidget *child,
   egg_list_box_child_changed (EGG_LIST_BOX (self), child);
 }
 
-static gboolean
-is_xmpp_local_contact (FolksIndividual *individual)
-{
-  EmpathyContact *contact;
-  TpConnection *connection;
-  const gchar *protocol_name = NULL;
-  gboolean result;
-
-  contact = empathy_contact_dup_from_folks_individual (individual);
-
-  if (contact == NULL)
-    return FALSE;
-
-  connection = empathy_contact_get_connection (contact);
-  protocol_name = tp_connection_get_protocol_name (connection);
-  result = !tp_strdiff (protocol_name, "local-xmpp");
-  g_object_unref (contact);
-
-  return result;
-}
-
 static GtkWidget *
 add_roster_contact (EmpathyRosterView *self,
     FolksIndividual *individual,
@@ -332,10 +311,6 @@ individual_added (EmpathyRosterView *self,
     {
       add_to_group (self, individual, NO_GROUP);
     }
-  else if (is_xmpp_local_contact (individual))
-    {
-      add_to_group (self, individual, EMPATHY_ROSTER_VIEW_GROUP_PEOPLE_NEARBY);
-    }
   else
     {
       GList *groups, *l;



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