[gtk+/wip/csoriano/pathbar-bin-view-window] using gtkpathbarbox



commit 7a3b8ef030561e965135042bb09cc0c048714f24
Author: Carlos Soriano <csoriano gnome org>
Date:   Fri Jun 24 15:19:56 2016 +0200

    using gtkpathbarbox

 gtk/gtkpathbar.c             |   19 +++++
 gtk/gtkpathbarbox.c          |   38 ++++------
 gtk/gtkpathbarcontainer.c    |  176 +++++++++++++++++++++++++-----------------
 gtk/gtkpathbarcontainer.h    |   19 +++--
 gtk/ui/gtkpathbar.ui         |   51 +------------
 tests/testpathbar.c          |    2 +-
 tests/testpathbarcontainer.c |   16 +++-
 7 files changed, 164 insertions(+), 157 deletions(-)
---
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index ec58bfb..8742b7a 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -571,6 +571,16 @@ update_selected_path (GtkPathBar  *self)
 }
 
 static void
+on_overflow_clicked (GtkButton *button,
+                     gpointer   user_data)
+{
+  GtkPathBar *self = GTK_PATH_BAR (user_data);
+
+  gtk_path_bar_set_inverted (self, !gtk_path_bar_get_inverted (self));
+
+}
+
+static void
 gtk_path_bar_finalize (GObject *object)
 {
   GtkPathBar *self = (GtkPathBar *)object;
@@ -729,6 +739,15 @@ gtk_path_bar_init (GtkPathBar *self)
   g_type_ensure (GTK_TYPE_PATH_BAR_CONTAINER);
   gtk_widget_init_template (GTK_WIDGET (self));
 
+  g_signal_connect (priv->path_bar_overflow_root_1, "clicked",
+                    (GCallback) on_overflow_clicked, self);
+  g_signal_connect (priv->path_bar_overflow_root_2, "clicked",
+                    (GCallback) on_overflow_clicked, self);
+  g_signal_connect (priv->path_bar_overflow_tail_1, "clicked",
+                    (GCallback) on_overflow_clicked, self);
+  g_signal_connect (priv->path_bar_overflow_tail_2, "clicked",
+                    (GCallback) on_overflow_clicked, self);
+
   priv->inverted = FALSE;
 }
 
diff --git a/gtk/gtkpathbarbox.c b/gtk/gtkpathbarbox.c
index 324931a..1e4bee0 100644
--- a/gtk/gtkpathbarbox.c
+++ b/gtk/gtkpathbarbox.c
@@ -68,6 +68,7 @@ gtk_path_bar_box_add (GtkContainer *container,
   GtkPathBarBoxPrivate *priv = gtk_path_bar_box_get_instance_private (self);
 
   priv->children = g_list_append (priv->children, widget);
+  gtk_widget_set_parent (widget, GTK_WIDGET (self));
 
   gtk_widget_queue_resize (GTK_WIDGET (self));
 }
@@ -80,6 +81,7 @@ gtk_path_bar_box_remove (GtkContainer *container,
   GtkPathBarBoxPrivate *priv = gtk_path_bar_box_get_instance_private (self);
 
   priv->children = g_list_remove (priv->children, widget);
+  gtk_widget_unparent (widget);
 
   gtk_widget_queue_resize (GTK_WIDGET (self));
 }
@@ -102,23 +104,14 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
   GtkAllocation child_allocation;
   gint available_size;
   gint n_visible_children = 0;
-  gint current_x = 0;
+  gint current_x = allocation->x;
   gint i;
   GtkRequisition minimum_size;
   GtkRequisition natural_size;
+  GtkRequisition distributed_size;
 
   gtk_widget_get_preferred_size (widget, &minimum_size, &natural_size);
 
-#if 0
-  if (natural_size.width <= allocation->width)
-    {
-      GTK_WIDGET_CLASS (gtk_path_bar_box_parent_class)->size_allocate (widget, allocation);
-
-      return;
-    }
-
-#endif
-
   gtk_widget_set_allocation (widget, allocation);
 
   available_size = allocation->width;
@@ -139,12 +132,9 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
       n_visible_children++;
     }
 
- g_print ("child sizing pathbar %d %d\n", sizes[2].minimum_size, sizes[2].natural_size);
   gtk_distribute_natural_allocation (MAX (0, available_size),
                                      n_visible_children, sizes);
 
- g_print ("child sizing pathbar %d %d\n", sizes[2].minimum_size, sizes[2].natural_size);
-
   for (child = children, i = 0; child != NULL; child = g_list_next (child), i++)
     {
       if (!gtk_widget_get_visible (child->data))
@@ -153,7 +143,6 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
       child_available_size.width = sizes[i].minimum_size;
       child_available_size.height = allocation->height;
 
-      g_print ("child sizing 1 %d %d\n", child_available_size.width, sizes[i].minimum_size);
       if (GTK_IS_PATH_BAR_CONTAINER (child->data))
         {
           gtk_path_bar_container_adapt_to_size (GTK_PATH_BAR_CONTAINER (child->data),
@@ -161,14 +150,14 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
           gtk_path_bar_container_get_preferred_size_for_requisition (GTK_WIDGET (child->data),
                                                                      &child_available_size,
                                                                      &minimum_size,
-                                                                     &natural_size);
+                                                                     &natural_size,
+                                                                     &distributed_size);
 
-          sizes[i].minimum_size = MIN (child_available_size.width, natural_size.width);
+          sizes[i].minimum_size = MIN (child_available_size.width, distributed_size.width);
         }
-      g_print ("child sizing after %d %d\n", child_available_size.width, sizes[i].minimum_size);
 
       child_allocation.x = current_x;
-      child_allocation.y = 0;
+      child_allocation.y = allocation->y;
       child_allocation.width = sizes[i].minimum_size;
       child_allocation.height = allocation->height;
 
@@ -176,8 +165,6 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
 
       current_x += sizes[i].minimum_size;
     }
-
-  g_print ("\n\n\n");
 }
 
 static void
@@ -197,8 +184,8 @@ gtk_path_bar_box_get_preferred_width (GtkWidget *widget,
         continue;
 
       gtk_widget_get_preferred_width (GTK_WIDGET (child->data),
-                                     &child_minimum_width,
-                                     &child_natural_width);
+                                      &child_minimum_width,
+                                      &child_natural_width);
 
       *minimum_width = MAX (*minimum_width, child_minimum_width);
       *natural_width = MAX (*natural_width, child_natural_width);
@@ -241,7 +228,12 @@ gtk_path_bar_box_get_preferred_height (GtkWidget *widget,
 static void
 gtk_path_bar_box_init (GtkPathBarBox *self)
 {
+  GtkPathBarBoxPrivate *priv = gtk_path_bar_box_get_instance_private (self);
+
   gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
+  gtk_widget_set_redraw_on_allocate (GTK_WIDGET (self), TRUE);
+
+  priv->children = NULL;
 }
 
 static void
diff --git a/gtk/gtkpathbarcontainer.c b/gtk/gtkpathbarcontainer.c
index 0de53df..f860a45 100644
--- a/gtk/gtkpathbarcontainer.c
+++ b/gtk/gtkpathbarcontainer.c
@@ -33,9 +33,9 @@
 //TODO remove
 #include "gtkbutton.h"
 
-#define REVEALER_ANIMATION_TIME 2000 //ms
+#define REVEALER_ANIMATION_TIME 250 //ms
 #define INVERT_ANIMATION_SPEED 1.2 //px/ms
-#define INVERT_ANIMATION_MAX_TIME 750 //px/ms
+#define INVERT_ANIMATION_MAX_TIME 10000 //ms
 
 struct _GtkPathBarContainerPrivate
 {
@@ -55,12 +55,14 @@ struct _GtkPathBarContainerPrivate
   GtkWidget *children_box;
 
   guint invert_animation_tick_id;
-  double invert_animation_progress;
+  float invert_animation_progress;
   gint invert_animation_initial_children_width;
   guint64 invert_animation_initial_time;
   gint allocated_children_width;
   gint total_children_width;
   gint previous_child_width;
+
+  gint invert_animation_initial_width;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkPathBarContainer, gtk_path_bar_container, GTK_TYPE_BIN)
@@ -75,9 +77,9 @@ static GParamSpec *path_bar_container_properties[LAST_PROP] = { NULL, };
 
 static void
 gtk_path_bar_container_set_property (GObject      *object,
-                                    guint         prop_id,
-                                    const GValue *value,
-                                    GParamSpec   *pspec)
+                                     guint         prop_id,
+                                     const GValue *value,
+                                     GParamSpec   *pspec)
 {
   GtkPathBarContainer *children_box = GTK_PATH_BAR_CONTAINER (object);
 
@@ -129,9 +131,11 @@ gtk_path_bar_container_add (GtkPathBarContainer *self,
   gtk_container_add (GTK_CONTAINER (revealer), widget);
   gtk_container_add (GTK_CONTAINER (priv->children_box), revealer);
   gtk_revealer_set_transition_duration (GTK_REVEALER (revealer),
-                                            REVEALER_ANIMATION_TIME);
+                                        REVEALER_ANIMATION_TIME);
   priv->children = g_list_append (priv->children, widget);
   gtk_widget_show_all (revealer);
+
+  gtk_widget_queue_allocate (GTK_WIDGET (self));
 }
 
 static void
@@ -191,12 +195,13 @@ gtk_path_bar_container_remove (GtkPathBarContainer *self,
   gtk_widget_queue_resize (GTK_WIDGET (self));
 }
 
-static gboolean
+static void
 get_children_preferred_size_for_requisition (GtkPathBarContainer *self,
                                              GtkRequisition      *available_size,
                                              gboolean             inverted,
                                              GtkRequisition      *minimum_size,
-                                             GtkRequisition      *natural_size)
+                                             GtkRequisition      *natural_size,
+                                             GtkRequisition      *distributed_size)
 {
   GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
   GtkWidget *child_widget;
@@ -204,8 +209,10 @@ get_children_preferred_size_for_requisition (GtkPathBarContainer *self,
   GtkRequestedSize child_width;
   GtkRequestedSize child_height;
   GtkRequestedSize revealer_width;
+  GtkRequestedSize *sizes;
   GtkWidget *revealer;
   gint i;
+  gint n_children = 0;
   GList *children;
   gint current_children_min_width = 0;
   gint current_child_min_width = 0;
@@ -217,6 +224,8 @@ get_children_preferred_size_for_requisition (GtkPathBarContainer *self,
 
   children = g_list_copy (priv->children);
 
+  sizes = g_new(GtkRequestedSize, g_list_length (children));
+
   if (inverted)
     children = g_list_reverse (children);
 
@@ -241,39 +250,50 @@ get_children_preferred_size_for_requisition (GtkPathBarContainer *self,
                                                  &revealer_width.minimum_size,
                                                  &revealer_width.natural_size);
 
-      /* If we are in the middle of a revealer animation, get the revealer
-       * allocation */
+      /* Minimum size is always the first child whole size */
+      if (i > 0)
+        {
           current_child_min_width = revealer_width.minimum_size;
           current_child_nat_width = revealer_width.natural_size;
+        }
+      else
+        {
+          current_child_min_width = child_width.minimum_size;
+          current_child_nat_width = child_width.natural_size;
+        }
+
+      full_children_current_width += current_child_min_width;
+      if (full_children_current_width > available_size->width && priv->invert_animation)
+        break;
 
       current_children_min_height = MAX (current_children_min_height, child_height.minimum_size);
       current_children_nat_height = MAX (current_children_nat_height, child_height.natural_size);
       current_children_min_width += current_child_min_width;
       current_children_nat_width += current_child_nat_width;
 
-      full_children_current_width += current_child_min_width;
-      g_print ("children container i: %d reversed: %i current width %d available %d\n", i, inverted, 
child_width.natural_size, available_size->width);
-      if (!gtk_revealer_get_reveal_child (revealer))
-        {
-          break;
-        }
+      sizes[i].minimum_size = current_child_min_width;
+      sizes[i].natural_size = current_child_nat_width;
+      n_children++;
     }
 
-  if (minimum_size)
-    {
-      minimum_size->width = current_children_min_width;
-      minimum_size->height = current_children_min_height;
-    }
+  gtk_distribute_natural_allocation (MAX (0, available_size->width - current_children_min_width),
+                                     n_children, sizes);
 
-  if (natural_size)
-    {
-      natural_size->width = current_children_nat_width;
-      natural_size->height = current_children_nat_height;
-    }
+  minimum_size->width = current_children_min_width;
+  minimum_size->height = current_children_min_height;
 
-  g_list_free (children);
+  natural_size->width = current_children_nat_width;
+  natural_size->height = current_children_nat_height;
+
+  current_children_min_width = 0;
+  for (i = 0; i < n_children; i++)
+    current_children_min_width += sizes[i].minimum_size;
+
+  distributed_size->width = current_children_min_width;
+  distributed_size->height = MIN (available_size->height, natural_size->height);
 
-  return current_children_nat_width > available_size->width;
+
+  g_list_free (children);
 }
 
 static void
@@ -325,7 +345,6 @@ update_children_visibility (GtkPathBarContainer *self,
       if (!g_list_find (priv->widgets_to_remove, child_widget))
         priv->widgets_to_show = g_list_append (priv->widgets_to_show, child_widget);
     }
-g_print ("####### i %d\n", g_list_length (priv->widgets_to_show));
 
   priv->total_children_width = current_children_width;
   g_list_free (children);
@@ -403,7 +422,7 @@ idle_update_revealers (GtkPathBarContainer *self)
           g_signal_connect (revealer, "notify::child-revealed", (GCallback) revealer_on_hide_completed, 
self);
 
           remove_opacity_classes (revealer);
-          add_opacity_class (revealer, "pathbar-opacity-off");
+          //add_opacity_class (revealer, "pathbar-opacity-off");
 
           gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE);
         }
@@ -421,7 +440,7 @@ idle_update_revealers (GtkPathBarContainer *self)
                             (GCallback) unrevealed_really_remove_child, self);
 
           remove_opacity_classes (revealer);
-          add_opacity_class (revealer, "pathbar-opacity-off");
+          //add_opacity_class (revealer, "pathbar-opacity-off");
 
           gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE);
         }
@@ -462,24 +481,21 @@ get_max_scroll (GtkPathBarContainer *self)
   GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
   GtkRequisition children_used_min_size;
   GtkRequisition children_used_nat_size;
-  gboolean overflows;
+  GtkRequisition children_distributed_size;
   GtkAllocation allocation;
   GtkRequisition available_size;
   gint children_width;
-  gint children_used_width;
   gdouble max_scroll;
 
 
   gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
   available_size.width = allocation.width;
   available_size.height = allocation.height;
-  overflows = get_children_preferred_size_for_requisition (self, &available_size,
-                                                           TRUE,
-                                                           &children_used_min_size,
-                                                           &children_used_nat_size);
-
-  children_used_width = overflows ? MAX (children_used_min_size.width, allocation.width) :
-                                    children_used_nat_size.width;
+  get_children_preferred_size_for_requisition (self, &available_size,
+                                               priv->inverted,
+                                               &children_used_min_size,
+                                               &children_used_nat_size,
+                                               &children_distributed_size);
 
   children_width = gtk_widget_get_allocated_width (priv->children_box);
 
@@ -487,16 +503,16 @@ get_max_scroll (GtkPathBarContainer *self)
     {
       if (priv->inverted)
         {
-          max_scroll = MAX (0, children_width - children_used_width);
+          max_scroll = MAX (0, children_width - children_distributed_size.width);
         }
       else
         {
-          max_scroll = children_width - children_used_width;
+          max_scroll = children_width - children_used_min_size.width;
         }
     }
   else
     {
-      max_scroll = MAX (0, children_width - children_used_width);
+      max_scroll = 0;
     }
 
   return max_scroll;
@@ -623,9 +639,8 @@ finish_invert_animation (GtkPathBarContainer *self)
        * we are going to show the animation of the revealers next time
        * the scroll is updated
        */
-      animation_time =  priv->inverted ? 0 : REVEALER_ANIMATION_TIME;
       gtk_revealer_set_transition_duration (GTK_REVEALER (revealer),
-                                            animation_time);
+                                            0);
       gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE);
       gtk_revealer_set_transition_duration (GTK_REVEALER (revealer),
                                             REVEALER_ANIMATION_TIME);
@@ -634,6 +649,7 @@ finish_invert_animation (GtkPathBarContainer *self)
   priv->invert_animation = FALSE;
   priv->invert_animation_progress = 0;
   priv->invert_animation_initial_time = 0;
+  priv->invert_animation_initial_width = 0;
   gtk_widget_remove_tick_callback (priv->children_box,
                                    priv->invert_animation_tick_id);
   priv->invert_animation_tick_id = 0;
@@ -662,13 +678,16 @@ invert_animation_on_tick (GtkWidget     *widget,
 
   max_scroll = get_max_scroll (self);
   if (!max_scroll)
-    return TRUE;
+    {
+      g_print ("no max scroll\n");
+      return TRUE;
+    }
 
   /* If there are several items the animation can take some time, so let's limit
    * it to some extend
    */
   if (max_scroll / INVERT_ANIMATION_SPEED > INVERT_ANIMATION_MAX_TIME)
-    animation_speed = max_scroll / INVERT_ANIMATION_MAX_TIME;
+    animation_speed = (float) max_scroll / INVERT_ANIMATION_MAX_TIME;
   else
     animation_speed = INVERT_ANIMATION_SPEED;
 
@@ -684,6 +703,8 @@ invert_animation_on_tick (GtkWidget     *widget,
       return FALSE;
     }
 
+  gtk_widget_queue_allocate (gtk_widget_get_parent (GTK_WIDGET (self)));
+
   return TRUE;
 }
 
@@ -696,6 +717,7 @@ start_invert_animation (GtkPathBarContainer *self)
   if (priv->invert_animation)
     finish_invert_animation (self);
 
+  priv->invert_animation_initial_width = gtk_widget_get_allocated_width (GTK_WIDGET (self));
   priv->invert_animation = TRUE;
   priv->invert_animation_progress = 0;
   priv->invert_animation_initial_children_width = gtk_widget_get_allocated_width (GTK_WIDGET (self));
@@ -712,7 +734,8 @@ start_invert_animation (GtkPathBarContainer *self)
 
       gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 0);
       gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE);
-      gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), REVEALER_ANIMATION_TIME);
+      gtk_revealer_set_transition_duration (GTK_REVEALER (revealer),
+                                            REVEALER_ANIMATION_TIME);
     }
 
   priv->invert_animation_tick_id = gtk_widget_add_tick_callback (priv->children_box,
@@ -847,8 +870,7 @@ gtk_path_bar_container_realize (GtkWidget *widget)
   GtkRequisition children_used_min_size;
   GtkRequisition children_used_nat_size;
   GtkRequisition available_size;
-  gboolean overflows;
-  gint children_used_width;
+  GtkRequisition distributed_size;
 
   gtk_widget_set_realized (widget, TRUE);
 
@@ -871,17 +893,16 @@ gtk_path_bar_container_realize (GtkWidget *widget)
 
   available_size.width = allocation.width;
   available_size.height = allocation.height;
-  overflows = get_children_preferred_size_for_requisition (self, &available_size,
-                                                           priv->inverted,
-                                                           &children_used_min_size,
-                                                           &children_used_nat_size);
+  get_children_preferred_size_for_requisition (self, &available_size,
+                                               priv->inverted,
+                                               &children_used_min_size,
+                                               &children_used_nat_size,
+                                               &distributed_size);
 
-  children_used_width = overflows ? MAX (children_used_min_size.width, allocation.width) :
-                                    children_used_nat_size.width;
   attributes.x = 0;
   attributes.y = 0;
-  attributes.width = children_used_width;
-  attributes.height = children_used_nat_size.height;
+  attributes.width = distributed_size.width;
+  attributes.height = distributed_size.height;
 
   priv->bin_window = gdk_window_new (priv->view_window, &attributes,
                                      attributes_mask);
@@ -909,32 +930,45 @@ gtk_path_bar_container_draw (GtkWidget *widget,
   return GDK_EVENT_PROPAGATE;
 }
 
-static gboolean
+static void
 real_get_preferred_size_for_requisition (GtkWidget      *widget,
                                          GtkRequisition *available_size,
                                          GtkRequisition *minimum_size,
-                                         GtkRequisition *natural_size)
+                                         GtkRequisition *natural_size,
+                                         GtkRequisition *distributed_size)
 {
   GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (widget);
   GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
 
-  return  get_children_preferred_size_for_requisition (self, available_size,
-                                                       priv->inverted,
-                                                       minimum_size,
-                                                       natural_size);
+   get_children_preferred_size_for_requisition (self, available_size,
+                                                priv->inverted,
+                                                minimum_size,
+                                                natural_size,
+                                                distributed_size);
+  if (priv->invert_animation)
+    {
+      minimum_size->width += (1 - priv->invert_animation_progress) *
+                              (priv->invert_animation_initial_width - minimum_size->width);
+      natural_size->width += (1 - priv->invert_animation_progress) *
+                              (priv->invert_animation_initial_width - natural_size->width);
+      distributed_size->width += (1 - priv->invert_animation_progress) *
+                                  (priv->invert_animation_initial_width - distributed_size->width);
+    }
 }
 
-gboolean
+void
 gtk_path_bar_container_get_preferred_size_for_requisition (GtkWidget      *widget,
                                                            GtkRequisition *available_size,
                                                            GtkRequisition *minimum_size,
-                                                           GtkRequisition *natural_size)
+                                                           GtkRequisition *natural_size,
+                                                           GtkRequisition *distributed_size)
 {
 
-  return real_get_preferred_size_for_requisition (widget,
-                                                  available_size,
-                                                  minimum_size,
-                                                  natural_size);
+  real_get_preferred_size_for_requisition (widget,
+                                           available_size,
+                                           minimum_size,
+                                           natural_size,
+                                           distributed_size);
 }
 
 static void
diff --git a/gtk/gtkpathbarcontainer.h b/gtk/gtkpathbarcontainer.h
index 81134c7..fa812d6 100644
--- a/gtk/gtkpathbarcontainer.h
+++ b/gtk/gtkpathbarcontainer.h
@@ -49,10 +49,11 @@ struct _GtkPathBarContainerClass
    * overflow and the container reports preferred size for the non overflowing
    * children or the ones the container consider that are going to be visible
    */
-  gboolean        (* get_preferred_size_for_requisition)         (GtkWidget                *widget,
+  void            (* get_preferred_size_for_requisition)         (GtkWidget                *widget,
                                                                   GtkRequisition           *available_size,
                                                                   GtkRequisition           *minimum_size,
-                                                                  GtkRequisition           *natural_size);
+                                                                  GtkRequisition           *natural_size,
+                                                                  GtkRequisition           
*distributed_size);
 
   /* Padding for future expansion */
   gpointer reserved[10];
@@ -104,14 +105,14 @@ GDK_AVAILABLE_IN_3_20
 gint              gtk_path_bar_container_get_unused_width        (GtkPathBarContainer      *self);
 
 GDK_AVAILABLE_IN_3_20
-gboolean          gtk_path_bar_container_get_preferred_size_for_requisition         (GtkWidget               
 *widget,
-                                                                           GtkRequisition           
*available_size,
-                                                                           GtkRequisition           
*minimum_size,
-                                                                           GtkRequisition           
*natural_size);
+void              gtk_path_bar_container_get_preferred_size_for_requisition         (GtkWidget               
 *widget,
+                                                                                     GtkRequisition          
 *available_size,
+                                                                                     GtkRequisition          
 *minimum_size,
+                                                                                     GtkRequisition          
 *natural_size,
+                                                                                     GtkRequisition          
 *distributed_size);
 GDK_AVAILABLE_IN_3_20
-void
-gtk_path_bar_container_adapt_to_size (GtkPathBarContainer *self,
-                                      GtkRequisition      *available_size);
+void              gtk_path_bar_container_adapt_to_size                              (GtkPathBarContainer     
 *self,
+                                                                                     GtkRequisition          
 *available_size);
 
 G_END_DECLS
 
diff --git a/gtk/ui/gtkpathbar.ui b/gtk/ui/gtkpathbar.ui
index 679e772..18f10e7 100644
--- a/gtk/ui/gtkpathbar.ui
+++ b/gtk/ui/gtkpathbar.ui
@@ -4,6 +4,7 @@
   <template class="GtkPathBar" parent="GtkStack">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
     <child>
       <object class="GtkPathBarBox" id="path_bar_1">
         <property name="visible">True</property>
@@ -18,11 +19,6 @@
               <class name="flat"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
         </child>
         <child>
           <object class="GtkButton" id="path_bar_overflow_root_1">
@@ -35,22 +31,12 @@
               <class name="overflow"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
         <child>
           <object class="GtkPathBarContainer" id="path_bar_container_1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
         </child>
         <child>
           <object class="GtkButton" id="path_bar_overflow_tail_1">
@@ -63,11 +49,6 @@
               <class name="overflow"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">3</property>
-          </packing>
         </child>
         <child>
           <object class="GtkButton" id="path_bar_tail_1">
@@ -79,11 +60,6 @@
               <class name="flat"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">4</property>
-          </packing>
         </child>
       </object>
       <packing>
@@ -104,11 +80,6 @@
               <class name="flat"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
         </child>
         <child>
           <object class="GtkButton" id="path_bar_overflow_root_2">
@@ -121,22 +92,12 @@
               <class name="overflow"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
         <child>
           <object class="GtkPathBarContainer" id="path_bar_container_2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
         </child>
         <child>
           <object class="GtkButton" id="path_bar_overflow_tail_2">
@@ -149,11 +110,6 @@
               <class name="overflow"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">3</property>
-          </packing>
         </child>
         <child>
           <object class="GtkButton" id="path_bar_tail_2">
@@ -165,11 +121,6 @@
               <class name="flat"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">4</property>
-          </packing>
         </child>
       </object>
       <packing>
diff --git a/tests/testpathbar.c b/tests/testpathbar.c
index 87ab983..f6954b3 100644
--- a/tests/testpathbar.c
+++ b/tests/testpathbar.c
@@ -12,7 +12,7 @@ static GtkWidget *files_path_bar_random;
 static GtkWidget *files_path_bar_recent;
 static const gchar* REAL_LOCATION_RANDOM = "file:///boot/efi/EFI/BOOT";
 static const gchar* REAL_LOCATION_RECENT = "recent:///";
-static const gchar* ORIGINAL_PATH = "/test/test 2/test 3/asda lkasdl/pppppppppppppppp/ alskd";
+static const gchar* ORIGINAL_PATH = "/test/test 2/test 3/asda 
lkasdl/pppppppppppppppp/alskd/t/t/test3/tttttt/tast/aaaaaaaaaaaaaaaaaaaaaaaaaa";
 static const gchar* ROOT_PATH = "/test/test 2/test 3";
 static const gchar* DISPLAY_PATH = "/test/test 2/This Is A Root/asda lkasdl/pppppppppppppppp/ alskd";
 
diff --git a/tests/testpathbarcontainer.c b/tests/testpathbarcontainer.c
index caf9733..1798d4f 100644
--- a/tests/testpathbarcontainer.c
+++ b/tests/testpathbarcontainer.c
@@ -1,10 +1,16 @@
 #include "config.h"
 #include "glib.h"
 #include <gtk/gtk.h>
+#define GTK_COMPILATION
+#include <gtk/gtkpathbarcontainer.h>
+#include <gtk/gtkpathbarcontainer.c>
+#include <gtk/gtkpathbarboxprivate.h>
+#include <gtk/gtkpathbarbox.c>
 
 #define N_BUTTONS 10
 
 static GtkWidget *path_bar_container;
+static GtkWidget *path_bar_box;
 static char *lorem_ipsum = "Loremipsumdolorsitamet, consecteturadipisicingelit,";
 
 static char*
@@ -56,6 +62,7 @@ on_add_button (gint line)
   gtk_widget_show (button);
   g_signal_connect (button, "clicked", (GCallback) on_button_clicked, path_bar_container);
   gtk_path_bar_container_add (GTK_PATH_BAR_CONTAINER (path_bar_container), button);
+  gtk_container_add (GTK_CONTAINER (path_bar_box), gtk_button_new_with_label ("eeeeoo"));
 }
 
 static void
@@ -104,20 +111,23 @@ main (int argc, char *argv[])
 
   grid = gtk_grid_new ();
   g_type_ensure (GTK_TYPE_PATH_BAR_CONTAINER);
+  g_type_ensure (GTK_TYPE_PATH_BAR_BOX);
 
   label = gtk_label_new ("Generic GtkPathBar tests");
   gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 2, 1);
 
   /* ----------------------------------------------------------------------- */
   path_bar_container = gtk_path_bar_container_new ();
-  gtk_grid_attach (GTK_GRID (grid), path_bar_container, 0, 1, 1, 1);
-  gtk_widget_show_all (path_bar_container);
+  path_bar_box = gtk_path_bar_box_new ();
+  gtk_container_add (GTK_CONTAINER (path_bar_box), path_bar_container);
+  gtk_grid_attach (GTK_GRID (grid), path_bar_box, 0, 1, 1, 1);
+  gtk_widget_show_all (path_bar_box);
   /* Add/Remove buttons */
   add_button = gtk_button_new_with_label ("Add");
   gtk_widget_set_halign (add_button, GTK_ALIGN_END);
   remove_button = gtk_button_new_with_label ("Remove");
   gtk_widget_set_halign (remove_button, GTK_ALIGN_END);
-  gtk_grid_attach_next_to (GTK_GRID (grid), add_button, path_bar_container, GTK_POS_RIGHT, 1, 1);
+  gtk_grid_attach_next_to (GTK_GRID (grid), add_button, path_bar_box, GTK_POS_RIGHT, 1, 1);
   g_signal_connect_swapped (add_button, "clicked", (GCallback) on_add_button, GINT_TO_POINTER (0));
   gtk_grid_attach_next_to (GTK_GRID (grid), remove_button, add_button, GTK_POS_RIGHT, 1, 1);
   g_signal_connect_swapped (remove_button, "clicked", (GCallback) on_remove_button, GINT_TO_POINTER (0));


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