[gnome-clocks/zbrown/header-controls: 7/7] headerbar: "new" tooltip specific to current panel



commit 01d86c84a4f4152a5ac831d7e356c3e64c1fc6cc
Author: Zander Brown <zbrown gnome org>
Date:   Sat Dec 7 19:10:57 2019 +0000

    headerbar: "new" tooltip specific to current panel
    
    This allows translators to probide differing translations for to different contexts
    
    Also answer the question of "New what?"

 data/ui/headerbar.ui | 2 +-
 src/alarm.vala       | 4 +++-
 src/clock.vala       | 1 +
 src/headerbar.vala   | 1 +
 src/stopwatch.vala   | 1 +
 src/timer.vala       | 2 ++
 src/window.vala      | 9 +++++++++
 src/world.vala       | 2 ++
 8 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/headerbar.ui b/data/ui/headerbar.ui
index bd903c0..e7d5dba 100644
--- a/data/ui/headerbar.ui
+++ b/data/ui/headerbar.ui
@@ -136,7 +136,7 @@
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
             <property name="action_name">win.new</property>
-            <property name="tooltip-text" translatable="yes">New</property>
+            <property name="tooltip-text" bind-source="ClocksHeaderBar" bind-property="new-label" 
bind-flags="sync-create" />
             <child>
               <object class="GtkImage">
                 <property name="visible">True</property>
diff --git a/src/alarm.vala b/src/alarm.vala
index 8f43019..2ea377a 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -560,7 +560,7 @@ private class RingingPanel : Gtk.Grid {
         if (alarm.state != Item.State.SNOOZING) {
             alarm.snooze ();
         } else {
-           // The alarm is already snoozed, simply dismiss the panel.
+            // The alarm is already snoozed, simply dismiss the panel.
             dismiss ();
         }
     }
@@ -589,6 +589,8 @@ public class Face : Gtk.Stack, Clocks.Clock {
     public bool n_selected { get; set; }
     public string title { get; set; default = _("Clocks"); }
     public string subtitle { get; set; }
+    // Translators: Tooltip for the + button
+    public string new_label { get; default = _("New Alarm"); }
 
     private ContentStore alarms;
     private GLib.Settings settings;
diff --git a/src/clock.vala b/src/clock.vala
index 2a436ec..404ad89 100644
--- a/src/clock.vala
+++ b/src/clock.vala
@@ -32,6 +32,7 @@ public interface Clocks.Clock : GLib.Object {
     public abstract bool n_selected { get; set; }
     public abstract string title { get; protected set; }
     public abstract string subtitle { get; protected set; }
+    public abstract string new_label { get; }
 
     public virtual void activate_new () {
     }
diff --git a/src/headerbar.vala b/src/headerbar.vala
index 03b05f5..124871f 100644
--- a/src/headerbar.vala
+++ b/src/headerbar.vala
@@ -114,6 +114,7 @@ public class Clocks.HeaderBar : Hdy.HeaderBar {
     public Gtk.Stack stack { get; set; }
     public Hdy.ViewSwitcherBar switcher_bar { get; set; }
     public uint n_selected { get; set; }
+    public string new_label { get; set; }
 
     private bool _can_select;
     private ViewMode _mode;
diff --git a/src/stopwatch.vala b/src/stopwatch.vala
index 0bc4744..301b3f9 100644
--- a/src/stopwatch.vala
+++ b/src/stopwatch.vala
@@ -119,6 +119,7 @@ public class Face : Gtk.Box, Clocks.Clock {
     public bool n_selected { get; set; }
     public string title { get; set; default = _("Clocks"); }
     public string subtitle { get; set; }
+    public string new_label { get; default = null; }
 
     public State state { get; private set; default = State.RESET; }
 
diff --git a/src/timer.vala b/src/timer.vala
index a4702e3..3e437e1 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -78,6 +78,8 @@ public class Face : Gtk.Stack, Clocks.Clock {
     public bool n_selected { get; set; }
     public string title { get; set; default = _("Clocks"); }
     public string subtitle { get; set; }
+    // Translators: Tooltip for the + button
+    public string new_label { get; default = _("New Timer"); }
 
     public State state { get; private set; default = State.STOPPED; }
 
diff --git a/src/window.vala b/src/window.vala
index 1419927..a9df644 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -57,6 +57,7 @@ public class Window : Gtk.ApplicationWindow {
     private Binding bind_selected = null;
     private Binding bind_title = null;
     private Binding bind_subtitle = null;
+    private Binding bind_new_label = null;
 
     private bool inited = false;
 
@@ -364,6 +365,14 @@ public class Window : Gtk.ApplicationWindow {
                                              "subtitle",
                                              SYNC_CREATE);
 
+        if (bind_new_label != null) {
+            bind_new_label.unbind ();
+        }
+        bind_new_label = panel.bind_property ("new-label",
+                                              header_bar,
+                                              "new-label",
+                                              SYNC_CREATE);
+                                    
         stack.visible_child.grab_focus ();
     }
 }
diff --git a/src/world.vala b/src/world.vala
index c181441..b503e63 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -345,6 +345,8 @@ public class Face : Gtk.Stack, Clocks.Clock {
     public bool n_selected { get; set; }
     public string title { get; set; default = _("Clocks"); }
     public string subtitle { get; set; }
+    // Translators: Tooltip for the + button
+    public string new_label { get; default = _("Add Location"); }
 
     private ContentStore locations;
     private GLib.Settings settings;


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