[gnome-shell/4948-replicate-gs-folders-c-from-the-gnome-software: 15/15] appDisplay: Create default folders on start
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/4948-replicate-gs-folders-c-from-the-gnome-software: 15/15] appDisplay: Create default folders on start
- Date: Fri, 4 Mar 2022 13:02:15 +0000 (UTC)
commit 919039e2668ccd484beba4039232cc7649c31026
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Mar 2 14:33:11 2022 +0100
appDisplay: Create default folders on start
The default folders used to be created by gnome-software, as that was
where folder management used to be implemented. Since then, folder
management via drag and drop was implemented in the shell, and the
gnome-software code was removed.
The only bit that still involves gnome-software are the default folders
that are created on first run. Given that everything else has moved to
the shell, it makes sense to take over that part as well.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4948
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2110>
js/ui/appDisplay.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9abadaabec..3ff32c9f7a 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -54,6 +54,35 @@ const DELAYED_MOVE_TIMEOUT = 200;
const DIALOG_SHADE_NORMAL = Clutter.Color.from_pixel(0x000000cc);
const DIALOG_SHADE_HIGHLIGHT = Clutter.Color.from_pixel(0x00000055);
+const DEFAULT_FOLDERS = {
+ 'Utilities': {
+ name: 'X-GNOME-Utilities.directory',
+ categories: ['X-GNOME-Utilities'],
+ apps: [
+ 'gnome-abrt.desktop',
+ 'gnome-system-log.desktop',
+ 'nm-connection-editor.desktop',
+ 'org.gnome.baobab.desktop',
+ 'org.gnome.Connections.desktop',
+ 'org.gnome.DejaDup.desktop',
+ 'org.gnome.Dictionary.desktop',
+ 'org.gnome.DiskUtility.desktop',
+ 'org.gnome.eog.desktop',
+ 'org.gnome.Evince.desktop',
+ 'org.gnome.FileRoller.desktop',
+ 'org.gnome.fonts.desktop',
+ 'org.gnome.seahorse.Application.desktop',
+ 'org.gnome.tweaks.desktop',
+ 'org.gnome.Usage.desktop',
+ 'vinagre.desktop',
+ ],
+ },
+ 'YaST': {
+ name: 'suse-yast.directory',
+ categegories: ['X-SuSE-YaST'],
+ },
+};
+
var SidePages = {
NONE: 0,
PREVIOUS: 1 << 0,
@@ -1386,6 +1415,7 @@ class AppDisplay extends BaseAppView {
Main.queueDeferredWork(this._redisplayWorkId);
});
this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' });
+ this._ensureDefaultFolders();
this._folderSettings.connect('changed::folder-children', () => {
Main.queueDeferredWork(this._redisplayWorkId);
});
@@ -1450,6 +1480,28 @@ class AppDisplay extends BaseAppView {
this._pageManager.pages = pages;
}
+ _ensureDefaultFolders() {
+ if (this._folderSettings.get_strv('folder-children').length > 0)
+ return;
+
+ const folders = Object.keys(DEFAULT_FOLDERS);
+ this._folderSettings.set_strv('folder-children', folders);
+
+ const { path } = this._folderSettings;
+ for (const folder in folders) {
+ const { name, categories, apps } = DEFAULT_FOLDERS[folder];
+ const child = new Gio.Settings({
+ schema_id: 'org.gnome.desktop.app-folders.folder',
+ path: `${path}/folders/${folder}/`,
+ });
+ child.set_string('name', name);
+ child.set_boolean('translate', true);
+ child.set_strv('categories', categories);
+ if (apps)
+ child.set_strv('apps', apps);
+ }
+ }
+
_ensurePlaceholder(source) {
if (this._placeholder)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]