[gnome-shell-extensions] places-menu: sort special directories like nautilus does
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] places-menu: sort special directories like nautilus does
- Date: Tue, 19 Feb 2013 22:21:39 +0000 (UTC)
commit c3796b2b19c416fb4363e798152699e48a8d4c0d
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Feb 10 17:55:43 2013 +0100
places-menu: sort special directories like nautilus does
Place Home first, then show the others in alphabetical order.
https://bugzilla.gnome.org/show_bug.cgi?id=693242
extensions/places-menu/placeDisplay.js | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index a8acf30..6d0625b 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -197,6 +197,8 @@ const PlacesManager = new Lang.Class({
this._places.special.push(new PlaceInfo('special',
Gio.File.new_for_path(homePath),
_("Home")));
+
+ let specials = [];
for (let i = 0; i < DEFAULT_DIRECTORIES.length; i++) {
let specialPath = GLib.get_user_special_dir(DEFAULT_DIRECTORIES[i]);
if (specialPath == homePath)
@@ -209,9 +211,14 @@ const PlacesManager = new Lang.Class({
continue;
}
- this._places.special.push(info);
+ specials.push(info);
}
+ specials.sort(function(a, b) {
+ return GLib.utf8_collate(a.name, b.name);
+ });
+ this._places.special = this._places.special.concat(specials);
+
/*
* Show devices, code more or less ported from nautilus-places-sidebar.c
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]