From 3859ff00226a447a4bbb053acabb0c0b14b3df25 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 20 Dec 2012 14:27:38 +0100 Subject: [PATCH] WidgetInvoker: do not handle the clicked signal when there is no user interaction, part of SL #4307 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are cases where there is no user interaction but we do receive a clicked signal: in the clipboard we do have GtkRadioToolButton which are derived from the GtkToggleToolButton [1]. The 'clicked' signal is emitted when the 'active' property changes [2]. We use the 'active' property to indicate the current active clipping. In the Invoker we do check now if the event originated a user interaction or if it was generated due to a for example a property change. [1] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html [2] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html#GtkToggleToolButton--active Signed-off-by: Simon Schampijer Reviewed-by: Carlos Garnacho Acked-by: Manuel QuiƱones --- src/sugar3/graphics/palettewindow.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index 0d670066..ff5e3402 100644 --- a/src/sugar3/graphics/palettewindow.py +++ b/src/sugar3/graphics/palettewindow.py @@ -1155,6 +1155,18 @@ class WidgetInvoker(Invoker): return False def __click_event_cb(self, button): + event = Gtk.get_current_event() + if not event: + # not an event from a user interaction, this can be when + # the clicked event is emitted on a 'active' property + # change of ToggleToolButton for example + return + if event and button != Gtk.get_event_widget(event): + # another special case for the ToggleToolButton: this handles + # the case where we select an item and the active property + # of the other one changes to 'False' + return + if self.props.lock_palette and not self.locked: self.locked = True if hasattr(self.parent, 'set_expanded'):