More checks for the case where the overshoot is bigger than the size of the widget.
[hildon] / src / hildon-wizard-dialog.c
index a5c3f1b..510cfe5 100644 (file)
@@ -9,7 +9,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; version 2.1 of
- * the License.
+ * the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +26,7 @@
 /**
  * SECTION:hildon-wizard-dialog
  * @short_description: A widget to create a guided installation
- * process wizard
+ * process wizard.
  *
  * #HildonWizardDialog is a widget to create a guided installation
  * process. The dialog has four standard buttons, previous, next,
  * Response buttons are dimmed/undimmed automatically and the standard
  * icon is shown/hidden in response to page navigation. The notebook
  * widget provided by users contains the actual wizard pages.
+ * 
+ * Using of the API is very simple, it has only one function to create it
+ * and the rest of it is handled by developers notebook.
+ * Also the response is returned, either cancel or finnish.
+ * Next and previous buttons are handled by the wizard dialog it self, by
+ * switching the page either forward or backward in the notebook.
  */
 
 #ifdef                                          HAVE_CONFIG_H
@@ -99,6 +105,13 @@ enum
     PROP_AUTOTITLE
 };
 
+/**
+ * hildon_wizard_dialog_get_type:
+ *
+ * Initializes and returns the type of a hildon wizard dialog.
+ *
+ * @Returns: GType of #HildonWzardDialog
+ */
 GType G_GNUC_CONST
 hildon_wizard_dialog_get_type                   (void)
 {
@@ -232,7 +245,7 @@ hildon_wizard_dialog_init                       (HildonWizardDialog *wizard_dial
     gtk_dialog_set_has_separator (dialog, FALSE);
 
     priv->box = GTK_BOX (gtk_hbox_new (FALSE, 0));
-    priv->image = gtk_image_new_from_icon_name ("qgn_widg_wizard", HILDON_ICON_SIZE_WIDG_WIZARD);
+    priv->image = gtk_image_new_from_icon_name ("qgn_widg_wizard", HILDON_ICON_SIZE_WIZARD);
 
     /* Default values for user provided properties */
     priv->notebook = NULL;
@@ -414,13 +427,25 @@ response                                        (HildonWizardDialog *wizard_dial
 
     g_assert (priv);
 
+    current = gtk_notebook_current_page (notebook);
+
     switch (response_id) {
 
         case HILDON_WIZARD_DIALOG_PREVIOUS:
+            --current;
+            is_last = (current == last);
+            is_first = (current == 0);
+            make_buttons_sensitive (wizard_dialog,
+                                    !is_first, !is_first, !is_last); 
             gtk_notebook_prev_page (notebook); /* go to previous page */
             break;
 
         case HILDON_WIZARD_DIALOG_NEXT:
+            ++current;
+            is_last = (current == last);
+            is_first = (current == 0);
+            make_buttons_sensitive (wizard_dialog,
+                                    !is_first, !is_first, !is_last);
             gtk_notebook_next_page (notebook); /* go to next page */
             break;
 
@@ -434,11 +459,6 @@ response                                        (HildonWizardDialog *wizard_dial
     is_last = current == last;
     is_first = current == 0;
 
-    /* If first page, previous and finish are disabled, 
-       if last page, next is disabled */
-    make_buttons_sensitive (wizard_dialog,
-            !is_first, !is_first, !is_last);
-
     /* Don't let the dialog close */
     g_signal_stop_emission_by_name (wizard_dialog, "response");