diff options
author | Laurent Contzen <lcontzen@gmail.com> | 2012-07-08 19:54:08 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-23 22:11:28 +0800 |
commit | f253f50e656142d48b7feecf2678fa12cc9bf2db (patch) | |
tree | 172899227f9af1cc8aeb06aeeb5995c20f36d61e /libempathy-gtk | |
parent | f7200ee068d8f959608521737872254f20c5ee55 (diff) | |
download | gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.tar gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.tar.gz gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.tar.bz2 gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.tar.lz gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.tar.xz gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.tar.zst gsoc2013-empathy-f253f50e656142d48b7feecf2678fa12cc9bf2db.zip |
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
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-roster-model-manager.c | 33 | ||||
-rw-r--r-- | 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 7d747326a..cb8a112f9 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 42b8afe6a..3fc664c5f 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; |