]> Pileus Git - ~andy/gtk/commitdiff
return TRUE if there are disappearing placeholders that are still visible.
authorSoeren Sandmann <sandmann@daimi.au.dk>
Sun, 30 Nov 2003 16:37:38 +0000 (16:37 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Sun, 30 Nov 2003 16:37:38 +0000 (16:37 +0000)
Sun Nov 30 17:31:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

* gtk/gtktoolbar.c (slide_idle_handler): return TRUE if there are
disappearing placeholders that are still visible.

* gtk/gtktoolbar.c: formatting fixes

* gtk/gtktoolbar.c (struct _ToolbarContent): new bit:
disappearing, for placeholders that are going to disappear.

* gtk/gtktoolbar.c (get_item_size): return 0 for disappearing placeholders

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktoolbar.c

index 4b9f12736fc06bc1958d40756965307ade73825e..d646b01fe1f783f7bdc60ecfe065c4d312bec362 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Sun Nov 30 17:31:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (slide_idle_handler): return TRUE if there are
+       disappearing placeholders that are still visible.
+
+       * gtk/gtktoolbar.c: formatting fixes
+
+       * gtk/gtktoolbar.c (struct _ToolbarContent): new bit:
+       disappearing, for placeholders that are going to disappear.
+
+       * gtk/gtktoolbar.c (get_item_size): return 0 for disappearing placeholders
+
 Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
index 4b9f12736fc06bc1958d40756965307ade73825e..d646b01fe1f783f7bdc60ecfe065c4d312bec362 100644 (file)
@@ -1,3 +1,15 @@
+Sun Nov 30 17:31:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (slide_idle_handler): return TRUE if there are
+       disappearing placeholders that are still visible.
+
+       * gtk/gtktoolbar.c: formatting fixes
+
+       * gtk/gtktoolbar.c (struct _ToolbarContent): new bit:
+       disappearing, for placeholders that are going to disappear.
+
+       * gtk/gtktoolbar.c (get_item_size): return 0 for disappearing placeholders
+
 Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
index 4b9f12736fc06bc1958d40756965307ade73825e..d646b01fe1f783f7bdc60ecfe065c4d312bec362 100644 (file)
@@ -1,3 +1,15 @@
+Sun Nov 30 17:31:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (slide_idle_handler): return TRUE if there are
+       disappearing placeholders that are still visible.
+
+       * gtk/gtktoolbar.c: formatting fixes
+
+       * gtk/gtktoolbar.c (struct _ToolbarContent): new bit:
+       disappearing, for placeholders that are going to disappear.
+
+       * gtk/gtktoolbar.c (get_item_size): return 0 for disappearing placeholders
+
 Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
index 4b9f12736fc06bc1958d40756965307ade73825e..d646b01fe1f783f7bdc60ecfe065c4d312bec362 100644 (file)
@@ -1,3 +1,15 @@
+Sun Nov 30 17:31:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (slide_idle_handler): return TRUE if there are
+       disappearing placeholders that are still visible.
+
+       * gtk/gtktoolbar.c: formatting fixes
+
+       * gtk/gtktoolbar.c (struct _ToolbarContent): new bit:
+       disappearing, for placeholders that are going to disappear.
+
+       * gtk/gtktoolbar.c (get_item_size): return 0 for disappearing placeholders
+
 Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
index 4b9f12736fc06bc1958d40756965307ade73825e..d646b01fe1f783f7bdc60ecfe065c4d312bec362 100644 (file)
@@ -1,3 +1,15 @@
+Sun Nov 30 17:31:32 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (slide_idle_handler): return TRUE if there are
+       disappearing placeholders that are still visible.
+
+       * gtk/gtktoolbar.c: formatting fixes
+
+       * gtk/gtktoolbar.c (struct _ToolbarContent): new bit:
+       disappearing, for placeholders that are going to disappear.
+
+       * gtk/gtktoolbar.c (get_item_size): return 0 for disappearing placeholders
+
 Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
index a309ea1337780b337e75b14d6151843d89f9f6fa..6c574e5fe2d0ef5bfe6c5bce92d8305b1ed06778 100644 (file)
@@ -201,34 +201,35 @@ typedef enum {
 
 struct _ToolbarContent
 {
-  GtkToolItem * item;
-  guint         is_placeholder : 1;
-  GtkAllocation start_allocation;
-  GtkAllocation goal_allocation;
-  ItemState     state;
+  GtkToolItem *        item;
+  guint                is_placeholder : 1;
+  guint                disappearing : 1;
+  GtkAllocation        start_allocation;
+  GtkAllocation        goal_allocation;
+  ItemState    state;
 };
 
 struct _GtkToolbarPrivate
 {
-  GList     *content;
+  GList        *       content;
   
-  GtkWidget *arrow;
-  GtkWidget *arrow_button;
+  GtkWidget *  arrow;
+  GtkWidget *  arrow_button;
   
-  gboolean   show_arrow;
+  gboolean     show_arrow;
 
-  GtkMenu   *menu;
+  GtkMenu *    menu;
 
-  GdkWindow *event_window;
-  ApiMode    api_mode;
-  GtkSettings *settings;
-  int        idle_id;
-  gboolean   need_sync;
-  GtkToolItem *highlight_tool_item;
-  gint      max_homogeneous_pixels;
+  GdkWindow *  event_window;
+  ApiMode      api_mode;
+  GtkSettings *        settings;
+  int          idle_id;
+  gboolean     need_sync;
+  GtkToolItem *        highlight_tool_item;
+  gint         max_homogeneous_pixels;
 
-  GTimer   *timer;
-  gboolean  is_sliding;
+  GTimer *     timer;
+  gboolean     is_sliding;
 };
 
 static GtkContainerClass *parent_class = NULL;
@@ -1025,15 +1026,19 @@ fixup_allocation_for_vertical (GtkAllocation *allocation)
 }
 
 static gint
-get_item_size (GtkToolbar *toolbar,
-              GtkWidget  *child)
+get_item_size (GtkToolbar     *toolbar,
+              ToolbarContent *content)
 {
   GtkRequisition requisition;
-  GtkToolItem *item = GTK_TOOL_ITEM (child);
+  GtkToolItem *item = content->item;
 
-  gtk_widget_get_child_requisition (child, &requisition);
-  
-  if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
+  gtk_widget_get_child_requisition (GTK_WIDGET (item), &requisition);
+
+  if (content->is_placeholder && content->disappearing)
+    {
+      return 0;
+    }
+  else if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       if (toolbar_item_is_homogeneous (toolbar, item))
        return toolbar->button_maxw;
@@ -1072,7 +1077,9 @@ slide_idle_handler (gpointer data)
           ((content->goal_allocation.x != widget->allocation.x ||
             content->goal_allocation.y != widget->allocation.y ||
             content->goal_allocation.width != widget->allocation.width ||
-            content->goal_allocation.height != widget->allocation.height))))
+            content->goal_allocation.height != widget->allocation.height))) ||
+         (content->is_placeholder && content->disappearing &&
+          GTK_WIDGET_VISIBLE (content->item)))
        {
          gtk_widget_queue_resize_no_redraw (GTK_WIDGET (toolbar));
          return TRUE;
@@ -1292,10 +1299,9 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
   for (list = priv->content; list != NULL; list = list->next)
     {
       ToolbarContent *content = list->data;
-      GtkToolItem *item = content->item;
       
-      if (toolbar_item_visible (toolbar, item))
-       needed_size += get_item_size (toolbar, GTK_WIDGET (item));
+      if (toolbar_item_visible (toolbar, content->item))
+       needed_size += get_item_size (toolbar, content);
     }
 
   need_arrow = (needed_size > available_size) && priv->show_arrow && priv->api_mode == NEW_API;
@@ -1319,7 +1325,7 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
          continue;
        }
 
-      item_size = get_item_size (toolbar, GTK_WIDGET (item));
+      item_size = get_item_size (toolbar, content);
       if (item_size <= size && !overflowing)
        {
          size -= item_size;
@@ -1484,13 +1490,14 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
                                               &(content->start_allocation),
                                               &(content->goal_allocation),
                                               &alloc);
+
              priv->need_sync = TRUE;
            }
          else
            {
              alloc = allocations[i];
            }
-         
+
          if (alloc.width == 0 || alloc.height == 0)
            {
              gtk_widget_set_child_visible (GTK_WIDGET (item), FALSE);
@@ -1872,7 +1879,7 @@ reset_all_placeholders (GtkToolbar *toolbar)
     {
       ToolbarContent *content = list->data;
       if (content->is_placeholder)
-       gtk_widget_set_size_request (GTK_WIDGET (content->item), 0, 0);
+       content->disappearing = TRUE;
     }
 }
 
@@ -2025,6 +2032,8 @@ gtk_toolbar_set_drop_highlight_item (GtkToolbar  *toolbar,
 
   reset_all_placeholders (toolbar);
   
+  content->disappearing = FALSE;
+  
   gtk_widget_size_request (GTK_WIDGET (priv->highlight_tool_item),
                           &requisition);
 
@@ -2670,8 +2679,6 @@ gtk_toolbar_set_style (GtkToolbar      *toolbar,
 
   toolbar->style_set = TRUE;  
   g_signal_emit (toolbar, toolbar_signals[STYLE_CHANGED], 0, style);
-
-  
 }
 
 /**