[evince] shell: Make the title RTL compliant



commit 2528202e8ac05e9ceaf7cd18aab3a5618cba9a08
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Mon Jul 2 20:38:59 2018 -0400

    shell: Make the title RTL compliant
    
    Fixes #486

 shell/ev-window-title.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/shell/ev-window-title.c b/shell/ev-window-title.c
index eba2e9ed..cf7d2a8f 100644
--- a/shell/ev-window-title.c
+++ b/shell/ev-window-title.c
@@ -96,6 +96,7 @@ ev_window_title_update (EvWindowTitle *window_title)
        GtkHeaderBar *toolbar = GTK_HEADER_BAR (ev_window_get_toolbar (EV_WINDOW (window)));
        char *title = NULL, *p;
        char *subtitle = NULL, *title_header = NULL;
+       gboolean ltr;
 
         if (window_title->type == EV_WINDOW_TITLE_RECENT) {
                 gtk_header_bar_set_subtitle (toolbar, NULL);
@@ -103,6 +104,8 @@ ev_window_title_update (EvWindowTitle *window_title)
                 return;
         }
 
+       ltr = gtk_widget_get_direction (GTK_WIDGET (window)) == GTK_TEXT_DIR_LTR;
+
        if (window_title->doc_title && window_title->filename) {
                 title = g_strdup (window_title->doc_title);
                 ev_window_title_sanitize_title (window_title, &title);
@@ -110,7 +113,10 @@ ev_window_title_update (EvWindowTitle *window_title)
                subtitle = window_title->filename;
 
                title_header = title;
-               title = g_strdup_printf ("%s — %s", subtitle, title);
+               if (ltr)
+                       title = g_strdup_printf ("%s — %s", subtitle, title);
+               else
+                       title = g_strdup_printf ("%s — %s", title, subtitle);
 
                 for (p = title; *p; ++p) {
                         /* an '\n' byte is always ASCII, no need for UTF-8 special casing */
@@ -134,7 +140,11 @@ ev_window_title_update (EvWindowTitle *window_title)
        case EV_WINDOW_TITLE_PASSWORD: {
                 gchar *password_title;
 
-               password_title = g_strdup_printf ("%s — %s", title, _("Password Required"));
+               if (ltr)
+                       password_title = g_strdup_printf ("%s — %s", title, _("Password Required"));
+               else
+                       password_title = g_strdup_printf ("%s — %s", _("Password Required"), title);
+
                gtk_window_set_title (window, password_title);
                g_free (password_title);
 


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