Skip to content

Commit 10926a3

Browse files
authored
nemo-places-sidebar.c: Sort network mounts alphabetically (#3695)
1 parent 15f92ee commit 10926a3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/nemo-places-sidebar.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,16 @@ sort_places_func (gconstpointer a,
373373
return g_utf8_collate (((PlaceInfo *) a)->name, ((PlaceInfo *) b)->name);
374374
}
375375

376+
static gint
377+
sort_mounts_func (gconstpointer a,
378+
gconstpointer b)
379+
{
380+
g_autofree gchar *name_a = g_mount_get_name (G_MOUNT (a));
381+
g_autofree gchar *name_b = g_mount_get_name (G_MOUNT (b));
382+
383+
return g_utf8_collate (name_a, name_b);
384+
}
385+
376386
static PlaceInfo *
377387
new_place_info (PlaceType place_type,
378388
SectionType section_type,
@@ -1254,7 +1264,7 @@ update_places (NemoPlacesSidebar *sidebar)
12541264

12551265
g_list_free_full (network_volumes, g_object_unref);
12561266

1257-
network_mounts = g_list_reverse (network_mounts);
1267+
network_mounts = g_list_sort(network_mounts, sort_mounts_func);
12581268
for (l = network_mounts; l != NULL; l = l->next) {
12591269
mount = l->data;
12601270
root = g_mount_get_default_location (mount);

0 commit comments

Comments
 (0)