From c4e344f1d7b50ff3f2485498798d527d51dbcce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 29 Sep 2024 01:01:30 +0200 Subject: [PATCH] places-menu: Drop user-special dirs Nautilus no longer special-cases user directories, and instead added them to the default bookmarks, so the user can customize which they want to have displayed. We already show bookmarked places, so just dropping the hard-coded list gives us the same locations as nautilus. Part-of: --- extensions/places-menu/placeDisplay.js | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index ac53913c..fd2aafe5 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -201,14 +201,6 @@ class PlaceVolumeInfo extends PlaceInfo { } } -const DEFAULT_DIRECTORIES = [ - GLib.UserDirectory.DIRECTORY_DOCUMENTS, - GLib.UserDirectory.DIRECTORY_PICTURES, - GLib.UserDirectory.DIRECTORY_MUSIC, - GLib.UserDirectory.DIRECTORY_DOWNLOAD, - GLib.UserDirectory.DIRECTORY_VIDEOS, -]; - export class PlacesManager extends EventEmitter { constructor() { super(); @@ -288,19 +280,16 @@ export class PlacesManager extends EventEmitter { _('Home'))); let specials = []; - let dirs = DEFAULT_DIRECTORIES.slice(); - if (this._settings.get_boolean('show-desktop-icons')) - dirs.push(GLib.UserDirectory.DIRECTORY_DESKTOP); - - for (let i = 0; i < dirs.length; i++) { - let specialPath = GLib.get_user_special_dir(dirs[i]); - const specialFile = specialPath - ? Gio.File.new_for_path(specialPath) + if (this._settings.get_boolean('show-desktop-icons')) { + const desktopPath = GLib.get_user_special_dir( + GLib.UserDirectory.DIRECTORY_DESKTOP); + const desktopFile = desktopPath + ? Gio.File.new_for_path(desktopPath) : null; - if (specialFile && !specialFile.equal(homeFile)) - specials.push(new PlaceInfo('special', file)); + if (desktopFile && !desktopFile.equal(homeFile)) { + specials.push(new PlaceInfo('special', desktopFile)); } specials.sort((a, b) => GLib.utf8_collate(a.name, b.name));