appDisplay: Create AppFolderIcons for selected categories
App folders are intended for grouping some applications, not to assign a category to every single application, so we will only create folders for a selected subset of the existing categories. Software/Alacarte will eventually allow to create/modify those folders, so store the setting in GSettings so that it can be shared with those applications. https://bugzilla.gnome.org/show_bug.cgi?id=694192
This commit is contained in:
parent
6a1b341336
commit
e3c9c46c1c
@ -39,6 +39,14 @@
|
|||||||
will be displayed in the favorites area.
|
will be displayed in the favorites area.
|
||||||
</_description>
|
</_description>
|
||||||
</key>
|
</key>
|
||||||
|
<key name="app-folder-categories" type="as">
|
||||||
|
<default>[ 'Utilities', 'Sundry' ]</default>
|
||||||
|
<_summary>List of categories that should be displayed as folders</_summary>
|
||||||
|
<_description>
|
||||||
|
Each category name in this list will be represented as folder in the
|
||||||
|
application view, rather than being displayed inline in the main view.
|
||||||
|
</_description>
|
||||||
|
</key>
|
||||||
<key name="command-history" type="as">
|
<key name="command-history" type="as">
|
||||||
<default>[]</default>
|
<default>[]</default>
|
||||||
<_summary>History for command (Alt-F2) dialog</_summary>
|
<_summary>History for command (Alt-F2) dialog</_summary>
|
||||||
|
@ -267,6 +267,9 @@ const AppDisplay = new Lang.Class({
|
|||||||
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
||||||
Main.queueDeferredWork(this._workId);
|
Main.queueDeferredWork(this._workId);
|
||||||
}));
|
}));
|
||||||
|
global.settings.connect('changed::app-folder-categories', Lang.bind(this, function() {
|
||||||
|
Main.queueDeferredWork(this._workId);
|
||||||
|
}));
|
||||||
|
|
||||||
let box = new St.BoxLayout();
|
let box = new St.BoxLayout();
|
||||||
this.actor = new St.Bin({ child: box,
|
this.actor = new St.Bin({ child: box,
|
||||||
@ -297,12 +300,16 @@ const AppDisplay = new Lang.Class({
|
|||||||
|
|
||||||
var iter = root.iter();
|
var iter = root.iter();
|
||||||
var nextType;
|
var nextType;
|
||||||
|
let folderCategories = global.settings.get_strv('app-folder-categories');
|
||||||
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
|
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
|
||||||
if (nextType == GMenu.TreeItemType.DIRECTORY) {
|
if (nextType == GMenu.TreeItemType.DIRECTORY) {
|
||||||
var dir = iter.get_directory();
|
var dir = iter.get_directory();
|
||||||
if (dir.get_is_nodisplay())
|
if (dir.get_is_nodisplay())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (folderCategories.indexOf(dir.get_menu_id()) != -1)
|
||||||
|
this._view.addFolder(dir);
|
||||||
|
else
|
||||||
_loadCategory(dir, this._view);
|
_loadCategory(dir, this._view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user