Commit 12371751 authored by Javier Jardón's avatar Javier Jardón

gtkassistant: Move public members to private structure

parent 47275333
......@@ -64,7 +64,6 @@
#include "gtkprivate.h"
#include "gtkbuildable.h"
#define GTK_ASSISTANT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ASSISTANT, GtkAssistantPrivate))
#define HEADER_SPACING 12
#define ACTION_AREA_SPACING 12
......@@ -85,6 +84,13 @@ struct _GtkAssistantPage
struct _GtkAssistantPrivate
{
GtkWidget *cancel;
GtkWidget *forward;
GtkWidget *back;
GtkWidget *apply;
GtkWidget *close;
GtkWidget *last;
GtkWidget *header_image;
GtkWidget *sidebar_image;
......@@ -464,12 +470,12 @@ compute_last_button_state (GtkAssistant *assistant)
(page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
{
gtk_widget_show (assistant->last);
gtk_widget_set_sensitive (assistant->last,
gtk_widget_show (priv->last);
gtk_widget_set_sensitive (priv->last,
current_page_info->complete);
}
else
gtk_widget_hide (assistant->last);
gtk_widget_hide (priv->last);
}
static void
......@@ -484,9 +490,9 @@ compute_progress_state (GtkAssistant *assistant)
page_num = (priv->forward_function) (page_num, priv->forward_function_data);
if (page_num >= 0 && page_num < n_pages)
gtk_widget_show (assistant->forward);
gtk_widget_show (priv->forward);
else
gtk_widget_hide (assistant->forward);
gtk_widget_hide (priv->forward);
}
static void
......@@ -523,55 +529,55 @@ set_assistant_buttons_state (GtkAssistant *assistant)
switch (priv->current_page->type)
{
case GTK_ASSISTANT_PAGE_INTRO:
gtk_widget_set_sensitive (assistant->cancel, TRUE);
gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
gtk_widget_grab_default (assistant->forward);
gtk_widget_show (assistant->forward);
gtk_widget_hide (assistant->back);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->close);
gtk_widget_set_sensitive (priv->cancel, TRUE);
gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
gtk_widget_grab_default (priv->forward);
gtk_widget_show (priv->forward);
gtk_widget_hide (priv->back);
gtk_widget_hide (priv->apply);
gtk_widget_hide (priv->close);
compute_last_button_state (assistant);
break;
case GTK_ASSISTANT_PAGE_CONFIRM:
gtk_widget_set_sensitive (assistant->cancel, TRUE);
gtk_widget_set_sensitive (assistant->back, TRUE);
gtk_widget_set_sensitive (assistant->apply, priv->current_page->complete);
gtk_widget_grab_default (assistant->apply);
gtk_widget_show (assistant->back);
gtk_widget_show (assistant->apply);
gtk_widget_hide (assistant->forward);
gtk_widget_hide (assistant->close);
gtk_widget_hide (assistant->last);
gtk_widget_set_sensitive (priv->cancel, TRUE);
gtk_widget_set_sensitive (priv->back, TRUE);
gtk_widget_set_sensitive (priv->apply, priv->current_page->complete);
gtk_widget_grab_default (priv->apply);
gtk_widget_show (priv->back);
gtk_widget_show (priv->apply);
gtk_widget_hide (priv->forward);
gtk_widget_hide (priv->close);
gtk_widget_hide (priv->last);
break;
case GTK_ASSISTANT_PAGE_CONTENT:
gtk_widget_set_sensitive (assistant->cancel, TRUE);
gtk_widget_set_sensitive (assistant->back, TRUE);
gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
gtk_widget_grab_default (assistant->forward);
gtk_widget_show (assistant->back);
gtk_widget_show (assistant->forward);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->close);
gtk_widget_set_sensitive (priv->cancel, TRUE);
gtk_widget_set_sensitive (priv->back, TRUE);
gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
gtk_widget_grab_default (priv->forward);
gtk_widget_show (priv->back);
gtk_widget_show (priv->forward);
gtk_widget_hide (priv->apply);
gtk_widget_hide (priv->close);
compute_last_button_state (assistant);
break;
case GTK_ASSISTANT_PAGE_SUMMARY:
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->back);
gtk_widget_hide (assistant->forward);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->last);
gtk_widget_set_sensitive (priv->close, priv->current_page->complete);
gtk_widget_grab_default (priv->close);
gtk_widget_show (priv->close);
gtk_widget_hide (priv->back);
gtk_widget_hide (priv->forward);
gtk_widget_hide (priv->apply);
gtk_widget_hide (priv->last);
break;
case GTK_ASSISTANT_PAGE_PROGRESS:
gtk_widget_set_sensitive (assistant->cancel, priv->current_page->complete);
gtk_widget_set_sensitive (assistant->back, priv->current_page->complete);
gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
gtk_widget_grab_default (assistant->forward);
gtk_widget_show (assistant->back);
gtk_widget_hide (assistant->apply);
gtk_widget_hide (assistant->close);
gtk_widget_hide (assistant->last);
gtk_widget_set_sensitive (priv->cancel, priv->current_page->complete);
gtk_widget_set_sensitive (priv->back, priv->current_page->complete);
gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
gtk_widget_grab_default (priv->forward);
gtk_widget_show (priv->back);
gtk_widget_hide (priv->apply);
gtk_widget_hide (priv->close);
gtk_widget_hide (priv->last);
compute_progress_state (assistant);
break;
default:
......@@ -579,16 +585,16 @@ set_assistant_buttons_state (GtkAssistant *assistant)
}
if (priv->committed)
gtk_widget_hide (assistant->cancel);
gtk_widget_hide (priv->cancel);
else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY)
gtk_widget_hide (assistant->cancel);
gtk_widget_hide (priv->cancel);
else
gtk_widget_show (assistant->cancel);
gtk_widget_show (priv->cancel);
/* this is quite general, we don't want to
* go back if it's the first page */
if (!priv->visited_pages)
gtk_widget_hide (assistant->back);
gtk_widget_hide (priv->back);
}
static void
......@@ -632,12 +638,12 @@ set_current_page (GtkAssistant *assistant,
gint i;
/* find the best button to focus */
button[0] = assistant->apply;
button[1] = assistant->close;
button[2] = assistant->forward;
button[3] = assistant->back;
button[4] = assistant->cancel;
button[5] = assistant->last;
button[0] = priv->apply;
button[1] = priv->close;
button[2] = priv->forward;
button[3] = priv->back;
button[4] = priv->cancel;
button[5] = priv->last;
for (i = 0; i < 6; i++)
{
if (gtk_widget_get_visible (button[i]) && gtk_widget_get_sensitive (button[i]))
......@@ -773,7 +779,10 @@ gtk_assistant_init (GtkAssistant *assistant)
{
GtkAssistantPrivate *priv;
priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
assistant->priv = G_TYPE_INSTANCE_GET_PRIVATE (assistant,
GTK_TYPE_ASSISTANT,
GtkAssistantPrivate);
priv = assistant->priv;
gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
......@@ -795,47 +804,47 @@ gtk_assistant_init (GtkAssistant *assistant)
/* Action area */
priv->action_area = gtk_hbox_new (FALSE, 6);
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);
assistant->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
assistant->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
assistant->last = gtk_button_new_from_stock (GTK_STOCK_GOTO_LAST);
gtk_widget_set_can_default (assistant->close, TRUE);
gtk_widget_set_can_default (assistant->apply, TRUE);
gtk_widget_set_can_default (assistant->forward, TRUE);
priv->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
priv->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
priv->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
priv->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
priv->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
priv->last = gtk_button_new_from_stock (GTK_STOCK_GOTO_LAST);
gtk_widget_set_can_default (priv->close, TRUE);
gtk_widget_set_can_default (priv->apply, TRUE);
gtk_widget_set_can_default (priv->forward, TRUE);
priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (priv->size_group, assistant->close);
gtk_size_group_add_widget (priv->size_group, assistant->apply);
gtk_size_group_add_widget (priv->size_group, assistant->forward);
gtk_size_group_add_widget (priv->size_group, assistant->back);
gtk_size_group_add_widget (priv->size_group, assistant->cancel);
gtk_size_group_add_widget (priv->size_group, assistant->last);
gtk_size_group_add_widget (priv->size_group, priv->close);
gtk_size_group_add_widget (priv->size_group, priv->apply);
gtk_size_group_add_widget (priv->size_group, priv->forward);
gtk_size_group_add_widget (priv->size_group, priv->back);
gtk_size_group_add_widget (priv->size_group, priv->cancel);
gtk_size_group_add_widget (priv->size_group, priv->last);
if (!alternative_button_order (assistant))
{
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->back, 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->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), priv->apply, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
}
else
{
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, 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->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->back, 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), priv->close, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
}
gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));
gtk_widget_show (assistant->forward);
gtk_widget_show (assistant->back);
gtk_widget_show (assistant->cancel);
gtk_widget_show (priv->forward);
gtk_widget_show (priv->back);
gtk_widget_show (priv->cancel);
gtk_widget_show (priv->action_area);
gtk_widget_pop_composite_child ();
......@@ -848,17 +857,17 @@ gtk_assistant_init (GtkAssistant *assistant)
priv->forward_function_data = assistant;
priv->forward_data_destroy = NULL;
g_signal_connect (G_OBJECT (assistant->close), "clicked",
g_signal_connect (G_OBJECT (priv->close), "clicked",
G_CALLBACK (on_assistant_close), assistant);
g_signal_connect (G_OBJECT (assistant->apply), "clicked",
g_signal_connect (G_OBJECT (priv->apply), "clicked",
G_CALLBACK (on_assistant_apply), assistant);
g_signal_connect (G_OBJECT (assistant->forward), "clicked",
g_signal_connect (G_OBJECT (priv->forward), "clicked",
G_CALLBACK (on_assistant_forward), assistant);
g_signal_connect (G_OBJECT (assistant->back), "clicked",
g_signal_connect (G_OBJECT (priv->back), "clicked",
G_CALLBACK (on_assistant_back), assistant);
g_signal_connect (G_OBJECT (assistant->cancel), "clicked",
g_signal_connect (G_OBJECT (priv->cancel), "clicked",
G_CALLBACK (on_assistant_cancel), assistant);
g_signal_connect (G_OBJECT (assistant->last), "clicked",
g_signal_connect (G_OBJECT (priv->last), "clicked",
G_CALLBACK (on_assistant_last), assistant);
}
......
......@@ -77,15 +77,8 @@ struct _GtkAssistant
{
GtkWindow parent;
GtkWidget *GSEAL (cancel);
GtkWidget *GSEAL (forward);
GtkWidget *GSEAL (back);
GtkWidget *GSEAL (apply);
GtkWidget *GSEAL (close);
GtkWidget *GSEAL (last);
/*< private >*/
GtkAssistantPrivate *GSEAL (priv);
GtkAssistantPrivate *priv;
};
struct _GtkAssistantClass
......
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