aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-18 00:19:08 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-18 00:19:08 +0800
commit09328ae39c6c1bd22282783c459d7f851086d9fb (patch)
treeb040741e85a30e2c3e747eb4a9512be9fb443bb9 /libempathy-gtk
parent57632da0b1bc6d3128dcd1af371996bdd888cec8 (diff)
downloadgsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.tar
gsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.tar.gz
gsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.tar.bz2
gsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.tar.lz
gsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.tar.xz
gsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.tar.zst
gsoc2013-empathy-09328ae39c6c1bd22282783c459d7f851086d9fb.zip
Fix state order to have offline contacts last. Fixes bug #509906.
svn path=/trunk/; revision=574
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index 820db5b10..3536f6bbe 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -1213,6 +1213,28 @@ contact_list_store_get_group (EmpathyContactListStore *store,
}
}
+static guint
+contact_list_store_ordered_presence (McPresence state)
+{
+ switch (state) {
+ case MC_PRESENCE_UNSET:
+ case MC_PRESENCE_OFFLINE:
+ return 5;
+ case MC_PRESENCE_AVAILABLE:
+ return 0;
+ case MC_PRESENCE_AWAY:
+ return 2;
+ case MC_PRESENCE_EXTENDED_AWAY:
+ return 3;
+ case MC_PRESENCE_HIDDEN:
+ return 4;
+ case MC_PRESENCE_DO_NOT_DISTURB:
+ return 1;
+ default:
+ g_return_val_if_reached (6);
+ }
+}
+
static gint
contact_list_store_state_sort_func (GtkTreeModel *model,
GtkTreeIter *iter_a,
@@ -1224,7 +1246,6 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
gboolean is_separator_a, is_separator_b;
EmpathyContact *contact_a, *contact_b;
EmpathyPresence *presence_a, *presence_b;
- McPresence state_a, state_b;
gtk_tree_model_get (model, iter_a,
EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name_a,
@@ -1271,9 +1292,14 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
/* Both offline, sort by name */
ret_val = g_utf8_collate (name_a, name_b);
} else {
+ guint state_a, state_b;
+
state_a = empathy_presence_get_state (presence_a);
state_b = empathy_presence_get_state (presence_b);
+ state_a = contact_list_store_ordered_presence (state_a);
+ state_b = contact_list_store_ordered_presence (state_b);
+
if (state_a < state_b) {
ret_val = -1;
} else if (state_a > state_b) {