[gtk+/gtk-2-16] Avoid assertions due to invalid page sequence



commit ce698bb822215200d09620f51d78c5e52946527d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 30 02:14:03 2009 -0400

    Avoid assertions due to invalid page sequence
    
    It is much nicer to handle this gracefully in compute_last_button_state.
    Fixes bug 584125.
---
 gtk/gtkassistant.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index c340d1b..5aac9ad 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -197,8 +197,8 @@ gtk_assistant_class_init (GtkAssistantClass *class)
    * @assistant: the #GtkAssistant
    * @page: the current page
    *
-   * The ::prepared signal is emitted when a new page is set as the assistant's 
-   * current page, before making the new page visible. A handler for this signal 
+   * The ::prepare signal is emitted when a new page is set as the assistant's
+   * current page, before making the new page visible. A handler for this signal
    * can do any preparation which are necessary before showing @page.
    *
    * Since: 2.10
@@ -217,14 +217,14 @@ gtk_assistant_class_init (GtkAssistantClass *class)
    * @assistant: the @GtkAssistant
    *
    * The ::apply signal is emitted when the apply button is clicked. The default
-   * behavior of the #GtkAssistant is to switch to the page after the current page,
-   * unless the current page is the last one.
+   * behavior of the #GtkAssistant is to switch to the page after the current
+   * page, unless the current page is the last one.
    *
-   * A handler for the ::apply signal should carry out the actions for which the
-   * wizard has collected data. If the action takes a long time to complete, you
-   * might consider to put a page of type GTK_ASSISTANT_PAGE_PROGRESS after the
-   * confirmation page and handle this operation within the ::prepare signal of
-   * the progress page.
+   * A handler for the ::apply signal should carry out the actions for which
+   * the wizard has collected data. If the action takes a long time to complete,
+   * you might consider to put a page of type %GTK_ASSISTANT_PAGE_PROGRESS
+   * after the confirmation page and handle this operation within the
+   * #GtkAssistant::prepare signal of the progress page.
    *
    * Since: 2.10
    */
@@ -243,7 +243,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
    *
    * The ::close signal is emitted either when the close button of
    * a summary page is clicked, or when the apply button in the last
-   * page in the flow (of type GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
+   * page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
    *
    * Since: 2.10
    */
@@ -276,7 +276,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
   /**
    * GtkAssistant:page-type:
    *
-   * The type of the assistant page. 
+   * The type of the assistant page.
    *
    * Since: 2.10
    */
@@ -292,7 +292,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
   /**
    * GtkAssistant:title:
    *
-   * The title that is displayed in the page header. 
+   * The title that is displayed in the page header.
    *
    * If title and header-image are both %NULL, no header is displayed.
    *
@@ -326,7 +326,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
   /**
    * GtkAssistant:header-image:
    *
-   * The image that is displayed next to the page. 
+   * The image that is displayed next to the page.
    *
    * Set this to %NULL to make the sidebar disappear.
    *
@@ -410,14 +410,12 @@ compute_last_button_state (GtkAssistant *assistant)
       page_info = g_list_nth_data (priv->pages, page_num);
 
       count++;
-
-      g_assert (page_info);
     }
 
   /* make the last button visible if we can skip multiple
-   * pages and end on a confirmation or summary page 
+   * pages and end on a confirmation or summary page
    */
-  if (count > 1 && 
+  if (count > 1 && page_info &&
       (page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
        page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
     {
@@ -2154,7 +2152,7 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
  * @assistant: a #GtkAssistant
  * @page: a page of @assistant
  * 
- * Gets whether @page is complete..
+ * Gets whether @page is complete.
  * 
  * Return value: %TRUE if @page is complete.
  *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]