[gnome-shell/app-picker-refresh: 2/16] appDisplay: Merge AppIcon and AppWellIcon
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/app-picker-refresh: 2/16] appDisplay: Merge AppIcon and AppWellIcon
- Date: Tue, 19 Feb 2013 11:55:39 +0000 (UTC)
commit 30f4288abab3aca622781aafb9752dcd19ddb240
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jan 30 23:51:43 2013 +0100
appDisplay: Merge AppIcon and AppWellIcon
js/ui/appDisplay.js | 60 ++++++++++++++++++++++++++++++++++++++------------
js/ui/dash.js | 10 ++++----
2 files changed, 50 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 96c3d01..4a68931 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -71,7 +71,7 @@ const AlphabeticalView = new Lang.Class({
if (this._appIcons[id] !== undefined)
return;
- let appIcon = new AppWellIcon(app);
+ let appIcon = new AppIcon(app);
let pos = Util.insertSorted(this._allApps, app, function(a, b) {
return a.compare_by_name(b);
});
@@ -250,30 +250,52 @@ const AppSearchProvider = new Lang.Class({
createResultActor: function (resultMeta, terms) {
let app = resultMeta['id'];
- let icon = new AppWellIcon(app);
+ let icon = new AppIcon(app);
return icon.actor;
}
});
-const AppIcon = new Lang.Class({
- Name: 'AppIcon',
- Extends: IconGrid.BaseIcon,
+const SettingsSearchProvider = new Lang.Class({
+ Name: 'SettingsSearchProvider',
- _init : function(app, params) {
- this.app = app;
+ _init: function() {
+ this.appInfo = Gio.DesktopAppInfo.new('gnome-control-center.desktop');
+ this._appSys = Shell.AppSystem.get_default();
+ },
- let label = this.app.get_name();
+ getResultMetas: function(prefs, callback) {
+ let metas = [];
+ for (let i = 0; i < prefs.length; i++) {
+ let pref = prefs[i];
+ metas.push({ 'id': pref,
+ 'name': pref.get_name(),
+ 'createIcon': function() { return null; }
+ });
+ }
+ callback(metas);
+ },
- this.parent(label, params);
+ getInitialResultSet: function(terms) {
+ this.searchSystem.pushResults(this, this._appSys.search_settings(terms));
},
- createIcon: function(iconSize) {
- return this.app.create_icon_texture(iconSize);
+ getSubsearchResultSet: function(previousResults, terms) {
+ this.searchSystem.pushResults(this, this._appSys.search_settings(terms));
+ },
+
+ activateResult: function(pref) {
+ pref.activate();
+ },
+
+ launchSearch: function(terms) {
+ // FIXME: this should be a remote search provider
+ this.appInfo.launch([], global.create_app_launch_context());
}
});
-const AppWellIcon = new Lang.Class({
- Name: 'AppWellIcon',
+
+const AppIcon = new Lang.Class({
+ Name: 'AppIcon',
_init : function(app, iconParams) {
this.app = app;
@@ -285,7 +307,11 @@ const AppWellIcon = new Lang.Class({
y_fill: true });
this.actor._delegate = this;
- this.icon = new AppIcon(app, iconParams);
+ if (!iconParams)
+ iconParams = {};
+
+ iconParams['createIcon'] = Lang.bind(this, this._createIcon);
+ this.icon = new IconGrid.BaseIcon(app.get_name(), iconParams);
this.actor.set_child(this.icon.actor);
this.actor.label_actor = this.icon.label;
@@ -328,6 +354,10 @@ const AppWellIcon = new Lang.Class({
this._removeMenuTimeout();
},
+ _createIcon: function(iconSize) {
+ return this.app.create_icon_texture(iconSize);
+ },
+
_removeMenuTimeout: function() {
if (this._menuTimeoutId > 0) {
Mainloop.source_remove(this._menuTimeoutId);
@@ -453,7 +483,7 @@ const AppWellIcon = new Lang.Class({
return this.icon.icon;
}
});
-Signals.addSignalMethods(AppWellIcon.prototype);
+Signals.addSignalMethods(AppIcon.prototype);
const AppIconMenu = new Lang.Class({
Name: 'AppIconMenu',
diff --git a/js/ui/dash.js b/js/ui/dash.js
index c1385b9..3a0d611 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -22,7 +22,7 @@ const DASH_ITEM_LABEL_HIDE_TIME = 0.1;
const DASH_ITEM_HOVER_TIMEOUT = 300;
function getAppFromSource(source) {
- if (source instanceof AppDisplay.AppWellIcon) {
+ if (source instanceof AppDisplay.AppIcon) {
return source.app;
} else {
return null;
@@ -486,9 +486,9 @@ const Dash = new Lang.Class({
},
_createAppItem: function(app) {
- let appIcon = new AppDisplay.AppWellIcon(app,
- { setSizeManually: true,
- showLabel: false });
+ let appIcon = new AppDisplay.AppIcon(app,
+ { setSizeManually: true,
+ showLabel: false });
appIcon._draggable.connect('drag-begin',
Lang.bind(this, function() {
appIcon.actor.opacity = 50;
@@ -505,7 +505,7 @@ const Dash = new Lang.Class({
let item = new DashItemContainer();
item.setChild(appIcon.actor);
- // Override default AppWellIcon label_actor, now the
+ // Override default AppIcon label_actor, now the
// accessible_name is set at DashItemContainer.setLabelText
appIcon.actor.label_actor = null;
item.setLabelText(app.get_name());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]