summaryrefslogtreecommitdiff
path: root/gtk/gtkassistant.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-01-03 20:40:30 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-01-03 20:40:30 +0000
commit198c3c61a9bf715ec4c7329ccc6ef4c351205667 (patch)
treecd8a9101cef093b0ff4c99a3f89dbb3bdb3dae30 /gtk/gtkassistant.c
parent5490174708db1e51784875162bad96e1740a69af (diff)
downloadgtk+-198c3c61a9bf715ec4c7329ccc6ef4c351205667.tar.gz
If the current page is removed, always pick a different one. (#392457,
2007-01-03 Matthias Clasen <mclasen@redhat.com> * gtk/gtkassistant.c (remove_page): If the current page is removed, always pick a different one. (#392457, Colin Watson) svn path=/trunk/; revision=17037
Diffstat (limited to 'gtk/gtkassistant.c')
-rw-r--r--gtk/gtkassistant.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 4dc89885bf..49a519dba7 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -849,12 +849,29 @@ remove_page (GtkAssistant *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)
+ 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);