2 * GTK - The GIMP Toolkit
3 * Copyright (C) 1999 Red Hat, Inc.
4 * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
5 * Copyright (C) 2003 Matthias Clasen <mclasen@redhat.com>
6 * Copyright (C) 2005 Carlos Garnacho Parro <carlosg@gnome.org>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA.
27 * SECTION:gtkassistant
28 * @Short_description: A widget used to guide users through multi-step operations
29 * @Title: GtkAssistant
31 * A #GtkAssistant is a widget used to represent a generally complex
32 * operation splitted in several steps, guiding the user through its pages
33 * and controlling the page flow to collect the necessary data.
35 * The design of GtkAssistant is that it controls what buttons to show and
36 * to make sensitive, based on what it knows about the page sequence and
37 * the <link linkend="GtkAssistantPageType">type</link> of each page, in
38 * addition to state information like the page
39 * <link linkend="gtk-assistant-set-page-complete">completion</link> and
40 * <link linkend="gtk-assistant-commit">committed</link> status.
42 * <refsect2 id="GtkAssistant-BUILDER-UI">
43 * <title>GtkAssistant as GtkBuildable</title>
45 * The GtkAssistant implementation of the GtkBuildable interface exposes the
46 * @action_area as internal children with the name "action_area".
48 * To add pages to an assistant in GtkBuilder, simply add it as a
49 * <child> to the GtkAssistant object, and set its child properties
59 #include "gtkassistant.h"
61 #include "gtkaccessible.h"
62 #include "gtkbutton.h"
67 #include "gtksizegroup.h"
68 #include "gtksizerequest.h"
72 #include "gtkprivate.h"
73 #include "gtkbuildable.h"
76 #define HEADER_SPACING 12
77 #define ACTION_AREA_SPACING 12
79 typedef struct _GtkAssistantPage GtkAssistantPage;
81 struct _GtkAssistantPage
84 GtkAssistantPageType type;
86 guint complete_set : 1;
89 GdkPixbuf *header_image;
90 GdkPixbuf *sidebar_image;
93 struct _GtkAssistantPrivate
102 GtkWidget *header_image;
103 GtkWidget *sidebar_image;
105 GtkWidget *action_area;
109 GtkAssistantPage *current_page;
111 GSList *visited_pages;
113 GtkSizeGroup *size_group;
115 GtkAssistantPageFunc forward_function;
116 gpointer forward_function_data;
117 GDestroyNotify forward_data_destroy;
122 static void gtk_assistant_class_init (GtkAssistantClass *class);
123 static void gtk_assistant_init (GtkAssistant *assistant);
124 static void gtk_assistant_destroy (GtkWidget *widget);
125 static void gtk_assistant_style_set (GtkWidget *widget,
126 GtkStyle *old_style);
127 static void gtk_assistant_get_preferred_width (GtkWidget *widget,
130 static void gtk_assistant_get_preferred_height (GtkWidget *widget,
133 static void gtk_assistant_size_allocate (GtkWidget *widget,
134 GtkAllocation *allocation);
135 static void gtk_assistant_map (GtkWidget *widget);
136 static void gtk_assistant_unmap (GtkWidget *widget);
137 static gboolean gtk_assistant_delete_event (GtkWidget *widget,
139 static gboolean gtk_assistant_draw (GtkWidget *widget,
141 static gboolean gtk_assistant_focus (GtkWidget *widget,
142 GtkDirectionType direction);
143 static void gtk_assistant_add (GtkContainer *container,
145 static void gtk_assistant_remove (GtkContainer *container,
147 static void gtk_assistant_forall (GtkContainer *container,
148 gboolean include_internals,
149 GtkCallback callback,
150 gpointer callback_data);
151 static void gtk_assistant_set_child_property (GtkContainer *container,
156 static void gtk_assistant_get_child_property (GtkContainer *container,
162 static AtkObject *gtk_assistant_get_accessible (GtkWidget *widget);
164 static void gtk_assistant_buildable_interface_init (GtkBuildableIface *iface);
165 static GObject *gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
167 const gchar *childname);
168 static gboolean gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
171 const gchar *tagname,
172 GMarkupParser *parser,
174 static void gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
177 const gchar *tagname,
180 static GList* find_page (GtkAssistant *assistant,
186 CHILD_PROP_PAGE_TYPE,
187 CHILD_PROP_PAGE_TITLE,
188 CHILD_PROP_PAGE_HEADER_IMAGE,
189 CHILD_PROP_PAGE_SIDEBAR_IMAGE,
190 CHILD_PROP_PAGE_COMPLETE
202 static guint signals [LAST_SIGNAL] = { 0 };
205 G_DEFINE_TYPE_WITH_CODE (GtkAssistant, gtk_assistant, GTK_TYPE_WINDOW,
206 G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
207 gtk_assistant_buildable_interface_init))
211 gtk_assistant_class_init (GtkAssistantClass *class)
213 GObjectClass *gobject_class;
214 GtkWidgetClass *widget_class;
215 GtkContainerClass *container_class;
217 gobject_class = (GObjectClass *) class;
218 widget_class = (GtkWidgetClass *) class;
219 container_class = (GtkContainerClass *) class;
221 widget_class->destroy = gtk_assistant_destroy;
222 widget_class->style_set = gtk_assistant_style_set;
223 widget_class->get_preferred_width = gtk_assistant_get_preferred_width;
224 widget_class->get_preferred_height = gtk_assistant_get_preferred_height;
225 widget_class->size_allocate = gtk_assistant_size_allocate;
226 widget_class->map = gtk_assistant_map;
227 widget_class->unmap = gtk_assistant_unmap;
228 widget_class->delete_event = gtk_assistant_delete_event;
229 widget_class->draw = gtk_assistant_draw;
230 widget_class->focus = gtk_assistant_focus;
231 widget_class->get_accessible = gtk_assistant_get_accessible;
233 container_class->add = gtk_assistant_add;
234 container_class->remove = gtk_assistant_remove;
235 container_class->forall = gtk_assistant_forall;
236 container_class->set_child_property = gtk_assistant_set_child_property;
237 container_class->get_child_property = gtk_assistant_get_child_property;
240 * GtkAssistant::cancel:
241 * @assistant: the #GtkAssistant
243 * The ::cancel signal is emitted when then the cancel button is clicked.
248 g_signal_new (I_("cancel"),
249 G_TYPE_FROM_CLASS (gobject_class),
251 G_STRUCT_OFFSET (GtkAssistantClass, cancel),
253 g_cclosure_marshal_VOID__VOID,
257 * GtkAssistant::prepare:
258 * @assistant: the #GtkAssistant
259 * @page: the current page
261 * The ::prepare signal is emitted when a new page is set as the assistant's
262 * current page, before making the new page visible. A handler for this signal
263 * can do any preparation which are necessary before showing @page.
268 g_signal_new (I_("prepare"),
269 G_TYPE_FROM_CLASS (gobject_class),
271 G_STRUCT_OFFSET (GtkAssistantClass, prepare),
273 g_cclosure_marshal_VOID__OBJECT,
274 G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
277 * GtkAssistant::apply:
278 * @assistant: the #GtkAssistant
280 * The ::apply signal is emitted when the apply button is clicked. The default
281 * behavior of the #GtkAssistant is to switch to the page after the current
282 * page, unless the current page is the last one.
284 * A handler for the ::apply signal should carry out the actions for which
285 * the wizard has collected data. If the action takes a long time to complete,
286 * you might consider putting a page of type %GTK_ASSISTANT_PAGE_PROGRESS
287 * after the confirmation page and handle this operation within the
288 * #GtkAssistant::prepare signal of the progress page.
293 g_signal_new (I_("apply"),
294 G_TYPE_FROM_CLASS (gobject_class),
296 G_STRUCT_OFFSET (GtkAssistantClass, apply),
298 g_cclosure_marshal_VOID__VOID,
302 * GtkAssistant::close:
303 * @assistant: the #GtkAssistant
305 * The ::close signal is emitted either when the close button of
306 * a summary page is clicked, or when the apply button in the last
307 * page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
312 g_signal_new (I_("close"),
313 G_TYPE_FROM_CLASS (gobject_class),
315 G_STRUCT_OFFSET (GtkAssistantClass, close),
317 g_cclosure_marshal_VOID__VOID,
320 gtk_widget_class_install_style_property (widget_class,
321 g_param_spec_int ("header-padding",
322 P_("Header Padding"),
323 P_("Number of pixels around the header."),
327 GTK_PARAM_READABLE));
328 gtk_widget_class_install_style_property (widget_class,
329 g_param_spec_int ("content-padding",
330 P_("Content Padding"),
331 P_("Number of pixels around the content pages."),
335 GTK_PARAM_READABLE));
338 * GtkAssistant:page-type:
340 * The type of the assistant page.
344 gtk_container_class_install_child_property (container_class,
345 CHILD_PROP_PAGE_TYPE,
346 g_param_spec_enum ("page-type",
348 P_("The type of the assistant page"),
349 GTK_TYPE_ASSISTANT_PAGE_TYPE,
350 GTK_ASSISTANT_PAGE_CONTENT,
351 GTK_PARAM_READWRITE));
354 * GtkAssistant:title:
356 * The title that is displayed in the page header.
358 * If title and header-image are both %NULL, no header is displayed.
362 gtk_container_class_install_child_property (container_class,
363 CHILD_PROP_PAGE_TITLE,
364 g_param_spec_string ("title",
366 P_("The title of the assistant page"),
368 GTK_PARAM_READWRITE));
371 * GtkAssistant:header-image:
373 * The image that is displayed next to the title in the page header.
375 * If title and header-image are both %NULL, no header is displayed.
379 gtk_container_class_install_child_property (container_class,
380 CHILD_PROP_PAGE_HEADER_IMAGE,
381 g_param_spec_object ("header-image",
383 P_("Header image for the assistant page"),
385 GTK_PARAM_READWRITE));
388 * GtkAssistant:header-image:
390 * The image that is displayed next to the page.
392 * Set this to %NULL to make the sidebar disappear.
396 gtk_container_class_install_child_property (container_class,
397 CHILD_PROP_PAGE_SIDEBAR_IMAGE,
398 g_param_spec_object ("sidebar-image",
400 P_("Sidebar image for the assistant page"),
402 GTK_PARAM_READWRITE));
404 * GtkAssistant:complete:
406 * Setting the "complete" child property to %TRUE marks a page as complete
407 * (i.e.: all the required fields are filled out). GTK+ uses this information
408 * to control the sensitivity of the navigation buttons.
412 gtk_container_class_install_child_property (container_class,
413 CHILD_PROP_PAGE_COMPLETE,
414 g_param_spec_boolean ("complete",
416 P_("Whether all required fields on the page have been filled out"),
420 g_type_class_add_private (gobject_class, sizeof (GtkAssistantPrivate));
424 default_forward_function (gint current_page, gpointer data)
426 GtkAssistant *assistant;
427 GtkAssistantPrivate *priv;
428 GtkAssistantPage *page_info;
431 assistant = GTK_ASSISTANT (data);
432 priv = assistant->priv;
434 page_node = g_list_nth (priv->pages, ++current_page);
439 page_info = (GtkAssistantPage *) page_node->data;
441 while (page_node && !gtk_widget_get_visible (page_info->page))
443 page_node = page_node->next;
447 page_info = (GtkAssistantPage *) page_node->data;
454 compute_last_button_state (GtkAssistant *assistant)
456 GtkAssistantPrivate *priv = assistant->priv;
457 GtkAssistantPage *page_info, *current_page_info;
458 gint count, page_num, n_pages;
461 page_num = gtk_assistant_get_current_page (assistant);
462 n_pages = gtk_assistant_get_n_pages (assistant);
463 current_page_info = page_info = g_list_nth_data (priv->pages, page_num);
465 while (page_num >= 0 && page_num < n_pages &&
466 page_info->type == GTK_ASSISTANT_PAGE_CONTENT &&
467 (count == 0 || page_info->complete) &&
470 page_num = (priv->forward_function) (page_num, priv->forward_function_data);
471 page_info = g_list_nth_data (priv->pages, page_num);
476 /* make the last button visible if we can skip multiple
477 * pages and end on a confirmation or summary page
479 if (count > 1 && page_info &&
480 (page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
481 page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
483 gtk_widget_show (priv->last);
484 gtk_widget_set_sensitive (priv->last,
485 current_page_info->complete);
488 gtk_widget_hide (priv->last);
492 compute_progress_state (GtkAssistant *assistant)
494 GtkAssistantPrivate *priv = assistant->priv;
495 gint page_num, n_pages;
497 n_pages = gtk_assistant_get_n_pages (assistant);
498 page_num = gtk_assistant_get_current_page (assistant);
500 page_num = (priv->forward_function) (page_num, priv->forward_function_data);
502 if (page_num >= 0 && page_num < n_pages)
503 gtk_widget_show (priv->forward);
505 gtk_widget_hide (priv->forward);
509 set_assistant_header_image (GtkAssistant *assistant)
511 GtkAssistantPrivate *priv = assistant->priv;
513 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->header_image),
514 priv->current_page->header_image);
518 set_assistant_sidebar_image (GtkAssistant *assistant)
520 GtkAssistantPrivate *priv = assistant->priv;
522 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->sidebar_image),
523 priv->current_page->sidebar_image);
525 if (priv->current_page->sidebar_image)
526 gtk_widget_show (priv->sidebar_image);
528 gtk_widget_hide (priv->sidebar_image);
532 set_assistant_buttons_state (GtkAssistant *assistant)
534 GtkAssistantPrivate *priv = assistant->priv;
536 if (!priv->current_page)
539 switch (priv->current_page->type)
541 case GTK_ASSISTANT_PAGE_INTRO:
542 gtk_widget_set_sensitive (priv->cancel, TRUE);
543 gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
544 gtk_widget_grab_default (priv->forward);
545 gtk_widget_show (priv->forward);
546 gtk_widget_hide (priv->back);
547 gtk_widget_hide (priv->apply);
548 gtk_widget_hide (priv->close);
549 compute_last_button_state (assistant);
551 case GTK_ASSISTANT_PAGE_CONFIRM:
552 gtk_widget_set_sensitive (priv->cancel, TRUE);
553 gtk_widget_set_sensitive (priv->back, TRUE);
554 gtk_widget_set_sensitive (priv->apply, priv->current_page->complete);
555 gtk_widget_grab_default (priv->apply);
556 gtk_widget_show (priv->back);
557 gtk_widget_show (priv->apply);
558 gtk_widget_hide (priv->forward);
559 gtk_widget_hide (priv->close);
560 gtk_widget_hide (priv->last);
562 case GTK_ASSISTANT_PAGE_CONTENT:
563 gtk_widget_set_sensitive (priv->cancel, TRUE);
564 gtk_widget_set_sensitive (priv->back, TRUE);
565 gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
566 gtk_widget_grab_default (priv->forward);
567 gtk_widget_show (priv->back);
568 gtk_widget_show (priv->forward);
569 gtk_widget_hide (priv->apply);
570 gtk_widget_hide (priv->close);
571 compute_last_button_state (assistant);
573 case GTK_ASSISTANT_PAGE_SUMMARY:
574 gtk_widget_set_sensitive (priv->close, priv->current_page->complete);
575 gtk_widget_grab_default (priv->close);
576 gtk_widget_show (priv->close);
577 gtk_widget_hide (priv->back);
578 gtk_widget_hide (priv->forward);
579 gtk_widget_hide (priv->apply);
580 gtk_widget_hide (priv->last);
582 case GTK_ASSISTANT_PAGE_PROGRESS:
583 gtk_widget_set_sensitive (priv->cancel, priv->current_page->complete);
584 gtk_widget_set_sensitive (priv->back, priv->current_page->complete);
585 gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
586 gtk_widget_grab_default (priv->forward);
587 gtk_widget_show (priv->back);
588 gtk_widget_hide (priv->apply);
589 gtk_widget_hide (priv->close);
590 gtk_widget_hide (priv->last);
591 compute_progress_state (assistant);
594 g_assert_not_reached ();
598 gtk_widget_hide (priv->cancel);
599 else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY)
600 gtk_widget_hide (priv->cancel);
602 gtk_widget_show (priv->cancel);
604 /* this is quite general, we don't want to
605 * go back if it's the first page */
606 if (!priv->visited_pages)
607 gtk_widget_hide (priv->back);
611 set_current_page (GtkAssistant *assistant,
612 GtkAssistantPage *page)
614 GtkAssistantPrivate *priv = assistant->priv;
615 GtkAssistantPage *old_page;
617 if (priv->current_page &&
618 gtk_widget_is_drawable (priv->current_page->page))
619 old_page = priv->current_page;
623 priv->current_page = page;
625 set_assistant_buttons_state (assistant);
626 set_assistant_header_image (assistant);
627 set_assistant_sidebar_image (assistant);
629 g_signal_emit (assistant, signals [PREPARE], 0, priv->current_page->page);
631 if (gtk_widget_get_visible (priv->current_page->page) && gtk_widget_get_mapped (GTK_WIDGET (assistant)))
633 gtk_widget_set_child_visible (priv->current_page->page, TRUE);
634 gtk_widget_map (priv->current_page->page);
635 gtk_widget_map (priv->current_page->title);
638 if (old_page && gtk_widget_get_mapped (old_page->page))
640 gtk_widget_set_child_visible (old_page->page, FALSE);
641 gtk_widget_unmap (old_page->page);
642 gtk_widget_unmap (old_page->title);
645 if (!gtk_widget_child_focus (priv->current_page->page, GTK_DIR_TAB_FORWARD))
647 GtkWidget *button[6];
650 /* find the best button to focus */
651 button[0] = priv->apply;
652 button[1] = priv->close;
653 button[2] = priv->forward;
654 button[3] = priv->back;
655 button[4] = priv->cancel;
656 button[5] = priv->last;
657 for (i = 0; i < 6; i++)
659 if (gtk_widget_get_visible (button[i]) && gtk_widget_get_sensitive (button[i]))
661 gtk_widget_grab_focus (button[i]);
667 gtk_widget_queue_resize (GTK_WIDGET (assistant));
671 compute_next_step (GtkAssistant *assistant)
673 GtkAssistantPrivate *priv = assistant->priv;
674 GtkAssistantPage *page_info;
675 gint current_page, n_pages, next_page;
677 current_page = gtk_assistant_get_current_page (assistant);
678 page_info = priv->current_page;
679 n_pages = gtk_assistant_get_n_pages (assistant);
681 next_page = (priv->forward_function) (current_page,
682 priv->forward_function_data);
684 if (next_page >= 0 && next_page < n_pages)
686 priv->visited_pages = g_slist_prepend (priv->visited_pages, page_info);
687 set_current_page (assistant, g_list_nth_data (priv->pages, next_page));
696 on_assistant_close (GtkWidget *widget,
697 GtkAssistant *assistant)
699 g_signal_emit (assistant, signals [CLOSE], 0, NULL);
703 on_assistant_apply (GtkWidget *widget,
704 GtkAssistant *assistant)
708 g_signal_emit (assistant, signals [APPLY], 0);
710 success = compute_next_step (assistant);
712 /* if the assistant hasn't switched to another page, just emit
713 * the CLOSE signal, it't the last page in the assistant flow
716 g_signal_emit (assistant, signals [CLOSE], 0);
720 on_assistant_forward (GtkWidget *widget,
721 GtkAssistant *assistant)
723 if (!compute_next_step (assistant))
724 g_critical ("Page flow is broken, you may want to end it with a page of "
725 "type GTK_ASSISTANT_PAGE_CONFIRM or GTK_ASSISTANT_PAGE_SUMMARY");
729 on_assistant_back (GtkWidget *widget,
730 GtkAssistant *assistant)
732 GtkAssistantPrivate *priv = assistant->priv;
733 GtkAssistantPage *page_info;
736 /* skip the progress pages when going back */
739 page_node = priv->visited_pages;
741 g_return_if_fail (page_node != NULL);
743 priv->visited_pages = priv->visited_pages->next;
744 page_info = (GtkAssistantPage *) page_node->data;
745 g_slist_free_1 (page_node);
747 while (page_info->type == GTK_ASSISTANT_PAGE_PROGRESS ||
748 !gtk_widget_get_visible (page_info->page));
750 set_current_page (assistant, page_info);
754 on_assistant_cancel (GtkWidget *widget,
755 GtkAssistant *assistant)
757 g_signal_emit (assistant, signals [CANCEL], 0, NULL);
761 on_assistant_last (GtkWidget *widget,
762 GtkAssistant *assistant)
764 GtkAssistantPrivate *priv = assistant->priv;
766 while (priv->current_page->type == GTK_ASSISTANT_PAGE_CONTENT &&
767 priv->current_page->complete)
768 compute_next_step (assistant);
772 alternative_button_order (GtkAssistant *assistant)
774 GtkSettings *settings;
778 screen = gtk_widget_get_screen (GTK_WIDGET (assistant));
779 settings = gtk_settings_get_for_screen (screen);
781 g_object_get (settings,
782 "gtk-alternative-button-order", &result,
788 gtk_assistant_init (GtkAssistant *assistant)
790 GtkAssistantPrivate *priv;
792 assistant->priv = G_TYPE_INSTANCE_GET_PRIVATE (assistant,
794 GtkAssistantPrivate);
795 priv = assistant->priv;
797 gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
798 gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
800 gtk_widget_push_composite_child ();
803 priv->header_image = gtk_image_new ();
804 gtk_misc_set_alignment (GTK_MISC (priv->header_image), 1., 0.5);
805 gtk_widget_set_parent (priv->header_image, GTK_WIDGET (assistant));
806 gtk_widget_show (priv->header_image);
809 priv->sidebar_image = gtk_image_new ();
810 gtk_misc_set_alignment (GTK_MISC (priv->sidebar_image), 0., 0.);
811 gtk_widget_set_parent (priv->sidebar_image, GTK_WIDGET (assistant));
812 gtk_widget_show (priv->sidebar_image);
815 priv->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 6);
817 priv->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
818 priv->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
819 priv->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
820 priv->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
821 priv->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
822 priv->last = gtk_button_new_from_stock (GTK_STOCK_GOTO_LAST);
823 gtk_widget_set_can_default (priv->close, TRUE);
824 gtk_widget_set_can_default (priv->apply, TRUE);
825 gtk_widget_set_can_default (priv->forward, TRUE);
827 priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
828 gtk_size_group_add_widget (priv->size_group, priv->close);
829 gtk_size_group_add_widget (priv->size_group, priv->apply);
830 gtk_size_group_add_widget (priv->size_group, priv->forward);
831 gtk_size_group_add_widget (priv->size_group, priv->back);
832 gtk_size_group_add_widget (priv->size_group, priv->cancel);
833 gtk_size_group_add_widget (priv->size_group, priv->last);
835 if (!alternative_button_order (assistant))
837 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
838 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
839 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
840 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
841 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
842 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
846 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
847 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
848 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
849 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
850 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
851 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
854 gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));
855 gtk_widget_show (priv->forward);
856 gtk_widget_show (priv->back);
857 gtk_widget_show (priv->cancel);
858 gtk_widget_show (priv->action_area);
860 gtk_widget_pop_composite_child ();
863 priv->current_page = NULL;
864 priv->visited_pages = NULL;
866 priv->forward_function = default_forward_function;
867 priv->forward_function_data = assistant;
868 priv->forward_data_destroy = NULL;
870 g_signal_connect (G_OBJECT (priv->close), "clicked",
871 G_CALLBACK (on_assistant_close), assistant);
872 g_signal_connect (G_OBJECT (priv->apply), "clicked",
873 G_CALLBACK (on_assistant_apply), assistant);
874 g_signal_connect (G_OBJECT (priv->forward), "clicked",
875 G_CALLBACK (on_assistant_forward), assistant);
876 g_signal_connect (G_OBJECT (priv->back), "clicked",
877 G_CALLBACK (on_assistant_back), assistant);
878 g_signal_connect (G_OBJECT (priv->cancel), "clicked",
879 G_CALLBACK (on_assistant_cancel), assistant);
880 g_signal_connect (G_OBJECT (priv->last), "clicked",
881 G_CALLBACK (on_assistant_last), assistant);
885 gtk_assistant_set_child_property (GtkContainer *container,
893 case CHILD_PROP_PAGE_TYPE:
894 gtk_assistant_set_page_type (GTK_ASSISTANT (container), child,
895 g_value_get_enum (value));
897 case CHILD_PROP_PAGE_TITLE:
898 gtk_assistant_set_page_title (GTK_ASSISTANT (container), child,
899 g_value_get_string (value));
901 case CHILD_PROP_PAGE_HEADER_IMAGE:
902 gtk_assistant_set_page_header_image (GTK_ASSISTANT (container), child,
903 g_value_get_object (value));
905 case CHILD_PROP_PAGE_SIDEBAR_IMAGE:
906 gtk_assistant_set_page_side_image (GTK_ASSISTANT (container), child,
907 g_value_get_object (value));
909 case CHILD_PROP_PAGE_COMPLETE:
910 gtk_assistant_set_page_complete (GTK_ASSISTANT (container), child,
911 g_value_get_boolean (value));
914 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
920 gtk_assistant_get_child_property (GtkContainer *container,
928 case CHILD_PROP_PAGE_TYPE:
929 g_value_set_enum (value,
930 gtk_assistant_get_page_type (GTK_ASSISTANT (container), child));
932 case CHILD_PROP_PAGE_TITLE:
933 g_value_set_string (value,
934 gtk_assistant_get_page_title (GTK_ASSISTANT (container), child));
936 case CHILD_PROP_PAGE_HEADER_IMAGE:
937 g_value_set_object (value,
938 gtk_assistant_get_page_header_image (GTK_ASSISTANT (container), child));
940 case CHILD_PROP_PAGE_SIDEBAR_IMAGE:
941 g_value_set_object (value,
942 gtk_assistant_get_page_side_image (GTK_ASSISTANT (container), child));
944 case CHILD_PROP_PAGE_COMPLETE:
945 g_value_set_boolean (value,
946 gtk_assistant_get_page_complete (GTK_ASSISTANT (container), child));
949 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
955 on_page_notify_visibility (GtkWidget *widget,
959 GtkAssistant *assistant = GTK_ASSISTANT (data);
961 /* update buttons state, flow may have changed */
962 if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
963 set_assistant_buttons_state (assistant);
967 remove_page (GtkAssistant *assistant,
970 GtkAssistantPrivate *priv = assistant->priv;
971 GtkAssistantPage *page_info;
974 page_info = element->data;
976 /* If this is the current page, we need to switch away. */
977 if (page_info == priv->current_page)
979 if (!compute_next_step (assistant))
981 /* The best we can do at this point is probably to pick the first
984 page_node = priv->pages;
986 while (page_node && !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
987 page_node = page_node->next;
989 if (page_node == element)
990 page_node = page_node->next;
993 priv->current_page = page_node->data;
995 priv->current_page = NULL;
999 priv->pages = g_list_remove_link (priv->pages, element);
1000 priv->visited_pages = g_slist_remove_all (priv->visited_pages, page_info);
1002 g_signal_handlers_disconnect_by_func (page_info->page, on_page_notify_visibility, assistant);
1003 gtk_widget_unparent (page_info->page);
1005 if (page_info->header_image)
1006 g_object_unref (page_info->header_image);
1008 if (page_info->sidebar_image)
1009 g_object_unref (page_info->sidebar_image);
1011 gtk_widget_destroy (page_info->title);
1012 g_slice_free (GtkAssistantPage, page_info);
1013 g_list_free_1 (element);
1017 gtk_assistant_destroy (GtkWidget *widget)
1019 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1020 GtkAssistantPrivate *priv = assistant->priv;
1022 if (priv->header_image)
1024 gtk_widget_destroy (priv->header_image);
1025 priv->header_image = NULL;
1028 if (priv->sidebar_image)
1030 gtk_widget_destroy (priv->sidebar_image);
1031 priv->sidebar_image = NULL;
1034 if (priv->action_area)
1036 gtk_widget_destroy (priv->action_area);
1037 priv->action_area = NULL;
1040 if (priv->size_group)
1042 g_object_unref (priv->size_group);
1043 priv->size_group = NULL;
1046 if (priv->forward_function)
1048 if (priv->forward_function_data &&
1049 priv->forward_data_destroy)
1050 priv->forward_data_destroy (priv->forward_function_data);
1052 priv->forward_function = NULL;
1053 priv->forward_function_data = NULL;
1054 priv->forward_data_destroy = NULL;
1057 if (priv->visited_pages)
1059 g_slist_free (priv->visited_pages);
1060 priv->visited_pages = NULL;
1063 /* We set current to NULL so that the remove code doesn't try
1064 * to do anything funny */
1065 priv->current_page = NULL;
1068 remove_page (assistant, priv->pages);
1070 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->destroy (widget);
1074 find_page (GtkAssistant *assistant,
1077 GtkAssistantPrivate *priv = assistant->priv;
1078 GList *child = priv->pages;
1082 GtkAssistantPage *page_info = child->data;
1083 if (page_info->page == page)
1086 child = child->next;
1093 set_title_colors (GtkWidget *assistant,
1094 GtkWidget *title_label)
1098 gtk_widget_ensure_style (assistant);
1099 style = gtk_widget_get_style (assistant);
1101 /* change colors schema, for making the header text visible */
1102 gtk_widget_modify_bg (title_label, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
1103 gtk_widget_modify_fg (title_label, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
1107 set_title_font (GtkWidget *assistant,
1108 GtkWidget *title_label)
1110 PangoFontDescription *desc;
1113 desc = pango_font_description_new ();
1114 size = pango_font_description_get_size (gtk_widget_get_style (assistant)->font_desc);
1116 pango_font_description_set_weight (desc, PANGO_WEIGHT_ULTRABOLD);
1117 pango_font_description_set_size (desc, size * PANGO_SCALE_XX_LARGE);
1119 gtk_widget_modify_font (title_label, desc);
1120 pango_font_description_free (desc);
1124 gtk_assistant_style_set (GtkWidget *widget,
1125 GtkStyle *old_style)
1127 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1128 GtkAssistantPrivate *priv = assistant->priv;
1135 GtkAssistantPage *page = list->data;
1137 set_title_colors (widget, page->title);
1138 set_title_font (widget, page->title);
1145 gtk_assistant_size_request (GtkWidget *widget,
1146 GtkRequisition *requisition)
1148 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1149 GtkAssistantPrivate *priv = assistant->priv;
1150 GtkRequisition child_requisition;
1151 gint header_padding, content_padding;
1152 gint width, height, header_width, header_height;
1156 gtk_widget_style_get (widget,
1157 "header-padding", &header_padding,
1158 "content-padding", &content_padding,
1161 header_width = header_height = 0;
1166 GtkAssistantPage *page = list->data;
1169 gtk_widget_get_preferred_size (page->page,
1170 &child_requisition, NULL);
1171 width = MAX (width, child_requisition.width);
1172 height = MAX (height, child_requisition.height);
1174 gtk_widget_get_preferred_size (page->title,
1175 &child_requisition, NULL);
1176 w = child_requisition.width;
1177 h = child_requisition.height;
1179 if (page->header_image)
1181 w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
1182 h = MAX (h, gdk_pixbuf_get_height (page->header_image));
1185 header_width = MAX (header_width, w);
1186 header_height = MAX (header_height, h);
1191 gtk_widget_get_preferred_size (priv->sidebar_image,
1192 &child_requisition, NULL);
1193 width += child_requisition.width;
1194 height = MAX (height, child_requisition.height);
1196 gtk_widget_set_size_request (priv->header_image, header_width, header_height);
1197 gtk_widget_get_preferred_size (priv->header_image,
1198 &child_requisition, NULL);
1199 width = MAX (width, header_width) + 2 * header_padding;
1200 height += header_height + 2 * header_padding;
1202 gtk_widget_get_preferred_size (priv->action_area,
1203 &child_requisition, NULL);
1204 width = MAX (width, child_requisition.width);
1205 height += child_requisition.height + ACTION_AREA_SPACING;
1207 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
1208 width += border_width * 2 + content_padding * 2;
1209 height += border_width * 2 + content_padding * 2;
1211 requisition->width = width;
1212 requisition->height = height;
1216 gtk_assistant_get_preferred_width (GtkWidget *widget,
1220 GtkRequisition requisition;
1222 gtk_assistant_size_request (widget, &requisition);
1224 *minimum = *natural = requisition.width;
1228 gtk_assistant_get_preferred_height (GtkWidget *widget,
1232 GtkRequisition requisition;
1234 gtk_assistant_size_request (widget, &requisition);
1236 *minimum = *natural = requisition.height;
1240 gtk_assistant_size_allocate (GtkWidget *widget,
1241 GtkAllocation *allocation)
1243 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1244 GtkAssistantPrivate *priv = assistant->priv;
1245 GtkRequisition header_requisition, action_requisition, sidebar_requisition;
1246 GtkAllocation child_allocation, header_allocation;
1247 GtkAllocation action_area_allocation, header_image_allocation;
1248 gint header_padding, content_padding;
1253 rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
1254 pages = priv->pages;
1256 gtk_widget_style_get (widget,
1257 "header-padding", &header_padding,
1258 "content-padding", &content_padding,
1261 gtk_widget_set_allocation (widget, allocation);
1262 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
1265 gtk_widget_get_preferred_size (priv->header_image,
1266 &header_requisition, NULL);
1268 header_allocation.x = border_width + header_padding;
1269 header_allocation.y = border_width + header_padding;
1270 header_allocation.width = allocation->width - 2 * border_width - 2 * header_padding;
1271 header_allocation.height = header_requisition.height;
1273 gtk_widget_size_allocate (priv->header_image, &header_allocation);
1276 gtk_widget_get_preferred_size (priv->action_area,
1277 &action_requisition, NULL);
1279 child_allocation.x = border_width;
1280 child_allocation.y = allocation->height - border_width - action_requisition.height;
1281 child_allocation.width = allocation->width - 2 * border_width;
1282 child_allocation.height = action_requisition.height;
1284 gtk_widget_size_allocate (priv->action_area, &child_allocation);
1286 gtk_widget_get_allocation (priv->header_image, &header_image_allocation);
1287 gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
1290 gtk_widget_get_preferred_size (priv->sidebar_image,
1291 &sidebar_requisition, NULL);
1294 child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
1296 child_allocation.x = border_width;
1298 child_allocation.y = border_width + header_image_allocation.height + 2 * header_padding;
1299 child_allocation.width = sidebar_requisition.width;
1300 child_allocation.height = allocation->height - 2 * border_width -
1301 header_image_allocation.height - 2 * header_padding - action_area_allocation.height;
1303 gtk_widget_size_allocate (priv->sidebar_image, &child_allocation);
1306 child_allocation.x = border_width + content_padding;
1307 child_allocation.y = border_width +
1308 header_image_allocation.height + 2 * header_padding + content_padding;
1309 child_allocation.width = allocation->width - 2 * border_width - 2 * content_padding;
1310 child_allocation.height = allocation->height - 2 * border_width -
1311 header_image_allocation.height - 2 * header_padding - ACTION_AREA_SPACING - action_area_allocation.height - 2 * content_padding;
1313 if (gtk_widget_get_visible (priv->sidebar_image))
1315 GtkAllocation sidebar_image_allocation;
1317 gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
1320 child_allocation.x += sidebar_image_allocation.width;
1322 child_allocation.width -= sidebar_image_allocation.width;
1327 GtkAssistantPage *page = pages->data;
1329 gtk_widget_size_allocate (page->page, &child_allocation);
1330 gtk_widget_size_allocate (page->title, &header_allocation);
1331 pages = pages->next;
1336 gtk_assistant_map (GtkWidget *widget)
1338 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1339 GtkAssistantPrivate *priv = assistant->priv;
1341 GtkAssistantPage *page;
1343 gtk_widget_set_mapped (widget, TRUE);
1345 gtk_widget_map (priv->header_image);
1346 gtk_widget_map (priv->action_area);
1348 if (gtk_widget_get_visible (priv->sidebar_image) &&
1349 !gtk_widget_get_mapped (priv->sidebar_image))
1350 gtk_widget_map (priv->sidebar_image);
1352 /* if there's no default page, pick the first one */
1354 if (!priv->current_page)
1356 page_node = priv->pages;
1358 while (page_node && !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
1359 page_node = page_node->next;
1362 page = page_node->data;
1366 gtk_widget_get_visible (page->page) &&
1367 !gtk_widget_get_mapped (page->page))
1368 set_current_page (assistant, page);
1370 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->map (widget);
1374 gtk_assistant_unmap (GtkWidget *widget)
1376 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1377 GtkAssistantPrivate *priv = assistant->priv;
1379 gtk_widget_set_mapped (widget, FALSE);
1381 gtk_widget_unmap (priv->header_image);
1382 gtk_widget_unmap (priv->action_area);
1384 if (gtk_widget_is_drawable (priv->sidebar_image))
1385 gtk_widget_unmap (priv->sidebar_image);
1387 if (priv->current_page &&
1388 gtk_widget_is_drawable (priv->current_page->page))
1389 gtk_widget_unmap (priv->current_page->page);
1391 g_slist_free (priv->visited_pages);
1392 priv->visited_pages = NULL;
1393 priv->current_page = NULL;
1395 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->unmap (widget);
1399 gtk_assistant_delete_event (GtkWidget *widget,
1402 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1403 GtkAssistantPrivate *priv = assistant->priv;
1405 /* Do not allow cancelling in the middle of a progress page */
1406 if (priv->current_page &&
1407 (priv->current_page->type != GTK_ASSISTANT_PAGE_PROGRESS ||
1408 priv->current_page->complete))
1409 g_signal_emit (widget, signals [CANCEL], 0, NULL);
1415 assistant_paint_colored_box (GtkWidget *widget,
1418 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1419 GtkAssistantPrivate *priv = assistant->priv;
1420 GtkAllocation allocation, action_area_allocation, header_image_allocation;
1422 gint border_width, header_padding, content_padding;
1423 gint content_x, content_width;
1426 rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
1427 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
1429 gtk_widget_style_get (widget,
1430 "header-padding", &header_padding,
1431 "content-padding", &content_padding,
1434 style = gtk_widget_get_style (widget);
1435 gtk_widget_get_allocation (widget, &allocation);
1436 gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
1437 gtk_widget_get_allocation (priv->header_image, &header_image_allocation);
1440 gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_SELECTED]);
1441 cairo_rectangle (cr,
1444 allocation.width - 2 * border_width,
1445 allocation.height - action_area_allocation.height - 2 * border_width - ACTION_AREA_SPACING);
1449 content_x = content_padding + border_width;
1450 content_width = allocation.width - 2 * content_padding - 2 * border_width;
1452 if (gtk_widget_get_visible (priv->sidebar_image))
1454 GtkAllocation sidebar_image_allocation;
1456 gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
1459 content_x += sidebar_image_allocation.width;
1460 content_width -= sidebar_image_allocation.width;
1463 gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
1465 cairo_rectangle (cr,
1467 header_image_allocation.height + content_padding + 2 * header_padding + border_width,
1469 allocation.height - 2 * border_width - action_area_allocation.height -
1470 header_image_allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
1475 gtk_assistant_draw (GtkWidget *widget,
1478 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1479 GtkAssistantPrivate *priv = assistant->priv;
1480 GtkContainer *container = GTK_CONTAINER (widget);
1482 if (GTK_WIDGET_CLASS (gtk_assistant_parent_class)->draw)
1483 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->draw (widget, cr);
1485 assistant_paint_colored_box (widget, cr);
1487 gtk_container_propagate_draw (container, priv->header_image, cr);
1488 gtk_container_propagate_draw (container, priv->sidebar_image, cr);
1489 gtk_container_propagate_draw (container, priv->action_area, cr);
1491 if (priv->current_page)
1493 gtk_container_propagate_draw (container, priv->current_page->page, cr);
1494 gtk_container_propagate_draw (container, priv->current_page->title, cr);
1501 gtk_assistant_focus (GtkWidget *widget,
1502 GtkDirectionType direction)
1504 GtkAssistantPrivate *priv;
1505 GtkContainer *container;
1507 container = GTK_CONTAINER (widget);
1508 priv = GTK_ASSISTANT (widget)->priv;
1510 /* we only have to care about 2 widgets, action area and the current page */
1511 if (gtk_container_get_focus_child (container) == priv->action_area)
1513 if (!gtk_widget_child_focus (priv->action_area, direction) &&
1514 (priv->current_page == NULL ||
1515 !gtk_widget_child_focus (priv->current_page->page, direction)))
1517 /* if we're leaving the action area and the current page hasn't
1518 any focusable widget, clear focus and go back to the action area */
1519 gtk_container_set_focus_child (GTK_CONTAINER (priv->action_area), NULL);
1520 gtk_widget_child_focus (priv->action_area, direction);
1525 if ((priv->current_page == NULL ||
1526 !gtk_widget_child_focus (priv->current_page->page, direction)) &&
1527 !gtk_widget_child_focus (priv->action_area, direction))
1529 /* if we're leaving the current page and there isn't nothing focusable
1530 in the action area, try to clear focus and go back to the page */
1531 gtk_window_set_focus (GTK_WINDOW (widget), NULL);
1532 if (priv->current_page != NULL)
1533 gtk_widget_child_focus (priv->current_page->page, direction);
1541 gtk_assistant_add (GtkContainer *container,
1544 gtk_assistant_append_page (GTK_ASSISTANT (container), page);
1548 gtk_assistant_remove (GtkContainer *container,
1551 GtkAssistant *assistant = (GtkAssistant*) container;
1554 element = find_page (assistant, page);
1558 remove_page (assistant, element);
1559 gtk_widget_queue_resize ((GtkWidget *) container);
1564 gtk_assistant_forall (GtkContainer *container,
1565 gboolean include_internals,
1566 GtkCallback callback,
1567 gpointer callback_data)
1569 GtkAssistant *assistant = (GtkAssistant*) container;
1570 GtkAssistantPrivate *priv = assistant->priv;
1573 if (include_internals)
1575 (*callback) (priv->header_image, callback_data);
1576 (*callback) (priv->sidebar_image, callback_data);
1577 (*callback) (priv->action_area, callback_data);
1580 pages = priv->pages;
1584 GtkAssistantPage *page = (GtkAssistantPage *) pages->data;
1586 (*callback) (page->page, callback_data);
1588 if (include_internals)
1589 (*callback) (page->title, callback_data);
1591 pages = pages->next;
1596 * gtk_assistant_new:
1598 * Creates a new #GtkAssistant.
1600 * Return value: a newly created #GtkAssistant
1605 gtk_assistant_new (void)
1607 GtkWidget *assistant;
1609 assistant = g_object_new (GTK_TYPE_ASSISTANT, NULL);
1615 * gtk_assistant_get_current_page:
1616 * @assistant: a #GtkAssistant
1618 * Returns the page number of the current page
1620 * Return value: The index (starting from 0) of the current page in
1621 * the @assistant, if the @assistant has no pages, -1 will be returned
1626 gtk_assistant_get_current_page (GtkAssistant *assistant)
1628 GtkAssistantPrivate *priv;
1630 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), -1);
1632 priv = assistant->priv;
1634 if (!priv->pages || !priv->current_page)
1637 return g_list_index (priv->pages, priv->current_page);
1641 * gtk_assistant_set_current_page:
1642 * @assistant: a #GtkAssistant
1643 * @page_num: index of the page to switch to, starting from 0.
1644 * If negative, the last page will be used. If greater
1645 * than the number of pages in the @assistant, nothing
1648 * Switches the page to @page_num. Note that this will only be necessary
1649 * in custom buttons, as the @assistant flow can be set with
1650 * gtk_assistant_set_forward_page_func().
1655 gtk_assistant_set_current_page (GtkAssistant *assistant,
1658 GtkAssistantPrivate *priv;
1659 GtkAssistantPage *page;
1661 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1663 priv = assistant->priv;
1666 page = (GtkAssistantPage *) g_list_nth_data (priv->pages, page_num);
1668 page = (GtkAssistantPage *) g_list_last (priv->pages)->data;
1670 g_return_if_fail (page != NULL);
1672 if (priv->current_page == page)
1675 /* only add the page to the visited list if the
1676 * assistant is mapped, if not, just use it as an
1677 * initial page setting, for the cases where the
1678 * initial page is != to 0
1680 if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
1681 priv->visited_pages = g_slist_prepend (priv->visited_pages,
1682 priv->current_page);
1684 set_current_page (assistant, page);
1688 * gtk_assistant_get_n_pages:
1689 * @assistant: a #GtkAssistant
1691 * Returns the number of pages in the @assistant
1693 * Return value: The number of pages in the @assistant.
1698 gtk_assistant_get_n_pages (GtkAssistant *assistant)
1700 GtkAssistantPrivate *priv;
1702 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1704 priv = assistant->priv;
1706 return g_list_length (priv->pages);
1710 * gtk_assistant_get_nth_page:
1711 * @assistant: a #GtkAssistant
1712 * @page_num: The index of a page in the @assistant, or -1 to get the last page;
1714 * Returns the child widget contained in page number @page_num.
1716 * Return value: (transfer none): The child widget, or %NULL
1717 * if @page_num is out of bounds.
1722 gtk_assistant_get_nth_page (GtkAssistant *assistant,
1725 GtkAssistantPrivate *priv;
1726 GtkAssistantPage *page;
1729 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
1730 g_return_val_if_fail (page_num >= -1, NULL);
1732 priv = assistant->priv;
1735 elem = g_list_last (priv->pages);
1737 elem = g_list_nth (priv->pages, page_num);
1742 page = (GtkAssistantPage *) elem->data;
1748 * gtk_assistant_prepend_page:
1749 * @assistant: a #GtkAssistant
1750 * @page: a #GtkWidget
1752 * Prepends a page to the @assistant.
1754 * Return value: the index (starting at 0) of the inserted page
1759 gtk_assistant_prepend_page (GtkAssistant *assistant,
1762 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1763 g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
1765 return gtk_assistant_insert_page (assistant, page, 0);
1769 * gtk_assistant_append_page:
1770 * @assistant: a #GtkAssistant
1771 * @page: a #GtkWidget
1773 * Appends a page to the @assistant.
1775 * Return value: the index (starting at 0) of the inserted page
1780 gtk_assistant_append_page (GtkAssistant *assistant,
1783 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1784 g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
1786 return gtk_assistant_insert_page (assistant, page, -1);
1790 * gtk_assistant_insert_page:
1791 * @assistant: a #GtkAssistant
1792 * @page: a #GtkWidget
1793 * @position: the index (starting at 0) at which to insert the page,
1794 * or -1 to append the page to the @assistant
1796 * Inserts a page in the @assistant at a given position.
1798 * Return value: the index (starting from 0) of the inserted page
1803 gtk_assistant_insert_page (GtkAssistant *assistant,
1807 GtkAssistantPrivate *priv;
1808 GtkAssistantPage *page_info;
1811 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1812 g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
1813 g_return_val_if_fail (gtk_widget_get_parent (page) == NULL, 0);
1814 g_return_val_if_fail (!gtk_widget_is_toplevel (page), 0);
1816 priv = assistant->priv;
1818 page_info = g_slice_new0 (GtkAssistantPage);
1819 page_info->page = page;
1820 page_info->title = gtk_label_new (NULL);
1822 g_signal_connect (G_OBJECT (page), "notify::visible",
1823 G_CALLBACK (on_page_notify_visibility), assistant);
1825 gtk_misc_set_alignment (GTK_MISC (page_info->title), 0.,0.5);
1826 set_title_colors (GTK_WIDGET (assistant), page_info->title);
1827 set_title_font (GTK_WIDGET (assistant), page_info->title);
1828 gtk_widget_show (page_info->title);
1830 n_pages = g_list_length (priv->pages);
1832 if (position < 0 || position > n_pages)
1835 priv->pages = g_list_insert (priv->pages, page_info, position);
1837 gtk_widget_set_child_visible (page_info->page, FALSE);
1838 gtk_widget_set_parent (page_info->page, GTK_WIDGET (assistant));
1839 gtk_widget_set_parent (page_info->title, GTK_WIDGET (assistant));
1841 if (gtk_widget_get_realized (GTK_WIDGET (assistant)))
1843 gtk_widget_realize (page_info->page);
1844 gtk_widget_realize (page_info->title);
1847 gtk_widget_queue_resize (GTK_WIDGET (assistant));
1853 * gtk_assistant_set_forward_page_func:
1854 * @assistant: a #GtkAssistant
1855 * @page_func: (allow-none): the #GtkAssistantPageFunc, or %NULL to use the default one
1856 * @data: user data for @page_func
1857 * @destroy: destroy notifier for @data
1859 * Sets the page forwarding function to be @page_func, this function will
1860 * be used to determine what will be the next page when the user presses
1861 * the forward button. Setting @page_func to %NULL will make the assistant
1862 * to use the default forward function, which just goes to the next visible
1868 gtk_assistant_set_forward_page_func (GtkAssistant *assistant,
1869 GtkAssistantPageFunc page_func,
1871 GDestroyNotify destroy)
1873 GtkAssistantPrivate *priv;
1875 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1877 priv = assistant->priv;
1879 if (priv->forward_data_destroy &&
1880 priv->forward_function_data)
1881 (*priv->forward_data_destroy) (priv->forward_function_data);
1885 priv->forward_function = page_func;
1886 priv->forward_function_data = data;
1887 priv->forward_data_destroy = destroy;
1891 priv->forward_function = default_forward_function;
1892 priv->forward_function_data = assistant;
1893 priv->forward_data_destroy = NULL;
1896 /* Page flow has possibly changed, so the
1897 buttons state might need to change too */
1898 set_assistant_buttons_state (assistant);
1902 * gtk_assistant_add_action_widget:
1903 * @assistant: a #GtkAssistant
1904 * @child: a #GtkWidget
1906 * Adds a widget to the action area of a #GtkAssistant.
1911 gtk_assistant_add_action_widget (GtkAssistant *assistant,
1914 GtkAssistantPrivate *priv;
1916 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1917 g_return_if_fail (GTK_IS_WIDGET (child));
1919 priv = assistant->priv;
1921 if (GTK_IS_BUTTON (child))
1922 gtk_size_group_add_widget (priv->size_group, child);
1924 gtk_box_pack_end (GTK_BOX (priv->action_area), child, FALSE, FALSE, 0);
1928 * gtk_assistant_remove_action_widget:
1929 * @assistant: a #GtkAssistant
1930 * @child: a #GtkWidget
1932 * Removes a widget from the action area of a #GtkAssistant.
1937 gtk_assistant_remove_action_widget (GtkAssistant *assistant,
1940 GtkAssistantPrivate *priv;
1942 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1943 g_return_if_fail (GTK_IS_WIDGET (child));
1945 priv = assistant->priv;
1947 if (GTK_IS_BUTTON (child))
1948 gtk_size_group_remove_widget (priv->size_group, child);
1950 gtk_container_remove (GTK_CONTAINER (priv->action_area), child);
1954 * gtk_assistant_set_page_title:
1955 * @assistant: a #GtkAssistant
1956 * @page: a page of @assistant
1957 * @title: the new title for @page
1959 * Sets a title for @page. The title is displayed in the header
1960 * area of the assistant when @page is the current page.
1965 gtk_assistant_set_page_title (GtkAssistant *assistant,
1969 GtkAssistantPage *page_info;
1972 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1973 g_return_if_fail (GTK_IS_WIDGET (page));
1975 child = find_page (assistant, page);
1977 g_return_if_fail (child != NULL);
1979 page_info = (GtkAssistantPage*) child->data;
1981 gtk_label_set_text ((GtkLabel*) page_info->title, title);
1982 gtk_widget_queue_resize (GTK_WIDGET (assistant));
1983 gtk_widget_child_notify (page, "title");
1987 * gtk_assistant_get_page_title:
1988 * @assistant: a #GtkAssistant
1989 * @page: a page of @assistant
1991 * Gets the title for @page.
1993 * Return value: the title for @page.
1997 G_CONST_RETURN gchar*
1998 gtk_assistant_get_page_title (GtkAssistant *assistant,
2001 GtkAssistantPage *page_info;
2004 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
2005 g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
2007 child = find_page (assistant, page);
2009 g_return_val_if_fail (child != NULL, NULL);
2011 page_info = (GtkAssistantPage*) child->data;
2013 return gtk_label_get_text ((GtkLabel*) page_info->title);
2017 * gtk_assistant_set_page_type:
2018 * @assistant: a #GtkAssistant
2019 * @page: a page of @assistant
2020 * @type: the new type for @page
2022 * Sets the page type for @page. The page type determines the page
2023 * behavior in the @assistant.
2028 gtk_assistant_set_page_type (GtkAssistant *assistant,
2030 GtkAssistantPageType type)
2032 GtkAssistantPrivate *priv;
2033 GtkAssistantPage *page_info;
2036 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2037 g_return_if_fail (GTK_IS_WIDGET (page));
2039 priv = assistant->priv;
2040 child = find_page (assistant, page);
2042 g_return_if_fail (child != NULL);
2044 page_info = (GtkAssistantPage*) child->data;
2046 if (type != page_info->type)
2048 page_info->type = type;
2050 /* backwards compatibility to the era before fixing bug 604289 */
2051 if (type == GTK_ASSISTANT_PAGE_SUMMARY && !page_info->complete_set)
2053 gtk_assistant_set_page_complete (assistant, page, TRUE);
2054 page_info->complete_set = FALSE;
2057 /* Always set buttons state, a change in a future page
2058 might change current page buttons */
2059 set_assistant_buttons_state (assistant);
2061 gtk_widget_child_notify (page, "page-type");
2066 * gtk_assistant_get_page_type:
2067 * @assistant: a #GtkAssistant
2068 * @page: a page of @assistant
2070 * Gets the page type of @page.
2072 * Return value: the page type of @page.
2076 GtkAssistantPageType
2077 gtk_assistant_get_page_type (GtkAssistant *assistant,
2080 GtkAssistantPage *page_info;
2083 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), GTK_ASSISTANT_PAGE_CONTENT);
2084 g_return_val_if_fail (GTK_IS_WIDGET (page), GTK_ASSISTANT_PAGE_CONTENT);
2086 child = find_page (assistant, page);
2088 g_return_val_if_fail (child != NULL, GTK_ASSISTANT_PAGE_CONTENT);
2090 page_info = (GtkAssistantPage*) child->data;
2092 return page_info->type;
2096 * gtk_assistant_set_page_header_image:
2097 * @assistant: a #GtkAssistant
2098 * @page: a page of @assistant
2099 * @pixbuf: (allow-none): the new header image @page
2101 * Sets a header image for @page. This image is displayed in the header
2102 * area of the assistant when @page is the current page.
2107 gtk_assistant_set_page_header_image (GtkAssistant *assistant,
2111 GtkAssistantPrivate *priv;
2112 GtkAssistantPage *page_info;
2115 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2116 g_return_if_fail (GTK_IS_WIDGET (page));
2117 g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
2119 priv = assistant->priv;
2120 child = find_page (assistant, page);
2122 g_return_if_fail (child != NULL);
2124 page_info = (GtkAssistantPage*) child->data;
2126 if (pixbuf != page_info->header_image)
2128 if (page_info->header_image)
2130 g_object_unref (page_info->header_image);
2131 page_info->header_image = NULL;
2135 page_info->header_image = g_object_ref (pixbuf);
2137 if (page_info == priv->current_page)
2138 set_assistant_header_image (assistant);
2140 gtk_widget_child_notify (page, "header-image");
2145 * gtk_assistant_get_page_header_image:
2146 * @assistant: a #GtkAssistant
2147 * @page: a page of @assistant
2149 * Gets the header image for @page.
2151 * Return value: (transfer none): the header image for @page, or %NULL
2152 * if there's no header image for the page.
2157 gtk_assistant_get_page_header_image (GtkAssistant *assistant,
2160 GtkAssistantPage *page_info;
2163 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
2164 g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
2166 child = find_page (assistant, page);
2168 g_return_val_if_fail (child != NULL, NULL);
2170 page_info = (GtkAssistantPage*) child->data;
2172 return page_info->header_image;
2176 * gtk_assistant_set_page_side_image:
2177 * @assistant: a #GtkAssistant
2178 * @page: a page of @assistant
2179 * @pixbuf: (allow-none): the new header image @page
2181 * Sets a header image for @page. This image is displayed in the side
2182 * area of the assistant when @page is the current page.
2187 gtk_assistant_set_page_side_image (GtkAssistant *assistant,
2191 GtkAssistantPrivate *priv;
2192 GtkAssistantPage *page_info;
2195 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2196 g_return_if_fail (GTK_IS_WIDGET (page));
2197 g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
2199 priv = assistant->priv;
2200 child = find_page (assistant, page);
2202 g_return_if_fail (child != NULL);
2204 page_info = (GtkAssistantPage*) child->data;
2206 if (pixbuf != page_info->sidebar_image)
2208 if (page_info->sidebar_image)
2210 g_object_unref (page_info->sidebar_image);
2211 page_info->sidebar_image = NULL;
2215 page_info->sidebar_image = g_object_ref (pixbuf);
2217 if (page_info == priv->current_page)
2218 set_assistant_sidebar_image (assistant);
2220 gtk_widget_child_notify (page, "sidebar-image");
2225 * gtk_assistant_get_page_side_image:
2226 * @assistant: a #GtkAssistant
2227 * @page: a page of @assistant
2229 * Gets the header image for @page.
2231 * Return value: (transfer none): the side image for @page, or %NULL
2232 * if there's no side image for the page.
2237 gtk_assistant_get_page_side_image (GtkAssistant *assistant,
2240 GtkAssistantPage *page_info;
2243 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
2244 g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
2246 child = find_page (assistant, page);
2248 g_return_val_if_fail (child != NULL, NULL);
2250 page_info = (GtkAssistantPage*) child->data;
2252 return page_info->sidebar_image;
2256 * gtk_assistant_set_page_complete:
2257 * @assistant: a #GtkAssistant
2258 * @page: a page of @assistant
2259 * @complete: the completeness status of the page
2261 * Sets whether @page contents are complete. This will make
2262 * @assistant update the buttons state to be able to continue the task.
2267 gtk_assistant_set_page_complete (GtkAssistant *assistant,
2271 GtkAssistantPrivate *priv;
2272 GtkAssistantPage *page_info;
2275 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2276 g_return_if_fail (GTK_IS_WIDGET (page));
2278 priv = assistant->priv;
2279 child = find_page (assistant, page);
2281 g_return_if_fail (child != NULL);
2283 page_info = (GtkAssistantPage*) child->data;
2285 if (complete != page_info->complete)
2287 page_info->complete = complete;
2288 page_info->complete_set = TRUE;
2290 /* Always set buttons state, a change in a future page
2291 might change current page buttons */
2292 set_assistant_buttons_state (assistant);
2294 gtk_widget_child_notify (page, "complete");
2299 * gtk_assistant_get_page_complete:
2300 * @assistant: a #GtkAssistant
2301 * @page: a page of @assistant
2303 * Gets whether @page is complete.
2305 * Return value: %TRUE if @page is complete.
2310 gtk_assistant_get_page_complete (GtkAssistant *assistant,
2313 GtkAssistantPage *page_info;
2316 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), FALSE);
2317 g_return_val_if_fail (GTK_IS_WIDGET (page), FALSE);
2319 child = find_page (assistant, page);
2321 g_return_val_if_fail (child != NULL, FALSE);
2323 page_info = (GtkAssistantPage*) child->data;
2325 return page_info->complete;
2329 * gtk_assistant_update_buttons_state:
2330 * @assistant: a #GtkAssistant
2332 * Forces @assistant to recompute the buttons state.
2334 * GTK+ automatically takes care of this in most situations,
2335 * e.g. when the user goes to a different page, or when the
2336 * visibility or completeness of a page changes.
2338 * One situation where it can be necessary to call this
2339 * function is when changing a value on the current page
2340 * affects the future page flow of the assistant.
2345 gtk_assistant_update_buttons_state (GtkAssistant *assistant)
2347 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2349 set_assistant_buttons_state (assistant);
2353 * gtk_assistant_commit:
2354 * @assistant: a #GtkAssistant
2356 * Erases the visited page history so the back button is not
2357 * shown on the current page, and removes the cancel button
2358 * from subsequent pages.
2360 * Use this when the information provided up to the current
2361 * page is hereafter deemed permanent and cannot be modified
2362 * or undone. For example, showing a progress page to track
2363 * a long-running, unreversible operation after the user has
2364 * clicked apply on a confirmation page.
2369 gtk_assistant_commit (GtkAssistant *assistant)
2371 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2373 g_slist_free (assistant->priv->visited_pages);
2374 assistant->priv->visited_pages = NULL;
2376 assistant->priv->committed = TRUE;
2378 set_assistant_buttons_state (assistant);
2383 /* accessible implementation */
2386 gtk_assistant_accessible_get_n_children (AtkObject *accessible)
2388 GtkAssistant *assistant;
2391 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
2396 assistant = GTK_ASSISTANT (widget);
2398 return g_list_length (assistant->priv->pages) + 1;
2403 gtk_assistant_accessible_ref_child (AtkObject *accessible,
2406 GtkAssistant *assistant;
2407 GtkAssistantPrivate *priv;
2408 GtkWidget *widget, *child;
2413 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
2417 assistant = GTK_ASSISTANT (widget);
2418 priv = assistant->priv;
2419 n_pages = g_list_length (priv->pages);
2423 else if (index < n_pages)
2425 GtkAssistantPage *page = g_list_nth_data (priv->pages, index);
2428 title = gtk_assistant_get_page_title (assistant, child);
2430 else if (index == n_pages)
2432 child = priv->action_area;
2438 obj = gtk_widget_get_accessible (child);
2441 atk_object_set_name (obj, title);
2443 return g_object_ref (obj);
2447 gtk_assistant_accessible_class_init (AtkObjectClass *class)
2449 class->get_n_children = gtk_assistant_accessible_get_n_children;
2450 class->ref_child = gtk_assistant_accessible_ref_child;
2454 gtk_assistant_accessible_get_type (void)
2456 static GType type = 0;
2461 * Figure out the size of the class and instance
2462 * we are deriving from
2464 AtkObjectFactory *factory;
2467 GType derived_atk_type;
2469 derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
2470 factory = atk_registry_get_factory (atk_get_default_registry (),
2472 derived_atk_type = atk_object_factory_get_accessible_type (factory);
2473 g_type_query (derived_atk_type, &query);
2475 type = g_type_register_static_simple (derived_atk_type,
2476 I_("GtkAssistantAccessible"),
2478 (GClassInitFunc) gtk_assistant_accessible_class_init,
2479 query.instance_size,
2487 gtk_assistant_accessible_new (GObject *obj)
2489 AtkObject *accessible;
2491 g_return_val_if_fail (GTK_IS_ASSISTANT (obj), NULL);
2493 accessible = g_object_new (gtk_assistant_accessible_get_type (), NULL);
2494 atk_object_initialize (accessible, obj);
2500 gtk_assistant_accessible_factory_get_accessible_type (void)
2502 return gtk_assistant_accessible_get_type ();
2506 gtk_assistant_accessible_factory_create_accessible (GObject *obj)
2508 return gtk_assistant_accessible_new (obj);
2512 gtk_assistant_accessible_factory_class_init (AtkObjectFactoryClass *class)
2514 class->create_accessible = gtk_assistant_accessible_factory_create_accessible;
2515 class->get_accessible_type = gtk_assistant_accessible_factory_get_accessible_type;
2519 gtk_assistant_accessible_factory_get_type (void)
2521 static GType type = 0;
2525 type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
2526 I_("GtkAssistantAccessibleFactory"),
2527 sizeof (AtkObjectFactoryClass),
2528 (GClassInitFunc) gtk_assistant_accessible_factory_class_init,
2529 sizeof (AtkObjectFactory),
2537 gtk_assistant_get_accessible (GtkWidget *widget)
2539 static gboolean first_time = TRUE;
2543 AtkObjectFactory *factory;
2544 AtkRegistry *registry;
2546 GType derived_atk_type;
2549 * Figure out whether accessibility is enabled by looking at the
2550 * type of the accessible object which would be created for
2551 * the parent type of GtkAssistant.
2553 derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
2555 registry = atk_get_default_registry ();
2556 factory = atk_registry_get_factory (registry,
2558 derived_atk_type = atk_object_factory_get_accessible_type (factory);
2559 if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
2561 atk_registry_set_factory_type (registry,
2563 gtk_assistant_accessible_factory_get_type ());
2568 return GTK_WIDGET_CLASS (gtk_assistant_parent_class)->get_accessible (widget);
2572 static GtkBuildableIface *parent_buildable_iface;
2575 gtk_assistant_buildable_interface_init (GtkBuildableIface *iface)
2577 parent_buildable_iface = g_type_interface_peek_parent (iface);
2578 iface->get_internal_child = gtk_assistant_buildable_get_internal_child;
2579 iface->custom_tag_start = gtk_assistant_buildable_custom_tag_start;
2580 iface->custom_finished = gtk_assistant_buildable_custom_finished;
2584 gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
2585 GtkBuilder *builder,
2586 const gchar *childname)
2588 if (strcmp (childname, "action_area") == 0)
2589 return G_OBJECT (GTK_ASSISTANT (buildable)->priv->action_area);
2591 return parent_buildable_iface->get_internal_child (buildable,
2597 gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
2598 GtkBuilder *builder,
2600 const gchar *tagname,
2601 GMarkupParser *parser,
2604 return parent_buildable_iface->custom_tag_start (buildable, builder, child,
2605 tagname, parser, data);
2609 gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
2610 GtkBuilder *builder,
2612 const gchar *tagname,
2615 parent_buildable_iface->custom_finished (buildable, builder, child,
2616 tagname, user_data);