2007-04-05 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Thu, 5 Apr 2007 17:58:43 +0000 (17:58 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Thu, 5 Apr 2007 17:58:43 +0000 (17:58 +0000)
* docs/reference/modest-design.sgml: Corrected spelling mistake.
        * src/maemo/easysetup/modest-easysetup-wizard.c: (create_account):
        Create the 2 server accounts and then create the account, using the names of the 2 server accounts.
        This seems to be how this should be used. If it is, then I will update the AccountMgr documentation
        to make that clearer.
        * src/modest-account-mgr.h: Corrected the modest_account_mgr_search_server_account() documentation.

pmo-trunk-r1516

ChangeLog2
docs/reference/modest-design.sgml
src/maemo/easysetup/modest-easysetup-wizard.c
src/modest-account-mgr.h
src/modest-ui-actions.c

index 182b86d..85f3e78 100644 (file)
@@ -1,5 +1,14 @@
 2007-04-05  Murray Cumming  <murrayc@murrayc.com>
 
 2007-04-05  Murray Cumming  <murrayc@murrayc.com>
 
+       * docs/reference/modest-design.sgml: Corrected spelling mistake.
+       * src/maemo/easysetup/modest-easysetup-wizard.c: (create_account): 
+       Create the 2 server accounts and then create the account, using the names of the 2 server accounts.
+       This seems to be how this should be used. If it is, then I will update the AccountMgr documentation 
+       to make that clearer.
+       * src/modest-account-mgr.h: Corrected the modest_account_mgr_search_server_account() documentation.
+
+2007-04-05  Murray Cumming  <murrayc@murrayc.com>
+
        * src/maemo/modest-account-view-window.c:
        (modest_account_view_window_init),
        (modest_account_view_window_new):
        * src/maemo/modest-account-view-window.c:
        (modest_account_view_window_init),
        (modest_account_view_window_new):
index ac7dff5..370656e 100644 (file)
          used by other accounts as well.
        </para>
        
          used by other accounts as well.
        </para>
        
-       <para>The reason two keep accounts and server accounts separately, is a bit of
+       <para>The reason to keep accounts and server accounts separately, is a bit of
          flexibility. In mobile use-cases, quite often it's desirable to use a
          network-specific smtp-server. The chosen structure makes it easy to iterate
          over all smtp-servers and find the right one.
          flexibility. In mobile use-cases, quite often it's desirable to use a
          network-specific smtp-server. The chosen structure makes it easy to iterate
          over all smtp-servers and find the right one.
        recipient (<command>RCPT TO:</command>) is on the same network.
       </para>
     </chapter>
        recipient (<command>RCPT TO:</command>) is on the same network.
       </para>
     </chapter>
-  </part>
\ No newline at end of file
+  </part>
index 581fb45..e29dad5 100644 (file)
@@ -1179,7 +1179,7 @@ create_account (ModestEasysetupWizardDialog *self)
         * but let's check again just in case:
         */
        if (modest_account_mgr_account_exists (self->account_manager, account_name, FALSE)) 
         * but let's check again just in case:
         */
        if (modest_account_mgr_account_exists (self->account_manager, account_name, FALSE)) 
-               return FALSE;
+               return FALSE;   
                
        /* username and password (for both incoming and outgoing): */
        const gchar* username = gtk_entry_get_text (GTK_ENTRY (self->entry_user_username));
                
        /* username and password (for both incoming and outgoing): */
        const gchar* username = gtk_entry_get_text (GTK_ENTRY (self->entry_user_username));
@@ -1238,8 +1238,13 @@ create_account (ModestEasysetupWizardDialog *self)
                
        }
        
                
        }
        
+       /* First we add the 2 server accounts, and then we add the account that uses them.
+        * If we don't do it in this order then we will experience a crash. */
+        
+       /* Add a (incoming) server account, to be used by the account: */
+       gchar *store_name = g_strconcat (account_name, "_store", NULL);
        gboolean created = modest_account_mgr_add_server_account (self->account_manager,
        gboolean created = modest_account_mgr_add_server_account (self->account_manager,
-               account_name,
+               store_name,
                servername_incoming,
                username, password,
                protocol_incoming,
                servername_incoming,
                username, password,
                protocol_incoming,
@@ -1313,8 +1318,10 @@ create_account (ModestEasysetupWizardDialog *self)
                
        }
            
                
        }
            
+       /* Add a (outgoing) server account to be used by the account: */
+       gchar *transport_name = g_strconcat (account_name, "_transport", NULL); /* What is this good for? */
        created = modest_account_mgr_add_server_account (self->account_manager,
        created = modest_account_mgr_add_server_account (self->account_manager,
-               account_name,
+               transport_name,
                servername_outgoing,
                username, password,
                protocol_outgoing,
                servername_outgoing,
                username, password,
                protocol_outgoing,
@@ -1327,7 +1334,21 @@ create_account (ModestEasysetupWizardDialog *self)
                /* TODO: Provide a Logical ID for the text: */
                show_error (GTK_WINDOW (self), _("An error occurred while creating the outgoing account."));
                return FALSE;   
                /* TODO: Provide a Logical ID for the text: */
                show_error (GTK_WINDOW (self), _("An error occurred while creating the outgoing account."));
                return FALSE;   
-       }            
+       }
+       
+       
+       /* Create the account, which will contain the two "server accounts": */
+       created = modest_account_mgr_add_account (self->account_manager, account_name, 
+               store_name, /* The name of our POP/IMAP server account. */
+               transport_name /* The name of our SMTP server account. */);
+       g_free (store_name);
+       g_free (transport_name);
+       
+       if (!created) {
+               /* TODO: Provide a Logical ID for the text: */
+               show_error (GTK_WINDOW (self), _("An error occurred while creating the account."));
+               return FALSE;   
+       }
        
        return FALSE;
 }
        
        return FALSE;
 }
index 22901fb..1e2e27b 100644 (file)
@@ -178,14 +178,13 @@ GSList*           modest_account_mgr_account_names    (ModestAccountMgr *self);
 
 
 /**
 
 
 /**
- * modest_account_mgr_server_account_names:
+ * modest_account_mgr_search_server_account:
  * @self: a ModestAccountMgr instance
  * @account_name: get only server accounts for @account_name, or NULL for any
  * @self: a ModestAccountMgr instance
  * @account_name: get only server accounts for @account_name, or NULL for any
- * @type: get only server accounts from protocol type @type, or MODEST_PROTO_TYPE_ANY
- * @proto: get only server account with protocol @proto, or NULL for any
- * @only_enabled: get only enabled server accounts if TRUE
+ * @type: get only server accounts from protocol type @type, or MODEST_PROTOCOL_TYPE_UNKNOWN
+ * @proto: get only server account with protocol @proto, or MODEST_PROTOCOL_UNKNOWN for any
  * 
  * 
- * list all the server account names
+ * List all the server account names, optionally narrowing the result down to one account.
  *
  * Returns: a newly allocated list of server account names, or NULL in case of
  * error or if there are no server accounts. The caller must free the returned GSList
  *
  * Returns: a newly allocated list of server account names, or NULL in case of
  * error or if there are no server accounts. The caller must free the returned GSList
index 80be1c3..460c7b0 100644 (file)
@@ -206,6 +206,15 @@ void
 modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
 {
        GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr());
 modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
 {
        GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr());
+       
+#if 0
+       GSList *account_names = modest_account_mgr_search_server_accounts (
+               modest_runtime_get_account_mgr(),
+               NULL /* account_name, any */,
+               MODEST_PROTOCOL_TYPE_UNKNOWN /* type */,
+               MODEST_PROTOCOL_UNKNOWN /* proto */);
+#endif
+                                                    
        gboolean accounts_exist = account_names != NULL;
        g_slist_free (account_names);
        
        gboolean accounts_exist = account_names != NULL;
        g_slist_free (account_names);
        
@@ -215,7 +224,7 @@ modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
 #ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
        /* To test, while modest_account_mgr_account_names() is broken: accounts_exist = TRUE; */
        if (!accounts_exist) {
 #ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
        /* To test, while modest_account_mgr_account_names() is broken: accounts_exist = TRUE; */
        if (!accounts_exist) {
-               printf ("debug: modest_account_mgr_account_names() returned NULL.");
+               printf ("debug: modest_account_mgr_account_names() returned NULL.\n");
                /* If there are no accounts yet, just show the easy-setup wizard, as per the UI spec: */
                ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new ();
                gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
                /* If there are no accounts yet, just show the easy-setup wizard, as per the UI spec: */
                ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new ();
                gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));