From 2ffe24ca113fffe61547366ab39d1aa93c9e0170 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 23 Jan 2006 19:11:40 +0000 Subject: [PATCH] Only show the last button if we can jump to the end. (gtk_assistant_init): 2006-01-23 Matthias Clasen * gtk/gtkassistant.c (compute_last_button_state): Only show the last button if we can jump to the end. (gtk_assistant_init): Make the spacing and button order more HIG compliant. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ gtk/gtkassistant.c | 34 ++++++++++++++++++++++------------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index bceb24b44..f9660a274 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-01-23 Matthias Clasen + * gtk/gtkassistant.c (compute_last_button_state): Only show the + last button if we can jump to the end. + (gtk_assistant_init): Make the spacing and button order more + HIG compliant. + Fix drawing issues in progress bars. (#328081, Christian Persch) * gtk/gtkprogressbar.c (gtk_progress_bar_size_request): Always diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bceb24b44..f9660a274 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,10 @@ 2006-01-23 Matthias Clasen + * gtk/gtkassistant.c (compute_last_button_state): Only show the + last button if we can jump to the end. + (gtk_assistant_init): Make the spacing and button order more + HIG compliant. + Fix drawing issues in progress bars. (#328081, Christian Persch) * gtk/gtkprogressbar.c (gtk_progress_bar_size_request): Always diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index cdabfda6c..18a1c69a7 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -29,6 +29,7 @@ #include "gtkbutton.h" #include "gtkhbox.h" +#include "gtkhbbox.h" #include "gtkimage.h" #include "gtklabel.h" #include "gtksizegroup.h" @@ -387,16 +388,24 @@ compute_last_button_state (GtkAssistant *assistant) n_pages = gtk_assistant_get_n_pages (assistant); page_info = g_list_nth_data (priv->pages, page_num); - while ((page_num > 0 && page_num < n_pages) && + while (page_num >= 0 && page_num < n_pages && (page_info->type == GTK_ASSISTANT_PAGE_CONTENT) && - (page_info->complete)) + page_info->complete && count < n_pages) { - page_num = (priv->forward_function) (page_num, priv->forward_function_data); + page_num = (priv->forward_function) (page_num, priv->forward_function_data); page_info = g_list_nth_data (priv->pages, page_num); + count++; + + g_assert (page_info); } - if (count > 1) + /* make the last button visible if we can skip multiple + * pages and end on a confirmation or summary page + */ + if (count > 1 && + (page_info->type == GTK_ASSISTANT_PAGE_CONFIRM || + page_info->type == GTK_ASSISTANT_PAGE_SUMMARY)) gtk_widget_show (assistant->last); else gtk_widget_hide (assistant->last); @@ -663,9 +672,10 @@ gtk_assistant_init (GtkAssistant *assistant) gtk_widget_set_parent (priv->sidebar_image, GTK_WIDGET (assistant)); gtk_widget_show (priv->sidebar_image); - /* Action area */ - priv->action_area = gtk_hbox_new (FALSE, 12); - gtk_container_set_border_width (GTK_CONTAINER (priv->action_area), 6); + /* Action area */ + priv->action_area = gtk_hbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (priv->action_area), 12); + assistant->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE); assistant->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY); assistant->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD); @@ -683,21 +693,21 @@ gtk_assistant_init (GtkAssistant *assistant) if (!alternative_button_order (assistant)) { - gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, 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->last, 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->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->close, FALSE, FALSE, 0); } else { - gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, 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->cancel, 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->last, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0); } gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));