[gnome-clocks] Rename signal in "show-standalone"



commit 8e9ebb14d6fb1d251b623151c78aec9b6626ba52
Author: Paolo Borelli <pborelli gnome org>
Date:   Wed Aug 29 22:33:17 2012 +0200

    Rename signal in "show-standalone"
    
    In preparation to also have a standalone alarm

 gnomeclocks/app.py    |   26 +++++++++++++-------------
 gnomeclocks/clocks.py |    6 +++---
 gnomeclocks/world.py  |    5 +++--
 3 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index a75d6d1..cc38da2 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -77,10 +77,10 @@ class Window(Gtk.ApplicationWindow):
 
         self.vbox.pack_end(self.notebook, True, True, 0)
         for view in self.views:
+            view.connect("show-standalone", self._on_show_standalone)
             self.notebook.append_page(view, Gtk.Label(str(view)))
         self.notebook.append_page(self.single_evbox, Gtk.Label("Widget"))
 
-        self.world.connect("show-clock", self._on_show_clock)
         self.toolbar.connect("view-clock", self._on_view_clock)
         self.vbox.show_all()
         self.show_all()
@@ -89,14 +89,15 @@ class Window(Gtk.ApplicationWindow):
     def show_clock(self, view):
         self.toolbar.activate_view(view)
 
-    def _on_show_clock(self, widget, d):
-        def show_standalone_clock():
-            self.toolbar._set_single_toolbar(d.location)
-            self.single_evbox.add(d.get_standalone_widget())
+    def _on_show_standalone(self, widget, d):
+        def show_standalone_page():
+            widget, title = d.get_standalone_widget()
+            self.toolbar._set_single_toolbar(title)
+            self.single_evbox.add(widget)
             self.single_evbox.show_all()
             self.notebook.set_current_page(-1)
 
-        self.embed.spotlight(show_standalone_clock)
+        self.embed.spotlight(show_standalone_page)
 
     def _on_view_clock(self, button, view):
         def show_clock_view():
@@ -322,8 +323,8 @@ class ClocksToolbar(Gtk.Toolbar):
                 self.current_view = view
                 button.set_active(True)
 
-        self.city_label = Gtk.Label()
-        toolbox.pack_start(self.city_label, False, False, 0)
+        self.titleLabel = Gtk.Label()
+        toolbox.pack_start(self.titleLabel, False, False, 0)
         toolbox.pack_start(Gtk.Box(), False, False, 15)
 
         toolbox.pack_start(Gtk.Label(""), True, True, 0)
@@ -354,18 +355,17 @@ class ClocksToolbar(Gtk.Toolbar):
         self.newButton.show()
         self.selectButton.show()
         self.backButton.hide()
-        self.city_label.hide()
+        self.titleLabel.hide()
 
-    def _set_single_toolbar(self, location):
+    def _set_single_toolbar(self, title):
         self.buttonBox.hide()
         self.newButton.hide()
         self.selectButton.hide()
         if not self.backButton.get_parent():
             self.leftBox.pack_start(self.backButton, False, False, 0)
         self.backButton.show_all()
-        label = GLib.markup_escape_text(location.get_city_name())
-        self.city_label.set_markup("<b>%s</b>" % label)
-        self.city_label.show()
+        self.titleLabel.set_markup("<b>%s</b>" % title)
+        self.titleLabel.show()
 
     def _on_toggled(self, widget, view):
         self.current_view = view
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 52772f3..414ee56 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -24,9 +24,9 @@ class Clock(Gtk.EventBox):
         'show-requested': (GObject.SignalFlags.RUN_LAST,
                            None,
                            ()),
-        'show-clock': (GObject.SignalFlags.RUN_LAST,
-                       None,
-                       (GObject.TYPE_PYOBJECT, )),
+        'show-standalone': (GObject.SignalFlags.RUN_LAST,
+                            None,
+                            (GObject.TYPE_PYOBJECT, )),
         'selection-changed': (GObject.SignalFlags.RUN_LAST,
                               None,
                               ())
diff --git a/gnomeclocks/world.py b/gnomeclocks/world.py
index 365aeba..2a04a18 100644
--- a/gnomeclocks/world.py
+++ b/gnomeclocks/world.py
@@ -215,7 +215,8 @@ class DigitalClock():
         if not self.standalone:
             self.standalone = StandaloneClock(self.location, self.sunrise, self.sunset)
         self.update()
-        return self.standalone
+        title = GLib.markup_escape_text(self.location.get_city_name())
+        return self.standalone, title
 
     def get_day(self):
         clock_time_day = self.get_local_time(time.time()).tm_yday
@@ -287,7 +288,7 @@ class World(Clock):
 
     def _on_item_activated(self, iconview, path):
         d = self.liststore[path][3]
-        self.emit("show-clock", d)
+        self.emit("show-standalone", d)
 
     def _on_selection_changed(self, iconview):
         self.emit("selection-changed")



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