EventIcon: only trigger 'activate' signal on principal button click

With the introduction of 'activate' signal on [1], and the use of that
signal in Sugar Home, we introduced a bug, now, pressing the secondary button
starts the activity instead of open the palette.
This patch solves the issue checking the putton pressed before send the signal.

[1] a19cf9ed27
This commit is contained in:
Gonzalo Odiard 2015-08-06 16:59:13 -03:00
parent 16107a3985
commit 88213f6408

View File

@ -762,9 +762,10 @@ class EventIcon(Gtk.EventBox):
self.set_palette(Palette(text)) self.set_palette(Palette(text))
def __button_release_event_cb(self, icon, event): def __button_release_event_cb(self, icon, event):
alloc = self.get_allocation() if event.button == 1:
if 0 < event.x < alloc.width and 0 < event.y < alloc.height: alloc = self.get_allocation()
self.emit('activate') if 0 < event.x < alloc.width and 0 < event.y < alloc.height:
self.emit('activate')
class CanvasIcon(EventIcon): class CanvasIcon(EventIcon):