Hook up activate on search entry to launch if only one app displayed
svn path=/trunk/; revision=90
This commit is contained in:
parent
fae6839eb8
commit
10d5aaca83
@ -63,7 +63,7 @@ _init: function(appinfo, width) {
|
|||||||
width: width,
|
width: width,
|
||||||
height: APPDISPLAY_HEIGHT});
|
height: APPDISPLAY_HEIGHT});
|
||||||
this._group.connect('button-press-event', function(group, e) {
|
this._group.connect('button-press-event', function(group, e) {
|
||||||
me.emit('launch');
|
me.emit('activate');
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
this._bg = new Clutter.Rectangle({ color: APPDISPLAY_BACKGROUND_COLOR,
|
this._bg = new Clutter.Rectangle({ color: APPDISPLAY_BACKGROUND_COLOR,
|
||||||
@ -102,6 +102,12 @@ _init: function(appinfo, width) {
|
|||||||
y: this._name.height + 4})
|
y: this._name.height + 4})
|
||||||
this._group.add_actor(this._comment);
|
this._group.add_actor(this._comment);
|
||||||
this.actor = this._group;
|
this.actor = this._group;
|
||||||
|
},
|
||||||
|
launch: function() {
|
||||||
|
this._appinfo.launch([], null);
|
||||||
|
},
|
||||||
|
appinfo: function () {
|
||||||
|
return this._appinfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Signals.addSignalMethods(AppDisplayItem.prototype);
|
Signals.addSignalMethods(AppDisplayItem.prototype);
|
||||||
@ -155,6 +161,7 @@ _removeItem: function(appid) {
|
|||||||
let group = item.actor;
|
let group = item.actor;
|
||||||
group.destroy();
|
group.destroy();
|
||||||
delete this._displayed[appid];
|
delete this._displayed[appid];
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeAll: function() {
|
_removeAll: function() {
|
||||||
@ -180,11 +187,11 @@ _filterAdd: function(appid) {
|
|||||||
|
|
||||||
let appinfo = this._appset[appid];
|
let appinfo = this._appset[appid];
|
||||||
let name = appinfo.get_name();
|
let name = appinfo.get_name();
|
||||||
let index = 0; for (i in this._displayed) { index += 1; }
|
let index = 0; for (i in this._displayed) { index += 1; };
|
||||||
|
|
||||||
let appdisplay = new AppDisplayItem(appinfo, this._width);
|
let appdisplay = new AppDisplayItem(appinfo, this._width);
|
||||||
appdisplay.connect('launch', function() {
|
appdisplay.connect('activate', function() {
|
||||||
appinfo.launch([], null);
|
appdisplay.launch();
|
||||||
me.emit('activated');
|
me.emit('activated');
|
||||||
});
|
});
|
||||||
let group = appdisplay.actor;
|
let group = appdisplay.actor;
|
||||||
@ -256,6 +263,27 @@ setSearch: function(text) {
|
|||||||
this._redisplay();
|
this._redisplay();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
searchActivate: function() {
|
||||||
|
let displayedActors = this._grid.get_children();
|
||||||
|
if (displayedActors.length != 1)
|
||||||
|
return;
|
||||||
|
let selectedActor = displayedActors[0];
|
||||||
|
let selectedMenuItem = null;
|
||||||
|
for (appid in this._displayed) {
|
||||||
|
let item = this._displayed[appid];
|
||||||
|
if (item.actor == selectedActor) {
|
||||||
|
selectedMenuItem = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log("selected " + selectedMenuItem);
|
||||||
|
if (!selectedMenuItem)
|
||||||
|
return;
|
||||||
|
|
||||||
|
selectedMenuItem.launch();
|
||||||
|
this.emit('activated');
|
||||||
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
this._grid.show();
|
this._grid.show();
|
||||||
|
@ -82,15 +82,25 @@ _init : function(width) {
|
|||||||
this._group.add_actor(this._searchEntry);
|
this._group.add_actor(this._searchEntry);
|
||||||
global.stage.set_key_focus(this._searchEntry);
|
global.stage.set_key_focus(this._searchEntry);
|
||||||
this._searchQueued = false;
|
this._searchQueued = false;
|
||||||
this._searchEntry.connect('notify::text', function (se, prop) {
|
this._searchActive = false;
|
||||||
|
this._searchEntry.connect('notify::text', function (se, prop) {
|
||||||
if (me._searchQueued)
|
if (me._searchQueued)
|
||||||
return;
|
return;
|
||||||
Mainloop.timeout_add(250, function() {
|
Mainloop.timeout_add(250, function() {
|
||||||
|
let text = me._searchEntry.text;
|
||||||
me._searchQueued = false;
|
me._searchQueued = false;
|
||||||
me._appdisplay.setSearch(me._searchEntry.text);
|
me._searchActive = text != '';
|
||||||
|
me._appdisplay.setSearch(text);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
this._searchEntry.connect('activate', function (se) {
|
||||||
|
log("activate " + me._searchActive);
|
||||||
|
if (!me._searchActive)
|
||||||
|
return false;
|
||||||
|
me._appdisplay.searchActivate();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
let appsText = new Clutter.Label({ color: SIDESHOW_TEXT_COLOR,
|
let appsText = new Clutter.Label({ color: SIDESHOW_TEXT_COLOR,
|
||||||
font_name: "Sans Bold 14px",
|
font_name: "Sans Bold 14px",
|
||||||
|
Loading…
Reference in New Issue
Block a user