gcal-calender-popover: Make sorting stable
When multiple calendars with the same name exist, their relative order in the list is random and changes e.g. when toggling the checkmark next to them. The result is glitchy behavior. Now when two calendars have the same name we do a secondary sort by their ID, resulting in a nice deterministic order.
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
9f0c20fe24
commit
8f0a860966
@@ -196,11 +196,17 @@ listbox_sort_func (GtkListBoxRow *row1,
|
||||
gpointer user_data)
|
||||
{
|
||||
GcalCalendar *calendar1, *calendar2;
|
||||
gint result;
|
||||
|
||||
calendar1 = g_object_get_data (G_OBJECT (row1), "calendar");
|
||||
calendar2 = g_object_get_data (G_OBJECT (row2), "calendar");
|
||||
|
||||
return g_ascii_strcasecmp (gcal_calendar_get_name (calendar1), gcal_calendar_get_name (calendar2));
|
||||
result = g_ascii_strcasecmp (gcal_calendar_get_name (calendar1), gcal_calendar_get_name (calendar2));
|
||||
|
||||
if (result != 0)
|
||||
return result;
|
||||
|
||||
return g_ascii_strcasecmp (gcal_calendar_get_id (calendar1), gcal_calendar_get_id (calendar2));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user