2007-05-24 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Thu, 24 May 2007 11:56:19 +0000 (11:56 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Thu, 24 May 2007 11:56:19 +0000 (11:56 +0000)
* src/maemo/modest-account-settings-dialog.c:
        (modest_account_settings_dialog_set_account_name),
        Check the connection-specific smtp servers checkbox if there are any.

        * src/maemo/modest-connection-specific-smtp-edit-window.c:
        (modest_connection_specific_smtp_edit_window_init):
        Start with a suitable port number.

        * src/modest-account-mgr-helpers.h:
        * src/modest-account-mgr-helpers.c: Added
        modest_account_mgr_get_has_connection_specific_smtp().

        (modest_account_mgr_set_connection_specific_smtp),
        (modest_account_mgr_remove_connection_specific_smtp),
        (modest_account_mgr_get_has_connection_specific_smtp),
        (modest_account_mgr_get_connection_specific_smtp): Set/Get the list of
        connection-specific smtp server accounts in the account, rather than
        the server account conf dir.

        This fixes bug projects.maemo.org bug NB#58263 .

        * src/modest-tny-account-store.c:
        (create_per_account_local_outbox_folders): Do not call get_server_accounts()
        if there are no server accounts yet, to prevent an infinite loop when there
        are no accounts. Document that one must be called before the other.

pmo-trunk-r1969

ChangeLog2
src/maemo/modest-account-settings-dialog.c
src/maemo/modest-connection-specific-smtp-edit-window.c
src/maemo/modest-connection-specific-smtp-window.c
src/modest-account-mgr-helpers.c
src/modest-account-mgr-helpers.h
src/modest-tny-account-store.c

index 54946f1..9127a28 100644 (file)
@@ -1,3 +1,31 @@
+2007-05-24   Murray Cumming  <murrayc@murrayc.com>
+
+       * src/maemo/modest-account-settings-dialog.c:
+       (modest_account_settings_dialog_set_account_name),
+       Check the connection-specific smtp servers checkbox if there are any.
+       
+       * src/maemo/modest-connection-specific-smtp-edit-window.c:
+       (modest_connection_specific_smtp_edit_window_init): 
+       Start with a suitable port number.
+       
+       * src/modest-account-mgr-helpers.h:
+       * src/modest-account-mgr-helpers.c: Added 
+       modest_account_mgr_get_has_connection_specific_smtp().
+       
+       (modest_account_mgr_set_connection_specific_smtp),
+       (modest_account_mgr_remove_connection_specific_smtp),
+       (modest_account_mgr_get_has_connection_specific_smtp),
+       (modest_account_mgr_get_connection_specific_smtp): Set/Get the list of 
+       connection-specific smtp server accounts in the account, rather than 
+       the server account conf dir.
+       
+       This fixes bug projects.maemo.org bug NB#58263 .
+
+       * src/modest-tny-account-store.c:
+       (create_per_account_local_outbox_folders): Do not call get_server_accounts() 
+       if there are no server accounts yet, to prevent an infinite loop when there 
+       are no accounts. Document that one must be called before the other.
+
 2007-05-24  Murray Cumming  <murrayc@murrayc.com>
 
        * src/modest-account-mgr-helpers.c:
index de23a14..c5ad061 100644 (file)
@@ -1125,6 +1125,14 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                        hildon_number_editor_set_value (
                                HILDON_NUMBER_EDITOR (dialog->entry_outgoing_port), port_num);
                }
+               
+               const gboolean has_specific = 
+                       modest_account_mgr_get_has_connection_specific_smtp (
+                               dialog->account_manager, 
+                               account_name);
+               gtk_toggle_button_set_active (
+                       GTK_TOGGLE_BUTTON (dialog->checkbox_outgoing_smtp_specific), 
+                       has_specific);
        }
        
        /* account_data->is_enabled,  */
@@ -1297,9 +1305,10 @@ save_configuration (ModestAccountSettingsDialog *dialog)
        }
        
        /* Save connection-specific SMTP server accounts: */
-       if (dialog->specific_window)
+       if (dialog->specific_window) {
                return modest_connection_specific_smtp_window_save_server_accounts (
                        MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (dialog->specific_window), account_name);
+       }
        else
                return TRUE;
 }
index 412d41d..49d72e4 100644 (file)
@@ -224,6 +224,7 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd
        
        /* Show a default port number when the security method changes, as per the UI spec: */
        g_signal_connect (G_OBJECT (priv->combo_outgoing_security), "changed", (GCallback)on_combo_security_changed, self);
+       on_combo_security_changed (GTK_COMBO_BOX (priv->combo_outgoing_security), self);
        
        /* Add the buttons: */
        gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_OK, GTK_RESPONSE_OK);
index cd4623d..6b22197 100644 (file)
@@ -208,7 +208,7 @@ on_button_edit (GtkButton *button, gpointer user_data)
                                    MODEL_COL_SERVER_ACCOUNT_DATA, &data,
                                    -1);
        
-               printf("DEBUG: %s: BEFORE: connection-specific server_account_name=%s\n", __FUNCTION__, server_account_name);
+               /* printf("DEBUG: %s: BEFORE: connection-specific server_account_name=%s\n", __FUNCTION__, server_account_name); */
                /* TODO: Is 0 an allowed libconic IAP ID? 
                 * If not then we should check for it. */
                
@@ -424,6 +424,7 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe
                                        priv->account_name, connection_name);
                                server_account_name = modest_account_mgr_get_unused_account_name (
                                        priv->account_manager, name_start, TRUE /* server account. */);
+                               g_assert (server_account_name);
                                g_free (name_start);
                                
                                success = modest_account_mgr_add_server_account (priv->account_manager,
index 47a343c..bfa0c55 100644 (file)
@@ -85,7 +85,7 @@ gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self
        
        GSList *list = modest_account_mgr_get_list (self, account_name, 
                                                        MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST,
-                                                   MODEST_CONF_VALUE_STRING, TRUE);
+                                                   MODEST_CONF_VALUE_STRING, FALSE);
                
        /* The server account is in the item after the connection name: */
        GSList *list_connection = g_slist_append (list, (gpointer)connection_name);
@@ -93,8 +93,8 @@ gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self
        
        /* Reset the changed list: */
        modest_account_mgr_set_list (self, account_name, 
-                                                       MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST, list,
-                                                   MODEST_CONF_VALUE_STRING, TRUE);
+                                                       MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST, list_connection,
+                                                   MODEST_CONF_VALUE_STRING, FALSE);
                                
        /* TODO: Should we free the items too, or just the list? */
        g_slist_free (list);
@@ -117,7 +117,7 @@ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *s
 {
        GSList *list = modest_account_mgr_get_list (self, account_name, 
                                                        MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST,
-                                                   MODEST_CONF_VALUE_STRING, TRUE);
+                                                   MODEST_CONF_VALUE_STRING, FALSE);
        if (!list)
                return FALSE;
                
@@ -132,7 +132,7 @@ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *s
        /* Reset the changed list: */
        modest_account_mgr_set_list (self, account_name, 
                                                        MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST, list,
-                                                   MODEST_CONF_VALUE_STRING, TRUE);
+                                                   MODEST_CONF_VALUE_STRING, FALSE);
                                
        /* TODO: Should we free the items too, or just the list? */
        g_slist_free (list);
@@ -140,6 +140,20 @@ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *s
        return TRUE;
 }
 
+gboolean modest_account_mgr_get_has_connection_specific_smtp (ModestAccountMgr *self, const gchar* account_name)
+{
+       GSList *list = modest_account_mgr_get_list (self, account_name, 
+                                                       MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST,
+                                                   MODEST_CONF_VALUE_STRING, FALSE);
+       if (!list)
+               return FALSE;
+       
+       /* TODO: Should we free the items too, or just the list? */
+       g_slist_free (list);
+       
+       return TRUE;
+}
+
 /**
  * modest_account_mgr_get_connection_specific_smtp
  * @self: a ModestAccountMgr instance
@@ -157,7 +171,7 @@ gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self,
        
        GSList *list = modest_account_mgr_get_list (self, account_name, 
                                                        MODEST_ACCOUNT_CONNECTION_SPECIFIC_SMTP_LIST,
-                                                   MODEST_CONF_VALUE_STRING, TRUE);
+                                                   MODEST_CONF_VALUE_STRING, FALSE);
        if (!list)
                return NULL;
                
index f04d78f..b09818e 100644 (file)
@@ -228,6 +228,14 @@ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *s
                                         const gchar* connection_name);
 
 /**
+ * modest_account_mgr_get_has_connection_specific_smtp
+ * @self: a ModestAccountMgr instance
+ * @name: the account name
+ * @result: Whether this account uses any connection-specific smtp server accounts.
+ */    
+gboolean modest_account_mgr_get_has_connection_specific_smtp (ModestAccountMgr *self, const gchar* account_name);
+
+/**
  * modest_account_mgr_get_connection_specific_smtp
  * @self: a ModestAccountMgr instance
  * @name: the account name
index 5c3385f..46773b5 100644 (file)
@@ -508,11 +508,17 @@ create_per_account_local_outbox_folders (TnyAccountStore *self)
                        return;
        }
        
+       /* This transport accounts must be created before calling this function.
+        * Otherwise, we have an infinite loop when there are no accounts. */
+        if (!(priv->transport_accounts))
+               return;
+#if 0
        /* Create the transport accounts, if necessary: */
        if (!(priv->transport_accounts)) {
                get_server_accounts (self, NULL /* TnyList */, 
                        TNY_ACCOUNT_TYPE_TRANSPORT);
        }
+#endif
        
        GSList *accounts = NULL;
        
@@ -603,7 +609,7 @@ get_server_accounts  (TnyAccountStore *self, TnyList *list, TnyAccountType type)
                accounts = g_slist_append (accounts, tny_account); /* cache it */
        }
        
-       /* Do this here, in case create_per_account_local_outbox_folders() needs it. */
+       /* Do this here, because create_per_account_local_outbox_folders() needs it. */
        if (type == TNY_ACCOUNT_TYPE_TRANSPORT) {
                        /* Store the cache: */
                        priv->transport_accounts = accounts;