2007-07-05 Johannes Schmid <johannes.schmid@openismus.com>
[modest] / src / maemo / easysetup / modest-wizard-dialog.c
index 486da91..20797b1 100644 (file)
@@ -1,13 +1,32 @@
-/*
- * This is a copy of modest-wizard-dialog.h with a rename and some API additions,
- * for osso-modest-easysetup.
- * 
- * This file was part of modest-libs
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
  *
- * Copyright (C) 2005, 2006, 2007 Nokia Corporation, all rights reserved.
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
  *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 /**
  * SECTION:modest-wizard-dialog
  * @short_description: A widget to create a guided installation
 #include <config.h>
 #endif
 
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_HILDON0_WIDGETS
 #include <hildon-widgets/hildon-defines.h>
 #else
 #include <hildon/hildon-defines.h>
-#endif /*MODEST_HILDON_VERSION_0*/
+#endif /*MODEST_HAVE_HILDON0_WIDGETS*/
 
 #include "modest-wizard-dialog.h"
 
@@ -236,12 +255,13 @@ init (ModestWizardDialog *wizard_dialog)
     gtk_dialog_set_has_separator (dialog, FALSE);
     wizard_dialog->priv = priv;
     priv->box = GTK_BOX (gtk_hbox_new (FALSE, 0));
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_HILDON0_WIDGETS
     priv->image = gtk_image_new_from_icon_name ("qgn_widg_wizard",
                                                HILDON_ICON_SIZE_WIDG_WIZARD);
 #else
+               int icon_size = gtk_icon_size_register("hildon_wizard", 50, 50);
     priv->image = gtk_image_new_from_icon_name ("qgn_widg_wizard",
-                                               HILDON_ICON_SIZE_WIZARD);
+                                               icon_size);
 #endif /*MODEST_HILDON_VERSION_0*/
     /* Default values for user provided properties */
     priv->notebook = NULL;
@@ -422,12 +442,10 @@ get_property (GObject      *object,
 static void
 create_title (ModestWizardDialog *wizard_dialog)
 {
-    gint pages, current;
     gchar *str = NULL;
     ModestWizardDialogPrivate *priv = NULL;
     GtkNotebook *notebook = NULL;
 
-    /* FIXME (jfernandez): Sometines, priv is NULL */
     g_return_if_fail (MODEST_IS_WIZARD_DIALOG(wizard_dialog));
     g_return_if_fail (wizard_dialog->priv != NULL);
 
@@ -438,22 +456,37 @@ create_title (ModestWizardDialog *wizard_dialog)
         return;
 
     /* Get page information, we'll need that when creating title */
-    pages = gtk_notebook_get_n_pages (notebook);
-    current = gtk_notebook_get_current_page (priv->notebook);
+    gint pages = gtk_notebook_get_n_pages (notebook);
+    if (pages == 0)
+      return;
+       
+    gint current = gtk_notebook_get_current_page (priv->notebook);
     if (current < 0)
         current = 0;
 
     /* the welcome title on the initial page */
+    /* This is the standard wizard title, with, e.g., 1/4 at the end,
+        * but the Modest UI spec does not want this. */
+       /*
     if (current == 0) {
         str = g_strdup_printf (_("ecdg_ti_wizard_welcome"), 
                 priv->wizard_name, pages);
     } else {
-        const gchar *steps = gtk_notebook_get_tab_label_text (notebook,
-                gtk_notebook_get_nth_page (notebook, current));
-
+    */
+       const gchar *steps = gtk_notebook_get_tab_label_text (notebook,
+               gtk_notebook_get_nth_page (notebook, current));
+                
+               /* This is the standard wizard title, with, e.g., 1/4 at the end,
+                * but the Modest UI spec does not want this.
+                */
+               /*
         str = g_strdup_printf (_("ecdg_ti_wizard_step"), 
                 priv->wizard_name, current + 1, pages, steps);
-    }
+        */
+
+        str = g_strdup_printf (_("%s: %s"), 
+                priv->wizard_name, steps);
+    /* } */
 
     /* Update the dialog to display the generated title */
     gtk_window_set_title (GTK_WINDOW (wizard_dialog), str);
@@ -463,7 +496,7 @@ create_title (ModestWizardDialog *wizard_dialog)
 /*
  * Response signal handler. This function is needed because GtkDialog's 
  * handler for this signal closes the dialog and we don't want that, we 
- * want to change pages and, dimm certain response buttons. Overriding the 
+ * want to change pages and, dim certain response buttons. Overriding the 
  * virtual function would not work because that would be called after the 
  * signal handler implemented by GtkDialog.
  * FIXME: There is a much saner way to do that [MDK]