[gnome-clocks] Fix time representation in RTL languages in the timer



commit 0dd0a15813c96fa4bdc0804a20388941fad44b84
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Thu Aug 1 19:34:22 2013 +0300

    Fix time representation in RTL languages in the timer
    
    Set the direction of the grid to LTR in RTL mode and pertend RATIO
    char with LTR marks in the timer label. Define grid_spinbuttons outside
    of the constructor as we plan to port Clocks.Timer.MainPanel to
    composite templates.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705305

 src/timer.vala |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/timer.vala b/src/timer.vala
index 0b1b36e..aff05cc 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -35,6 +35,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
     private uint timeout_id;
     private Utils.Bell bell;
     private Gtk.Widget setup_panel;
+    private Gtk.Grid grid_spinbuttons;
     private Gtk.SpinButton h_spinbutton;
     private Gtk.SpinButton m_spinbutton;
     private Gtk.SpinButton s_spinbutton;
@@ -60,11 +61,15 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
         var builder = Utils.load_ui ("timer.ui");
 
         setup_panel = builder.get_object ("setup_panel") as Gtk.Widget;
+        grid_spinbuttons = builder.get_object ("grid_spinbuttons") as Gtk.Grid;
         h_spinbutton = builder.get_object ("spinbutton_hours") as Gtk.SpinButton;
         m_spinbutton = builder.get_object ("spinbutton_minutes") as Gtk.SpinButton;
         s_spinbutton = builder.get_object ("spinbutton_seconds") as Gtk.SpinButton;
         start_button = builder.get_object ("start_button") as Gtk.Button;
 
+        // Force LTR since we do not want to reverse [hh] : [mm] : [ss]
+        grid_spinbuttons.set_direction (Gtk.TextDirection.LTR);
+
         h_spinbutton.output.connect (show_leading_zeros);
         m_spinbutton.output.connect (show_leading_zeros);
         s_spinbutton.output.connect (show_leading_zeros);
@@ -224,8 +229,9 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
     }
 
     private void update_countdown_label (int h, int m, int s) {
-        // Note that the format uses unicode RATIO character
-        time_label.set_text ("%02i∶%02i∶%02i".printf (h, m, s));
+        // Note that the format uses unicode RATIO character,
+        // which is prepended with a LTR mark
+        time_label.set_text ("%02i\xE2\x80\x8E∶%02i\xE2\x80\x8E∶%02i".printf (h, m, s));
     }
 
     public override void grab_focus () {


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