container: Split out a function

This commit is contained in:
Benjamin Otte 2012-04-09 21:04:47 +02:00
parent 090f30c559
commit 97dc45f8a5
2 changed files with 45 additions and 33 deletions

View File

@ -1666,6 +1666,47 @@ gtk_container_idle_sizer (gpointer data)
return FALSE;
}
void
_gtk_container_queue_resize_handler (GtkContainer *container)
{
GtkWidget *widget;
g_return_if_fail (GTK_IS_RESIZE_CONTAINER (container));
widget = GTK_WIDGET (container);
if (gtk_widget_get_visible (widget) &&
(gtk_widget_is_toplevel (widget) ||
gtk_widget_get_realized (widget)))
{
switch (container->priv->resize_mode)
{
case GTK_RESIZE_QUEUE:
if (!_gtk_widget_get_resize_pending (widget))
{
_gtk_widget_set_resize_pending (widget, TRUE);
if (container_resize_queue == NULL)
gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
gtk_container_idle_sizer,
NULL, NULL);
container_resize_queue = g_slist_prepend (container_resize_queue, container);
}
break;
case GTK_RESIZE_IMMEDIATE:
_gtk_style_context_validate (gtk_widget_get_style_context (widget),
g_get_monotonic_time (),
0);
gtk_container_check_resize (container);
case GTK_RESIZE_PARENT:
default:
g_assert_not_reached ();
break;
}
}
}
static void
_gtk_container_queue_resize_internal (GtkContainer *container,
gboolean invalidate_only)
@ -1690,39 +1731,7 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
while (widget);
if (widget && !invalidate_only)
{
container = GTK_CONTAINER (widget);
if (gtk_widget_get_visible (widget) &&
(gtk_widget_is_toplevel (widget) ||
gtk_widget_get_realized (widget)))
{
switch (container->priv->resize_mode)
{
case GTK_RESIZE_QUEUE:
if (!_gtk_widget_get_resize_pending (widget))
{
_gtk_widget_set_resize_pending (widget, TRUE);
if (container_resize_queue == NULL)
gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
gtk_container_idle_sizer,
NULL, NULL);
container_resize_queue = g_slist_prepend (container_resize_queue, container);
}
break;
case GTK_RESIZE_IMMEDIATE:
_gtk_style_context_validate (gtk_widget_get_style_context (widget),
g_get_monotonic_time (),
0);
break;
case GTK_RESIZE_PARENT:
g_assert_not_reached ();
break;
}
}
}
_gtk_container_queue_resize_handler (GTK_CONTAINER (widget));
}
/**

View File

@ -20,6 +20,8 @@
#ifndef __GTK_CONTAINER_PRIVATE_H__
#define __GTK_CONTAINER_PRIVATE_H__
#include "gtkcontainer.h"
G_BEGIN_DECLS
@ -29,6 +31,7 @@ void _gtk_container_resize_invalidate (GtkContainer *container);
void _gtk_container_clear_resize_widgets (GtkContainer *container);
gchar* _gtk_container_child_composite_name (GtkContainer *container,
GtkWidget *child);
void _gtk_container_queue_resize_handler (GtkContainer *container);
void _gtk_container_dequeue_resize_handler (GtkContainer *container);
GList * _gtk_container_focus_sort (GtkContainer *container,
GList *children,