diff options
author | Simon Schampijer <simon@laptop.org> | 2012-12-20 13:27:38 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-12-20 13:40:28 (GMT) |
commit | 3859ff00226a447a4bbb053acabb0c0b14b3df25 (patch) | |
tree | 3876529de5f9cdc2a9db2df6ce6b45a651689145 | |
parent | 1dd2aec650ac4c185fc8479007b42ab948e84a43 (diff) |
WidgetInvoker: do not handle the clicked signal when there is no user interaction, part of SL #4307
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 <simon@laptop.org>
Reviewed-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r-- | src/sugar3/graphics/palettewindow.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index 0d67006..ff5e340 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'): |