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;
}
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;
((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;
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;
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;
&(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);
{
ToolbarContent *content = list->data;
if (content->is_placeholder)
- gtk_widget_set_size_request (GTK_WIDGET (content->item), 0, 0);
+ content->disappearing = TRUE;
}
}
reset_all_placeholders (toolbar);
+ content->disappearing = FALSE;
+
gtk_widget_size_request (GTK_WIDGET (priv->highlight_tool_item),
&requisition);
toolbar->style_set = TRUE;
g_signal_emit (toolbar, toolbar_signals[STYLE_CHANGED], 0, style);
-
-
}
/**