gtk_widget_hide (priv->last);
compute_progress_state (assistant);
break;
+ case GTK_ASSISTANT_PAGE_CUSTOM:
+ gtk_widget_hide (priv->cancel);
+ gtk_widget_hide (priv->back);
+ gtk_widget_hide (priv->forward);
+ gtk_widget_hide (priv->apply);
+ gtk_widget_hide (priv->last);
+ gtk_widget_hide (priv->close);
+ break;
default:
g_assert_not_reached ();
}
if (priv->committed)
gtk_widget_hide (priv->cancel);
- else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY)
+ else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY ||
+ priv->current_page->type == GTK_ASSISTANT_PAGE_CUSTOM)
gtk_widget_hide (priv->cancel);
else
gtk_widget_show (priv->cancel);
on_assistant_forward (GtkWidget *widget,
GtkAssistant *assistant)
{
- if (!compute_next_step (assistant))
- g_critical ("Page flow is broken, you may want to end it with a page of "
- "type GTK_ASSISTANT_PAGE_CONFIRM or GTK_ASSISTANT_PAGE_SUMMARY");
+ gtk_assistant_next_page (assistant);
}
static void
on_assistant_back (GtkWidget *widget,
GtkAssistant *assistant)
{
- GtkAssistantPrivate *priv = assistant->priv;
- GtkAssistantPage *page_info;
- GSList *page_node;
-
- /* skip the progress pages when going back */
- do
- {
- page_node = priv->visited_pages;
-
- g_return_if_fail (page_node != NULL);
-
- priv->visited_pages = priv->visited_pages->next;
- page_info = (GtkAssistantPage *) page_node->data;
- g_slist_free_1 (page_node);
- }
- while (page_info->type == GTK_ASSISTANT_PAGE_PROGRESS ||
- !gtk_widget_get_visible (page_info->page));
-
- set_current_page (assistant, page_info);
+ gtk_assistant_previous_page (assistant);
}
static void
set_current_page (assistant, page);
}
+/**
+ * gtk_assistant_next_page:
+ * @assistant: a #GtkAssistant
+ *
+ * Navigate to the next page. It is a programming
+ * error to call this function if there is no next page.
+ *
+ * This function is for use when creating pages of the
+ * #GTK_ASSISTANT_PAGE_CUSTOM type.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_assistant_next_page (GtkAssistant *assistant)
+{
+ GtkAssistantPrivate *priv;
+
+ g_return_if_fail (GTK_IS_ASSISTANT (assistant));
+
+ priv = assistant->priv;
+
+ if (!compute_next_step (assistant))
+ g_critical ("Page flow is broken, you may want to end it with a page of "
+ "type GTK_ASSISTANT_PAGE_CONFIRM or GTK_ASSISTANT_PAGE_SUMMARY");
+}
+
+/**
+ * gtk_assistant_previous_page:
+ * @assistant: a #GtkAssistant
+ *
+ * Navigate to the previous visited page. It is a programming
+ * error to call this function if no previous page is
+ * available.
+ *
+ * This function is for use when creating pages of the
+ * #GTK_ASSISTANT_PAGE_CUSTOM type.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_assistant_previous_page (GtkAssistant *assistant)
+{
+ GtkAssistantPrivate *priv;
+ GtkAssistantPage *page_info;
+ GSList *page_node;
+
+ g_return_if_fail (GTK_IS_ASSISTANT (assistant));
+
+ priv = assistant->priv;
+
+ /* skip the progress pages when going back */
+ do
+ {
+ page_node = priv->visited_pages;
+
+ g_return_if_fail (page_node != NULL);
+
+ priv->visited_pages = priv->visited_pages->next;
+ page_info = (GtkAssistantPage *) page_node->data;
+ g_slist_free_1 (page_node);
+ }
+ while (page_info->type == GTK_ASSISTANT_PAGE_PROGRESS ||
+ !gtk_widget_get_visible (page_info->page));
+
+ set_current_page (assistant, page_info);
+}
+
/**
* gtk_assistant_get_n_pages:
* @assistant: a #GtkAssistant
* @GTK_ASSISTANT_PAGE_PROGRESS: Used for tasks that take a long time to
* complete, blocks the assistant until the page is marked as complete.
* Only the back button will be shown.
+ * @GTK_ASSISTANT_PAGE_CUSTOM: Used for when other page types are not
+ * appropriate. No buttons will be shown, and the application must
+ * add its own buttons through gtk_assistant_add_action_widget().
*
* An enum for determining the page role inside the #GtkAssistant. It's
* used to handle buttons sensitivity and visibility.
GTK_ASSISTANT_PAGE_INTRO,
GTK_ASSISTANT_PAGE_CONFIRM,
GTK_ASSISTANT_PAGE_SUMMARY,
- GTK_ASSISTANT_PAGE_PROGRESS
+ GTK_ASSISTANT_PAGE_PROGRESS,
+ GTK_ASSISTANT_PAGE_CUSTOM
} GtkAssistantPageType;
typedef struct _GtkAssistant GtkAssistant;
GType gtk_assistant_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_assistant_new (void);
+void gtk_assistant_next_page (GtkAssistant *assistant);
+void gtk_assistant_previous_page (GtkAssistant *assistant);
gint gtk_assistant_get_current_page (GtkAssistant *assistant);
void gtk_assistant_set_current_page (GtkAssistant *assistant,
gint page_num);