summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRares Visalom <rares.visalom@gmail.com>2017-08-21 16:20:25 +0300
committerRares Visalom <rares.visalom@gmail.com>2017-08-22 03:46:42 +0300
commit328c8e2138a348c3c2cd90208278586dc5e5105b (patch)
tree0f1137a7c560528665bd64c7b185c6147abd5303
parent29ecb0514e764b0106ff9d5e963df53516b04b4f (diff)
downloadgnome-shell-wip/raresv/system-actions.tar.gz
appDisplay: Include system actions in search resultswip/raresv/system-actions
The way system actions are displayed in the search results is by appending them at the end of the list returned by the ApplicationProvider. https://bugzilla.gnome.org/show_bug.cgi?id=691900
-rw-r--r--data/theme/gnome-shell-high-contrast.css6
-rw-r--r--data/theme/gnome-shell.css6
-rw-r--r--js/ui/appDisplay.js54
3 files changed, 56 insertions, 10 deletions
diff --git a/data/theme/gnome-shell-high-contrast.css b/data/theme/gnome-shell-high-contrast.css
index 6b4ea1218..766202927 100644
--- a/data/theme/gnome-shell-high-contrast.css
+++ b/data/theme/gnome-shell-high-contrast.css
@@ -1210,6 +1210,12 @@ StScrollBar {
.icon-grid .overview-icon {
icon-size: 96px; }
+.system-action-icon {
+ background-color: black;
+ color: white;
+ border-radius: 99px;
+ icon-size: 48px; }
+
.app-view-controls {
padding-bottom: 32px; }
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 34d3c886b..f94c67cbc 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -1210,6 +1210,12 @@ StScrollBar {
.icon-grid .overview-icon {
icon-size: 96px; }
+.system-action-icon {
+ background-color: black;
+ color: white;
+ border-radius: 99px;
+ icon-size: 48px; }
+
.app-view-controls {
padding-bottom: 32px; }
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 428b3c062..9b92311ac 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -24,8 +24,11 @@ const OverviewControls = imports.ui.overviewControls;
const PopupMenu = imports.ui.popupMenu;
const Tweener = imports.ui.tweener;
const Workspace = imports.ui.workspace;
+const Search = imports.ui.search;
+const System = imports.ui.status.system;
const Params = imports.misc.params;
const Util = imports.misc.util;
+const SystemActions = imports.misc.systemActions;
var MAX_APPLICATION_WORK_MILLIS = 75;
var MENU_POPUP_TIMEOUT = 600;
@@ -1085,19 +1088,35 @@ var AppSearchProvider = new Lang.Class({
this.id = 'applications';
this.isRemoteProvider = false;
this.canLaunchSearch = false;
+
+ this._systemActions = new SystemActions.getDefault();
},
getResultMetas: function(apps, callback) {
let metas = [];
- for (let i = 0; i < apps.length; i++) {
- let app = this._appSys.lookup_app(apps[i]);
- metas.push({ 'id': app.get_id(),
- 'name': app.get_name(),
- 'createIcon': function(size) {
- return app.create_icon_texture(size);
- }
- });
+ for (let id of apps) {
+ if (id.endsWith('.desktop')) {
+ let app = this._appSys.lookup_app(id);
+
+ metas.push({ 'id': app.get_id(),
+ 'name': app.get_name(),
+ 'createIcon': function(size) {
+ return app.create_icon_texture(size);
+ }
+ });
+ } else {
+ let name = this._systemActions.getName(id);
+ let iconName = this._systemActions.getIconName(id);
+
+ let createIcon = size => new St.Icon({ icon_name: iconName,
+ width: size,
+ height: size,
+ style_class: 'system-action-icon' });
+
+ metas.push({ id, name, createIcon });
+ }
}
+
callback(metas);
},
@@ -1119,6 +1138,9 @@ var AppSearchProvider = new Lang.Class({
return usage.compare('', a, b);
}));
});
+
+ results = results.concat(this._systemActions.getMatchingActions(terms));
+
callback(results);
},
@@ -1127,8 +1149,10 @@ var AppSearchProvider = new Lang.Class({
},
createResultObject: function (resultMeta) {
- let app = this._appSys.lookup_app(resultMeta['id']);
- return new AppIcon(app);
+ if (resultMeta.id.endsWith('.desktop'))
+ return new AppIcon(this._appSys.lookup_app(resultMeta['id']));
+ else
+ return new SystemActionIcon(this, resultMeta);
}
});
@@ -1983,3 +2007,13 @@ var AppIconMenu = new Lang.Class({
}
});
Signals.addSignalMethods(AppIconMenu.prototype);
+
+var SystemActionIcon = new Lang.Class({
+ Name: 'SystemActionIcon',
+ Extends: Search.GridSearchResult,
+
+ activate: function() {
+ SystemActions.getDefault().activateAction(this.metaInfo['id']);
+ Main.overview.hide();
+ }
+});