Commit 5a1415fe authored by Johannes Schmid's avatar Johannes Schmid Committed by Murray Cumming

Added GtkToolPalette.

        * gtk/gtktoolpallete.[h|cc]:
        * gtk/gtktoolitemgroup.[h|cc]: Added a tool pallete container widget,
        with groups of toolbar items that can be shown as a grid of icons
        or a list of names.
        * gtk/Makefile.am:
        * gtk/gtk.h:
        * gtk/gtkmarshal.list: Mentioned the new files.

        Bug #567729
parent 8e9436da
......@@ -87,6 +87,7 @@ IGNORE_HFILES= \
gtktrayicon.h \
gtktreedatalist.h \
gtktreeprivate.h \
gtktoolpaletteprivate.h \
gtktypebuiltins.h \
gtkxembed.h \
gtkwin32embed.h \
......@@ -335,6 +336,7 @@ HTML_IMAGES = \
$(srcdir)/images/statusbar.png \
$(srcdir)/images/toggle-button.png \
$(srcdir)/images/toolbar.png \
$(srcdir)/images/toolpalette.png \
$(srcdir)/images/tree-view-coordinates.png \
$(srcdir)/images/volumebutton.png \
$(srcdir)/images/window.png \
......
......@@ -238,6 +238,8 @@ that is, GUI components such as #GtkButton or #GtkTextView.
<xi:include href="xml/gtktoolshell.xml" />
<xi:include href="xml/gtktoolbar.xml" />
<xi:include href="xml/gtktoolitem.xml" />
<xi:include href="xml/gtktoolpalette.xml" />
<xi:include href="xml/gtktoolitemgroup.xml" />
<xi:include href="xml/gtkseparatortoolitem.xml" />
<xi:include href="xml/gtktoolbutton.xml" />
<xi:include href="xml/gtkmenutoolbutton.xml" />
......
......@@ -4430,6 +4430,109 @@ GTK_TOOLTIPS_GET_CLASS
gtk_tooltips_get_type
</SECTION>
<SECTION>
<FILE>gtktoolpalette</FILE>
<TITLE>GtkToolPalette</TITLE>
GtkToolPalette
gtk_tool_palette_new
gtk_tool_palette_get_exclusive
gtk_tool_palette_set_exclusive
gtk_tool_palette_get_expand
gtk_tool_palette_set_expand
gtk_tool_palette_get_group_position
gtk_tool_palette_set_group_position
gtk_tool_palette_get_icon_size
gtk_tool_palette_set_icon_size
gtk_tool_palette_get_orientation
gtk_tool_palette_set_orientation
gtk_tool_palette_get_style
gtk_tool_palette_set_style
gtk_tool_palette_add_drag_dest
gtk_tool_palette_get_drag_item
gtk_tool_palette_get_drag_target_group
gtk_tool_palette_get_drag_target_item
gtk_tool_palette_get_drop_group
gtk_tool_palette_get_drop_item
gtk_tool_palette_set_drag_source
<SUBSECTION Standard>
GtkToolPaletteClass
GTK_TOOL_PALETTE
GTK_IS_TOOL_PALETTE
GTK_TYPE_TOOL_PALETTE
GTK_TOOL_PALETTE_CLASS
GTK_IS_TOOL_PALETTE_CLASS
GTK_TOOL_PALETTE_GET_CLASS
<SUBSECTION Private>
gtk_tool_palette_get_type
GtkToolPalettePrivate
</SECTION>
<SECTION>
<FILE>gtktoolitemgroup</FILE>
<TITLE>GtkToolItemGroup</TITLE>
GtkToolItemGroup
gtk_tool_item_group_get_collapsed
gtk_tool_item_group_get_drop_item
gtk_tool_item_group_get_ellipsize
gtk_tool_item_group_get_item_position
gtk_tool_item_group_get_n_items
gtk_tool_item_group_get_name
gtk_tool_item_group_get_nth_item
gtk_tool_item_group_insert
gtk_tool_item_group_new
gtk_tool_item_group_set_collapsed
gtk_tool_item_group_set_ellipsize
gtk_tool_item_group_set_item_position
gtk_tool_item_group_set_name
<SUBSECTION Standard>
GtkToolItemGroupClass
GTK_TOOL_ITEM_GROUP
GTK_IS_TOOL_ITEM_GROUP
GTK_TYPE_TOOL_ITEM_GROUP
GTK_TOOL_ITEM_GROUP_CLASS
GTK_IS_TOOL_ITEM_GROUP_CLASS
GTK_TOOL_ITEM_GROUP_GET_CLASS
<SUBSECTION Private>
gtk_tool_item_group_get_type
</SECTION>
<SECTION>
<FILE>GtkToolPalette</FILE>
<TITLE>GtkToolPalette</TITLE>
GtkToolPalette
gtk_tool_palette_new
gtk_tool_palette_get_exclusive
gtk_tool_palette_set_exclusive
gtk_tool_palette_get_expand
gtk_tool_palette_set_expand
gtk_tool_palette_get_group_position
gtk_tool_palette_set_group_position
gtk_tool_palette_get_icon_size
gtk_tool_palette_set_icon_size
gtk_tool_palette_get_orientation
gtk_tool_palette_set_orientation
gtk_tool_palette_get_style
gtk_tool_palette_set_style
gtk_tool_palette_add_drag_dest
gtk_tool_palette_get_drag_item
gtk_tool_palette_get_drag_target_group
gtk_tool_palette_get_drag_target_item
gtk_tool_palette_get_drop_group
gtk_tool_palette_get_drop_item
gtk_tool_palette_set_drag_source
<SUBSECTION Standard>
GtkToolPaletteClass
GTK_TOOL_PALETTE
GTK_IS_TOOL_PALETTE
GTK_TYPE_TOOL_PALETTE
GTK_TOOL_PALETTE_CLASS
GTK_IS_TOOL_PALETTE_CLASS
GTK_TOOL_PALETTE_GET_CLASS
<SUBSECTION Private>
gtk_tool_palette_get_type
GtkToolPalettePrivate
</SECTION>
<SECTION>
<FILE>gtktooltip</FILE>
<TITLE>GtkTooltip</TITLE>
......
......@@ -166,6 +166,8 @@ gtk_toggle_tool_button_get_type
gtk_toolbar_get_type
gtk_tool_button_get_type
gtk_tool_item_get_type
gtk_tool_item_group_get_type
gtk_tool_palette_get_type
gtk_tooltips_get_type
gtk_tree_drag_dest_get_type
gtk_tree_drag_source_get_type
......
......@@ -95,6 +95,9 @@
</link>
<link linkend="GtkToolbar">
<inlinegraphic fileref="toolbar.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkToolPalette">
<inlinegraphic fileref="toolpalette.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkTreeView">
<inlinegraphic fileref="list-and-tree.png" format="PNG"></inlinegraphic>
......
......@@ -311,6 +311,8 @@ gtk_public_h_sources = \
gtktoolbar.h \
gtktoolbutton.h \
gtktoolitem.h \
gtktoolitemgroup.h \
gtktoolpalette.h \
gtktoolshell.h \
gtktooltip.h \
gtktreednd.h \
......@@ -586,6 +588,8 @@ gtk_base_c_sources = \
gtktoolbar.c \
gtktoolbutton.c \
gtktoolitem.c \
gtktoolitemgroup.c \
gtktoolpalette.c \
gtktoolshell.c \
gtktooltip.c \
gtktreedatalist.c \
......
......@@ -188,6 +188,8 @@
#include <gtk/gtktoolbar.h>
#include <gtk/gtktoolbutton.h>
#include <gtk/gtktoolitem.h>
#include <gtk/gtktoolitemgroup.h>
#include <gtk/gtktoolpalette.h>
#include <gtk/gtktoolshell.h>
#include <gtk/gtktooltip.h>
#include <gtk/gtktestutils.h>
......
/* GtkToolPalette -- A tool palette with categories and DnD support
* Copyright (C) 2008 Openismus GmbH
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Mathias Hasselmann
* Jan Arne Petersen
*/
#include "gtktoolpaletteprivate.h"
#include <gtk/gtk.h>
#include <math.h>
#include <string.h>
#define P_(msgid) (msgid)
#define ANIMATION_TIMEOUT 50
#define ANIMATION_DURATION (ANIMATION_TIMEOUT * 4)
#define DEFAULT_ANIMATION_STATE TRUE
#define DEFAULT_EXPANDER_SIZE 16
#define DEFAULT_HEADER_SPACING 2
#define DEFAULT_NAME NULL
#define DEFAULT_COLLAPSED FALSE
#define DEFAULT_ELLIPSIZE PANGO_ELLIPSIZE_NONE
/**
* SECTION:GtkToolItemGroup
* @short_description: A sub container used in a tool palette
* @include: gtktoolitemgroup.h
*
* An #GtkToolItemGroup is used together with #GtkToolPalette to add #GtkToolItem<!-- -->s to a palette like container
* with different categories and drag and drop support.
*
* Since: 2.18
*/
enum
{
PROP_NONE,
PROP_NAME,
PROP_COLLAPSED,
PROP_ELLIPSIZE,
PROP_RELIEF
};
enum
{
CHILD_PROP_NONE,
CHILD_PROP_HOMOGENEOUS,
CHILD_PROP_EXPAND,
CHILD_PROP_FILL,
CHILD_PROP_NEW_ROW,
CHILD_PROP_POSITION,
};
typedef struct _GtkToolItemGroupChild GtkToolItemGroupChild;
struct _GtkToolItemGroupPrivate
{
GtkWidget *header;
GList *children;
gboolean animation;
gint64 animation_start;
GSource *animation_timeout;
GtkExpanderStyle expander_style;
gint expander_size;
gint header_spacing;
PangoEllipsizeMode ellipsize;
gulong focus_set_id;
GtkWidget *toplevel;
GtkSettings *settings;
gulong settings_connection;
guint collapsed : 1;
};
struct _GtkToolItemGroupChild
{
GtkToolItem *item;
guint homogeneous : 1;
guint expand : 1;
guint fill : 1;
guint new_row : 1;
};
static void gtk_tool_item_group_tool_shell_init (GtkToolShellIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkToolItemGroup, gtk_tool_item_group, GTK_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (GTK_TYPE_TOOL_SHELL, gtk_tool_item_group_tool_shell_init));
static GtkWidget*
gtk_tool_item_group_get_alignment (GtkToolItemGroup *group)
{
return gtk_bin_get_child (GTK_BIN (group->priv->header));
}
static GtkWidget*
gtk_tool_item_group_get_label (GtkToolItemGroup *group)
{
GtkWidget *alignment = gtk_tool_item_group_get_alignment (group);
return gtk_bin_get_child (GTK_BIN (alignment));
}
static GtkOrientation
gtk_tool_item_group_get_orientation (GtkToolShell *shell)
{
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
if (GTK_IS_TOOL_PALETTE (parent))
return gtk_tool_palette_get_orientation (GTK_TOOL_PALETTE (parent));
return GTK_ORIENTATION_VERTICAL;
}
static GtkToolbarStyle
gtk_tool_item_group_get_style (GtkToolShell *shell)
{
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
if (GTK_IS_TOOL_PALETTE (parent))
return gtk_tool_palette_get_style (GTK_TOOL_PALETTE (parent));
return GTK_TOOLBAR_ICONS;
}
static GtkIconSize
gtk_tool_item_group_get_icon_size (GtkToolShell *shell)
{
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
if (GTK_IS_TOOL_PALETTE (parent))
return gtk_tool_palette_get_icon_size (GTK_TOOL_PALETTE (parent));
return GTK_ICON_SIZE_SMALL_TOOLBAR;
}
#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
static PangoEllipsizeMode
gtk_tool_item_group_get_ellipsize_mode (GtkToolShell *shell)
{
return GTK_TOOL_ITEM_GROUP (shell)->priv->ellipsize;
}
static gfloat
gtk_tool_item_group_get_text_alignment (GtkToolShell *shell)
{
if (GTK_TOOLBAR_TEXT == gtk_tool_item_group_get_style (shell) ||
GTK_TOOLBAR_BOTH_HORIZ == gtk_tool_item_group_get_style (shell))
return 0.0;
return 0.5;
}
static GtkOrientation
gtk_tool_item_group_get_text_orientation (GtkToolShell *shell)
{
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
if (GTK_IS_TOOL_PALETTE (parent))
{
GtkOrientation orientation = gtk_tool_palette_get_orientation (GTK_TOOL_PALETTE (parent));
if (GTK_ORIENTATION_HORIZONTAL == orientation &&
(GTK_TOOLBAR_TEXT == gtk_tool_item_group_get_style (shell)/* ||
GTK_TOOLBAR_BOTH_HORIZ == gtk_tool_item_group_get_style (shell)*/))
return GTK_ORIENTATION_VERTICAL;
}
return GTK_ORIENTATION_HORIZONTAL;
}
static GtkSizeGroup *
gtk_tool_item_group_get_text_size_group (GtkToolShell *shell)
{
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
if (GTK_IS_TOOL_PALETTE (parent))
return _gtk_tool_palette_get_size_group (GTK_TOOL_PALETTE (parent));
return NULL;
}
#endif
static void
animation_change_notify (GtkToolItemGroup *group)
{
GtkSettings *settings = group->priv->settings;
gboolean animation;
if (settings)
g_object_get (settings,
"gtk-enable-animations", &animation,
NULL);
else
animation = DEFAULT_ANIMATION_STATE;
group->priv->animation = animation;
}
static void
gtk_tool_item_group_settings_change_notify (GtkSettings *settings,
const GParamSpec *pspec,
GtkToolItemGroup *group)
{
if (! strcmp (pspec->name, "gtk-enable-animations"))
{
animation_change_notify (group);
}
}
static void
gtk_tool_item_group_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
GtkToolItemGroupPrivate* priv = group->priv;
GtkSettings *old_settings = priv->settings;
GtkSettings *settings;
if (gtk_widget_has_screen (GTK_WIDGET (group)))
settings = gtk_widget_get_settings (GTK_WIDGET (group));
else
settings = NULL;
if (settings == old_settings)
return;
if (old_settings)
{
g_signal_handler_disconnect (old_settings, priv->settings_connection);
g_object_unref (old_settings);
}
if (settings)
{
priv->settings_connection =
g_signal_connect (settings, "notify",
G_CALLBACK (gtk_tool_item_group_settings_change_notify),
group);
priv->settings = g_object_ref (settings);
}
else
priv->settings = NULL;
animation_change_notify (group);
}
static void
gtk_tool_item_group_tool_shell_init (GtkToolShellIface *iface)
{
iface->get_icon_size = gtk_tool_item_group_get_icon_size;
iface->get_orientation = gtk_tool_item_group_get_orientation;
iface->get_style = gtk_tool_item_group_get_style;
#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
iface->get_text_alignment = gtk_tool_item_group_get_text_alignment;
iface->get_text_orientation = gtk_tool_item_group_get_text_orientation;
iface->get_text_size_group = gtk_tool_item_group_get_text_size_group;
iface->get_ellipsize_mode = gtk_tool_item_group_get_ellipsize_mode;
#endif
}
static gboolean
gtk_tool_item_group_header_expose_event_cb (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (data);
GtkExpanderStyle expander_style;
GtkOrientation orientation;
gint x, y;
GtkTextDirection direction;
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
expander_style = group->priv->expander_style;
direction = gtk_widget_get_direction (widget);
if (GTK_ORIENTATION_VERTICAL == orientation)
{
if (GTK_TEXT_DIR_RTL == direction)
x = widget->allocation.x + widget->allocation.width - group->priv->expander_size / 2;
else
x = widget->allocation.x + group->priv->expander_size / 2;
y = widget->allocation.y + widget->allocation.height / 2;
}
else
{
x = widget->allocation.x + widget->allocation.width / 2;
y = widget->allocation.y + group->priv->expander_size / 2;
/* Unfortunatly gtk_paint_expander() doesn't support rotated drawing
* modes. Luckily the following shady arithmetics produce the desired
* result. */
expander_style = GTK_EXPANDER_EXPANDED - expander_style; /* XXX */
}
gtk_paint_expander (widget->style, widget->window,
group->priv->header->state,
&event->area, GTK_WIDGET (group),
"tool-palette-header", x, y,
expander_style);
return FALSE;
}
static void
gtk_tool_item_group_header_size_request_cb (GtkWidget *widget G_GNUC_UNUSED,
GtkRequisition *requisition,
gpointer data)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (data);
requisition->height = MAX (requisition->height, group->priv->expander_size);
}
static void
gtk_tool_item_group_header_clicked_cb (GtkButton *button G_GNUC_UNUSED,
gpointer data)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (data);
GtkWidget *parent = gtk_widget_get_parent (data);
if (group->priv->collapsed ||
!GTK_IS_TOOL_PALETTE (parent) ||
!gtk_tool_palette_get_exclusive (GTK_TOOL_PALETTE (parent), data))
gtk_tool_item_group_set_collapsed (group, !group->priv->collapsed);
}
static void
gtk_tool_item_group_header_adjust_style (GtkToolItemGroup *group)
{
GtkWidget *alignment = gtk_tool_item_group_get_alignment (group);
GtkWidget *label = gtk_bin_get_child (GTK_BIN (alignment));
GtkWidget *widget = GTK_WIDGET (group);
gint dx = 0, dy = 0;
GtkTextDirection direction = gtk_widget_get_direction (widget);
gtk_widget_style_get (widget,
"header-spacing", &group->priv->header_spacing,
"expander-size", &group->priv->expander_size,
NULL);
switch (gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group)))
{
case GTK_ORIENTATION_HORIZONTAL:
dy = group->priv->header_spacing + group->priv->expander_size;
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE);
if (GTK_TEXT_DIR_RTL == direction)
gtk_label_set_angle (GTK_LABEL (label), -90);
else
gtk_label_set_angle (GTK_LABEL (label), 90);
break;
case GTK_ORIENTATION_VERTICAL:
dx = group->priv->header_spacing + group->priv->expander_size;
gtk_label_set_ellipsize (GTK_LABEL (label), group->priv->ellipsize);
gtk_label_set_angle (GTK_LABEL (label), 0);
break;
}
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), dy, 0, dx, 0);
}
static void
gtk_tool_item_group_init (GtkToolItemGroup *group)
{
GtkWidget *alignment;
GtkWidget *label;
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (group), FALSE);
group->priv = G_TYPE_INSTANCE_GET_PRIVATE (group,
GTK_TYPE_TOOL_ITEM_GROUP,
GtkToolItemGroupPrivate);
group->priv->children = NULL;
group->priv->header_spacing = DEFAULT_HEADER_SPACING;
group->priv->expander_size = DEFAULT_EXPANDER_SIZE;
group->priv->expander_style = GTK_EXPANDER_EXPANDED;
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
gtk_container_add (GTK_CONTAINER (alignment), label);
gtk_widget_show_all (alignment);
gtk_widget_push_composite_child ();
group->priv->header = gtk_button_new ();
gtk_widget_set_composite_name (group->priv->header, "header");
gtk_widget_pop_composite_child ();
g_object_ref_sink (group->priv->header);
gtk_button_set_focus_on_click (GTK_BUTTON (group->priv->header), FALSE);
gtk_container_add (GTK_CONTAINER (group->priv->header), alignment);
gtk_widget_set_parent (group->priv->header, GTK_WIDGET (group));
gtk_tool_item_group_header_adjust_style (group);
g_signal_connect_after (alignment, "expose-event",
G_CALLBACK (gtk_tool_item_group_header_expose_event_cb),
group);
g_signal_connect_after (alignment, "size-request",
G_CALLBACK (gtk_tool_item_group_header_size_request_cb),
group);
g_signal_connect (group->priv->header, "clicked",
G_CALLBACK (gtk_tool_item_group_header_clicked_cb),
group);
}
static void
gtk_tool_item_group_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (object);
switch (prop_id)
{
case PROP_NAME:
gtk_tool_item_group_set_name (group, g_value_get_string (value));
break;
case PROP_COLLAPSED:
gtk_tool_item_group_set_collapsed (group, g_value_get_boolean (value));
break;
case PROP_ELLIPSIZE:
gtk_tool_item_group_set_ellipsize (group, g_value_get_enum (value));
break;
case PROP_RELIEF:
gtk_tool_item_group_set_header_relief (group, g_value_get_enum(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_tool_item_group_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (object);
switch (prop_id)
{
case PROP_NAME:
g_value_set_string (value, gtk_tool_item_group_get_name (group));
break;
case PROP_COLLAPSED:
g_value_set_boolean (value, gtk_tool_item_group_get_collapsed (group));
break;
case PROP_ELLIPSIZE:
g_value_set_enum (value, gtk_tool_item_group_get_ellipsize (group));
break;
case PROP_RELIEF:
g_value_set_enum (value, gtk_tool_item_group_get_header_relief (group));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_tool_item_group_finalize (GObject *object)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (object);
if (group->priv->children)
{
g_list_free (group->priv->children);
group->priv->children = NULL;
}
G_OBJECT_CLASS (gtk_tool_item_group_parent_class)->finalize (object);
}
static void
gtk_tool_item_group_dispose (GObject *object)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (object);
if (group->priv->toplevel)
{
/* disconnect focus tracking handler */
g_signal_handler_disconnect (group->priv->toplevel,
group->priv->focus_set_id);
group->priv->focus_set_id = 0;
group->priv->toplevel = NULL;
}
G_OBJECT_CLASS (gtk_tool_item_group_parent_class)->dispose (object);
}
static void
gtk_tool_item_group_get_item_size (GtkToolItemGroup *group,
GtkRequisition *item_size,
gboolean homogeneous_only,
gint *requested_rows)
{
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (group));
if (GTK_IS_TOOL_PALETTE (parent))
_gtk_tool_palette_get_item_size (GTK_TOOL_PALETTE (parent), item_size, homogeneous_only, requested_rows);
else
_gtk_tool_item_group_item_size_request (group, item_size, homogeneous_only, requested_rows);
}
static void
gtk_tool_item_group_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
const gint border_width = GTK_CONTAINER (widget)->border_width;
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
GtkOrientation orientation;
GtkRequisition item_size;
gint requested_rows;
if (group->priv->children && gtk_tool_item_group_get_name (group))
{
gtk_widget_size_request (group->priv->header, requisition);
gtk_widget_show (group->priv->header);
}
else
{
requisition->width = requisition->height = 0;
gtk_widget_hide (group->priv->header);
}
gtk_tool_item_group_get_item_size (group, &item_size, FALSE, &requested_rows);
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
if (GTK_ORIENTATION_VERTICAL == orientation)