[gnome-documents/gnome-3-8] preview: flip navigation buttons icon names for RTL



commit 727fbb520710fe11eec56111a2246cb874ba8e66
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 25 13:09:03 2013 -0400

    preview: flip navigation buttons icon names for RTL
    
    Or we'll end up showing buttons pointing in the right direction, since
    halign respects RTL already.
    Also, set an uniform horizontal margin on the buttons, so they don't
    appear at a different position when flipped in the other direction.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698857

 src/preview.js |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index 0bde66d..8de72e6 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -615,15 +615,21 @@ const PreviewNavButtons = new Lang.Class({
         this._previewView = previewView;
         this._model = previewView.getModel();
         this._overlay = overlay;
+
         this._visible = false;
         this._pageChangedId = 0;
         this._autoHideId = 0;
         this._motionId = 0;
         this._hover = false;
 
-        this.prev_widget = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'go-previous-symbolic',
+        let isRtl = (this._previewView.widget.get_direction() == Gtk.TextDirection.RTL);
+        let prevIconName = isRtl ? 'go-next-symbolic' : 'go-previous-symbolic';
+        let nextIconName = isRtl ? 'go-previous-symbolic' : 'go-next-symbolic';
+
+        this.prev_widget = new Gtk.Button({ child: new Gtk.Image ({ icon_name: prevIconName,
                                                                     pixel_size: 16 }),
                                             margin_left: _PREVIEW_NAVBAR_MARGIN,
+                                            margin_right: _PREVIEW_NAVBAR_MARGIN,
                                             halign: Gtk.Align.START,
                                             valign: Gtk.Align.CENTER });
         this.prev_widget.get_style_context().add_class('osd');
@@ -632,8 +638,9 @@ const PreviewNavButtons = new Lang.Class({
         this.prev_widget.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
         this.prev_widget.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
 
-        this.next_widget = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'go-next-symbolic',
+        this.next_widget = new Gtk.Button({ child: new Gtk.Image ({ icon_name: nextIconName,
                                                                     pixel_size: 16 }),
+                                            margin_left: _PREVIEW_NAVBAR_MARGIN,
                                             margin_right: _PREVIEW_NAVBAR_MARGIN,
                                             halign: Gtk.Align.END,
                                             valign: Gtk.Align.CENTER });


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