[gnome-clocks] Use different labels for the "New" button



commit 61ba69424c3f11ebd22b34e1d52f2a863d81868f
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Oct 7 15:39:12 2012 +0200

    Use different labels for the "New" button
    
    In many languages the "New" button on World Clocks and on Alarms needs
    different translations.

 gnomeclocks/alarm.py  |    3 ++-
 gnomeclocks/app.py    |    9 ++++++---
 gnomeclocks/clocks.py |    4 ++--
 gnomeclocks/world.py  |    3 ++-
 4 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gnomeclocks/alarm.py b/gnomeclocks/alarm.py
index 873a86f..b08939e 100644
--- a/gnomeclocks/alarm.py
+++ b/gnomeclocks/alarm.py
@@ -297,7 +297,8 @@ class AlarmWidget():
 
 class Alarm(Clock):
     def __init__(self):
-        Clock.__init__(self, _("Alarm"), True, True)
+        # Translators: "New" refers to an alarm
+        Clock.__init__(self, _("Alarm"), _("New"), True)
 
         self.liststore = Gtk.ListStore(bool,
                                        GdkPixbuf.Pixbuf,
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index 42551ab..b87eb30 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -209,8 +209,7 @@ class ClocksToolbar(Gtk.Toolbar):
         left_box = Gtk.Box()
         left_item.add(left_box)
 
-        # Translators: "New" refers to a world clock or an alarm
-        self.new_button = Gtk.Button(_("New"))
+        self.new_button = Gtk.Button()
         self.new_button.set_action_name("win.new")
         self.new_button.set_size_request(64, 34)
         left_box.pack_start(self.new_button, False, False, 0)
@@ -292,7 +291,11 @@ class ClocksToolbar(Gtk.Toolbar):
         self.get_style_context().remove_class("selection-mode")
         self.standalone = None
         self.button_box.show()
-        self.new_button.set_visible(self.current_view.has_new)
+        if self.current_view.new_label:
+            self.new_button.set_label(self.current_view.new_label)
+            self.new_button.show()
+        else:
+            self.new_button.hide()
         self.select_button.set_visible(self.current_view.has_selection_mode)
         self.back_button.hide()
         self.title_label.hide()
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index caddc82..1f3884d 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -29,10 +29,10 @@ class Clock(Gtk.EventBox):
                               ())
     }
 
-    def __init__(self, label, has_new=False, has_selection_mode=False):
+    def __init__(self, label, new_label=None, has_selection_mode=False):
         Gtk.EventBox.__init__(self)
         self.label = label
-        self.has_new = has_new
+        self.new_label = new_label
         self.has_selection_mode = has_selection_mode
         self.get_style_context().add_class('view')
         self.get_style_context().add_class('content-view')
diff --git a/gnomeclocks/world.py b/gnomeclocks/world.py
index 8273153..743177b 100644
--- a/gnomeclocks/world.py
+++ b/gnomeclocks/world.py
@@ -256,7 +256,8 @@ class DigitalClock():
 
 class World(Clock):
     def __init__(self):
-        Clock.__init__(self, _("World"), True, True)
+        # Translators: "New" refers to a world clock
+        Clock.__init__(self, _("World"), _("New"), True)
 
         self.liststore = Gtk.ListStore(bool,
                                        GdkPixbuf.Pixbuf,



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