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 * If you have a case that doesn't quite fit in #GtkAssistants way of
43 * handling buttons, you can use the #GTK_ASSISTANT_PAGE_CUSTOM page type
44 * and handle buttons yourself.
46 * <refsect2 id="GtkAssistant-BUILDER-UI">
47 * <title>GtkAssistant as GtkBuildable</title>
49 * The GtkAssistant implementation of the GtkBuildable interface exposes the
50 * @action_area as internal children with the name "action_area".
52 * To add pages to an assistant in GtkBuilder, simply add it as a
53 * <child> to the GtkAssistant object, and set its child properties
63 #include "gtkassistant.h"
65 #include "gtkaccessible.h"
66 #include "gtkbutton.h"
71 #include "gtksizegroup.h"
72 #include "gtksizerequest.h"
76 #include "gtkprivate.h"
77 #include "gtkbuildable.h"
80 #define HEADER_SPACING 12
81 #define ACTION_AREA_SPACING 12
83 typedef struct _GtkAssistantPage GtkAssistantPage;
85 struct _GtkAssistantPage
88 GtkAssistantPageType type;
90 guint complete_set : 1;
93 GdkPixbuf *header_image;
94 GdkPixbuf *sidebar_image;
97 struct _GtkAssistantPrivate
106 GtkWidget *header_image;
107 GtkWidget *sidebar_image;
109 GtkWidget *action_area;
113 GtkAssistantPage *current_page;
115 GSList *visited_pages;
117 GtkSizeGroup *size_group;
119 GtkAssistantPageFunc forward_function;
120 gpointer forward_function_data;
121 GDestroyNotify forward_data_destroy;
126 static void gtk_assistant_class_init (GtkAssistantClass *class);
127 static void gtk_assistant_init (GtkAssistant *assistant);
128 static void gtk_assistant_destroy (GtkWidget *widget);
129 static void gtk_assistant_style_set (GtkWidget *widget,
130 GtkStyle *old_style);
131 static void gtk_assistant_get_preferred_width (GtkWidget *widget,
134 static void gtk_assistant_get_preferred_height (GtkWidget *widget,
137 static void gtk_assistant_size_allocate (GtkWidget *widget,
138 GtkAllocation *allocation);
139 static void gtk_assistant_map (GtkWidget *widget);
140 static void gtk_assistant_unmap (GtkWidget *widget);
141 static gboolean gtk_assistant_delete_event (GtkWidget *widget,
143 static gboolean gtk_assistant_draw (GtkWidget *widget,
145 static gboolean gtk_assistant_focus (GtkWidget *widget,
146 GtkDirectionType direction);
147 static void gtk_assistant_add (GtkContainer *container,
149 static void gtk_assistant_remove (GtkContainer *container,
151 static void gtk_assistant_forall (GtkContainer *container,
152 gboolean include_internals,
153 GtkCallback callback,
154 gpointer callback_data);
155 static void gtk_assistant_set_child_property (GtkContainer *container,
160 static void gtk_assistant_get_child_property (GtkContainer *container,
166 static AtkObject *gtk_assistant_get_accessible (GtkWidget *widget);
167 static GType gtk_assistant_accessible_factory_get_type (void);
169 static void gtk_assistant_buildable_interface_init (GtkBuildableIface *iface);
170 static GObject *gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
172 const gchar *childname);
173 static gboolean gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
176 const gchar *tagname,
177 GMarkupParser *parser,
179 static void gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
182 const gchar *tagname,
185 static GList* find_page (GtkAssistant *assistant,
191 CHILD_PROP_PAGE_TYPE,
192 CHILD_PROP_PAGE_TITLE,
193 CHILD_PROP_PAGE_HEADER_IMAGE,
194 CHILD_PROP_PAGE_SIDEBAR_IMAGE,
195 CHILD_PROP_PAGE_COMPLETE
207 static guint signals [LAST_SIGNAL] = { 0 };
210 G_DEFINE_TYPE_WITH_CODE (GtkAssistant, gtk_assistant, GTK_TYPE_WINDOW,
211 G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
212 gtk_assistant_buildable_interface_init))
216 gtk_assistant_class_init (GtkAssistantClass *class)
218 GObjectClass *gobject_class;
219 GtkWidgetClass *widget_class;
220 GtkContainerClass *container_class;
222 gobject_class = (GObjectClass *) class;
223 widget_class = (GtkWidgetClass *) class;
224 container_class = (GtkContainerClass *) class;
226 widget_class->destroy = gtk_assistant_destroy;
227 widget_class->style_set = gtk_assistant_style_set;
228 widget_class->get_preferred_width = gtk_assistant_get_preferred_width;
229 widget_class->get_preferred_height = gtk_assistant_get_preferred_height;
230 widget_class->size_allocate = gtk_assistant_size_allocate;
231 widget_class->map = gtk_assistant_map;
232 widget_class->unmap = gtk_assistant_unmap;
233 widget_class->delete_event = gtk_assistant_delete_event;
234 widget_class->draw = gtk_assistant_draw;
235 widget_class->focus = gtk_assistant_focus;
236 widget_class->get_accessible = gtk_assistant_get_accessible;
238 container_class->add = gtk_assistant_add;
239 container_class->remove = gtk_assistant_remove;
240 container_class->forall = gtk_assistant_forall;
241 container_class->set_child_property = gtk_assistant_set_child_property;
242 container_class->get_child_property = gtk_assistant_get_child_property;
245 * GtkAssistant::cancel:
246 * @assistant: the #GtkAssistant
248 * The ::cancel signal is emitted when then the cancel button is clicked.
253 g_signal_new (I_("cancel"),
254 G_TYPE_FROM_CLASS (gobject_class),
256 G_STRUCT_OFFSET (GtkAssistantClass, cancel),
258 g_cclosure_marshal_VOID__VOID,
262 * GtkAssistant::prepare:
263 * @assistant: the #GtkAssistant
264 * @page: the current page
266 * The ::prepare signal is emitted when a new page is set as the assistant's
267 * current page, before making the new page visible. A handler for this signal
268 * can do any preparation which are necessary before showing @page.
273 g_signal_new (I_("prepare"),
274 G_TYPE_FROM_CLASS (gobject_class),
276 G_STRUCT_OFFSET (GtkAssistantClass, prepare),
278 g_cclosure_marshal_VOID__OBJECT,
279 G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
282 * GtkAssistant::apply:
283 * @assistant: the #GtkAssistant
285 * The ::apply signal is emitted when the apply button is clicked. The default
286 * behavior of the #GtkAssistant is to switch to the page after the current
287 * page, unless the current page is the last one.
289 * A handler for the ::apply signal should carry out the actions for which
290 * the wizard has collected data. If the action takes a long time to complete,
291 * you might consider putting a page of type %GTK_ASSISTANT_PAGE_PROGRESS
292 * after the confirmation page and handle this operation within the
293 * #GtkAssistant::prepare signal of the progress page.
298 g_signal_new (I_("apply"),
299 G_TYPE_FROM_CLASS (gobject_class),
301 G_STRUCT_OFFSET (GtkAssistantClass, apply),
303 g_cclosure_marshal_VOID__VOID,
307 * GtkAssistant::close:
308 * @assistant: the #GtkAssistant
310 * The ::close signal is emitted either when the close button of
311 * a summary page is clicked, or when the apply button in the last
312 * page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
317 g_signal_new (I_("close"),
318 G_TYPE_FROM_CLASS (gobject_class),
320 G_STRUCT_OFFSET (GtkAssistantClass, close),
322 g_cclosure_marshal_VOID__VOID,
325 gtk_widget_class_install_style_property (widget_class,
326 g_param_spec_int ("header-padding",
327 P_("Header Padding"),
328 P_("Number of pixels around the header."),
332 GTK_PARAM_READABLE));
333 gtk_widget_class_install_style_property (widget_class,
334 g_param_spec_int ("content-padding",
335 P_("Content Padding"),
336 P_("Number of pixels around the content pages."),
340 GTK_PARAM_READABLE));
343 * GtkAssistant:page-type:
345 * The type of the assistant page.
349 gtk_container_class_install_child_property (container_class,
350 CHILD_PROP_PAGE_TYPE,
351 g_param_spec_enum ("page-type",
353 P_("The type of the assistant page"),
354 GTK_TYPE_ASSISTANT_PAGE_TYPE,
355 GTK_ASSISTANT_PAGE_CONTENT,
356 GTK_PARAM_READWRITE));
359 * GtkAssistant:title:
361 * The title that is displayed in the page header.
363 * If title and header-image are both %NULL, no header is displayed.
367 gtk_container_class_install_child_property (container_class,
368 CHILD_PROP_PAGE_TITLE,
369 g_param_spec_string ("title",
371 P_("The title of the assistant page"),
373 GTK_PARAM_READWRITE));
376 * GtkAssistant:header-image:
378 * The image that is displayed next to the title in the page header.
380 * If title and header-image are both %NULL, no header is displayed.
384 gtk_container_class_install_child_property (container_class,
385 CHILD_PROP_PAGE_HEADER_IMAGE,
386 g_param_spec_object ("header-image",
388 P_("Header image for the assistant page"),
390 GTK_PARAM_READWRITE));
393 * GtkAssistant:header-image:
395 * The image that is displayed next to the page.
397 * Set this to %NULL to make the sidebar disappear.
401 gtk_container_class_install_child_property (container_class,
402 CHILD_PROP_PAGE_SIDEBAR_IMAGE,
403 g_param_spec_object ("sidebar-image",
405 P_("Sidebar image for the assistant page"),
407 GTK_PARAM_READWRITE));
409 * GtkAssistant:complete:
411 * Setting the "complete" child property to %TRUE marks a page as complete
412 * (i.e.: all the required fields are filled out). GTK+ uses this information
413 * to control the sensitivity of the navigation buttons.
417 gtk_container_class_install_child_property (container_class,
418 CHILD_PROP_PAGE_COMPLETE,
419 g_param_spec_boolean ("complete",
421 P_("Whether all required fields on the page have been filled out"),
425 g_type_class_add_private (gobject_class, sizeof (GtkAssistantPrivate));
429 default_forward_function (gint current_page, gpointer data)
431 GtkAssistant *assistant;
432 GtkAssistantPrivate *priv;
433 GtkAssistantPage *page_info;
436 assistant = GTK_ASSISTANT (data);
437 priv = assistant->priv;
439 page_node = g_list_nth (priv->pages, ++current_page);
444 page_info = (GtkAssistantPage *) page_node->data;
446 while (page_node && !gtk_widget_get_visible (page_info->page))
448 page_node = page_node->next;
452 page_info = (GtkAssistantPage *) page_node->data;
459 compute_last_button_state (GtkAssistant *assistant)
461 GtkAssistantPrivate *priv = assistant->priv;
462 GtkAssistantPage *page_info, *current_page_info;
463 gint count, page_num, n_pages;
466 page_num = gtk_assistant_get_current_page (assistant);
467 n_pages = gtk_assistant_get_n_pages (assistant);
468 current_page_info = page_info = g_list_nth_data (priv->pages, page_num);
470 while (page_num >= 0 && page_num < n_pages &&
471 page_info->type == GTK_ASSISTANT_PAGE_CONTENT &&
472 (count == 0 || page_info->complete) &&
475 page_num = (priv->forward_function) (page_num, priv->forward_function_data);
476 page_info = g_list_nth_data (priv->pages, page_num);
481 /* make the last button visible if we can skip multiple
482 * pages and end on a confirmation or summary page
484 if (count > 1 && page_info &&
485 (page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
486 page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
488 gtk_widget_show (priv->last);
489 gtk_widget_set_sensitive (priv->last,
490 current_page_info->complete);
493 gtk_widget_hide (priv->last);
497 compute_progress_state (GtkAssistant *assistant)
499 GtkAssistantPrivate *priv = assistant->priv;
500 gint page_num, n_pages;
502 n_pages = gtk_assistant_get_n_pages (assistant);
503 page_num = gtk_assistant_get_current_page (assistant);
505 page_num = (priv->forward_function) (page_num, priv->forward_function_data);
507 if (page_num >= 0 && page_num < n_pages)
508 gtk_widget_show (priv->forward);
510 gtk_widget_hide (priv->forward);
514 set_assistant_header_image (GtkAssistant *assistant)
516 GtkAssistantPrivate *priv = assistant->priv;
518 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->header_image),
519 priv->current_page->header_image);
523 set_assistant_sidebar_image (GtkAssistant *assistant)
525 GtkAssistantPrivate *priv = assistant->priv;
527 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->sidebar_image),
528 priv->current_page->sidebar_image);
530 if (priv->current_page->sidebar_image)
531 gtk_widget_show (priv->sidebar_image);
533 gtk_widget_hide (priv->sidebar_image);
537 set_assistant_buttons_state (GtkAssistant *assistant)
539 GtkAssistantPrivate *priv = assistant->priv;
541 if (!priv->current_page)
544 switch (priv->current_page->type)
546 case GTK_ASSISTANT_PAGE_INTRO:
547 gtk_widget_set_sensitive (priv->cancel, TRUE);
548 gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
549 gtk_widget_grab_default (priv->forward);
550 gtk_widget_show (priv->forward);
551 gtk_widget_hide (priv->back);
552 gtk_widget_hide (priv->apply);
553 gtk_widget_hide (priv->close);
554 compute_last_button_state (assistant);
556 case GTK_ASSISTANT_PAGE_CONFIRM:
557 gtk_widget_set_sensitive (priv->cancel, TRUE);
558 gtk_widget_set_sensitive (priv->back, TRUE);
559 gtk_widget_set_sensitive (priv->apply, priv->current_page->complete);
560 gtk_widget_grab_default (priv->apply);
561 gtk_widget_show (priv->back);
562 gtk_widget_show (priv->apply);
563 gtk_widget_hide (priv->forward);
564 gtk_widget_hide (priv->close);
565 gtk_widget_hide (priv->last);
567 case GTK_ASSISTANT_PAGE_CONTENT:
568 gtk_widget_set_sensitive (priv->cancel, TRUE);
569 gtk_widget_set_sensitive (priv->back, TRUE);
570 gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
571 gtk_widget_grab_default (priv->forward);
572 gtk_widget_show (priv->back);
573 gtk_widget_show (priv->forward);
574 gtk_widget_hide (priv->apply);
575 gtk_widget_hide (priv->close);
576 compute_last_button_state (assistant);
578 case GTK_ASSISTANT_PAGE_SUMMARY:
579 gtk_widget_set_sensitive (priv->close, priv->current_page->complete);
580 gtk_widget_grab_default (priv->close);
581 gtk_widget_show (priv->close);
582 gtk_widget_hide (priv->back);
583 gtk_widget_hide (priv->forward);
584 gtk_widget_hide (priv->apply);
585 gtk_widget_hide (priv->last);
587 case GTK_ASSISTANT_PAGE_PROGRESS:
588 gtk_widget_set_sensitive (priv->cancel, priv->current_page->complete);
589 gtk_widget_set_sensitive (priv->back, priv->current_page->complete);
590 gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
591 gtk_widget_grab_default (priv->forward);
592 gtk_widget_show (priv->back);
593 gtk_widget_hide (priv->apply);
594 gtk_widget_hide (priv->close);
595 gtk_widget_hide (priv->last);
596 compute_progress_state (assistant);
598 case GTK_ASSISTANT_PAGE_CUSTOM:
599 gtk_widget_hide (priv->cancel);
600 gtk_widget_hide (priv->back);
601 gtk_widget_hide (priv->forward);
602 gtk_widget_hide (priv->apply);
603 gtk_widget_hide (priv->last);
604 gtk_widget_hide (priv->close);
607 g_assert_not_reached ();
611 gtk_widget_hide (priv->cancel);
612 else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY ||
613 priv->current_page->type == GTK_ASSISTANT_PAGE_CUSTOM)
614 gtk_widget_hide (priv->cancel);
616 gtk_widget_show (priv->cancel);
618 /* this is quite general, we don't want to
619 * go back if it's the first page */
620 if (!priv->visited_pages)
621 gtk_widget_hide (priv->back);
625 set_current_page (GtkAssistant *assistant,
626 GtkAssistantPage *page)
628 GtkAssistantPrivate *priv = assistant->priv;
629 GtkAssistantPage *old_page;
631 if (priv->current_page &&
632 gtk_widget_is_drawable (priv->current_page->page))
633 old_page = priv->current_page;
637 priv->current_page = page;
639 set_assistant_buttons_state (assistant);
640 set_assistant_header_image (assistant);
641 set_assistant_sidebar_image (assistant);
643 g_signal_emit (assistant, signals [PREPARE], 0, priv->current_page->page);
645 if (gtk_widget_get_visible (priv->current_page->page) && gtk_widget_get_mapped (GTK_WIDGET (assistant)))
647 gtk_widget_set_child_visible (priv->current_page->page, TRUE);
648 gtk_widget_map (priv->current_page->page);
649 gtk_widget_map (priv->current_page->title);
652 if (old_page && gtk_widget_get_mapped (old_page->page))
654 gtk_widget_set_child_visible (old_page->page, FALSE);
655 gtk_widget_unmap (old_page->page);
656 gtk_widget_unmap (old_page->title);
659 if (!gtk_widget_child_focus (priv->current_page->page, GTK_DIR_TAB_FORWARD))
661 GtkWidget *button[6];
664 /* find the best button to focus */
665 button[0] = priv->apply;
666 button[1] = priv->close;
667 button[2] = priv->forward;
668 button[3] = priv->back;
669 button[4] = priv->cancel;
670 button[5] = priv->last;
671 for (i = 0; i < 6; i++)
673 if (gtk_widget_get_visible (button[i]) && gtk_widget_get_sensitive (button[i]))
675 gtk_widget_grab_focus (button[i]);
681 gtk_widget_queue_resize (GTK_WIDGET (assistant));
685 compute_next_step (GtkAssistant *assistant)
687 GtkAssistantPrivate *priv = assistant->priv;
688 GtkAssistantPage *page_info;
689 gint current_page, n_pages, next_page;
691 current_page = gtk_assistant_get_current_page (assistant);
692 page_info = priv->current_page;
693 n_pages = gtk_assistant_get_n_pages (assistant);
695 next_page = (priv->forward_function) (current_page,
696 priv->forward_function_data);
698 if (next_page >= 0 && next_page < n_pages)
700 priv->visited_pages = g_slist_prepend (priv->visited_pages, page_info);
701 set_current_page (assistant, g_list_nth_data (priv->pages, next_page));
710 on_assistant_close (GtkWidget *widget,
711 GtkAssistant *assistant)
713 g_signal_emit (assistant, signals [CLOSE], 0, NULL);
717 on_assistant_apply (GtkWidget *widget,
718 GtkAssistant *assistant)
722 g_signal_emit (assistant, signals [APPLY], 0);
724 success = compute_next_step (assistant);
726 /* if the assistant hasn't switched to another page, just emit
727 * the CLOSE signal, it't the last page in the assistant flow
730 g_signal_emit (assistant, signals [CLOSE], 0);
734 on_assistant_forward (GtkWidget *widget,
735 GtkAssistant *assistant)
737 gtk_assistant_next_page (assistant);
741 on_assistant_back (GtkWidget *widget,
742 GtkAssistant *assistant)
744 gtk_assistant_previous_page (assistant);
748 on_assistant_cancel (GtkWidget *widget,
749 GtkAssistant *assistant)
751 g_signal_emit (assistant, signals [CANCEL], 0, NULL);
755 on_assistant_last (GtkWidget *widget,
756 GtkAssistant *assistant)
758 GtkAssistantPrivate *priv = assistant->priv;
760 while (priv->current_page->type == GTK_ASSISTANT_PAGE_CONTENT &&
761 priv->current_page->complete)
762 compute_next_step (assistant);
766 alternative_button_order (GtkAssistant *assistant)
768 GtkSettings *settings;
772 screen = gtk_widget_get_screen (GTK_WIDGET (assistant));
773 settings = gtk_settings_get_for_screen (screen);
775 g_object_get (settings,
776 "gtk-alternative-button-order", &result,
782 gtk_assistant_init (GtkAssistant *assistant)
784 GtkAssistantPrivate *priv;
786 assistant->priv = G_TYPE_INSTANCE_GET_PRIVATE (assistant,
788 GtkAssistantPrivate);
789 priv = assistant->priv;
791 gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
792 gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
794 gtk_widget_push_composite_child ();
797 priv->header_image = gtk_image_new ();
798 gtk_misc_set_alignment (GTK_MISC (priv->header_image), 1., 0.5);
799 gtk_widget_set_parent (priv->header_image, GTK_WIDGET (assistant));
800 gtk_widget_show (priv->header_image);
803 priv->sidebar_image = gtk_image_new ();
804 gtk_misc_set_alignment (GTK_MISC (priv->sidebar_image), 0., 0.);
805 gtk_widget_set_parent (priv->sidebar_image, GTK_WIDGET (assistant));
806 gtk_widget_show (priv->sidebar_image);
809 priv->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
811 priv->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
812 priv->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
813 priv->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
814 priv->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
815 priv->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
816 priv->last = gtk_button_new_from_stock (GTK_STOCK_GOTO_LAST);
817 gtk_widget_set_can_default (priv->close, TRUE);
818 gtk_widget_set_can_default (priv->apply, TRUE);
819 gtk_widget_set_can_default (priv->forward, TRUE);
821 priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
822 gtk_size_group_add_widget (priv->size_group, priv->close);
823 gtk_size_group_add_widget (priv->size_group, priv->apply);
824 gtk_size_group_add_widget (priv->size_group, priv->forward);
825 gtk_size_group_add_widget (priv->size_group, priv->back);
826 gtk_size_group_add_widget (priv->size_group, priv->cancel);
827 gtk_size_group_add_widget (priv->size_group, priv->last);
829 if (!alternative_button_order (assistant))
831 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
832 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
833 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
834 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
835 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
836 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
840 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, 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->apply, FALSE, FALSE, 0);
843 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
844 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
845 gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
848 gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));
849 gtk_widget_show (priv->forward);
850 gtk_widget_show (priv->back);
851 gtk_widget_show (priv->cancel);
852 gtk_widget_show (priv->action_area);
854 gtk_widget_pop_composite_child ();
857 priv->current_page = NULL;
858 priv->visited_pages = NULL;
860 priv->forward_function = default_forward_function;
861 priv->forward_function_data = assistant;
862 priv->forward_data_destroy = NULL;
864 g_signal_connect (G_OBJECT (priv->close), "clicked",
865 G_CALLBACK (on_assistant_close), assistant);
866 g_signal_connect (G_OBJECT (priv->apply), "clicked",
867 G_CALLBACK (on_assistant_apply), assistant);
868 g_signal_connect (G_OBJECT (priv->forward), "clicked",
869 G_CALLBACK (on_assistant_forward), assistant);
870 g_signal_connect (G_OBJECT (priv->back), "clicked",
871 G_CALLBACK (on_assistant_back), assistant);
872 g_signal_connect (G_OBJECT (priv->cancel), "clicked",
873 G_CALLBACK (on_assistant_cancel), assistant);
874 g_signal_connect (G_OBJECT (priv->last), "clicked",
875 G_CALLBACK (on_assistant_last), assistant);
879 gtk_assistant_set_child_property (GtkContainer *container,
887 case CHILD_PROP_PAGE_TYPE:
888 gtk_assistant_set_page_type (GTK_ASSISTANT (container), child,
889 g_value_get_enum (value));
891 case CHILD_PROP_PAGE_TITLE:
892 gtk_assistant_set_page_title (GTK_ASSISTANT (container), child,
893 g_value_get_string (value));
895 case CHILD_PROP_PAGE_HEADER_IMAGE:
896 gtk_assistant_set_page_header_image (GTK_ASSISTANT (container), child,
897 g_value_get_object (value));
899 case CHILD_PROP_PAGE_SIDEBAR_IMAGE:
900 gtk_assistant_set_page_side_image (GTK_ASSISTANT (container), child,
901 g_value_get_object (value));
903 case CHILD_PROP_PAGE_COMPLETE:
904 gtk_assistant_set_page_complete (GTK_ASSISTANT (container), child,
905 g_value_get_boolean (value));
908 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
914 gtk_assistant_get_child_property (GtkContainer *container,
922 case CHILD_PROP_PAGE_TYPE:
923 g_value_set_enum (value,
924 gtk_assistant_get_page_type (GTK_ASSISTANT (container), child));
926 case CHILD_PROP_PAGE_TITLE:
927 g_value_set_string (value,
928 gtk_assistant_get_page_title (GTK_ASSISTANT (container), child));
930 case CHILD_PROP_PAGE_HEADER_IMAGE:
931 g_value_set_object (value,
932 gtk_assistant_get_page_header_image (GTK_ASSISTANT (container), child));
934 case CHILD_PROP_PAGE_SIDEBAR_IMAGE:
935 g_value_set_object (value,
936 gtk_assistant_get_page_side_image (GTK_ASSISTANT (container), child));
938 case CHILD_PROP_PAGE_COMPLETE:
939 g_value_set_boolean (value,
940 gtk_assistant_get_page_complete (GTK_ASSISTANT (container), child));
943 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
949 on_page_notify_visibility (GtkWidget *widget,
953 GtkAssistant *assistant = GTK_ASSISTANT (data);
955 /* update buttons state, flow may have changed */
956 if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
957 set_assistant_buttons_state (assistant);
961 remove_page (GtkAssistant *assistant,
964 GtkAssistantPrivate *priv = assistant->priv;
965 GtkAssistantPage *page_info;
968 page_info = element->data;
970 /* If this is the current page, we need to switch away. */
971 if (page_info == priv->current_page)
973 if (!compute_next_step (assistant))
975 /* The best we can do at this point is probably to pick the first
978 page_node = priv->pages;
980 while (page_node && !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
981 page_node = page_node->next;
983 if (page_node == element)
984 page_node = page_node->next;
987 priv->current_page = page_node->data;
989 priv->current_page = NULL;
993 priv->pages = g_list_remove_link (priv->pages, element);
994 priv->visited_pages = g_slist_remove_all (priv->visited_pages, page_info);
996 g_signal_handlers_disconnect_by_func (page_info->page, on_page_notify_visibility, assistant);
997 gtk_widget_unparent (page_info->page);
999 if (page_info->header_image)
1000 g_object_unref (page_info->header_image);
1002 if (page_info->sidebar_image)
1003 g_object_unref (page_info->sidebar_image);
1005 gtk_widget_destroy (page_info->title);
1006 g_slice_free (GtkAssistantPage, page_info);
1007 g_list_free_1 (element);
1011 gtk_assistant_destroy (GtkWidget *widget)
1013 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1014 GtkAssistantPrivate *priv = assistant->priv;
1016 if (priv->header_image)
1018 gtk_widget_destroy (priv->header_image);
1019 priv->header_image = NULL;
1022 if (priv->sidebar_image)
1024 gtk_widget_destroy (priv->sidebar_image);
1025 priv->sidebar_image = NULL;
1028 if (priv->action_area)
1030 gtk_widget_destroy (priv->action_area);
1031 priv->action_area = NULL;
1034 if (priv->size_group)
1036 g_object_unref (priv->size_group);
1037 priv->size_group = NULL;
1040 if (priv->forward_function)
1042 if (priv->forward_function_data &&
1043 priv->forward_data_destroy)
1044 priv->forward_data_destroy (priv->forward_function_data);
1046 priv->forward_function = NULL;
1047 priv->forward_function_data = NULL;
1048 priv->forward_data_destroy = NULL;
1051 if (priv->visited_pages)
1053 g_slist_free (priv->visited_pages);
1054 priv->visited_pages = NULL;
1057 /* We set current to NULL so that the remove code doesn't try
1058 * to do anything funny */
1059 priv->current_page = NULL;
1062 remove_page (assistant, priv->pages);
1064 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->destroy (widget);
1068 find_page (GtkAssistant *assistant,
1071 GtkAssistantPrivate *priv = assistant->priv;
1072 GList *child = priv->pages;
1076 GtkAssistantPage *page_info = child->data;
1077 if (page_info->page == page)
1080 child = child->next;
1087 set_title_colors (GtkWidget *assistant,
1088 GtkWidget *title_label)
1092 gtk_widget_ensure_style (assistant);
1093 style = gtk_widget_get_style (assistant);
1095 /* change colors schema, for making the header text visible */
1096 gtk_widget_modify_bg (title_label, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
1097 gtk_widget_modify_fg (title_label, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
1101 set_title_font (GtkWidget *assistant,
1102 GtkWidget *title_label)
1104 PangoFontDescription *desc;
1107 desc = pango_font_description_new ();
1108 size = pango_font_description_get_size (gtk_widget_get_style (assistant)->font_desc);
1110 pango_font_description_set_weight (desc, PANGO_WEIGHT_ULTRABOLD);
1111 pango_font_description_set_size (desc, size * PANGO_SCALE_XX_LARGE);
1113 gtk_widget_modify_font (title_label, desc);
1114 pango_font_description_free (desc);
1118 gtk_assistant_style_set (GtkWidget *widget,
1119 GtkStyle *old_style)
1121 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1122 GtkAssistantPrivate *priv = assistant->priv;
1129 GtkAssistantPage *page = list->data;
1131 set_title_colors (widget, page->title);
1132 set_title_font (widget, page->title);
1139 gtk_assistant_size_request (GtkWidget *widget,
1140 GtkRequisition *requisition)
1142 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1143 GtkAssistantPrivate *priv = assistant->priv;
1144 GtkRequisition child_requisition;
1145 gint header_padding, content_padding;
1146 gint width, height, header_width, header_height;
1150 gtk_widget_style_get (widget,
1151 "header-padding", &header_padding,
1152 "content-padding", &content_padding,
1155 header_width = header_height = 0;
1160 GtkAssistantPage *page = list->data;
1163 gtk_widget_get_preferred_size (page->page,
1164 &child_requisition, NULL);
1165 width = MAX (width, child_requisition.width);
1166 height = MAX (height, child_requisition.height);
1168 gtk_widget_get_preferred_size (page->title,
1169 &child_requisition, NULL);
1170 w = child_requisition.width;
1171 h = child_requisition.height;
1173 if (page->header_image)
1175 w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
1176 h = MAX (h, gdk_pixbuf_get_height (page->header_image));
1179 header_width = MAX (header_width, w);
1180 header_height = MAX (header_height, h);
1185 gtk_widget_get_preferred_size (priv->sidebar_image,
1186 &child_requisition, NULL);
1187 width += child_requisition.width;
1188 height = MAX (height, child_requisition.height);
1190 gtk_widget_set_size_request (priv->header_image, header_width, header_height);
1191 gtk_widget_get_preferred_size (priv->header_image,
1192 &child_requisition, NULL);
1193 width = MAX (width, header_width) + 2 * header_padding;
1194 height += header_height + 2 * header_padding;
1196 gtk_widget_get_preferred_size (priv->action_area,
1197 &child_requisition, NULL);
1198 width = MAX (width, child_requisition.width);
1199 height += child_requisition.height + ACTION_AREA_SPACING;
1201 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
1202 width += border_width * 2 + content_padding * 2;
1203 height += border_width * 2 + content_padding * 2;
1205 requisition->width = width;
1206 requisition->height = height;
1210 gtk_assistant_get_preferred_width (GtkWidget *widget,
1214 GtkRequisition requisition;
1216 gtk_assistant_size_request (widget, &requisition);
1218 *minimum = *natural = requisition.width;
1222 gtk_assistant_get_preferred_height (GtkWidget *widget,
1226 GtkRequisition requisition;
1228 gtk_assistant_size_request (widget, &requisition);
1230 *minimum = *natural = requisition.height;
1234 gtk_assistant_size_allocate (GtkWidget *widget,
1235 GtkAllocation *allocation)
1237 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1238 GtkAssistantPrivate *priv = assistant->priv;
1239 GtkRequisition header_requisition, action_requisition, sidebar_requisition;
1240 GtkAllocation child_allocation, header_allocation;
1241 GtkAllocation action_area_allocation, header_image_allocation;
1242 gint header_padding, content_padding;
1247 rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
1248 pages = priv->pages;
1250 gtk_widget_style_get (widget,
1251 "header-padding", &header_padding,
1252 "content-padding", &content_padding,
1255 gtk_widget_set_allocation (widget, allocation);
1256 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
1259 gtk_widget_get_preferred_size (priv->header_image,
1260 &header_requisition, NULL);
1262 header_allocation.x = border_width + header_padding;
1263 header_allocation.y = border_width + header_padding;
1264 header_allocation.width = allocation->width - 2 * border_width - 2 * header_padding;
1265 header_allocation.height = header_requisition.height;
1267 gtk_widget_size_allocate (priv->header_image, &header_allocation);
1270 gtk_widget_get_preferred_size (priv->action_area,
1271 &action_requisition, NULL);
1273 child_allocation.x = border_width;
1274 child_allocation.y = allocation->height - border_width - action_requisition.height;
1275 child_allocation.width = allocation->width - 2 * border_width;
1276 child_allocation.height = action_requisition.height;
1278 gtk_widget_size_allocate (priv->action_area, &child_allocation);
1280 gtk_widget_get_allocation (priv->header_image, &header_image_allocation);
1281 gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
1284 gtk_widget_get_preferred_size (priv->sidebar_image,
1285 &sidebar_requisition, NULL);
1288 child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
1290 child_allocation.x = border_width;
1292 child_allocation.y = border_width + header_image_allocation.height + 2 * header_padding;
1293 child_allocation.width = sidebar_requisition.width;
1294 child_allocation.height = allocation->height - 2 * border_width -
1295 header_image_allocation.height - 2 * header_padding - action_area_allocation.height;
1297 gtk_widget_size_allocate (priv->sidebar_image, &child_allocation);
1300 child_allocation.x = border_width + content_padding;
1301 child_allocation.y = border_width +
1302 header_image_allocation.height + 2 * header_padding + content_padding;
1303 child_allocation.width = allocation->width - 2 * border_width - 2 * content_padding;
1304 child_allocation.height = allocation->height - 2 * border_width -
1305 header_image_allocation.height - 2 * header_padding - ACTION_AREA_SPACING - action_area_allocation.height - 2 * content_padding;
1307 if (gtk_widget_get_visible (priv->sidebar_image))
1309 GtkAllocation sidebar_image_allocation;
1311 gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
1314 child_allocation.x += sidebar_image_allocation.width;
1316 child_allocation.width -= sidebar_image_allocation.width;
1321 GtkAssistantPage *page = pages->data;
1323 gtk_widget_size_allocate (page->page, &child_allocation);
1324 gtk_widget_size_allocate (page->title, &header_allocation);
1325 pages = pages->next;
1330 gtk_assistant_map (GtkWidget *widget)
1332 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1333 GtkAssistantPrivate *priv = assistant->priv;
1335 GtkAssistantPage *page;
1337 gtk_widget_set_mapped (widget, TRUE);
1339 gtk_widget_map (priv->header_image);
1340 gtk_widget_map (priv->action_area);
1342 if (gtk_widget_get_visible (priv->sidebar_image) &&
1343 !gtk_widget_get_mapped (priv->sidebar_image))
1344 gtk_widget_map (priv->sidebar_image);
1346 /* if there's no default page, pick the first one */
1348 if (!priv->current_page)
1350 page_node = priv->pages;
1352 while (page_node && !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
1353 page_node = page_node->next;
1356 page = page_node->data;
1360 gtk_widget_get_visible (page->page) &&
1361 !gtk_widget_get_mapped (page->page))
1362 set_current_page (assistant, page);
1364 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->map (widget);
1368 gtk_assistant_unmap (GtkWidget *widget)
1370 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1371 GtkAssistantPrivate *priv = assistant->priv;
1373 gtk_widget_set_mapped (widget, FALSE);
1375 gtk_widget_unmap (priv->header_image);
1376 gtk_widget_unmap (priv->action_area);
1378 if (gtk_widget_is_drawable (priv->sidebar_image))
1379 gtk_widget_unmap (priv->sidebar_image);
1381 if (priv->current_page &&
1382 gtk_widget_is_drawable (priv->current_page->page))
1383 gtk_widget_unmap (priv->current_page->page);
1385 g_slist_free (priv->visited_pages);
1386 priv->visited_pages = NULL;
1387 priv->current_page = NULL;
1389 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->unmap (widget);
1393 gtk_assistant_delete_event (GtkWidget *widget,
1396 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1397 GtkAssistantPrivate *priv = assistant->priv;
1399 /* Do not allow cancelling in the middle of a progress page */
1400 if (priv->current_page &&
1401 (priv->current_page->type != GTK_ASSISTANT_PAGE_PROGRESS ||
1402 priv->current_page->complete))
1403 g_signal_emit (widget, signals [CANCEL], 0, NULL);
1409 assistant_paint_colored_box (GtkWidget *widget,
1412 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1413 GtkAssistantPrivate *priv = assistant->priv;
1414 GtkAllocation allocation, action_area_allocation, header_image_allocation;
1416 gint border_width, header_padding, content_padding;
1417 gint content_x, content_width;
1420 rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
1421 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
1423 gtk_widget_style_get (widget,
1424 "header-padding", &header_padding,
1425 "content-padding", &content_padding,
1428 style = gtk_widget_get_style (widget);
1429 gtk_widget_get_allocation (widget, &allocation);
1430 gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
1431 gtk_widget_get_allocation (priv->header_image, &header_image_allocation);
1434 gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_SELECTED]);
1435 cairo_rectangle (cr,
1438 allocation.width - 2 * border_width,
1439 allocation.height - action_area_allocation.height - 2 * border_width - ACTION_AREA_SPACING);
1443 content_x = content_padding + border_width;
1444 content_width = allocation.width - 2 * content_padding - 2 * border_width;
1446 if (gtk_widget_get_visible (priv->sidebar_image))
1448 GtkAllocation sidebar_image_allocation;
1450 gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
1453 content_x += sidebar_image_allocation.width;
1454 content_width -= sidebar_image_allocation.width;
1457 gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
1459 cairo_rectangle (cr,
1461 header_image_allocation.height + content_padding + 2 * header_padding + border_width,
1463 allocation.height - 2 * border_width - action_area_allocation.height -
1464 header_image_allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
1469 gtk_assistant_draw (GtkWidget *widget,
1472 GtkAssistant *assistant = GTK_ASSISTANT (widget);
1473 GtkAssistantPrivate *priv = assistant->priv;
1474 GtkContainer *container = GTK_CONTAINER (widget);
1476 if (GTK_WIDGET_CLASS (gtk_assistant_parent_class)->draw)
1477 GTK_WIDGET_CLASS (gtk_assistant_parent_class)->draw (widget, cr);
1479 assistant_paint_colored_box (widget, cr);
1481 gtk_container_propagate_draw (container, priv->header_image, cr);
1482 gtk_container_propagate_draw (container, priv->sidebar_image, cr);
1483 gtk_container_propagate_draw (container, priv->action_area, cr);
1485 if (priv->current_page)
1487 gtk_container_propagate_draw (container, priv->current_page->page, cr);
1488 gtk_container_propagate_draw (container, priv->current_page->title, cr);
1495 gtk_assistant_focus (GtkWidget *widget,
1496 GtkDirectionType direction)
1498 GtkAssistantPrivate *priv;
1499 GtkContainer *container;
1501 container = GTK_CONTAINER (widget);
1502 priv = GTK_ASSISTANT (widget)->priv;
1504 /* we only have to care about 2 widgets, action area and the current page */
1505 if (gtk_container_get_focus_child (container) == priv->action_area)
1507 if (!gtk_widget_child_focus (priv->action_area, direction) &&
1508 (priv->current_page == NULL ||
1509 !gtk_widget_child_focus (priv->current_page->page, direction)))
1511 /* if we're leaving the action area and the current page hasn't
1512 any focusable widget, clear focus and go back to the action area */
1513 gtk_container_set_focus_child (GTK_CONTAINER (priv->action_area), NULL);
1514 gtk_widget_child_focus (priv->action_area, direction);
1519 if ((priv->current_page == NULL ||
1520 !gtk_widget_child_focus (priv->current_page->page, direction)) &&
1521 !gtk_widget_child_focus (priv->action_area, direction))
1523 /* if we're leaving the current page and there isn't nothing focusable
1524 in the action area, try to clear focus and go back to the page */
1525 gtk_window_set_focus (GTK_WINDOW (widget), NULL);
1526 if (priv->current_page != NULL)
1527 gtk_widget_child_focus (priv->current_page->page, direction);
1535 gtk_assistant_add (GtkContainer *container,
1538 gtk_assistant_append_page (GTK_ASSISTANT (container), page);
1542 gtk_assistant_remove (GtkContainer *container,
1545 GtkAssistant *assistant = (GtkAssistant*) container;
1548 element = find_page (assistant, page);
1552 remove_page (assistant, element);
1553 gtk_widget_queue_resize ((GtkWidget *) container);
1558 gtk_assistant_forall (GtkContainer *container,
1559 gboolean include_internals,
1560 GtkCallback callback,
1561 gpointer callback_data)
1563 GtkAssistant *assistant = (GtkAssistant*) container;
1564 GtkAssistantPrivate *priv = assistant->priv;
1567 if (include_internals)
1569 (*callback) (priv->header_image, callback_data);
1570 (*callback) (priv->sidebar_image, callback_data);
1571 (*callback) (priv->action_area, callback_data);
1574 pages = priv->pages;
1578 GtkAssistantPage *page = (GtkAssistantPage *) pages->data;
1580 (*callback) (page->page, callback_data);
1582 if (include_internals)
1583 (*callback) (page->title, callback_data);
1585 pages = pages->next;
1590 * gtk_assistant_new:
1592 * Creates a new #GtkAssistant.
1594 * Return value: a newly created #GtkAssistant
1599 gtk_assistant_new (void)
1601 GtkWidget *assistant;
1603 assistant = g_object_new (GTK_TYPE_ASSISTANT, NULL);
1609 * gtk_assistant_get_current_page:
1610 * @assistant: a #GtkAssistant
1612 * Returns the page number of the current page
1614 * Return value: The index (starting from 0) of the current page in
1615 * the @assistant, if the @assistant has no pages, -1 will be returned
1620 gtk_assistant_get_current_page (GtkAssistant *assistant)
1622 GtkAssistantPrivate *priv;
1624 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), -1);
1626 priv = assistant->priv;
1628 if (!priv->pages || !priv->current_page)
1631 return g_list_index (priv->pages, priv->current_page);
1635 * gtk_assistant_set_current_page:
1636 * @assistant: a #GtkAssistant
1637 * @page_num: index of the page to switch to, starting from 0.
1638 * If negative, the last page will be used. If greater
1639 * than the number of pages in the @assistant, nothing
1642 * Switches the page to @page_num. Note that this will only be necessary
1643 * in custom buttons, as the @assistant flow can be set with
1644 * gtk_assistant_set_forward_page_func().
1649 gtk_assistant_set_current_page (GtkAssistant *assistant,
1652 GtkAssistantPrivate *priv;
1653 GtkAssistantPage *page;
1655 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1657 priv = assistant->priv;
1660 page = (GtkAssistantPage *) g_list_nth_data (priv->pages, page_num);
1662 page = (GtkAssistantPage *) g_list_last (priv->pages)->data;
1664 g_return_if_fail (page != NULL);
1666 if (priv->current_page == page)
1669 /* only add the page to the visited list if the
1670 * assistant is mapped, if not, just use it as an
1671 * initial page setting, for the cases where the
1672 * initial page is != to 0
1674 if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
1675 priv->visited_pages = g_slist_prepend (priv->visited_pages,
1676 priv->current_page);
1678 set_current_page (assistant, page);
1682 * gtk_assistant_next_page:
1683 * @assistant: a #GtkAssistant
1685 * Navigate to the next page. It is a programming
1686 * error to call this function if there is no next page.
1688 * This function is for use when creating pages of the
1689 * #GTK_ASSISTANT_PAGE_CUSTOM type.
1694 gtk_assistant_next_page (GtkAssistant *assistant)
1696 GtkAssistantPrivate *priv;
1698 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1700 priv = assistant->priv;
1702 if (!compute_next_step (assistant))
1703 g_critical ("Page flow is broken, you may want to end it with a page of "
1704 "type GTK_ASSISTANT_PAGE_CONFIRM or GTK_ASSISTANT_PAGE_SUMMARY");
1708 * gtk_assistant_previous_page:
1709 * @assistant: a #GtkAssistant
1711 * Navigate to the previous visited page. It is a programming
1712 * error to call this function if no previous page is
1715 * This function is for use when creating pages of the
1716 * #GTK_ASSISTANT_PAGE_CUSTOM type.
1721 gtk_assistant_previous_page (GtkAssistant *assistant)
1723 GtkAssistantPrivate *priv;
1724 GtkAssistantPage *page_info;
1727 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1729 priv = assistant->priv;
1731 /* skip the progress pages when going back */
1734 page_node = priv->visited_pages;
1736 g_return_if_fail (page_node != NULL);
1738 priv->visited_pages = priv->visited_pages->next;
1739 page_info = (GtkAssistantPage *) page_node->data;
1740 g_slist_free_1 (page_node);
1742 while (page_info->type == GTK_ASSISTANT_PAGE_PROGRESS ||
1743 !gtk_widget_get_visible (page_info->page));
1745 set_current_page (assistant, page_info);
1749 * gtk_assistant_get_n_pages:
1750 * @assistant: a #GtkAssistant
1752 * Returns the number of pages in the @assistant
1754 * Return value: The number of pages in the @assistant.
1759 gtk_assistant_get_n_pages (GtkAssistant *assistant)
1761 GtkAssistantPrivate *priv;
1763 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1765 priv = assistant->priv;
1767 return g_list_length (priv->pages);
1771 * gtk_assistant_get_nth_page:
1772 * @assistant: a #GtkAssistant
1773 * @page_num: The index of a page in the @assistant, or -1 to get the last page;
1775 * Returns the child widget contained in page number @page_num.
1777 * Return value: (transfer none): The child widget, or %NULL
1778 * if @page_num is out of bounds.
1783 gtk_assistant_get_nth_page (GtkAssistant *assistant,
1786 GtkAssistantPrivate *priv;
1787 GtkAssistantPage *page;
1790 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
1791 g_return_val_if_fail (page_num >= -1, NULL);
1793 priv = assistant->priv;
1796 elem = g_list_last (priv->pages);
1798 elem = g_list_nth (priv->pages, page_num);
1803 page = (GtkAssistantPage *) elem->data;
1809 * gtk_assistant_prepend_page:
1810 * @assistant: a #GtkAssistant
1811 * @page: a #GtkWidget
1813 * Prepends a page to the @assistant.
1815 * Return value: the index (starting at 0) of the inserted page
1820 gtk_assistant_prepend_page (GtkAssistant *assistant,
1823 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1824 g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
1826 return gtk_assistant_insert_page (assistant, page, 0);
1830 * gtk_assistant_append_page:
1831 * @assistant: a #GtkAssistant
1832 * @page: a #GtkWidget
1834 * Appends a page to the @assistant.
1836 * Return value: the index (starting at 0) of the inserted page
1841 gtk_assistant_append_page (GtkAssistant *assistant,
1844 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1845 g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
1847 return gtk_assistant_insert_page (assistant, page, -1);
1851 * gtk_assistant_insert_page:
1852 * @assistant: a #GtkAssistant
1853 * @page: a #GtkWidget
1854 * @position: the index (starting at 0) at which to insert the page,
1855 * or -1 to append the page to the @assistant
1857 * Inserts a page in the @assistant at a given position.
1859 * Return value: the index (starting from 0) of the inserted page
1864 gtk_assistant_insert_page (GtkAssistant *assistant,
1868 GtkAssistantPrivate *priv;
1869 GtkAssistantPage *page_info;
1872 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
1873 g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
1874 g_return_val_if_fail (gtk_widget_get_parent (page) == NULL, 0);
1875 g_return_val_if_fail (!gtk_widget_is_toplevel (page), 0);
1877 priv = assistant->priv;
1879 page_info = g_slice_new0 (GtkAssistantPage);
1880 page_info->page = page;
1881 page_info->title = gtk_label_new (NULL);
1883 g_signal_connect (G_OBJECT (page), "notify::visible",
1884 G_CALLBACK (on_page_notify_visibility), assistant);
1886 gtk_misc_set_alignment (GTK_MISC (page_info->title), 0.,0.5);
1887 set_title_colors (GTK_WIDGET (assistant), page_info->title);
1888 set_title_font (GTK_WIDGET (assistant), page_info->title);
1889 gtk_widget_show (page_info->title);
1891 n_pages = g_list_length (priv->pages);
1893 if (position < 0 || position > n_pages)
1896 priv->pages = g_list_insert (priv->pages, page_info, position);
1898 gtk_widget_set_child_visible (page_info->page, FALSE);
1899 gtk_widget_set_parent (page_info->page, GTK_WIDGET (assistant));
1900 gtk_widget_set_parent (page_info->title, GTK_WIDGET (assistant));
1902 if (gtk_widget_get_realized (GTK_WIDGET (assistant)))
1904 gtk_widget_realize (page_info->page);
1905 gtk_widget_realize (page_info->title);
1908 gtk_widget_queue_resize (GTK_WIDGET (assistant));
1914 * gtk_assistant_set_forward_page_func:
1915 * @assistant: a #GtkAssistant
1916 * @page_func: (allow-none): the #GtkAssistantPageFunc, or %NULL to use the default one
1917 * @data: user data for @page_func
1918 * @destroy: destroy notifier for @data
1920 * Sets the page forwarding function to be @page_func, this function will
1921 * be used to determine what will be the next page when the user presses
1922 * the forward button. Setting @page_func to %NULL will make the assistant
1923 * to use the default forward function, which just goes to the next visible
1929 gtk_assistant_set_forward_page_func (GtkAssistant *assistant,
1930 GtkAssistantPageFunc page_func,
1932 GDestroyNotify destroy)
1934 GtkAssistantPrivate *priv;
1936 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1938 priv = assistant->priv;
1940 if (priv->forward_data_destroy &&
1941 priv->forward_function_data)
1942 (*priv->forward_data_destroy) (priv->forward_function_data);
1946 priv->forward_function = page_func;
1947 priv->forward_function_data = data;
1948 priv->forward_data_destroy = destroy;
1952 priv->forward_function = default_forward_function;
1953 priv->forward_function_data = assistant;
1954 priv->forward_data_destroy = NULL;
1957 /* Page flow has possibly changed, so the
1958 buttons state might need to change too */
1959 set_assistant_buttons_state (assistant);
1963 * gtk_assistant_add_action_widget:
1964 * @assistant: a #GtkAssistant
1965 * @child: a #GtkWidget
1967 * Adds a widget to the action area of a #GtkAssistant.
1972 gtk_assistant_add_action_widget (GtkAssistant *assistant,
1975 GtkAssistantPrivate *priv;
1977 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
1978 g_return_if_fail (GTK_IS_WIDGET (child));
1980 priv = assistant->priv;
1982 if (GTK_IS_BUTTON (child))
1983 gtk_size_group_add_widget (priv->size_group, child);
1985 gtk_box_pack_end (GTK_BOX (priv->action_area), child, FALSE, FALSE, 0);
1989 * gtk_assistant_remove_action_widget:
1990 * @assistant: a #GtkAssistant
1991 * @child: a #GtkWidget
1993 * Removes a widget from the action area of a #GtkAssistant.
1998 gtk_assistant_remove_action_widget (GtkAssistant *assistant,
2001 GtkAssistantPrivate *priv;
2003 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2004 g_return_if_fail (GTK_IS_WIDGET (child));
2006 priv = assistant->priv;
2008 if (GTK_IS_BUTTON (child))
2009 gtk_size_group_remove_widget (priv->size_group, child);
2011 gtk_container_remove (GTK_CONTAINER (priv->action_area), child);
2015 * gtk_assistant_set_page_title:
2016 * @assistant: a #GtkAssistant
2017 * @page: a page of @assistant
2018 * @title: the new title for @page
2020 * Sets a title for @page. The title is displayed in the header
2021 * area of the assistant when @page is the current page.
2026 gtk_assistant_set_page_title (GtkAssistant *assistant,
2030 GtkAssistantPage *page_info;
2033 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2034 g_return_if_fail (GTK_IS_WIDGET (page));
2036 child = find_page (assistant, page);
2038 g_return_if_fail (child != NULL);
2040 page_info = (GtkAssistantPage*) child->data;
2042 gtk_label_set_text ((GtkLabel*) page_info->title, title);
2043 gtk_widget_queue_resize (GTK_WIDGET (assistant));
2044 gtk_widget_child_notify (page, "title");
2048 * gtk_assistant_get_page_title:
2049 * @assistant: a #GtkAssistant
2050 * @page: a page of @assistant
2052 * Gets the title for @page.
2054 * Return value: the title for @page.
2058 G_CONST_RETURN gchar*
2059 gtk_assistant_get_page_title (GtkAssistant *assistant,
2062 GtkAssistantPage *page_info;
2065 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
2066 g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
2068 child = find_page (assistant, page);
2070 g_return_val_if_fail (child != NULL, NULL);
2072 page_info = (GtkAssistantPage*) child->data;
2074 return gtk_label_get_text ((GtkLabel*) page_info->title);
2078 * gtk_assistant_set_page_type:
2079 * @assistant: a #GtkAssistant
2080 * @page: a page of @assistant
2081 * @type: the new type for @page
2083 * Sets the page type for @page. The page type determines the page
2084 * behavior in the @assistant.
2089 gtk_assistant_set_page_type (GtkAssistant *assistant,
2091 GtkAssistantPageType type)
2093 GtkAssistantPrivate *priv;
2094 GtkAssistantPage *page_info;
2097 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2098 g_return_if_fail (GTK_IS_WIDGET (page));
2100 priv = assistant->priv;
2101 child = find_page (assistant, page);
2103 g_return_if_fail (child != NULL);
2105 page_info = (GtkAssistantPage*) child->data;
2107 if (type != page_info->type)
2109 page_info->type = type;
2111 /* backwards compatibility to the era before fixing bug 604289 */
2112 if (type == GTK_ASSISTANT_PAGE_SUMMARY && !page_info->complete_set)
2114 gtk_assistant_set_page_complete (assistant, page, TRUE);
2115 page_info->complete_set = FALSE;
2118 /* Always set buttons state, a change in a future page
2119 might change current page buttons */
2120 set_assistant_buttons_state (assistant);
2122 gtk_widget_child_notify (page, "page-type");
2127 * gtk_assistant_get_page_type:
2128 * @assistant: a #GtkAssistant
2129 * @page: a page of @assistant
2131 * Gets the page type of @page.
2133 * Return value: the page type of @page.
2137 GtkAssistantPageType
2138 gtk_assistant_get_page_type (GtkAssistant *assistant,
2141 GtkAssistantPage *page_info;
2144 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), GTK_ASSISTANT_PAGE_CONTENT);
2145 g_return_val_if_fail (GTK_IS_WIDGET (page), GTK_ASSISTANT_PAGE_CONTENT);
2147 child = find_page (assistant, page);
2149 g_return_val_if_fail (child != NULL, GTK_ASSISTANT_PAGE_CONTENT);
2151 page_info = (GtkAssistantPage*) child->data;
2153 return page_info->type;
2157 * gtk_assistant_set_page_header_image:
2158 * @assistant: a #GtkAssistant
2159 * @page: a page of @assistant
2160 * @pixbuf: (allow-none): the new header image @page
2162 * Sets a header image for @page. This image is displayed in the header
2163 * area of the assistant when @page is the current page.
2168 gtk_assistant_set_page_header_image (GtkAssistant *assistant,
2172 GtkAssistantPrivate *priv;
2173 GtkAssistantPage *page_info;
2176 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2177 g_return_if_fail (GTK_IS_WIDGET (page));
2178 g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
2180 priv = assistant->priv;
2181 child = find_page (assistant, page);
2183 g_return_if_fail (child != NULL);
2185 page_info = (GtkAssistantPage*) child->data;
2187 if (pixbuf != page_info->header_image)
2189 if (page_info->header_image)
2191 g_object_unref (page_info->header_image);
2192 page_info->header_image = NULL;
2196 page_info->header_image = g_object_ref (pixbuf);
2198 if (page_info == priv->current_page)
2199 set_assistant_header_image (assistant);
2201 gtk_widget_child_notify (page, "header-image");
2206 * gtk_assistant_get_page_header_image:
2207 * @assistant: a #GtkAssistant
2208 * @page: a page of @assistant
2210 * Gets the header image for @page.
2212 * Return value: (transfer none): the header image for @page, or %NULL
2213 * if there's no header image for the page.
2218 gtk_assistant_get_page_header_image (GtkAssistant *assistant,
2221 GtkAssistantPage *page_info;
2224 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
2225 g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
2227 child = find_page (assistant, page);
2229 g_return_val_if_fail (child != NULL, NULL);
2231 page_info = (GtkAssistantPage*) child->data;
2233 return page_info->header_image;
2237 * gtk_assistant_set_page_side_image:
2238 * @assistant: a #GtkAssistant
2239 * @page: a page of @assistant
2240 * @pixbuf: (allow-none): the new header image @page
2242 * Sets a header image for @page. This image is displayed in the side
2243 * area of the assistant when @page is the current page.
2248 gtk_assistant_set_page_side_image (GtkAssistant *assistant,
2252 GtkAssistantPrivate *priv;
2253 GtkAssistantPage *page_info;
2256 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2257 g_return_if_fail (GTK_IS_WIDGET (page));
2258 g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
2260 priv = assistant->priv;
2261 child = find_page (assistant, page);
2263 g_return_if_fail (child != NULL);
2265 page_info = (GtkAssistantPage*) child->data;
2267 if (pixbuf != page_info->sidebar_image)
2269 if (page_info->sidebar_image)
2271 g_object_unref (page_info->sidebar_image);
2272 page_info->sidebar_image = NULL;
2276 page_info->sidebar_image = g_object_ref (pixbuf);
2278 if (page_info == priv->current_page)
2279 set_assistant_sidebar_image (assistant);
2281 gtk_widget_child_notify (page, "sidebar-image");
2286 * gtk_assistant_get_page_side_image:
2287 * @assistant: a #GtkAssistant
2288 * @page: a page of @assistant
2290 * Gets the header image for @page.
2292 * Return value: (transfer none): the side image for @page, or %NULL
2293 * if there's no side image for the page.
2298 gtk_assistant_get_page_side_image (GtkAssistant *assistant,
2301 GtkAssistantPage *page_info;
2304 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
2305 g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
2307 child = find_page (assistant, page);
2309 g_return_val_if_fail (child != NULL, NULL);
2311 page_info = (GtkAssistantPage*) child->data;
2313 return page_info->sidebar_image;
2317 * gtk_assistant_set_page_complete:
2318 * @assistant: a #GtkAssistant
2319 * @page: a page of @assistant
2320 * @complete: the completeness status of the page
2322 * Sets whether @page contents are complete. This will make
2323 * @assistant update the buttons state to be able to continue the task.
2328 gtk_assistant_set_page_complete (GtkAssistant *assistant,
2332 GtkAssistantPrivate *priv;
2333 GtkAssistantPage *page_info;
2336 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2337 g_return_if_fail (GTK_IS_WIDGET (page));
2339 priv = assistant->priv;
2340 child = find_page (assistant, page);
2342 g_return_if_fail (child != NULL);
2344 page_info = (GtkAssistantPage*) child->data;
2346 if (complete != page_info->complete)
2348 page_info->complete = complete;
2349 page_info->complete_set = TRUE;
2351 /* Always set buttons state, a change in a future page
2352 might change current page buttons */
2353 set_assistant_buttons_state (assistant);
2355 gtk_widget_child_notify (page, "complete");
2360 * gtk_assistant_get_page_complete:
2361 * @assistant: a #GtkAssistant
2362 * @page: a page of @assistant
2364 * Gets whether @page is complete.
2366 * Return value: %TRUE if @page is complete.
2371 gtk_assistant_get_page_complete (GtkAssistant *assistant,
2374 GtkAssistantPage *page_info;
2377 g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), FALSE);
2378 g_return_val_if_fail (GTK_IS_WIDGET (page), FALSE);
2380 child = find_page (assistant, page);
2382 g_return_val_if_fail (child != NULL, FALSE);
2384 page_info = (GtkAssistantPage*) child->data;
2386 return page_info->complete;
2390 * gtk_assistant_update_buttons_state:
2391 * @assistant: a #GtkAssistant
2393 * Forces @assistant to recompute the buttons state.
2395 * GTK+ automatically takes care of this in most situations,
2396 * e.g. when the user goes to a different page, or when the
2397 * visibility or completeness of a page changes.
2399 * One situation where it can be necessary to call this
2400 * function is when changing a value on the current page
2401 * affects the future page flow of the assistant.
2406 gtk_assistant_update_buttons_state (GtkAssistant *assistant)
2408 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2410 set_assistant_buttons_state (assistant);
2414 * gtk_assistant_commit:
2415 * @assistant: a #GtkAssistant
2417 * Erases the visited page history so the back button is not
2418 * shown on the current page, and removes the cancel button
2419 * from subsequent pages.
2421 * Use this when the information provided up to the current
2422 * page is hereafter deemed permanent and cannot be modified
2423 * or undone. For example, showing a progress page to track
2424 * a long-running, unreversible operation after the user has
2425 * clicked apply on a confirmation page.
2430 gtk_assistant_commit (GtkAssistant *assistant)
2432 g_return_if_fail (GTK_IS_ASSISTANT (assistant));
2434 g_slist_free (assistant->priv->visited_pages);
2435 assistant->priv->visited_pages = NULL;
2437 assistant->priv->committed = TRUE;
2439 set_assistant_buttons_state (assistant);
2443 gtk_assistant_get_accessible (GtkWidget *widget)
2445 static gboolean first_time = TRUE;
2449 AtkObjectFactory *factory;
2450 AtkRegistry *registry;
2452 GType derived_atk_type;
2455 * Figure out whether accessibility is enabled by looking at the
2456 * type of the accessible object which would be created for
2457 * the parent type of GtkAssistant.
2459 derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
2461 registry = atk_get_default_registry ();
2462 factory = atk_registry_get_factory (registry, derived_type);
2463 derived_atk_type = atk_object_factory_get_accessible_type (factory);
2464 if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
2465 atk_registry_set_factory_type (registry,
2467 gtk_assistant_accessible_factory_get_type ());
2472 return GTK_WIDGET_CLASS (gtk_assistant_parent_class)->get_accessible (widget);
2475 /* accessible implementation */
2477 /* dummy typedefs */
2478 typedef struct _GtkAssistantAccessible GtkAssistantAccessible;
2479 typedef struct _GtkAssistantAccessibleClass GtkAssistantAccessibleClass;
2481 ATK_DEFINE_TYPE (GtkAssistantAccessible, gtk_assistant_accessible, GTK_TYPE_ASSISTANT);
2484 gtk_assistant_accessible_get_n_children (AtkObject *accessible)
2488 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
2492 return g_list_length (GTK_ASSISTANT (accessible)->priv->pages) + 1;
2496 gtk_assistant_accessible_ref_child (AtkObject *accessible,
2499 GtkAssistant *assistant;
2500 GtkAssistantPrivate *priv;
2501 GtkWidget *widget, *child;
2506 widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
2510 assistant = GTK_ASSISTANT (widget);
2511 priv = assistant->priv;
2512 n_pages = g_list_length (priv->pages);
2516 else if (index < n_pages)
2518 GtkAssistantPage *page = g_list_nth_data (priv->pages, index);
2521 title = gtk_assistant_get_page_title (assistant, child);
2523 else if (index == n_pages)
2525 child = priv->action_area;
2531 obj = gtk_widget_get_accessible (child);
2534 atk_object_set_name (obj, title);
2536 return g_object_ref (obj);
2540 gtk_assistant_accessible_class_init (GtkAssistantAccessibleClass *klass)
2542 AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
2544 atk_class->get_n_children = gtk_assistant_accessible_get_n_children;
2545 atk_class->ref_child = gtk_assistant_accessible_ref_child;
2549 gtk_assistant_accessible_init (GtkAssistantAccessible *self)
2554 typedef AtkObjectFactory GtkAssistantAccessibleFactory;
2555 typedef AtkObjectFactoryClass GtkAssistantAccessibleFactoryClass;
2557 G_DEFINE_TYPE (GtkAssistantAccessibleFactory,
2558 gtk_assistant_accessible_factory,
2559 ATK_TYPE_OBJECT_FACTORY);
2562 gtk_assistant_accessible_factory_get_accessible_type (void)
2564 return gtk_assistant_accessible_get_type ();
2568 gtk_assistant_accessible_factory_create_accessible (GObject *obj)
2570 AtkObject *accessible;
2572 accessible = g_object_new (gtk_assistant_accessible_get_type (), NULL);
2573 atk_object_initialize (accessible, obj);
2579 gtk_assistant_accessible_factory_class_init (AtkObjectFactoryClass *class)
2581 class->create_accessible = gtk_assistant_accessible_factory_create_accessible;
2582 class->get_accessible_type = gtk_assistant_accessible_factory_get_accessible_type;
2586 gtk_assistant_accessible_factory_init (AtkObjectFactory *factory)
2590 /* buildable implementation */
2592 static GtkBuildableIface *parent_buildable_iface;
2595 gtk_assistant_buildable_interface_init (GtkBuildableIface *iface)
2597 parent_buildable_iface = g_type_interface_peek_parent (iface);
2598 iface->get_internal_child = gtk_assistant_buildable_get_internal_child;
2599 iface->custom_tag_start = gtk_assistant_buildable_custom_tag_start;
2600 iface->custom_finished = gtk_assistant_buildable_custom_finished;
2604 gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
2605 GtkBuilder *builder,
2606 const gchar *childname)
2608 if (strcmp (childname, "action_area") == 0)
2609 return G_OBJECT (GTK_ASSISTANT (buildable)->priv->action_area);
2611 return parent_buildable_iface->get_internal_child (buildable,
2617 gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
2618 GtkBuilder *builder,
2620 const gchar *tagname,
2621 GMarkupParser *parser,
2624 return parent_buildable_iface->custom_tag_start (buildable, builder, child,
2625 tagname, parser, data);
2629 gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
2630 GtkBuilder *builder,
2632 const gchar *tagname,
2635 parent_buildable_iface->custom_finished (buildable, builder, child,
2636 tagname, user_data);