appDisplay: Include system actions in search results
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
This commit is contained in:
parent
595065b420
commit
52f604757c
@ -1210,6 +1210,12 @@ StScrollBar {
|
|||||||
.icon-grid .overview-icon {
|
.icon-grid .overview-icon {
|
||||||
icon-size: 96px; }
|
icon-size: 96px; }
|
||||||
|
|
||||||
|
.system-action-icon {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
border-radius: 99px;
|
||||||
|
icon-size: 48px; }
|
||||||
|
|
||||||
.app-view-controls {
|
.app-view-controls {
|
||||||
padding-bottom: 32px; }
|
padding-bottom: 32px; }
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 53cf147f95305d398b71443de2b5cb893fbcd166
|
Subproject commit 81c5a273cf2fa5ef8c05940665a077635ae019a4
|
@ -1210,6 +1210,12 @@ StScrollBar {
|
|||||||
.icon-grid .overview-icon {
|
.icon-grid .overview-icon {
|
||||||
icon-size: 96px; }
|
icon-size: 96px; }
|
||||||
|
|
||||||
|
.system-action-icon {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
border-radius: 99px;
|
||||||
|
icon-size: 48px; }
|
||||||
|
|
||||||
.app-view-controls {
|
.app-view-controls {
|
||||||
padding-bottom: 32px; }
|
padding-bottom: 32px; }
|
||||||
|
|
||||||
|
@ -24,8 +24,11 @@ const OverviewControls = imports.ui.overviewControls;
|
|||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const Tweener = imports.ui.tweener;
|
const Tweener = imports.ui.tweener;
|
||||||
const Workspace = imports.ui.workspace;
|
const Workspace = imports.ui.workspace;
|
||||||
|
const Search = imports.ui.search;
|
||||||
|
const System = imports.ui.status.system;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
|
const SystemActions = imports.misc.systemActions;
|
||||||
|
|
||||||
var MAX_APPLICATION_WORK_MILLIS = 75;
|
var MAX_APPLICATION_WORK_MILLIS = 75;
|
||||||
var MENU_POPUP_TIMEOUT = 600;
|
var MENU_POPUP_TIMEOUT = 600;
|
||||||
@ -1085,19 +1088,35 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
this.id = 'applications';
|
this.id = 'applications';
|
||||||
this.isRemoteProvider = false;
|
this.isRemoteProvider = false;
|
||||||
this.canLaunchSearch = false;
|
this.canLaunchSearch = false;
|
||||||
|
|
||||||
|
this._systemActions = new SystemActions.getDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMetas: function(apps, callback) {
|
getResultMetas: function(apps, callback) {
|
||||||
let metas = [];
|
let metas = [];
|
||||||
for (let i = 0; i < apps.length; i++) {
|
for (let id of apps) {
|
||||||
let app = this._appSys.lookup_app(apps[i]);
|
if (id.endsWith('.desktop')) {
|
||||||
metas.push({ 'id': app.get_id(),
|
let app = this._appSys.lookup_app(id);
|
||||||
'name': app.get_name(),
|
|
||||||
'createIcon': function(size) {
|
metas.push({ 'id': app.get_id(),
|
||||||
return app.create_icon_texture(size);
|
'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);
|
callback(metas);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1119,6 +1138,9 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
return usage.compare('', a, b);
|
return usage.compare('', a, b);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
results = results.concat(this._systemActions.getMatchingActions(terms));
|
||||||
|
|
||||||
callback(results);
|
callback(results);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1127,8 +1149,10 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
createResultObject: function (resultMeta) {
|
createResultObject: function (resultMeta) {
|
||||||
let app = this._appSys.lookup_app(resultMeta['id']);
|
if (resultMeta.id.endsWith('.desktop'))
|
||||||
return new AppIcon(app);
|
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);
|
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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user