Commit 70440523 authored by Sven Herzberg's avatar Sven Herzberg

let the close button reflect the page_complete status of SUMMARY pages

In order to respect this properly, we have to restore the original
behavior by watching a flag to check if the user has already set this.

* gtk/gtkassistant.c: fix the bug by introducing a flag to check for
  non-automatic value setting
* tests/testassistant.c: updated the "generous assistant" to permit
  quick manual testing of this feature
parent 68790321
......@@ -55,7 +55,8 @@ struct _GtkAssistantPage
GtkWidget *page;
GtkAssistantPageType type;
gboolean complete;
guint complete : 1;
guint complete_set : 1;
GtkWidget *title;
GdkPixbuf *header_image;
......@@ -136,6 +137,8 @@ static void gtk_assistant_buildable_custom_finished (GtkBuildable *bui
const gchar *tagname,
gpointer user_data);
static GList* find_page (GtkAssistant *assistant,
GtkWidget *page);
......@@ -516,7 +519,7 @@ set_assistant_buttons_state (GtkAssistant *assistant)
compute_last_button_state (assistant);
gtk_widget_set_sensitive (assistant->close, TRUE);
gtk_widget_set_sensitive (assistant->close, priv->current_page->complete);
gtk_widget_grab_default (assistant->close);
gtk_widget_show (assistant->close);
gtk_widget_hide (assistant->cancel);
......@@ -1928,6 +1931,13 @@ gtk_assistant_set_page_type (GtkAssistant *assistant,
page_info->type = type;
/* backwards compatibility to the era before fixing bug 604289 */
if (type == GTK_ASSISTANT_PAGE_SUMMARY && !page_info->complete_set)
gtk_assistant_set_page_complete (assistant, page, TRUE);
page_info->complete_set = FALSE;
/* Always set buttons state, a change in a future page
might change current page buttons */
set_assistant_buttons_state (assistant);
......@@ -2159,6 +2169,7 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
if (complete != page_info->complete)
page_info->complete = complete;
page_info->complete_set = TRUE;
/* Always set buttons state, a change in a future page
might change current page buttons */
......@@ -57,7 +57,7 @@ test_bug_546005 (void)
gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &cursor_path, NULL);
g_assert (gtk_tree_path_compare (cursor_path, path) == 0);
//gtk_assert_cmptreepath (cursor_path, ==, path);
gtk_tree_path_free (path);
gtk_tree_path_free (cursor_path);
......@@ -213,6 +213,7 @@ create_generous_assistant (GtkWidget *widget)
if (!assistant)
GtkWidget *page, *next, *check;
PageData *pdata;
assistant = gtk_assistant_new ();
gtk_window_set_default_size (GTK_WINDOW (assistant), 400, 300);
......@@ -259,12 +260,21 @@ create_generous_assistant (GtkWidget *widget)
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Progress");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_PROGRESS);
page = get_test_page ("Summary");
page = gtk_check_button_new_with_label ("Summary complete");
gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Summary");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_SUMMARY);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page),
gtk_assistant_get_page_complete (GTK_ASSISTANT (assistant),
pdata = g_new (PageData, 1);
pdata->assistant = GTK_ASSISTANT (assistant);
pdata->page = page;
g_signal_connect (page, "toggled",
G_CALLBACK (complete_cb), pdata);
if (!GTK_WIDGET_VISIBLE (assistant))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment