Move the activate and select functionality inside the callbacks

Move the activate and select functionality inside the callbacks for
'button-release-event' signals of the display item and the information
button correspondingly. This way it is more obvious that this is an
event handling code that needs to return a boolean value for whether
the signal has been fully handled by the actor.
This commit is contained in:
Marina Zhurakhinskaya 2009-06-25 18:01:45 -04:00 committed by Colin Walters
parent 3a7447dacc
commit 45c97862e5

View File

@ -63,7 +63,13 @@ GenericDisplayItem.prototype = {
width: availableWidth, width: availableWidth,
height: ITEM_DISPLAY_HEIGHT }); height: ITEM_DISPLAY_HEIGHT });
this.actor._delegate = this; this.actor._delegate = this;
this.actor.connect('button-release-event', Lang.bind(this, this.activate)); this.actor.connect('button-release-event',
Lang.bind(this,
function() {
// Activates the item by launching it
this.emit('activate');
return true;
}));
let draggable = DND.makeDraggable(this.actor); let draggable = DND.makeDraggable(this.actor);
draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin)); draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin));
@ -93,8 +99,13 @@ GenericDisplayItem.prototype = {
function() { function() {
return true; return true;
})); }));
this._informationButton.connect('button-release-event', Lang.bind(this, this.select)); this._informationButton.connect('button-release-event',
Lang.bind(this,
function() {
// Selects the item by highlighting it and displaying its details
this.emit('select');
return true;
}));
this._informationButton.hide(); this._informationButton.hide();
this.actor.add_actor(this._informationButton); this.actor.add_actor(this._informationButton);
this._informationButton.lower_bottom(); this._informationButton.lower_bottom();
@ -155,18 +166,6 @@ GenericDisplayItem.prototype = {
this._bg.background_color = color; this._bg.background_color = color;
}, },
// Activates the item by launching it
activate: function() {
this.emit('activate');
return true;
},
// Selects the item by highlighting it and displaying it details
select: function() {
this.emit('select');
return true;
},
/* /*
* Returns an actor containing item details. In the future details can have more information than what * Returns an actor containing item details. In the future details can have more information than what
* the preview pop-up has and be item-type specific. * the preview pop-up has and be item-type specific.