[gnome-clocks] Hide the selection button in timer and stopwatch view



commit 170eef31a9ae5ce822135e158f9ae305adee4036
Author: MaÃl Lavault <mael lavault mailz org>
Date:   Thu Aug 16 21:15:36 2012 +0200

    Hide the selection button in timer and stopwatch view
    
    Hide the selection button in timer and stopwatch view since it not needed. Copied the new button behaviour.
    
    Signed-off-by: MaÃl Lavault <mael lavault mailz org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681861

 gnomeclocks/app.py    |   12 ++++++++++++
 gnomeclocks/clocks.py |    7 ++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index d0be55c..e4546c6 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -252,6 +252,18 @@ class ClocksToolbar(Gtk.Toolbar):
                         self.newButton.set_sensitive(False)
                         self.newButton.set_size_request(width, -1)
                         self.newButton.get_children()[0].hide()
+                    if view.hasSelectionMode:
+                        self.applyButton.get_children()[0].show_all()
+                        self.applyButton.show_all()
+                        self.applyButton.set_relief(Gtk.ReliefStyle.NORMAL)
+                        self.applyButton.set_sensitive(True)
+                    else:
+                        width = self.applyButton.get_allocation().width
+                        self.applyButton.set_relief(Gtk.ReliefStyle.NONE)
+                        self.applyButton.set_sensitive(False)
+                        self.applyButton.set_size_request(width, -1)
+                        self.applyButton.get_children()[0].hide()
+
             self.last_widget = widget
             self._busy = False
             self.emit("view-clock", self._buttonMap[widget])
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 57a33ab..cf18a4f 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -58,10 +58,11 @@ class Clock (Gtk.EventBox):
                     'show-clock': (GObject.SignalFlags.RUN_LAST,
                     None, (GObject.TYPE_PYOBJECT,))}
 
-    def __init__ (self, label, hasNew = False):
+    def __init__ (self, label, hasNew = False, hasSelectionMode = False):
         Gtk.EventBox.__init__ (self)
         self.button = ToggleButton (label)
         self.hasNew = hasNew
+        self.hasSelectionMode = hasSelectionMode
         self.get_style_context ().add_class ('grey-bg')
 
     def open_new_dialog(self):
@@ -78,7 +79,7 @@ class Clock (Gtk.EventBox):
 
 class World (Clock):
     def __init__ (self):
-        Clock.__init__ (self, _("World"), True)
+        Clock.__init__ (self, _("World"), True, True)
         self.addButton = None
 
         self.liststore = liststore = Gtk.ListStore(Pixbuf, str, GObject.TYPE_PYOBJECT)
@@ -175,7 +176,7 @@ class World (Clock):
 
 class Alarm (Clock):
     def __init__ (self):
-        Clock.__init__ (self, _("Alarm"), True)
+        Clock.__init__ (self, _("Alarm"), True, True)
 
         self.liststore = liststore = Gtk.ListStore(Pixbuf, str, GObject.TYPE_PYOBJECT)
         self.iconview = iconview = Gtk.IconView.new()



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