[gnome-clocks] SelectionToolbar: Hide actor when not visible



commit e0fa95ac677ffa04aabf95c2e98743335ffb61ad
Author: Volker Sobek <reklov live com>
Date:   Sat Nov 24 14:37:05 2012 +0100

    SelectionToolbar: Hide actor when not visible
    
    Hide the clutter actor once it is invisible, otherwise it keeps
    preventing input events on the widgets it covers.

 gnomeclocks/widgets.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index 7c4de4b..86f3f8f 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -332,9 +332,14 @@ class SelectionToolbar():
         self.widget.insert(self._leftGroup, -1)
         self._toolbarDelete = Gtk.Button(_("Delete"))
         self._leftBox.pack_start(self._toolbarDelete, True, True, 0)
+
         self.widget.show_all()
+        self.actor.hide()
+
+        self._transition = None
 
     def fade_in(self):
+        self.actor.show()
         self.actor.save_easing_state()
         self.actor.set_easing_duration(300)
         self.actor.set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD)
@@ -347,6 +352,14 @@ class SelectionToolbar():
         self.actor.set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD)
         self.actor.set_opacity(0)
         self.actor.restore_easing_state()
+        if not self._transition:
+            self._transition = self.actor.get_transition("opacity")
+            self._transition.connect("completed", self._on_transition_completed)
+
+    def _on_transition_completed(self, transition):
+        if self.actor.get_opacity() == 0:
+            self.actor.hide()
+        self._transition = None
 
 
 class Embed(GtkClutter.Embed):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]