[gthumb] Fixed RTL icons and arrow rendering, with newer gtk. Bug 747380.



commit 688f7a269d66c5355ffa5ebd23701ad2e23987fd
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Fri Dec 18 15:27:24 2015 -0500

    Fixed RTL icons and arrow rendering, with newer gtk. Bug 747380.

 configure.ac                                       |    2 +-
 .../file_tools/gth-file-tool-adjust-colors.c       |    4 +---
 extensions/file_tools/gth-file-tool-curves.c       |    4 +---
 extensions/file_tools/gth-file-tool-redo.c         |   11 ++++-------
 extensions/file_tools/gth-file-tool-rotate.c       |    4 +---
 extensions/file_tools/gth-file-tool-sharpen.c      |    4 +---
 extensions/file_tools/gth-file-tool-undo.c         |   11 ++++-------
 extensions/gstreamer_tools/gth-media-viewer-page.c |   12 +++---------
 gthumb/gth-browser.c                               |   20 +++++++++++---------
 9 files changed, 27 insertions(+), 45 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0bc03bd..451f405 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,7 +58,7 @@ GLIB_GSETTINGS
 GTHUMB_EXTENSION_RULES
 
 GLIB_REQUIRED=2.36.0
-GTK_REQUIRED=3.10.0
+GTK_REQUIRED=3.13.2
 EXIV2_REQUIRED=0.21
 CLUTTER_REQUIRED=1.12.0
 CLUTTER_GTK_REQUIRED=1.0.0
diff --git a/extensions/file_tools/gth-file-tool-adjust-colors.c 
b/extensions/file_tools/gth-file-tool-adjust-colors.c
index 941ed35..f8a4109 100644
--- a/extensions/file_tools/gth-file-tool-adjust-colors.c
+++ b/extensions/file_tools/gth-file-tool-adjust-colors.c
@@ -541,17 +541,15 @@ gth_file_tool_adjust_colors_populate_headerbar (GthFileTool *base,
                                                GthBrowser  *browser)
 {
        GthFileToolAdjustColors *self;
-       gboolean                 rtl;
        GtkWidget               *button;
 
        self = (GthFileToolAdjustColors *) base;
 
        /* reset button */
 
-       rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
        button = gth_browser_add_header_bar_button (browser,
                                                    GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
-                                                   rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+                                                   "edit-undo-symbolic",
                                                    _("Reset"),
                                                    NULL,
                                                    NULL);
diff --git a/extensions/file_tools/gth-file-tool-curves.c b/extensions/file_tools/gth-file-tool-curves.c
index 33e5644..0982c43 100644
--- a/extensions/file_tools/gth-file-tool-curves.c
+++ b/extensions/file_tools/gth-file-tool-curves.c
@@ -808,17 +808,15 @@ gth_file_tool_curves_populate_headerbar (GthFileTool *base,
                                         GthBrowser  *browser)
 {
        GthFileToolCurves *self;
-       gboolean           rtl;
        GtkWidget         *button;
 
        self = (GthFileToolCurves *) base;
 
        /* reset button */
 
-       rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
        button = gth_browser_add_header_bar_button (browser,
                                                    GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
-                                                   rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+                                                   "edit-undo-symbolic",
                                                    _("Reset"),
                                                    NULL,
                                                    NULL);
diff --git a/extensions/file_tools/gth-file-tool-redo.c b/extensions/file_tools/gth-file-tool-redo.c
index ed974c6..4d95d4c 100644
--- a/extensions/file_tools/gth-file-tool-redo.c
+++ b/extensions/file_tools/gth-file-tool-redo.c
@@ -72,11 +72,8 @@ gth_file_tool_redo_class_init (GthFileToolRedoClass *klass)
 static void
 gth_file_tool_redo_init (GthFileToolRedo *self)
 {
-       gboolean rtl;
-
-       rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
-
-       gth_file_tool_construct (GTH_FILE_TOOL (self), rtl ? "edit-redo-rtl-symbolic" :
-                                                            "edit-redo-symbolic",
-                                                      _("Redo"), GTH_TOOLBOX_SECTION_FILE);
+       gth_file_tool_construct (GTH_FILE_TOOL (self),
+                                "edit-redo-symbolic",
+                                _("Redo"),
+                                GTH_TOOLBOX_SECTION_FILE);
 }
diff --git a/extensions/file_tools/gth-file-tool-rotate.c b/extensions/file_tools/gth-file-tool-rotate.c
index aae519a..9292b1e 100644
--- a/extensions/file_tools/gth-file-tool-rotate.c
+++ b/extensions/file_tools/gth-file-tool-rotate.c
@@ -589,17 +589,15 @@ gth_file_tool_rotate_populate_headerbar (GthFileTool *base,
                                         GthBrowser  *browser)
 {
        GthFileToolRotate *self;
-       gboolean           rtl;
        GtkWidget         *button;
 
        self = (GthFileToolRotate *) base;
 
        /* reset button */
 
-       rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
        button = gth_browser_add_header_bar_button (browser,
                                                    GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
-                                                   rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+                                                   "edit-undo-symbolic",
                                                    _("Reset"),
                                                    NULL,
                                                    NULL);
diff --git a/extensions/file_tools/gth-file-tool-sharpen.c b/extensions/file_tools/gth-file-tool-sharpen.c
index 1cb2d2a..a3a500c 100644
--- a/extensions/file_tools/gth-file-tool-sharpen.c
+++ b/extensions/file_tools/gth-file-tool-sharpen.c
@@ -351,17 +351,15 @@ gth_file_tool_sharpen_populate_headerbar (GthFileTool *base,
                                          GthBrowser  *browser)
 {
        GthFileToolSharpen *self;
-       gboolean            rtl;
        GtkWidget          *button;
 
        self = (GthFileToolSharpen *) base;
 
        /* reset button */
 
-       rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
        button = gth_browser_add_header_bar_button (browser,
                                                    GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
-                                                   rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+                                                   "edit-undo-symbolic",
                                                    _("Reset"),
                                                    NULL,
                                                    NULL);
diff --git a/extensions/file_tools/gth-file-tool-undo.c b/extensions/file_tools/gth-file-tool-undo.c
index 8fc27c9..001ca70 100644
--- a/extensions/file_tools/gth-file-tool-undo.c
+++ b/extensions/file_tools/gth-file-tool-undo.c
@@ -72,11 +72,8 @@ gth_file_tool_undo_class_init (GthFileToolUndoClass *klass)
 static void
 gth_file_tool_undo_init (GthFileToolUndo *self)
 {
-       gboolean rtl;
-
-       rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
-
-       gth_file_tool_construct (GTH_FILE_TOOL (self), rtl ? "edit-undo-rtl-symbolic" :
-                                                            "edit-undo-symbolic",
-                                                      _("Undo"), GTH_TOOLBOX_SECTION_FILE);
+       gth_file_tool_construct (GTH_FILE_TOOL (self),
+                                "edit-undo-symbolic",
+                                _("Undo"),
+                                GTH_TOOLBOX_SECTION_FILE);
 }
diff --git a/extensions/gstreamer_tools/gth-media-viewer-page.c 
b/extensions/gstreamer_tools/gth-media-viewer-page.c
index 74b12ca..11ae335 100644
--- a/extensions/gstreamer_tools/gth-media-viewer-page.c
+++ b/extensions/gstreamer_tools/gth-media-viewer-page.c
@@ -594,13 +594,10 @@ update_play_button (GthMediaViewerPage *self,
        }
        else if (self->priv->playing && (new_state != GST_STATE_PLAYING)) {
                GtkWidget *play_button = GET_WIDGET ("play_button_image");
-               gboolean   rtl;
-
-               rtl = gtk_widget_get_direction (play_button) == GTK_TEXT_DIR_RTL;
 
                set_playing_state (self, FALSE);
                gtk_image_set_from_icon_name (GTK_IMAGE (play_button),
-                                             rtl ? "media-playback-start-rtl-symbolic" : 
"media-playback-start-symbolic",
+                                             "media-playback-start-symbolic",
                                              GTK_ICON_SIZE_LARGE_TOOLBAR);
                gtk_widget_set_tooltip_text (GET_WIDGET ("play_button_image"), _("Play"));
 
@@ -621,7 +618,6 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
                                     GthBrowser    *browser)
 {
        GthMediaViewerPage *self;
-       gboolean            rtl;
 
        if (! gstreamer_init ())
                return;
@@ -641,8 +637,6 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
                                                           "win.video-screenshot",
                                                           NULL);
 
-       rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL;
-
        /* video area */
 
        self->priv->area = gtk_drawing_area_new ();
@@ -706,10 +700,10 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
        gtk_widget_set_valign (self->priv->mediabar, GTK_ALIGN_END);
 
        gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("play_slower_image")),
-                                     rtl ? "media-seek-backward-rtl-symbolic" : 
"media-seek-backward-symbolic",
+                                     "media-seek-backward-symbolic",
                                      GTK_ICON_SIZE_MENU);
        gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("play_faster_image")),
-                                     rtl ? "media-seek-forward-rtl-symbolic" : "media-seek-forward-symbolic",
+                                     "media-seek-forward-symbolic",
                                      GTK_ICON_SIZE_MENU);
 
        g_signal_connect (GET_WIDGET ("volume_adjustment"),
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 1134895..ea8ffdb 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2641,6 +2641,9 @@ viewer_container_get_child_position_cb (GtkOverlay   *overlay,
        GthBrowser     *browser = user_data;
        GtkAllocation   main_alloc;
        gboolean        allocation_filled = FALSE;
+       gboolean        rtl;
+
+       rtl = gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL;
 
        gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN (overlay)), &main_alloc);
        gtk_widget_get_preferred_width (widget, NULL, &allocation->width);
@@ -2652,12 +2655,14 @@ viewer_container_get_child_position_cb (GtkOverlay   *overlay,
                allocation_filled = TRUE;
        }
        else if (widget == browser->priv->previous_image_button) {
-               allocation->x = OVERLAY_MARGIN;
+               allocation->x = rtl ? main_alloc.width - allocation->width - OVERLAY_MARGIN :
+                               OVERLAY_MARGIN;
                allocation->y = (main_alloc.height - allocation->height) / 2;
                allocation_filled = TRUE;
        }
        else if (widget == browser->priv->next_image_button) {
-               allocation->x = main_alloc.width - allocation->width - OVERLAY_MARGIN;
+               allocation->x = rtl ? OVERLAY_MARGIN :
+                               main_alloc.width - allocation->width - OVERLAY_MARGIN;
                allocation->y = (main_alloc.height - allocation->height) / 2;
                allocation_filled = TRUE;
        }
@@ -4385,15 +4390,12 @@ gth_browser_init (GthBrowser *browser)
 
        {
                GtkWidget  *header_bar;
-               gboolean    rtl;
                GtkBuilder *builder;
                GMenuModel *menu;
                GtkWidget  *button;
 
                header_bar = gth_window_get_header_bar (GTH_WINDOW (browser));
 
-               rtl = gtk_widget_get_direction (header_bar) == GTK_TEXT_DIR_RTL;
-
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS], 
GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
                gtk_widget_set_margin_right 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
@@ -4460,13 +4462,13 @@ gth_browser_init (GthBrowser *browser)
 
                gth_browser_add_header_bar_button (browser,
                                                   GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
-                                                  rtl ? "go-previous-rtl-symbolic" :  "go-previous-symbolic",
+                                                  "go-previous-symbolic",
                                                   _("Go to the previous visited location"),
                                                   "win.go-back",
                                                   NULL);
                gth_browser_add_header_bar_button (browser,
                                                   GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
-                                                  rtl ? "go-next-rtl-symbolic" : "go-next-symbolic",
+                                                  "go-next-symbolic",
                                                   _("Go to the next visited location"),
                                                   "win.go-forward",
                                                   NULL);
@@ -4489,7 +4491,7 @@ gth_browser_init (GthBrowser *browser)
 
                gth_browser_add_header_bar_button (browser,
                                                   GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION,
-                                                  rtl ? "go-previous-rtl-symbolic" :  "go-previous-symbolic",
+                                                  "go-previous-symbolic",
                                                   _("View the folders"),
                                                   "win.browser-mode",
                                                   NULL);
@@ -4513,7 +4515,7 @@ gth_browser_init (GthBrowser *browser)
 
                gth_browser_add_header_bar_button (browser,
                                                   GTH_BROWSER_HEADER_SECTION_EDITOR_NAVIGATION,
-                                                  rtl ? "go-previous-rtl-symbolic" :  "go-previous-symbolic",
+                                                  "go-previous-symbolic",
                                                   NULL,
                                                   "win.browser-mode",
                                                   NULL);


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