diff options
author | rbuj <[email protected]> | 2020-07-23 10:27:50 +0200 |
---|---|---|
committer | Luke from DC <[email protected]> | 2020-08-01 03:31:12 +0000 |
commit | 1d14ccccc6a44b348a0e166a947388d41a411e64 (patch) | |
tree | fc9771d65bf8344915c79d7ed9f9d3e3fb1d9a28 /applets/clock/clock.c | |
parent | 0b71fb2f2cbf4eb0eea9ea9ab0682eef2342a500 (diff) | |
download | mate-panel-1d14ccccc6a44b348a0e166a947388d41a411e64.tar.bz2 mate-panel-1d14ccccc6a44b348a0e166a947388d41a411e64.tar.xz |
clock: sort locations by time reverse and name
Diffstat (limited to 'applets/clock/clock.c')
-rw-r--r-- | applets/clock/clock.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c index 8e07d85a..d8368704 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -1111,6 +1111,22 @@ sort_locations_by_time_reverse (gconstpointer a, gconstpointer b) return sort_locations_by_time (b, a); } +static gint +sort_locations_by_time_reverse_and_name (gconstpointer a, gconstpointer b) +{ + gint ret; + + ret = sort_locations_by_time_reverse (a, b); + if (ret == 0) { + ClockLocation *loc_a = (ClockLocation *) a; + ClockLocation *loc_b = (ClockLocation *) b; + + ret = g_strcmp0 (clock_location_get_city (loc_a), + clock_location_get_city (loc_b)); + } + return ret; +} + static void location_tile_pressed_cb (ClockLocationTile *tile, gpointer data) { @@ -1162,7 +1178,7 @@ create_cities_section (ClockData *cd) /* Copy the existing list, so we can sort it nondestructively */ node = g_list_copy (cities); - node = g_list_sort (node, sort_locations_by_time_reverse); + node = g_list_sort (node, sort_locations_by_time_reverse_and_name); for (l = node; l; l = g_list_next (l)) { ClockLocation *loc = l->data; |