diff options
author | Laurent Contzen <lcontzen@gmail.com> | 2012-06-19 22:20:29 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-20 19:50:00 +0800 |
commit | d3d7a1fe65c052e9187b4603171198aa373f4d0b (patch) | |
tree | 23ae6f95697b862704d2db55ccaa41896e84312d | |
parent | 333e6efdcfc018ee6db2db27e7c05ede30974a11 (diff) | |
download | gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.tar gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.tar.gz gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.tar.bz2 gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.tar.lz gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.tar.xz gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.tar.zst gsoc2013-empathy-d3d7a1fe65c052e9187b4603171198aa373f4d0b.zip |
Create and use People Nearby group
https://bugzilla.gnome.org/show_bug.cgi?id=678156
-rw-r--r-- | libempathy-gtk/empathy-roster-view.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index 0decfd14f..111b643b6 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -8,6 +8,8 @@ #include <libempathy-gtk/empathy-roster-group.h> #include <libempathy-gtk/empathy-ui-utils.h> +#include <libempathy/empathy-utils.h> + G_DEFINE_TYPE (EmpathyRosterView, empathy_roster_view, EGG_TYPE_LIST_BOX) /* Flashing delay for icons (milliseconds). */ @@ -36,6 +38,7 @@ static guint signals[LAST_SIGNAL]; #define NO_GROUP "X-no-group" #define UNGROUPED _("Ungrouped") #define TOP_GROUP _("Top Contacts") +#define PEOPLE_NEARBY _("People Nearby") struct _EmpathyRosterViewPriv { @@ -163,6 +166,27 @@ 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, @@ -221,6 +245,8 @@ ensure_roster_group (EmpathyRosterView *self, if (!tp_strdiff (group, TOP_GROUP)) roster_group = empathy_roster_group_new (group, "emblem-favorite-symbolic"); + else if (!tp_strdiff (group, PEOPLE_NEARBY)) + roster_group = empathy_roster_group_new (group, "im-local-xmpp"); else roster_group = empathy_roster_group_new (group, NULL); @@ -299,6 +325,10 @@ individual_added (EmpathyRosterView *self, { add_to_group (self, individual, NO_GROUP); } + else if (is_xmpp_local_contact (individual)) + { + add_to_group (self, individual, PEOPLE_NEARBY); + } else { GeeSet *groups; |