]> git.0d.be Git - empathy.git/commitdiff
empathy-roster-model-manager: added xmpp-local contacts support empathy-roster-view...
authorLaurent Contzen <lcontzen@gmail.com>
Sun, 8 Jul 2012 11:54:08 +0000 (13:54 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 23 Jul 2012 14:11:28 +0000 (16:11 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=680302

libempathy-gtk/empathy-roster-model-manager.c
libempathy-gtk/empathy-roster-view.c

index 7d747326aaa64c7e8477f23872403d8d3f36069e..cb8a112f93ef925e3da7f00273392dd28df10a95 100644 (file)
 
 #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)
     {
index 42b8afe6ab94f80913330a22ad255b3382a9cadd..3fc664c5f07155909268b19b25909252ced3e3ca 100644 (file)
@@ -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;