2007-05-07 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Mon, 7 May 2007 14:32:40 +0000 (14:32 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Mon, 7 May 2007 14:32:40 +0000 (14:32 +0000)
(modest_wizard_dialog_force_title_update):
        * src/maemo/easysetup/modest-wizard-dialog.h:
        * src/maemo/easysetup/modest-wizard-dialog.c: (set_property):
        For GTK+ 2.10, when present, connect to the GtkNotebook signals so we
        can update the title when appropriate. Otherwise the title is wrong if the
        pages are added after adding the notebook to the dialog.
        This must be a problem in HildonWizardDialog too.
        Added modest_wizard_dialog_force_title_update() for GTK+ 2.6.

        * src/maemo/easysetup/modest-easysetup-wizard.c:
        (create_subsequent_customsetup_pages),
        (create_subsequent_easysetup_pages):
        Call modest_wizard_dialog_force_title_update() so that the title is
        correct even with GTK+ < 2.10.
        This fixes projects.maemo.org bug NB#56145 .

pmo-trunk-r1772

ChangeLog2
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/easysetup/modest-wizard-dialog.c
src/maemo/easysetup/modest-wizard-dialog.h

index 2e6d274..112175f 100644 (file)
@@ -1,4 +1,22 @@
 2007-05-07  Murray Cumming  <murrayc@murrayc.com>
+       
+       (modest_wizard_dialog_force_title_update):
+       * src/maemo/easysetup/modest-wizard-dialog.h:
+       * src/maemo/easysetup/modest-wizard-dialog.c: (set_property):
+       For GTK+ 2.10, when present, connect to the GtkNotebook signals so we 
+       can update the title when appropriate. Otherwise the title is wrong if the 
+       pages are added after adding the notebook to the dialog.
+       This must be a problem in HildonWizardDialog too.
+       Added modest_wizard_dialog_force_title_update() for GTK+ 2.6.
+       
+       * src/maemo/easysetup/modest-easysetup-wizard.c:
+       (create_subsequent_customsetup_pages),
+       (create_subsequent_easysetup_pages): 
+       Call modest_wizard_dialog_force_title_update() so that the title is 
+       correct even with GTK+ < 2.10.
+       This fixes projects.maemo.org bug NB#56145 .
+       
+2007-05-07  Murray Cumming  <murrayc@murrayc.com>
 
        * src/maemo/modest-platform.c:
        (modest_platform_set_update_interval): Use the ALARM_EVENT_NO_DIALOG 
index 0151a28..0e72a8e 100644 (file)
@@ -938,6 +938,9 @@ static void create_subsequent_customsetup_pages (ModestEasysetupWizardDialog *se
        if (!gtk_widget_get_parent (GTK_WIDGET (self->page_complete_customsetup)))
                gtk_notebook_append_page (notebook, self->page_complete_customsetup,
                        gtk_label_new (_("mcen_ti_emailsetup_complete")));
+                       
+       /* This is unnecessary with GTK+ 2.10: */
+       modest_wizard_dialog_force_title_update (MODEST_WIZARD_DIALOG(self));
 }
        
 static void create_subsequent_easysetup_pages (ModestEasysetupWizardDialog *self)
@@ -954,6 +957,8 @@ static void create_subsequent_easysetup_pages (ModestEasysetupWizardDialog *self
                gtk_notebook_append_page (notebook, self->page_complete_easysetup, 
                        gtk_label_new (_("mcen_ti_emailsetup_complete")));
                        
+       /* This is unnecessary with GTK+ 2.10: */
+       modest_wizard_dialog_force_title_update (MODEST_WIZARD_DIALOG(self));
 }
 /* After the user details page,
  * the following pages depend on whether "Other" was chosen 
index 2131caa..353296e 100644 (file)
@@ -29,6 +29,7 @@
 #include <gtk/gtkhbox.h>
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkbutton.h>
+#include <gtk/gtk.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -269,6 +270,43 @@ init (ModestWizardDialog *wizard_dialog)
             G_CALLBACK (response), NULL);
 }
 
+#if GTK_CHECK_VERSION(2, 10, 0) /* These signals were added in GTK+ 2.10: */
+static void on_notebook_page_added(ModestWizardDialog* dialog, 
+       GtkWidget   *child,
+       guint        page_num,
+       gpointer     user_data)
+{
+       /* The title should show the total number of pages: */
+       create_title (dialog);
+}
+
+static void on_notebook_page_removed(ModestWizardDialog* dialog, 
+       GtkWidget   *child,
+       guint        page_num,
+       gpointer     user_data)
+{
+       /* The title should show the total number of pages: */
+       create_title (dialog);
+}
+#endif /* GTK_CHECK_VERSION */
+
+static void
+connect_to_notebook_signals(ModestWizardDialog* dialog)
+{
+#if GTK_CHECK_VERSION(2, 10, 0) /* These signals were added in GTK+ 2.10: */
+       ModestWizardDialogPrivate *priv = MODEST_WIZARD_DIALOG(dialog)->priv;
+       g_return_if_fail (priv->notebook);
+       
+       /* Connect to the notebook signals,
+        * so we can update the title when necessary: */
+    g_signal_connect (G_OBJECT (priv->notebook), "page-added",
+            G_CALLBACK (on_notebook_page_added), NULL);
+    g_signal_connect (G_OBJECT (priv->notebook), "page-removed",
+            G_CALLBACK (on_notebook_page_removed), NULL);
+#endif /* GTK_CHECK_VERSION */
+}
+
+
 static void
 set_property (GObject      *object, 
               guint        property_id,
@@ -328,11 +366,14 @@ set_property (GObject      *object,
              * all that is required to display the dialog correctly */
             gtk_widget_show ( GTK_WIDGET (priv->notebook));
 
-            /* Update dialog title to reflect current page stats etc */        
+            /* Update dialog title to reflect current page stats etc */ 
+            ModestWizardDialog *wizard_dialog = MODEST_WIZARD_DIALOG (object);      
             if (priv->wizard_name && priv->autotitle)
-                create_title (MODEST_WIZARD_DIALOG (object));
+                create_title (wizard_dialog);
+                
+            connect_to_notebook_signals (wizard_dialog);
             
-            } break;
+            }break;
 
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -502,6 +543,21 @@ modest_wizard_dialog_new (GtkWindow   *parent,
     return widget;
 }
 
+/**
+ * modest_wizard_dialog_force_title_update:
+ * @wizard_dialog: The wizard dialog
+ *
+ * Force the title to be rebuilt, for instance when you have added or 
+ * removed notebook pages. This function is not necessary when using GTK+ 2.10, 
+ * because that has GtkNotebook signals that will be used to update the title 
+ * automatically.
+ */
+void
+modest_wizard_dialog_force_title_update (ModestWizardDialog   *wizard_dialog)
+{
+       create_title (wizard_dialog);
+}
+
 static gboolean
 invoke_before_next_vfunc (ModestWizardDialog *wizard_dialog)
 {
index 772e97e..08d445a 100644 (file)
@@ -79,6 +79,8 @@ GType modest_wizard_dialog_get_type   (void) G_GNUC_CONST;
 GtkWidget* modest_wizard_dialog_new   (GtkWindow        *parent,
                                        const char       *wizard_name,
                                        GtkNotebook      *notebook);
+                                       
+void modest_wizard_dialog_force_title_update (ModestWizardDialog* wizard_dialog);
 
 G_END_DECLS