aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-contact-list-store.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-25 00:33:33 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-25 00:33:33 +0800
commita687b7c513d3bb967781f17dc5d247161bcffd8c (patch)
tree116b335b3c4fe96ddd09c64e9aa382516168af03 /libempathy-gtk/empathy-contact-list-store.c
parentff21a5f6bfedae8ca32ac871ccad5c106e831b28 (diff)
downloadgsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.gz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.bz2
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.lz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.xz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.zst
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.zip
Remove EmpathyPresence object and have "presence" and "presence-message" properties directly in EmpathyContact
svn path=/trunk/; revision=601
Diffstat (limited to 'libempathy-gtk/empathy-contact-list-store.c')
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index bd5e9bc5e..7cabea78f 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -820,6 +820,9 @@ contact_list_store_members_changed_cb (EmpathyContactList *list_iface,
g_signal_connect (contact, "notify::presence",
G_CALLBACK (contact_list_store_contact_updated_cb),
store);
+ g_signal_connect (contact, "notify::presence-message",
+ G_CALLBACK (contact_list_store_contact_updated_cb),
+ store);
g_signal_connect (contact, "notify::name",
G_CALLBACK (contact_list_store_contact_updated_cb),
store);
@@ -1351,8 +1354,8 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
gint ret_val = 0;
gchar *name_a, *name_b;
gboolean is_separator_a, is_separator_b;
- EmpathyContact *contact_a, *contact_b;
- EmpathyPresence *presence_a, *presence_b;
+ EmpathyContact *contact_a, *contact_b;
+ guint presence_a, presence_b;
gtk_tree_model_get (model, iter_a,
EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name_a,
@@ -1389,32 +1392,17 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
* the presences.
*/
presence_a = empathy_contact_get_presence (EMPATHY_CONTACT (contact_a));
+ presence_a = contact_list_store_ordered_presence (presence_a);
presence_b = empathy_contact_get_presence (EMPATHY_CONTACT (contact_b));
+ presence_b = contact_list_store_ordered_presence (presence_b);
- if (!presence_a && presence_b) {
- ret_val = 1;
- } else if (presence_a && !presence_b) {
+ if (presence_a < presence_b) {
ret_val = -1;
- } else if (!presence_a && !presence_b) {
- /* Both offline, sort by name */
- ret_val = g_utf8_collate (name_a, name_b);
+ } else if (presence_a > presence_b) {
+ ret_val = 1;
} 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) {
- ret_val = 1;
- } else {
- /* Fallback: compare by name */
- ret_val = g_utf8_collate (name_a, name_b);
- }
+ /* Fallback: compare by name */
+ ret_val = g_utf8_collate (name_a, name_b);
}
free_and_out: