[epiphany] ephy-toolbar: fix the toolbar in RTL environments



commit c83458d2b065ba4056163dff6db1bc0779e0b8fd
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Fri Dec 14 21:26:58 2012 +0100

    ephy-toolbar: fix the toolbar in RTL environments
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684366

 src/ephy-toolbar.c |   11 +++++++++--
 src/ephy-window.c  |   13 +++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 6fff281..3af2e93 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -135,7 +135,10 @@ ephy_toolbar_constructed (GObject *object)
   gtk_container_add (GTK_CONTAINER (back_forward), box);
   gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (back_forward));
   gtk_widget_show_all (GTK_WIDGET (back_forward));
-  gtk_widget_set_margin_right (GTK_WIDGET (back_forward), 12);
+  if (gtk_widget_get_direction (GTK_WIDGET (back_forward)) == GTK_TEXT_DIR_RTL)
+    gtk_widget_set_margin_left (GTK_WIDGET (back_forward), 12);
+  else
+    gtk_widget_set_margin_right (GTK_WIDGET (back_forward), 12);
 
   /* Location and Reload/Stop */
   location_stop_reload = gtk_tool_item_new ();
@@ -170,7 +173,11 @@ ephy_toolbar_constructed (GObject *object)
   gtk_size_group_add_widget (size, location);
   g_object_unref (size);
 
-  gtk_widget_set_margin_right (GTK_WIDGET (location_stop_reload), 12);
+  if (gtk_widget_get_direction (GTK_WIDGET (location_stop_reload)) == GTK_TEXT_DIR_RTL)
+    gtk_widget_set_margin_left (GTK_WIDGET (location_stop_reload), 12);
+  else
+    gtk_widget_set_margin_right (GTK_WIDGET (location_stop_reload), 12);
+
   gtk_widget_show_all (GTK_WIDGET (location_stop_reload));
 
   /* Page Menu */
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0649701..37bc34b 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1297,6 +1297,7 @@ setup_ui_manager (EphyWindow *window)
 	GtkActionGroup *action_group;
 	GtkAction *action;
 	GtkUIManager *manager;
+	const char *prev_icon, *next_icon;
 
 	window->priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 	gtk_widget_show (window->priv->main_vbox);
@@ -1356,12 +1357,20 @@ setup_ui_manager (EphyWindow *window)
 	window->priv->tab_accels_action_group = action_group;
 	g_object_unref (action_group);
 
+	if (gtk_widget_get_direction (GTK_WIDGET (window)) == GTK_TEXT_DIR_RTL) {
+		prev_icon = "go-previous-rtl-symbolic";
+		next_icon = "go-next-rtl-symbolic";
+	} else {
+		prev_icon = "go-previous-symbolic";
+		next_icon = "go-next-symbolic";
+	}
+
 	action_group = gtk_action_group_new ("SpecialToolbarActions");
 	action =
 		g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
 			      "name", "NavigationBack",
 			      "label", _("Back"),
-			      "icon-name", "go-previous-symbolic",
+			      "icon-name", prev_icon,
 			      "window", window,
 			      "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_BACK,
 			      NULL);
@@ -1373,7 +1382,7 @@ setup_ui_manager (EphyWindow *window)
 		g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
 			      "name", "NavigationForward",
 			      "label", _("Forward"),
-			      "icon-name", "go-next-symbolic",
+			      "icon-name", next_icon,
 			      "window", window,
 			      "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD,
 			      NULL);



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