g_signal_connect (contact, "notify::alias",
G_CALLBACK (roster_contact_changed_cb), self);
+ /* Need to resort if most recent event changed */
+ g_signal_connect (contact, "notify::most-recent-event",
+ G_CALLBACK (roster_contact_changed_cb), self);
+
gtk_widget_show (contact);
gtk_container_add (GTK_CONTAINER (self), contact);
}
static void
-group_expanded_cb (EmpathyRosterGroup *group,
+group_expanded_cb (GtkWidget *expander,
GParamSpec *spec,
- EmpathyRosterView *self)
+ EmpathyRosterGroup *group)
{
GList *widgets, *l;
gtk_expander_set_expanded (EMPATHY_ROSTER_GROUP (roster_group)->expander,
empathy_contact_group_get_expanded (group));
- g_signal_connect (roster_group, "notify::expanded",
- G_CALLBACK (group_expanded_cb), self);
+ g_signal_connect (EMPATHY_ROSTER_GROUP (roster_group)->expander,
+ "notify::expanded", G_CALLBACK (group_expanded_cb), roster_group);
gtk_widget_show (roster_group);
gtk_container_add (GTK_CONTAINER (self), roster_group);
return FALSE;
}
+static gint
+compare_roster_contacts_by_conversation_time (EmpathyRosterContact *a,
+ EmpathyRosterContact *b)
+{
+ gint64 ts_a, ts_b;
+
+ ts_a = empathy_roster_contact_get_most_recent_timestamp (a);
+ ts_b = empathy_roster_contact_get_most_recent_timestamp (b);
+
+ if (ts_a == ts_b) return 0;
+ if (ts_a > ts_b) return -1;
+ return 1;
+}
+
static gint
compare_roster_contacts_by_alias (EmpathyRosterContact *a,
EmpathyRosterContact *b)
if (top_a == top_b)
/* Both contacts are in the top of the roster (or not). Sort them
* alphabetically */
- return compare_roster_contacts_by_alias (a, b);
+ return compare_roster_contacts_by_conversation_time (a, b);
else if (top_a)
return -1;
else
if (!tp_strdiff (group_a, group_b))
/* Same group, compare the contacts */
- return compare_roster_contacts_by_alias (a, b);
+ return compare_roster_contacts_by_conversation_time (a, b);
/* Sort by group */
return compare_group_names (group_a, group_b);
if (before == NULL)
{
/* No separator before the first row */
- gtk_list_box_row_set_header(row, NULL);
+ gtk_list_box_row_set_header (row, NULL);
return;
}
- if (gtk_list_box_row_get_header(row) != NULL)
+ if (gtk_list_box_row_get_header (row) != NULL)
return;
gtk_list_box_row_set_header (row,