[gtk+] pathbar: fix positioning of the down slider button



commit 89214cad5b19f760ea0508fd2418a540744f3660
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Aug 24 20:17:09 2013 -0700

    pathbar: fix positioning of the down slider button
    
    So that it's always linked with the rest of the pathbar.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706722

 gtk/gtkpathbar.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index f9135b5..70f124d 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -537,6 +537,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   gint allocation_width;
   gboolean need_sliders = FALSE;
   gint up_slider_offset = 0;
+  gint down_slider_offset = 0;
   GtkRequisition child_requisition;
   gboolean needs_reorder = FALSE;
 
@@ -703,8 +704,15 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       gtk_widget_set_child_visible (child, TRUE);
       gtk_widget_size_allocate (child, &child_allocation);
 
-      if (direction == GTK_TEXT_DIR_LTR)
-       child_allocation.x += child_allocation.width;
+      if (direction == GTK_TEXT_DIR_RTL)
+        {
+          down_slider_offset = child_allocation.x - allocation->x - path_bar->priv->slider_width;
+        }
+      else
+        {
+          down_slider_offset += child_allocation.width;
+          child_allocation.x += child_allocation.width;
+        }
     }
   /* Now we go hide all the widgets that don't fit */
   while (list)
@@ -730,6 +738,9 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->up_slider_button) == FALSE;
       gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
       gtk_widget_show_all (path_bar->priv->up_slider_button);
+
+      if (direction == GTK_TEXT_DIR_LTR)
+        down_slider_offset += path_bar->priv->slider_width;
     }
   else
     {
@@ -740,13 +751,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   if (need_sliders)
     {
       child_allocation.width = path_bar->priv->slider_width;
-
-      if (direction == GTK_TEXT_DIR_RTL)
-       child_allocation.x = 0;
-      else
-       child_allocation.x = allocation->width - path_bar->priv->slider_width;
-
-      child_allocation.x += allocation->x;
+      child_allocation.x = down_slider_offset + allocation->x;
       
       gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
 


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