https://projects.maemo.org
authorMurray Cumming <murrayc@murrayc.com>
Fri, 27 Apr 2007 15:31:08 +0000 (15:31 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Fri, 27 Apr 2007 15:31:08 +0000 (15:31 +0000)
pmo-trunk-r1701

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

index a343192..2656ede 100644 (file)
@@ -1,5 +1,17 @@
 2007-04-27  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/maemo/easysetup/modest-easysetup-wizard.h:
+       * src/maemo/easysetup/modest-easysetup-wizard.c:
+       (modest_easysetup_wizard_dialog_finalize),
+       (on_button_edit_advanced_settings), (create_page_complete_custom),
+       (on_response), (create_account):
+       Implement the Advanced Settings edit button, by saving the account information, 
+       for the Advanded Settings dialog to use directly from gconf, and removing it 
+       if Finish is never clicked. There is still some UI strangeness, so this is not finished.
+       Bug #5533 in the projects.maemo.org bugzilla.
+
+2007-04-27  Murray Cumming  <murrayc@murrayc.com>
+
        * src/maemo/modest-msg-view-window.c:
        (modest_msg_view_window_show_toolbar): Prevent hide/show of a NULL toolbar widget, 
        when opening a message window.
index f7e6d62..4e8ca3b 100644 (file)
@@ -28,6 +28,7 @@
 #include "modest-runtime.h" /* For modest_runtime_get_account_mgr(). */
 #include "maemo/modest-connection-specific-smtp-window.h"
 #include "maemo/modest-maemo-ui-constants.h"
+#include "maemo/modest-account-settings-dialog.h"
 #include <gconf/gconf-client.h>
 #include <string.h> /* For strlen(). */
 
@@ -91,6 +92,8 @@ modest_easysetup_wizard_dialog_finalize (GObject *object)
                
        if (self->specific_window)
                gtk_widget_destroy (self->specific_window);
+               
+       g_free (self->saved_account_name);
        
        G_OBJECT_CLASS (modest_easysetup_wizard_dialog_parent_class)->finalize (object);
 }
@@ -711,6 +714,33 @@ static GtkWidget* create_page_custom_outgoing (ModestEasysetupWizardDialog *self
        return GTK_WIDGET (box);
 }
 
+
+static void
+on_button_edit_advanced_settings (GtkButton *button, gpointer user_data)
+{
+       ModestEasysetupWizardDialog * self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
+       
+       /* Save the new account, so we can edit it with ModestAccountSettingsDialog, 
+        * without recoding it to use non-gconf information.
+        * This account will be deleted if Finish is never actually clicked. */
+
+       const gboolean saved = create_account (self);
+       if (!saved)
+               return;
+               
+       if (!(self->saved_account_name))
+               return;
+       
+       /* Show the Account Settings window: */
+       ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new ();
+       modest_account_settings_dialog_set_account_name (dialog, self->saved_account_name);
+       
+       gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self));
+       printf ("debug: before run\n");
+       gtk_dialog_run (GTK_DIALOG (dialog));
+       printf ("debug: after run\n");
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+}
 static GtkWidget* create_page_complete_custom (ModestEasysetupWizardDialog *self)
 {
        GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_HALF);
@@ -727,6 +757,9 @@ static GtkWidget* create_page_complete_custom (ModestEasysetupWizardDialog *self
        gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
        gtk_widget_show (caption);
        
+       g_signal_connect (G_OBJECT (self->button_edit), "clicked", 
+               G_CALLBACK (on_button_edit_advanced_settings), self);
+       
        gtk_widget_show (GTK_WIDGET (box));
        return GTK_WIDGET (box);
 }
@@ -740,6 +773,15 @@ on_response (ModestWizardDialog *wizard_dialog,
        gpointer user_data)
 {
        ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (wizard_dialog);
+       
+       if (response_id == GTK_RESPONSE_CANCEL) {
+               /* Remove any temporarily-saved account that will not actually be needed: */
+               if (self->saved_account_name) {
+                       modest_account_mgr_remove_account (self->account_manager,
+                                                                    self->saved_account_name, FALSE);
+               }       
+       }
+       
        invoke_enable_buttons_vfunc (self);
 }
 
@@ -1357,13 +1399,17 @@ create_account (ModestEasysetupWizardDialog *self)
                MODEST_ACCOUNT_DISPLAY_NAME, display_name, FALSE /* not server account */);
 
        /* Save the connection-specific SMTP server accounts. */
+       gboolean result = TRUE;
        if (self->specific_window)
-               return modest_connection_specific_smtp_window_save_server_accounts (
+               result = modest_connection_specific_smtp_window_save_server_accounts (
                        MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (self->specific_window), account_name);
                        
+       g_free (self->saved_account_name);
+       self->saved_account_name = g_strdup (account_name);
+       
        g_free (account_name);
 
-       return FALSE;
+       return result;
 }
 
 
index 289472f..adb610b 100644 (file)
@@ -41,6 +41,11 @@ typedef struct {
        /* Used by derived widgets to query existing accounts,
         * and to create new accounts: */
        ModestAccountMgr *account_manager;
+       
+       /* Whether we saved the account before we were finished, 
+        * to allow editing via the Advanced Settings dialog.
+        * We might need to delete the account if Finish is never clicked. */
+       gchar* saved_account_name;
                
        /* notebook pages: */
        GtkWidget *page_welcome;