- priv->forward_data_destroy = NULL;
- }
-
- if (priv->visited_pages)
- {
- g_slist_free (priv->visited_pages);
- priv->visited_pages = NULL;
- }
-
- /* We set current to NULL so that the remove code doesn't try
- * to do anything funny */
- priv->current_page = NULL;
-
- while (priv->pages)
- remove_page (assistant, priv->pages);
-
- GTK_WIDGET_CLASS (gtk_assistant_parent_class)->destroy (widget);
-}
-
-static GList*
-find_page (GtkAssistant *assistant,
- GtkWidget *page)
-{
- GtkAssistantPrivate *priv = assistant->priv;
- GList *child = priv->pages;
-
- while (child)
- {
- GtkAssistantPage *page_info = child->data;
- if (page_info->page == page)
- return child;
-
- child = child->next;
- }
-
- return NULL;
-}
-
-static void
-set_title_colors (GtkWidget *assistant,
- GtkWidget *title_label)
-{
- GtkStyle *style;
-
- gtk_widget_ensure_style (assistant);
- style = gtk_widget_get_style (assistant);
-
- /* change colors schema, for making the header text visible */
- gtk_widget_modify_bg (title_label, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
- gtk_widget_modify_fg (title_label, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
-}
-
-static void
-set_title_font (GtkWidget *assistant,
- GtkWidget *title_label)
-{
- PangoFontDescription *desc;
- gint size;
-
- desc = pango_font_description_new ();
- size = pango_font_description_get_size (gtk_widget_get_style (assistant)->font_desc);
-
- pango_font_description_set_weight (desc, PANGO_WEIGHT_ULTRABOLD);
- pango_font_description_set_size (desc, size * PANGO_SCALE_XX_LARGE);
-
- gtk_widget_modify_font (title_label, desc);
- pango_font_description_free (desc);
-}
-
-static void
-gtk_assistant_style_set (GtkWidget *widget,
- GtkStyle *old_style)
-{
- GtkAssistant *assistant = GTK_ASSISTANT (widget);
- GtkAssistantPrivate *priv = assistant->priv;
- GList *list;
-
- list = priv->pages;
-
- while (list)
- {
- GtkAssistantPage *page = list->data;
-
- set_title_colors (widget, page->title);
- set_title_font (widget, page->title);
-
- list = list->next;
- }
-}
-
-static void
-gtk_assistant_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkAssistant *assistant = GTK_ASSISTANT (widget);
- GtkAssistantPrivate *priv = assistant->priv;
- GtkRequisition child_requisition;
- gint header_padding, content_padding;
- gint width, height, header_width, header_height;
- guint border_width;
- GList *list;
-
- gtk_widget_style_get (widget,
- "header-padding", &header_padding,
- "content-padding", &content_padding,
- NULL);
- width = height = 0;
- header_width = header_height = 0;
- list = priv->pages;
-
- while (list)
- {
- GtkAssistantPage *page = list->data;
- gint w, h;
-
- gtk_widget_get_preferred_size (page->page,
- &child_requisition, NULL);
- width = MAX (width, child_requisition.width);
- height = MAX (height, child_requisition.height);
-
- gtk_widget_get_preferred_size (page->title,
- &child_requisition, NULL);
- w = child_requisition.width;
- h = child_requisition.height;
-
- if (page->header_image)
- {
- w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
- h = MAX (h, gdk_pixbuf_get_height (page->header_image));
- }
-
- header_width = MAX (header_width, w);
- header_height = MAX (header_height, h);
-
- list = list->next;
- }
-
- gtk_widget_get_preferred_size (priv->sidebar_image,
- &child_requisition, NULL);
- width += child_requisition.width;
- height = MAX (height, child_requisition.height);
-
- gtk_widget_set_size_request (priv->header_image, header_width, header_height);
- gtk_widget_get_preferred_size (priv->header_image,
- &child_requisition, NULL);
- width = MAX (width, header_width) + 2 * header_padding;
- height += header_height + 2 * header_padding;
-
- gtk_widget_get_preferred_size (priv->action_area,
- &child_requisition, NULL);
- width = MAX (width, child_requisition.width);
- height += child_requisition.height + ACTION_AREA_SPACING;
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- width += border_width * 2 + content_padding * 2;
- height += border_width * 2 + content_padding * 2;
-
- requisition->width = width;
- requisition->height = height;
-}
-
-static void
-gtk_assistant_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_assistant_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.width;
-}
-
-static void
-gtk_assistant_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_assistant_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.height;
-}
-
-static void
-gtk_assistant_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkAssistant *assistant = GTK_ASSISTANT (widget);
- GtkAssistantPrivate *priv = assistant->priv;
- GtkRequisition header_requisition, action_requisition, sidebar_requisition;
- GtkAllocation child_allocation, header_allocation;
- GtkAllocation action_area_allocation, header_image_allocation;
- gint header_padding, content_padding;
- guint border_width;
- gboolean rtl;
- GList *pages;
-
- rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
- pages = priv->pages;
-
- gtk_widget_style_get (widget,
- "header-padding", &header_padding,
- "content-padding", &content_padding,
- NULL);
-
- gtk_widget_set_allocation (widget, allocation);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- /* Header */
- gtk_widget_get_preferred_size (priv->header_image,
- &header_requisition, NULL);
-
- header_allocation.x = border_width + header_padding;
- header_allocation.y = border_width + header_padding;
- header_allocation.width = allocation->width - 2 * border_width - 2 * header_padding;
- header_allocation.height = header_requisition.height;
-
- gtk_widget_size_allocate (priv->header_image, &header_allocation);
-
- /* Action area */
- gtk_widget_get_preferred_size (priv->action_area,
- &action_requisition, NULL);
-
- child_allocation.x = border_width;
- child_allocation.y = allocation->height - border_width - action_requisition.height;
- child_allocation.width = allocation->width - 2 * border_width;
- child_allocation.height = action_requisition.height;
-
- gtk_widget_size_allocate (priv->action_area, &child_allocation);
-
- gtk_widget_get_allocation (priv->header_image, &header_image_allocation);
- gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
-
- /* Sidebar */
- gtk_widget_get_preferred_size (priv->sidebar_image,
- &sidebar_requisition, NULL);
-
- if (rtl)
- child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
- else
- child_allocation.x = border_width;
-
- child_allocation.y = border_width + header_image_allocation.height + 2 * header_padding;
- child_allocation.width = sidebar_requisition.width;
- child_allocation.height = allocation->height - 2 * border_width -
- header_image_allocation.height - 2 * header_padding - action_area_allocation.height;
-
- gtk_widget_size_allocate (priv->sidebar_image, &child_allocation);
-
- /* Pages */
- child_allocation.x = border_width + content_padding;
- child_allocation.y = border_width +
- header_image_allocation.height + 2 * header_padding + content_padding;
- child_allocation.width = allocation->width - 2 * border_width - 2 * content_padding;
- child_allocation.height = allocation->height - 2 * border_width -
- header_image_allocation.height - 2 * header_padding - ACTION_AREA_SPACING - action_area_allocation.height - 2 * content_padding;