From a687b7c513d3bb967781f17dc5d247161bcffd8c Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 24 Jan 2008 16:33:33 +0000 Subject: Remove EmpathyPresence object and have "presence" and "presence-message" properties directly in EmpathyContact svn path=/trunk/; revision=601 --- libempathy-gtk/empathy-contact-list-store.c | 36 ++++++++++------------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'libempathy-gtk/empathy-contact-list-store.c') 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: -- cgit v1.2.3