[gtk+/wip/csoriano/pathbar-bin-view-window] remove tail handling before invert animation



commit f81b1ebdec98f61112c472f4f52287ab73611306
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Jul 21 15:14:38 2016 +0200

    remove tail handling before invert animation

 gtk/gtkpathbar.c          |   13 +++++++++++--
 gtk/gtkpathbarbox.c       |    7 +------
 gtk/gtkpathbarcontainer.c |    9 +++------
 3 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index f845f75..775cf36 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -511,9 +511,9 @@ update_overflow (GtkPathBar *self)
   GtkWidget *overflow_button;
 
   get_path_bar_widgets (GTK_PATH_BAR (self), NULL, &overflow_button, NULL, &path_bar_container, TRUE);
+  children = gtk_path_bar_container_get_children (path_bar_container);
   shown_children = gtk_path_bar_container_get_shown_children (path_bar_container);
   last_shown_child = g_list_last (shown_children);
-  children = gtk_path_bar_container_get_children (path_bar_container);
 
   for (child = children; child != NULL; child = child->next)
     {
@@ -534,7 +534,7 @@ update_overflow (GtkPathBar *self)
       hide_overflow_handling (self);
     }
   else if (g_list_length (shown_children) != g_list_length (children) &&
-           !gtk_widget_get_visible (overflow_button) && !priv->inverted)
+           !gtk_widget_get_visible (overflow_button) && !priv->inverted && 
!gtk_path_bar_container_get_invert_animation (path_bar_container))
     {
       g_print ("~~~~~~~~~~~changeeeeed different length %d %d\n", g_list_length (shown_children), 
g_list_length (children));
       start_overflow_handling (self);
@@ -1069,6 +1069,8 @@ gtk_path_bar_set_inverted (GtkPathBar *self,
       GtkWidget *overflow_button;
       GtkWidget *tail_button;
       GtkWidget *path_bar_container;
+  GList *children;
+  GList *shown_children;
 
       priv->inverted = inverted != FALSE;
 
@@ -1076,6 +1078,13 @@ gtk_path_bar_set_inverted (GtkPathBar *self,
 
       get_path_bar_widgets (GTK_PATH_BAR (self), &path_bar_container, &overflow_button, &tail_button, NULL, 
TRUE);
 
+      get_path_bar_widgets (GTK_PATH_BAR (self), NULL, &overflow_button, NULL, &path_bar_container, TRUE);
+      children = gtk_path_bar_container_get_children (path_bar_container);
+      shown_children = gtk_path_bar_container_get_shown_children (path_bar_container);
+
+      if (g_list_length (children) != g_list_length (shown_children))
+        hide_overflow_handling (self);
+
       gtk_path_bar_container_set_inverted (GTK_PATH_BAR_CONTAINER (priv->path_bar_container_1), inverted);
       gtk_path_bar_container_set_inverted (GTK_PATH_BAR_CONTAINER (priv->path_bar_container_2), inverted);
 
diff --git a/gtk/gtkpathbarbox.c b/gtk/gtkpathbarbox.c
index dec1950..43e51e1 100644
--- a/gtk/gtkpathbarbox.c
+++ b/gtk/gtkpathbarbox.c
@@ -123,7 +123,6 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
 
   for (child = children, i = 0; child != NULL; child = g_list_next (child), i++)
     {
-      g_print ("minimum size bef %d\n", gtk_widget_get_visible (child->data));
       if (!gtk_widget_get_visible (child->data))
         continue;
 
@@ -131,7 +130,6 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
                                                  allocation->height,
                                                  &sizes[i].minimum_size,
                                                  &sizes[i].natural_size);
-      g_print ("minimum size %d %d\n", i, sizes[i].minimum_size);
       sizes[i].data = child->data;
       available_size -= sizes[i].minimum_size;
       n_visible_children++;
@@ -140,16 +138,13 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
   gtk_distribute_natural_allocation (MAX (0, available_size),
                                      n_visible_children, sizes);
 
-  g_print ("n visible children %d\n", n_visible_children);
   for (child = children, i = 0; child != NULL; child = g_list_next (child), i++)
     {
-      g_print ("allocate size bef %d\n", gtk_widget_get_visible (child->data));
       if (!gtk_widget_get_visible (child->data))
         continue;
 
       child_available_size.width = sizes[i].minimum_size;
       child_available_size.height = allocation->height;
-      g_print ("path bar box size allocate really? %d %d\n", child_available_size.width, 
child_available_size.height);
 
       if (GTK_IS_PATH_BAR_CONTAINER (child->data))
         {
@@ -161,8 +156,8 @@ gtk_path_bar_box_size_allocate (GtkWidget     *widget,
                                                                      &natural_size,
                                                                      &distributed_size);
 
-          g_print ("path bar box size allocate %d %d\n", child_available_size.width, distributed_size.width);
           sizes[i].minimum_size = MIN (child_available_size.width, distributed_size.width);
+          g_print ("pathbar getting %d\n", sizes[i].minimum_size);
         }
 
       child_allocation.x = current_x;
diff --git a/gtk/gtkpathbarcontainer.c b/gtk/gtkpathbarcontainer.c
index e76891e..6b0fcb2 100644
--- a/gtk/gtkpathbarcontainer.c
+++ b/gtk/gtkpathbarcontainer.c
@@ -382,7 +382,6 @@ update_children_visibility (GtkPathBarContainer *self)
 
       if (!allocate_more_children || current_children_width > available_size.width)
         {
-          g_print ("€€€€ Not allocate more %d \n", available_size.width);
           allocate_more_children = FALSE;
           if (gtk_revealer_get_child_revealed (GTK_REVEALER (gtk_widget_get_parent (child_widget))))
             children_to_hide = g_list_prepend (children_to_hide, child_widget);
@@ -392,7 +391,6 @@ update_children_visibility (GtkPathBarContainer *self)
 
       if (!g_list_find (priv->children_to_remove, child_widget))
         children_to_show = g_list_prepend (children_to_show, child_widget);
-      g_print ("children to show %d %d\n", g_list_length (children_to_show), i);
     }
 
   for (child = children_to_show, child_to_compare = priv->children_to_show;
@@ -432,7 +430,6 @@ update_children_visibility (GtkPathBarContainer *self)
         {
           priv->children_to_show = g_list_reverse (priv->children_to_show);
           priv->children_to_hide = g_list_reverse (priv->children_to_hide);
-          g_print ("children to sho????%d", g_list_length (priv->children_to_show));
         };
 
       if (!priv->children_shown_idle_id)
@@ -595,12 +592,10 @@ get_max_scroll (GtkPathBarContainer *self)
     {
       if (priv->inverted)
         {
-          g_print ("max scroll %d %d %d\n", available_size.width, children_width, 
children_distributed_size.width);
           max_scroll = MAX (0, children_width - children_distributed_size.width);
         }
       else
         {
-          g_print ("max scroll non inverted %d %d %d\n", available_size.width, children_width, 
children_distributed_size.width);
           max_scroll = MAX (0, children_width - children_distributed_size.width);
         }
     }
@@ -774,7 +769,6 @@ invert_animation_on_tick (GtkWidget     *widget,
 
   if (!max_scroll)
     {
-      g_print ("no max scroll\n");
       finish_invert_animation (self);
       return FALSE;
     }
@@ -814,6 +808,7 @@ start_invert_animation (GtkPathBarContainer *self)
     finish_invert_animation (self);
 
   priv->invert_animation_initial_width = gtk_widget_get_allocated_width (GTK_WIDGET (self));
+  g_print ("INITIAL INVERT ANIMATION WIDTH %d\n", priv->invert_animation_initial_width);
   priv->invert_animation = TRUE;
   priv->invert_animation_progress = 0;
   priv->allocated = FALSE;
@@ -1057,6 +1052,7 @@ real_get_preferred_size_for_requisition (GtkWidget      *widget,
                               (priv->invert_animation_initial_width - natural_size->width);
       distributed_size->width += (1 - priv->invert_animation_progress) *
                                   (priv->invert_animation_initial_width - distributed_size->width);
+  g_print ("real get preferres size %d %d %d\n", minimum_size->width, natural_size->width, 
distributed_size->width);
     }
 }
 
@@ -1170,6 +1166,7 @@ gtk_path_bar_container_adapt_to_size (GtkPathBarContainer *self,
   GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
 
   priv->parent_available_width = available_size->width;
+  g_print ("adapt to size %d\n", priv->parent_available_width);
 
   update_children_visibility (self);
   idle_update_revealers (self);


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