[maemo-developers] [maemo-developers] HildonWizardDialog fixes
From: Iain Holmes iain at openedhand.comDate: Mon Mar 20 17:27:56 EET 2006
- Previous message: [maemo-developers] my little osso-term mod
- Next message: [maemo-developers] Another HildonWizardDialog issue
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I've been using the HildonWizardDialog for a few things and here are
some fixes I have for it.
When not on the first or last page the icon is hidden correctly, but the
size of the icon remains. This leaves a large blank area to the left of
the dialog.
To show the dialog correctly the caller needs to call
gtk_widget_show_all on the dialog. All widgets that are made up of other
widgets are usually correctly displayed by using gtk_widget_show. I've
fixed this by making all the internal widgets shown.
I've come across a few other issues:
* There is no way to set the Previous or Next buttons to be sensitive or
not. There is a comment in the code saying that the Previous and Next
buttons should be action buttons like the Cancel and Finish buttons
which would allow the buttons to be controlled via
gtk_dialog_set_response_sensitive, but GtkDialog cannot have a response
button that doesn't emit the response signal which we don't want, as
this causes gtk_dialog_run to close the window.
* The page_change signal is a bit awkward to use. It might be more
useful to change its signature to
gboolean page_change (HildonWizardDialog *dialog,
int page_num,
HildonPageChangeDirection direction);
where HildonPageChangeDirection is
enum _HildonPageChangeDirection {
HILDON_PAGE_CHANGE_PREVIOUS,
HILDON_PAGE_CHANGE_NEXT
} HildonPageChangeDirection;
As it stands now, the first thing the caller needs to do in the callback
is get the current page from the notebook. This means they need to carry
a pointer to the notebook around. Also the int being passed at the
moment is linked to the button response ID, so the values that can be
passed in are 1 for the Previous button being pressed, or 2 for the Next
which seems a bit weird. I can make this change if people agree that it
is a good way to do it, but I don't know what other people are using the
Wizard for and maybe this way only suits my purposes.
iain
-------------- next part --------------
Index: hildon-wizard-dialog.c
===================================================================
--- hildon-wizard-dialog.c (revision 2935)
+++ hildon-wizard-dialog.c (working copy)
@@ -96,6 +96,7 @@
gchar *wizard_name;
GtkNotebook *notebook;
GtkBox *box;
+ GtkWidget *image_vbox;
GtkWidget *image;
GtkWidget *previous_button;
GtkWidget *next_button;
@@ -207,7 +208,7 @@
GtkDialog *dialog = GTK_DIALOG(wizard_dialog);
/* Init internal widgets */
- GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+ priv->image_vbox = gtk_vbox_new(FALSE, 0);
gtk_dialog_set_has_separator(dialog, FALSE);
wizard_dialog->priv = priv;
priv->box = GTK_BOX(gtk_hbox_new(FALSE, 0));
@@ -221,9 +222,14 @@
/* Build wizard layout */
gtk_box_pack_start_defaults(GTK_BOX(dialog->vbox),
GTK_WIDGET(priv->box));
- gtk_box_pack_start_defaults(GTK_BOX(priv->box), GTK_WIDGET(vbox));
- gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(priv->image), FALSE, FALSE, 0);
+ gtk_box_pack_start(priv->box, priv->image_vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start_defaults(GTK_BOX(priv->image_vbox), priv->image);
+ gtk_box_pack_start(GTK_BOX(priv->image_vbox),GTK_WIDGET(priv->image),
+ FALSE, FALSE, 0);
+ /* Show all the internal widgets */
+ gtk_widget_show_all (GTK_WIDGET (priv->box));
+
/* Initialize cancel button */
gtk_dialog_add_button(dialog, _("Ecdg_bd_wizard_cancel"),
HILDON_WIZARD_DIALOG_CANCEL);
@@ -231,6 +237,7 @@
/* Initialize previous button */
priv->previous_button =
gtk_button_new_with_label(_("Ecdg_bd_wizard_previous"));
+ gtk_widget_show (priv->previous_button);
gtk_box_pack_start(GTK_BOX(dialog->action_area),
priv->previous_button, FALSE, TRUE, 0);
g_signal_connect(priv->previous_button, "clicked",
@@ -239,6 +246,7 @@
/* Initialize next button */
priv->next_button =
gtk_button_new_with_label(_("Ecdg_bd_wizard_next"));
+ gtk_widget_show (priv->next_button);
gtk_box_pack_start(GTK_BOX(dialog->action_area),
priv->next_button, FALSE, TRUE, 0);
g_signal_connect(priv->next_button, "clicked",
@@ -285,8 +293,12 @@
* and remove borders) to make it look like a nice wizard widget */
gtk_notebook_set_show_tabs(priv->notebook, FALSE);
gtk_notebook_set_show_border(priv->notebook, FALSE);
- gtk_box_pack_start_defaults(GTK_BOX(priv->box),
- GTK_WIDGET(priv->notebook));
+ gtk_box_pack_start (GTK_BOX(priv->box), GTK_WIDGET(priv->notebook),
+ TRUE, TRUE, 0);
+
+ /* Show the notebook so that a only a gtk_widget_show is required
+ to display the dialog correctly */
+ gtk_widget_show (GTK_WIDGET (priv->notebook));
/* Update dialog title to reflact current page stats etc */
if (priv->wizard_name)
- Previous message: [maemo-developers] my little osso-term mod
- Next message: [maemo-developers] Another HildonWizardDialog issue
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
