[gtk+/pathbar] Remove the 'spacing' field since it is always zero anyway



commit f5801794dd722f138b3cd6abb61ce67f34e41b8a
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Apr 29 17:30:02 2013 -0500

    Remove the 'spacing' field since it is always zero anyway
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkpathbar.c |   42 ++++++++++++++++++------------------------
 1 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 8d539c1..fa65201 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -93,7 +93,6 @@ struct _GtkPathBarPrivate
   guint settings_signal_id;
   gint icon_size;
   gint16 slider_width;
-  gint16 spacing;
   guint timer;
   guint slider_visible : 1;
   guint need_timer     : 1;
@@ -256,7 +255,6 @@ gtk_path_bar_init (GtkPathBar *path_bar)
 
   priv->get_info_cancellable = NULL;
 
-  priv->spacing = 0;
   priv->icon_size = FALLBACK_ICON_SIZE;
 
   setup_basic_folders (path_bar);
@@ -526,8 +524,8 @@ gtk_path_bar_get_preferred_width (GtkWidget *widget,
   path_bar->priv->slider_width = MIN (height * 2 / 3 + 5, height);
   if (path_bar->priv->button_list && path_bar->priv->button_list->next != NULL)
     {
-      *minimum += (path_bar->priv->spacing + path_bar->priv->slider_width) * 2;
-      *natural += (path_bar->priv->spacing + path_bar->priv->slider_width) * 2;
+      *minimum += path_bar->priv->slider_width * 2;
+      *natural += path_bar->priv->slider_width * 2;
     }
 }
 
@@ -701,7 +699,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
 
   /* First, we check to see if we need the scrollbars. */
   if (path_bar->priv->fake_root)
-    width = path_bar->priv->spacing + path_bar->priv->slider_width;
+    width = path_bar->priv->slider_width;
   else
     width = 0;
 
@@ -711,7 +709,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
 
       gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
-      width += child_requisition.width + path_bar->priv->spacing;
+      width += child_requisition.width;
       if (list == path_bar->priv->fake_root)
        break;
     }
@@ -726,7 +724,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   else
     {
       gboolean reached_end = FALSE;
-      gint slider_space = 2 * (path_bar->priv->spacing + path_bar->priv->slider_width);
+      gint slider_space = 2 * path_bar->priv->slider_width;
 
       if (path_bar->priv->first_scrolled_button)
        first_button = path_bar->priv->first_scrolled_button;
@@ -750,13 +748,12 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
 
           gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
-         if (width + child_requisition.width +
-             path_bar->priv->spacing + slider_space > allocation_width)
+         if (width + child_requisition.width + slider_space > allocation_width)
            reached_end = TRUE;
          else if (list == path_bar->priv->fake_root)
            break;
          else
-           width += child_requisition.width + path_bar->priv->spacing;
+           width += child_requisition.width;
 
          list = list->prev;
        }
@@ -769,13 +766,13 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
 
           gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
-         if (width + child_requisition.width + path_bar->priv->spacing + slider_space > allocation_width)
+         if (width + child_requisition.width + slider_space > allocation_width)
            {
              reached_end = TRUE;
            }
          else
            {
-             width += child_requisition.width + path_bar->priv->spacing;
+             width += child_requisition.width;
              if (first_button == path_bar->priv->fake_root)
                break;
              first_button = first_button->next;
@@ -792,7 +789,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       child_allocation.x = allocation->x + allocation->width;
       if (need_sliders || path_bar->priv->fake_root)
        {
-         child_allocation.x -= (path_bar->priv->spacing + path_bar->priv->slider_width);
+         child_allocation.x -= path_bar->priv->slider_width;
          up_slider_offset = allocation->width - path_bar->priv->slider_width;
        }
     }
@@ -802,7 +799,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       if (need_sliders || path_bar->priv->fake_root)
        {
          up_slider_offset = 0;
-         child_allocation.x += (path_bar->priv->spacing + path_bar->priv->slider_width);
+         child_allocation.x += path_bar->priv->slider_width;
        }
     }
 
@@ -817,7 +814,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
       child_allocation.width = MIN (child_requisition.width,
-                                   allocation_width - (path_bar->priv->spacing + 
path_bar->priv->slider_width) * 2);
+                                   allocation_width - path_bar->priv->slider_width * 2);
 
       if (direction == GTK_TEXT_DIR_RTL)
        child_allocation.x -= child_allocation.width;
@@ -826,13 +823,13 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       if (need_sliders && direction == GTK_TEXT_DIR_RTL)
        {
           gtk_widget_get_allocation (widget, &widget_allocation);
-         if (child_allocation.x - path_bar->priv->spacing - path_bar->priv->slider_width < 
widget_allocation.x)
+         if (child_allocation.x - path_bar->priv->slider_width < widget_allocation.x)
            break;
        }
       else if (need_sliders && direction == GTK_TEXT_DIR_LTR)
        {
           gtk_widget_get_allocation (widget, &widget_allocation);
-         if (child_allocation.x + child_allocation.width + path_bar->priv->spacing + 
path_bar->priv->slider_width >
+         if (child_allocation.x + child_allocation.width + path_bar->priv->slider_width >
              widget_allocation.x + allocation_width)
            break;
        }
@@ -849,10 +846,8 @@ 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_RTL)
-       child_allocation.x -= path_bar->priv->spacing;
-      else
-       child_allocation.x += child_allocation.width + path_bar->priv->spacing;
+      if (direction != GTK_TEXT_DIR_RTL)
+       child_allocation.x += child_allocation.width;
     }
   /* Now we go hide all the widgets that don't fit */
   while (list)
@@ -1154,7 +1149,7 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
   gtk_widget_get_allocation (BUTTON_DATA (down_button->data)->button, &button_allocation);
 
   space_available = (allocation.width
-                    - 2 * path_bar->priv->spacing - 2 * path_bar->priv->slider_width
+                    - 2 * path_bar->priv->slider_width
                      - button_allocation.width);
   path_bar->priv->first_scrolled_button = down_button;
   
@@ -1167,8 +1162,7 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
       down_button = down_button->next;
       if (!down_button)
        break;
-      space_available -= (button_allocation.width
-                         + path_bar->priv->spacing);
+      space_available -= button_allocation.width;
     }
 }
 


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