* Boston, MA 02111-1307, USA.
*/
-#include <config.h>
+#include "config.h"
#include <atk/atk.h>
{
GtkAssistantPrivate *priv = assistant->priv;
+ if (!priv->current_page)
+ return;
+
switch (priv->current_page->type)
{
case GTK_ASSISTANT_PAGE_INTRO:
priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
+ gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
+
gtk_widget_push_composite_child ();
/* Header */
{
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->back, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->back, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
}
gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));
{
GtkAssistantPrivate *priv = assistant->priv;
GtkAssistantPage *page_info;
+ GList *page_node;
page_info = element->data;
- /* If we are mapped and visible, we want to deal with changing the page. */
- if ((GTK_WIDGET_MAPPED (page_info->page)) && (page_info == priv->current_page))
- compute_next_step (assistant);
+ /* If this is the current page, we need to switch away. */
+ if (page_info == priv->current_page)
+ {
+ if (!compute_next_step (assistant))
+ {
+ /* The best we can do at this point is probably to pick the first
+ * visible page.
+ */
+ page_node = priv->pages;
+
+ while (page_node && !GTK_WIDGET_VISIBLE (((GtkAssistantPage *) page_node->data)->page))
+ page_node = page_node->next;
+
+ if (page_node == element)
+ page_node = page_node->next;
+
+ if (page_node)
+ priv->current_page = page_node->data;
+ else
+ priv->current_page = NULL;
+ }
+ }
priv->pages = g_list_remove_link (priv->pages, element);
priv->visited_pages = g_slist_remove_all (priv->visited_pages, page_info);
/* Header */
gtk_widget_get_child_requisition (priv->header_image, &header_requisition);
- header_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width + header_padding;
- header_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width + header_padding;
+ header_allocation.x = GTK_CONTAINER (widget)->border_width + header_padding;
+ header_allocation.y = GTK_CONTAINER (widget)->border_width + header_padding;
header_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * header_padding;
header_allocation.height = header_requisition.height;
gtk_widget_size_allocate (priv->header_image, &header_allocation);
/* Action area */
- child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width;
- child_allocation.y = allocation->y + allocation->height -
+ child_allocation.x = GTK_CONTAINER (widget)->border_width;
+ child_allocation.y = allocation->height -
GTK_CONTAINER (widget)->border_width - priv->action_area->requisition.height;
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width;
child_allocation.height = priv->action_area->requisition.height;
/* Sidebar */
if (rtl)
- child_allocation.x = allocation->x + allocation->width -
+ child_allocation.x = allocation->width -
GTK_CONTAINER (widget)->border_width - priv->sidebar_image->requisition.width;
else
- child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width;
+ child_allocation.x = GTK_CONTAINER (widget)->border_width;
- child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width +
+ child_allocation.y = GTK_CONTAINER (widget)->border_width +
priv->header_image->allocation.height + 2 * header_padding;
child_allocation.width = priv->sidebar_image->requisition.width;
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
gtk_widget_size_allocate (priv->sidebar_image, &child_allocation);
/* Pages */
- child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width + content_padding;
- child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width +
+ child_allocation.x = GTK_CONTAINER (widget)->border_width + content_padding;
+ child_allocation.y = GTK_CONTAINER (widget)->border_width +
priv->header_image->allocation.height + 2 * header_padding + content_padding;
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * content_padding;
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
gtk_assistant_add (GtkContainer *container,
GtkWidget *page)
{
- g_return_if_fail (GTK_IS_WIDGET (page));
-
gtk_assistant_append_page (GTK_ASSISTANT (container), page);
}
gtk_assistant_remove (GtkContainer *container,
GtkWidget *page)
{
- GtkAssistant *assistant;
+ GtkAssistant *assistant = (GtkAssistant*) container;
GList *element;
- assistant = (GtkAssistant*) container;
-
element = find_page (assistant, page);
if (element)
* initial page is != to 0
*/
if (GTK_WIDGET_MAPPED (assistant))
- priv->visited_pages = g_slist_prepend (priv->visited_pages, page);
+ priv->visited_pages = g_slist_prepend (priv->visited_pages,
+ priv->current_page);
set_current_page (assistant, page);
}
/* Page flow has possibly changed, so the
buttons state might need to change too */
- if (priv->current_page)
- set_assistant_buttons_state (assistant);
+ set_assistant_buttons_state (assistant);
}
/**
GtkWidget *page,
const gchar *title)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
g_return_if_fail (GTK_IS_WIDGET (page));
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_if_fail (child != NULL);
gtk_assistant_get_page_title (GtkAssistant *assistant,
GtkWidget *page)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_val_if_fail (child != NULL, NULL);
/* Always set buttons state, a change in a future page
might change current page buttons */
- if (priv->current_page)
- set_assistant_buttons_state (assistant);
+ set_assistant_buttons_state (assistant);
gtk_widget_child_notify (page, "page-type");
}
gtk_assistant_get_page_type (GtkAssistant *assistant,
GtkWidget *page)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), GTK_ASSISTANT_PAGE_CONTENT);
g_return_val_if_fail (GTK_IS_WIDGET (page), GTK_ASSISTANT_PAGE_CONTENT);
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_val_if_fail (child != NULL, GTK_ASSISTANT_PAGE_CONTENT);
gtk_assistant_get_page_header_image (GtkAssistant *assistant,
GtkWidget *page)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_val_if_fail (child != NULL, NULL);
gtk_assistant_get_page_side_image (GtkAssistant *assistant,
GtkWidget *page)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (page), NULL);
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_val_if_fail (child != NULL, NULL);
/* Always set buttons state, a change in a future page
might change current page buttons */
- if (priv->current_page)
- set_assistant_buttons_state (assistant);
+ set_assistant_buttons_state (assistant);
gtk_widget_child_notify (page, "complete");
}
gtk_assistant_get_page_complete (GtkAssistant *assistant,
GtkWidget *page)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (page), FALSE);
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_val_if_fail (child != NULL, FALSE);
g_type_query (derived_atk_type, &query);
type = g_type_register_static_simple (derived_atk_type,
- "GtkAssistantAccessible",
+ I_("GtkAssistantAccessible"),
query.class_size,
(GClassInitFunc) gtk_assistant_accessible_class_init,
query.instance_size,
if (!type)
{
type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
- "GtkAssistantAccessibleFactory",
+ I_("GtkAssistantAccessibleFactory"),
sizeof (AtkObjectFactoryClass),
(GClassInitFunc) gtk_assistant_accessible_factory_class_init,
sizeof (AtkObjectFactory),