1 /* GTK - The GIMP Toolkit
3 * Copyright (C) 2001 Red Hat Software
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
22 #include "gtkbuildable.h"
23 #include "gtkcontainer.h"
25 #include "gtktypebuiltins.h"
26 #include "gtkprivate.h"
27 #include "gtksizegroup-private.h"
28 #include "gtkwidgetprivate.h"
29 #include "gtkcontainerprivate.h"
33 * SECTION:gtksizegroup
34 * @Short_description: Grouping widgets so they request the same size
35 * @Title: GtkSizeGroup
37 * #GtkSizeGroup provides a mechanism for grouping a number of widgets
38 * together so they all request the same amount of space. This is
39 * typically useful when you want a column of widgets to have the same
40 * size, but you can't use a #GtkGrid widget.
42 * In detail, the size requested for each widget in a #GtkSizeGroup is
43 * the maximum of the sizes that would have been requested for each
44 * widget in the size group if they were not in the size group. The mode
45 * of the size group (see gtk_size_group_set_mode()) determines whether
46 * this applies to the horizontal size, the vertical size, or both sizes.
48 * Note that size groups only affect the amount of space requested, not
49 * the size that the widgets finally receive. If you want the widgets in
50 * a #GtkSizeGroup to actually be the same size, you need to pack them in
51 * such a way that they get the size they request and not more. For
52 * example, if you are packing your widgets into a table, you would not
53 * include the %GTK_FILL flag.
55 * #GtkSizeGroup objects are referenced by each widget in the size group,
56 * so once you have added all widgets to a #GtkSizeGroup, you can drop
57 * the initial reference to the size group with g_object_unref(). If the
58 * widgets in the size group are subsequently destroyed, then they will
59 * be removed from the size group and drop their references on the size
60 * group; when all widgets have been removed, the size group will be
63 * Widgets can be part of multiple size groups; GTK+ will compute the
64 * horizontal size of a widget from the horizontal requisition of all
65 * widgets that can be reached from the widget by a chain of size groups
66 * of type %GTK_SIZE_GROUP_HORIZONTAL or %GTK_SIZE_GROUP_BOTH, and the
67 * vertical size from the vertical requisition of all widgets that can be
68 * reached from the widget by a chain of size groups of type
69 * %GTK_SIZE_GROUP_VERTICAL or %GTK_SIZE_GROUP_BOTH.
71 * Note that only non-contextual sizes of every widget are ever consulted
72 * by size groups (since size groups have no knowledge of what size a widget
73 * will be allocated in one dimension, it cannot derive how much height
74 * a widget will receive for a given width). When grouping widgets that
75 * trade height for width in mode %GTK_SIZE_GROUP_VERTICAL or %GTK_SIZE_GROUP_BOTH:
76 * the height for the minimum width will be the requested height for all
77 * widgets in the group. The same is of course true when horizontally grouping
78 * width for height widgets.
80 * Widgets that trade height-for-width should set a reasonably large minimum width
81 * by way of #GtkLabel:width-chars for instance. Widgets with static sizes as well
82 * as widgets that grow (such as ellipsizing text) need no such considerations.
84 * <refsect2 id="GtkSizeGroup-BUILDER-UI">
85 * <title>GtkSizeGroup as GtkBuildable</title>
87 * Size groups can be specified in a UI definition by placing an
88 * <object> element with <literal>class="GtkSizeGroup"</literal>
89 * somewhere in the UI definition. The widgets that belong to the
90 * size group are specified by a <widgets> element that may
91 * contain multiple <widget> elements, one for each member
92 * of the size group. The name attribute gives the id of the widget.
95 * <title>A UI definition fragment with GtkSizeGroup</title>
96 * <programlisting><![CDATA[
97 * <object class="GtkSizeGroup">
98 * <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
100 * <widget name="radio1"/>
101 * <widget name="radio2"/>
104 * ]]></programlisting>
111 struct _GtkSizeGroupPrivate
113 GtkRequisition minimum_req;
114 GtkRequisition natural_req;
120 guint have_width : 1;
121 guint have_height : 1;
122 guint ignore_hidden : 1;
132 static void gtk_size_group_set_property (GObject *object,
136 static void gtk_size_group_get_property (GObject *object,
141 static void add_group_to_closure (GtkSizeGroup *group,
142 GtkSizeGroupMode mode,
145 static void add_widget_to_closure (GtkWidget *widget,
146 GtkSizeGroupMode mode,
151 static void gtk_size_group_buildable_init (GtkBuildableIface *iface);
152 static gboolean gtk_size_group_buildable_custom_tag_start (GtkBuildable *buildable,
155 const gchar *tagname,
156 GMarkupParser *parser,
158 static void gtk_size_group_buildable_custom_finished (GtkBuildable *buildable,
161 const gchar *tagname,
165 mark_group_unvisited (GtkSizeGroup *group)
167 group->priv->visited = FALSE;
171 mark_widget_unvisited (GtkWidget *widget)
173 _gtk_widget_set_sizegroup_visited (widget, FALSE);
177 add_group_to_closure (GtkSizeGroup *group,
178 GtkSizeGroupMode mode,
182 GtkSizeGroupPrivate *priv = group->priv;
185 *groups = g_slist_prepend (*groups, group);
186 priv->visited = TRUE;
188 tmp_widgets = priv->widgets;
191 GtkWidget *tmp_widget = tmp_widgets->data;
193 if (!_gtk_widget_get_sizegroup_visited (tmp_widget))
194 add_widget_to_closure (tmp_widget, mode, groups, widgets);
196 tmp_widgets = tmp_widgets->next;
201 add_widget_to_closure (GtkWidget *widget,
202 GtkSizeGroupMode mode,
208 *widgets = g_slist_prepend (*widgets, widget);
209 _gtk_widget_set_sizegroup_visited (widget, TRUE);
211 tmp_groups = _gtk_widget_get_sizegroups (widget);
214 GtkSizeGroup *tmp_group = tmp_groups->data;
215 GtkSizeGroupPrivate *tmp_priv = tmp_group->priv;
217 if ((tmp_priv->mode == GTK_SIZE_GROUP_BOTH || tmp_priv->mode == mode) &&
218 !tmp_group->priv->visited)
219 add_group_to_closure (tmp_group, mode, groups, widgets);
221 tmp_groups = tmp_groups->next;
226 real_queue_resize (GtkWidget *widget,
227 GtkQueueResizeFlags flags)
229 GtkWidget *container;
231 _gtk_widget_set_alloc_needed (widget, TRUE);
232 _gtk_widget_set_width_request_needed (widget, TRUE);
233 _gtk_widget_set_height_request_needed (widget, TRUE);
235 container = gtk_widget_get_parent (widget);
237 gtk_widget_is_toplevel (widget) && GTK_IS_CONTAINER (widget))
242 if (flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY)
243 _gtk_container_resize_invalidate (GTK_CONTAINER (container));
245 _gtk_container_queue_resize (GTK_CONTAINER (container));
250 reset_group_sizes (GSList *groups)
252 GSList *tmp_list = groups;
255 GtkSizeGroup *tmp_group = tmp_list->data;
256 GtkSizeGroupPrivate *tmp_priv = tmp_group->priv;
258 tmp_priv->have_width = FALSE;
259 tmp_priv->have_height = FALSE;
261 tmp_list = tmp_list->next;
266 queue_resize_on_widget (GtkWidget *widget,
267 gboolean check_siblings,
268 GtkQueueResizeFlags flags)
270 GtkWidget *parent = widget;
275 GSList *widget_groups;
279 if (widget == parent && !check_siblings)
281 real_queue_resize (widget, flags);
282 parent = gtk_widget_get_parent (parent);
286 widget_groups = _gtk_widget_get_sizegroups (parent);
289 if (widget == parent)
290 real_queue_resize (widget, flags);
292 parent = gtk_widget_get_parent (parent);
299 add_widget_to_closure (parent, GTK_SIZE_GROUP_HORIZONTAL, &groups, &widgets);
300 g_slist_foreach (widgets, (GFunc)mark_widget_unvisited, NULL);
301 g_slist_foreach (groups, (GFunc)mark_group_unvisited, NULL);
303 reset_group_sizes (groups);
308 if (tmp_list->data == parent)
310 if (widget == parent)
311 real_queue_resize (parent, flags);
313 else if (tmp_list->data == widget)
315 g_warning ("A container and its child are part of this SizeGroup");
318 queue_resize_on_widget (tmp_list->data, FALSE, flags);
320 tmp_list = tmp_list->next;
323 g_slist_free (widgets);
324 g_slist_free (groups);
329 add_widget_to_closure (parent, GTK_SIZE_GROUP_VERTICAL, &groups, &widgets);
330 g_slist_foreach (widgets, (GFunc)mark_widget_unvisited, NULL);
331 g_slist_foreach (groups, (GFunc)mark_group_unvisited, NULL);
333 reset_group_sizes (groups);
338 if (tmp_list->data == parent)
340 if (widget == parent)
341 real_queue_resize (parent, flags);
343 else if (tmp_list->data == widget)
345 g_warning ("A container and its child are part of this SizeGroup");
348 queue_resize_on_widget (tmp_list->data, FALSE, flags);
350 tmp_list = tmp_list->next;
353 g_slist_free (widgets);
354 g_slist_free (groups);
356 parent = gtk_widget_get_parent (parent);
361 queue_resize_on_group (GtkSizeGroup *size_group)
363 GtkSizeGroupPrivate *priv = size_group->priv;
366 queue_resize_on_widget (priv->widgets->data, TRUE, 0);
370 gtk_size_group_class_init (GtkSizeGroupClass *klass)
372 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
374 gobject_class->set_property = gtk_size_group_set_property;
375 gobject_class->get_property = gtk_size_group_get_property;
377 g_object_class_install_property (gobject_class,
379 g_param_spec_enum ("mode",
381 P_("The directions in which the size group affects the requested sizes"
382 " of its component widgets"),
383 GTK_TYPE_SIZE_GROUP_MODE,
384 GTK_SIZE_GROUP_HORIZONTAL, GTK_PARAM_READWRITE));
387 * GtkSizeGroup:ignore-hidden:
389 * If %TRUE, unmapped widgets are ignored when determining
390 * the size of the group.
394 g_object_class_install_property (gobject_class,
396 g_param_spec_boolean ("ignore-hidden",
398 P_("If TRUE, unmapped widgets are ignored "
399 "when determining the size of the group"),
401 GTK_PARAM_READWRITE));
403 g_type_class_add_private (klass, sizeof (GtkSizeGroupPrivate));
407 gtk_size_group_init (GtkSizeGroup *size_group)
409 GtkSizeGroupPrivate *priv;
411 size_group->priv = G_TYPE_INSTANCE_GET_PRIVATE (size_group,
413 GtkSizeGroupPrivate);
414 priv = size_group->priv;
416 priv->widgets = NULL;
417 priv->mode = GTK_SIZE_GROUP_HORIZONTAL;
418 priv->have_width = 0;
419 priv->have_height = 0;
420 priv->ignore_hidden = 0;
421 priv->visited = FALSE;
425 gtk_size_group_buildable_init (GtkBuildableIface *iface)
427 iface->custom_tag_start = gtk_size_group_buildable_custom_tag_start;
428 iface->custom_finished = gtk_size_group_buildable_custom_finished;
431 G_DEFINE_TYPE_WITH_CODE (GtkSizeGroup, gtk_size_group, G_TYPE_OBJECT,
432 G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
433 gtk_size_group_buildable_init))
436 gtk_size_group_set_property (GObject *object,
441 GtkSizeGroup *size_group = GTK_SIZE_GROUP (object);
446 gtk_size_group_set_mode (size_group, g_value_get_enum (value));
448 case PROP_IGNORE_HIDDEN:
449 gtk_size_group_set_ignore_hidden (size_group, g_value_get_boolean (value));
452 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
458 gtk_size_group_get_property (GObject *object,
463 GtkSizeGroup *size_group = GTK_SIZE_GROUP (object);
464 GtkSizeGroupPrivate *priv = size_group->priv;
469 g_value_set_enum (value, priv->mode);
471 case PROP_IGNORE_HIDDEN:
472 g_value_set_boolean (value, priv->ignore_hidden);
475 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
481 * gtk_size_group_new:
482 * @mode: the mode for the new size group.
484 * Create a new #GtkSizeGroup.
486 * Return value: a newly created #GtkSizeGroup
489 gtk_size_group_new (GtkSizeGroupMode mode)
491 GtkSizeGroup *size_group = g_object_new (GTK_TYPE_SIZE_GROUP, NULL);
492 GtkSizeGroupPrivate *priv = size_group->priv;
500 * gtk_size_group_set_mode:
501 * @size_group: a #GtkSizeGroup
502 * @mode: the mode to set for the size group.
504 * Sets the #GtkSizeGroupMode of the size group. The mode of the size
505 * group determines whether the widgets in the size group should
506 * all have the same horizontal requisition (%GTK_SIZE_GROUP_HORIZONTAL)
507 * all have the same vertical requisition (%GTK_SIZE_GROUP_VERTICAL),
508 * or should all have the same requisition in both directions
509 * (%GTK_SIZE_GROUP_BOTH).
512 gtk_size_group_set_mode (GtkSizeGroup *size_group,
513 GtkSizeGroupMode mode)
515 GtkSizeGroupPrivate *priv;
517 g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
519 priv = size_group->priv;
521 if (priv->mode != mode)
523 if (priv->mode != GTK_SIZE_GROUP_NONE)
524 queue_resize_on_group (size_group);
526 if (priv->mode != GTK_SIZE_GROUP_NONE)
527 queue_resize_on_group (size_group);
529 g_object_notify (G_OBJECT (size_group), "mode");
534 * gtk_size_group_get_mode:
535 * @size_group: a #GtkSizeGroup
537 * Gets the current mode of the size group. See gtk_size_group_set_mode().
539 * Return value: the current mode of the size group.
542 gtk_size_group_get_mode (GtkSizeGroup *size_group)
544 g_return_val_if_fail (GTK_IS_SIZE_GROUP (size_group), GTK_SIZE_GROUP_BOTH);
546 return size_group->priv->mode;
550 * gtk_size_group_set_ignore_hidden:
551 * @size_group: a #GtkSizeGroup
552 * @ignore_hidden: whether unmapped widgets should be ignored
553 * when calculating the size
555 * Sets whether unmapped widgets should be ignored when
556 * calculating the size.
561 gtk_size_group_set_ignore_hidden (GtkSizeGroup *size_group,
562 gboolean ignore_hidden)
564 GtkSizeGroupPrivate *priv;
566 g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
568 priv = size_group->priv;
570 ignore_hidden = ignore_hidden != FALSE;
572 if (priv->ignore_hidden != ignore_hidden)
574 priv->ignore_hidden = ignore_hidden;
576 g_object_notify (G_OBJECT (size_group), "ignore-hidden");
581 * gtk_size_group_get_ignore_hidden:
582 * @size_group: a #GtkSizeGroup
584 * Returns if invisible widgets are ignored when calculating the size.
586 * Returns: %TRUE if invisible widgets are ignored.
591 gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group)
593 g_return_val_if_fail (GTK_IS_SIZE_GROUP (size_group), FALSE);
595 return size_group->priv->ignore_hidden;
599 gtk_size_group_widget_destroyed (GtkWidget *widget,
600 GtkSizeGroup *size_group)
602 gtk_size_group_remove_widget (size_group, widget);
606 * gtk_size_group_add_widget:
607 * @size_group: a #GtkSizeGroup
608 * @widget: the #GtkWidget to add
610 * Adds a widget to a #GtkSizeGroup. In the future, the requisition
611 * of the widget will be determined as the maximum of its requisition
612 * and the requisition of the other widgets in the size group.
613 * Whether this applies horizontally, vertically, or in both directions
614 * depends on the mode of the size group. See gtk_size_group_set_mode().
616 * When the widget is destroyed or no longer referenced elsewhere, it will
617 * be removed from the size group.
620 gtk_size_group_add_widget (GtkSizeGroup *size_group,
623 GtkSizeGroupPrivate *priv;
626 g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
627 g_return_if_fail (GTK_IS_WIDGET (widget));
629 priv = size_group->priv;
631 groups = _gtk_widget_get_sizegroups (widget);
633 if (!g_slist_find (groups, size_group))
635 _gtk_widget_add_sizegroup (widget, size_group);
637 priv->widgets = g_slist_prepend (priv->widgets, widget);
639 g_signal_connect (widget, "destroy",
640 G_CALLBACK (gtk_size_group_widget_destroyed),
643 g_object_ref (size_group);
646 queue_resize_on_group (size_group);
650 * gtk_size_group_remove_widget:
651 * @size_group: a #GtkSizeGroup
652 * @widget: the #GtkWidget to remove
654 * Removes a widget from a #GtkSizeGroup.
657 gtk_size_group_remove_widget (GtkSizeGroup *size_group,
660 GtkSizeGroupPrivate *priv;
662 g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
663 g_return_if_fail (GTK_IS_WIDGET (widget));
665 priv = size_group->priv;
667 g_return_if_fail (g_slist_find (priv->widgets, widget));
669 g_signal_handlers_disconnect_by_func (widget,
670 gtk_size_group_widget_destroyed,
673 _gtk_widget_remove_sizegroup (widget, size_group);
675 priv->widgets = g_slist_remove (priv->widgets, widget);
676 queue_resize_on_group (size_group);
677 gtk_widget_queue_resize (widget);
679 g_object_unref (size_group);
683 * gtk_size_group_get_widgets:
684 * @size_group: a #GtkSizeGroup
686 * Returns the list of widgets associated with @size_group.
688 * Return value: (element-type GtkWidget) (transfer none): a #GSList of
689 * widgets. The list is owned by GTK+ and should not be modified.
694 gtk_size_group_get_widgets (GtkSizeGroup *size_group)
696 return size_group->priv->widgets;
700 compute_dimension (GtkWidget *widget,
701 GtkSizeGroupMode mode,
702 gint *minimum, /* in-out */
703 gint *natural) /* in-out */
705 GSList *widgets = NULL;
706 GSList *groups = NULL;
708 gint min_result = 0, nat_result = 0;
710 add_widget_to_closure (widget, mode, &groups, &widgets);
711 g_slist_foreach (widgets, (GFunc)mark_widget_unvisited, NULL);
712 g_slist_foreach (groups, (GFunc)mark_group_unvisited, NULL);
714 g_slist_foreach (widgets, (GFunc)g_object_ref, NULL);
718 min_result = *minimum;
719 nat_result = *natural;
723 GtkSizeGroup *group = groups->data;
724 GtkSizeGroupPrivate *priv = group->priv;
726 if (mode == GTK_SIZE_GROUP_HORIZONTAL && priv->have_width)
728 min_result = priv->minimum_req.width;
729 nat_result = priv->natural_req.width;
731 else if (mode == GTK_SIZE_GROUP_VERTICAL && priv->have_height)
733 min_result = priv->minimum_req.height;
734 nat_result = priv->natural_req.height;
741 GtkWidget *tmp_widget = tmp_list->data;
742 gint min_dimension, nat_dimension;
744 if (tmp_widget == widget)
746 min_dimension = *minimum;
747 nat_dimension = *natural;
751 if (mode == GTK_SIZE_GROUP_HORIZONTAL)
752 gtk_widget_get_preferred_width (tmp_widget, &min_dimension, &nat_dimension);
754 gtk_widget_get_preferred_height (tmp_widget, &min_dimension, &nat_dimension);
757 if (gtk_widget_get_mapped (tmp_widget) || !priv->ignore_hidden)
759 min_result = MAX (min_result, min_dimension);
760 nat_result = MAX (nat_result, nat_dimension);
763 tmp_list = tmp_list->next;
769 GtkSizeGroup *tmp_group = tmp_list->data;
770 GtkSizeGroupPrivate *tmp_priv = tmp_group->priv;
772 if (mode == GTK_SIZE_GROUP_HORIZONTAL)
774 tmp_priv->have_width = TRUE;
775 tmp_priv->minimum_req.width = min_result;
776 tmp_priv->natural_req.width = nat_result;
780 tmp_priv->have_height = TRUE;
781 tmp_priv->minimum_req.height = min_result;
782 tmp_priv->natural_req.height = nat_result;
785 tmp_list = tmp_list->next;
790 g_slist_foreach (widgets, (GFunc)g_object_unref, NULL);
792 g_slist_free (widgets);
793 g_slist_free (groups);
795 *minimum = min_result;
796 *natural = nat_result;
800 * _gtk_size_group_bump_requisition:
801 * @widget: a #GtkWidget
802 * @mode: either %GTK_SIZE_GROUP_HORIZONTAL or %GTK_SIZE_GROUP_VERTICAL, depending
803 * on the dimension in which to bump the size.
804 * @minimum: a pointer to the widget's minimum size
805 * @natural: a pointer to the widget's natural size
807 * Refreshes the sizegroup while returning the groups requested
808 * value in the dimension @mode.
810 * This function is used both to update sizegroup minimum and natural size
811 * information and widget minimum and natural sizes in multiple passes from
812 * the size request apis.
815 _gtk_size_group_bump_requisition (GtkWidget *widget,
816 GtkSizeGroupMode mode,
820 if (!_gtk_widget_get_sizegroup_bumping (widget))
822 /* Avoid recursion here */
823 _gtk_widget_set_sizegroup_bumping (widget, TRUE);
825 if (_gtk_widget_get_sizegroups (widget))
826 compute_dimension (widget, mode, minimum, natural);
828 _gtk_widget_set_sizegroup_bumping (widget, FALSE);
835 * _gtk_size_group_queue_resize:
836 * @widget: a #GtkWidget
838 * Queue a resize on a widget, and on all other widgets grouped with this widget.
841 _gtk_size_group_queue_resize (GtkWidget *widget,
842 GtkQueueResizeFlags flags)
844 queue_resize_on_widget (widget, TRUE, flags);
850 } GSListSubParserData;
853 size_group_start_element (GMarkupParseContext *context,
854 const gchar *element_name,
856 const gchar **values,
861 GSListSubParserData *data = (GSListSubParserData*)user_data;
863 if (strcmp (element_name, "widget") == 0)
864 for (i = 0; names[i]; i++)
865 if (strcmp (names[i], "name") == 0)
866 data->items = g_slist_prepend (data->items, g_strdup (values[i]));
867 else if (strcmp (element_name, "widgets") == 0)
870 g_warning ("Unsupported type tag for GtkSizeGroup: %s\n",
875 static const GMarkupParser size_group_parser =
877 size_group_start_element
881 gtk_size_group_buildable_custom_tag_start (GtkBuildable *buildable,
884 const gchar *tagname,
885 GMarkupParser *parser,
888 GSListSubParserData *parser_data;
893 if (strcmp (tagname, "widgets") == 0)
895 parser_data = g_slice_new0 (GSListSubParserData);
896 parser_data->items = NULL;
897 parser_data->object = G_OBJECT (buildable);
899 *parser = size_group_parser;
908 gtk_size_group_buildable_custom_finished (GtkBuildable *buildable,
911 const gchar *tagname,
915 GSListSubParserData *data;
918 if (strcmp (tagname, "widgets"))
921 data = (GSListSubParserData*)user_data;
922 data->items = g_slist_reverse (data->items);
924 for (l = data->items; l; l = l->next)
926 object = gtk_builder_get_object (builder, l->data);
929 g_warning ("Unknown object %s specified in sizegroup %s",
930 (const gchar*)l->data,
931 gtk_buildable_get_name (GTK_BUILDABLE (data->object)));
934 gtk_size_group_add_widget (GTK_SIZE_GROUP (data->object),
935 GTK_WIDGET (object));
938 g_slist_free (data->items);
939 g_slice_free (GSListSubParserData, data);