2007-07-02 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Mon, 2 Jul 2007 10:59:32 +0000 (10:59 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Mon, 2 Jul 2007 10:59:32 +0000 (10:59 +0000)
* src/modest-tny-account.h:
* src/modest-tny-account.c:
(modest_tny_account_new_from_server_account),
(modest_tny_account_new_from_server_account_name),
(modest_tny_account_new_from_account): Added a TnyCamelSession parameter,
because this must now be set before setting the proto. This is usd in
modest_tny_account_new_from_server_account(). It avoids a (maybe harmless)
warning in camel_session_get_service() caused by
tny_camel_transport_account_prepare().

* src/modest-tny-account-store.c: (get_server_accounts): Pass the new
session parameter.

pmo-trunk-r2527

ChangeLog2
src/modest-tny-account-store.c
src/modest-tny-account.c
src/modest-tny-account.h

index e7cbef7..fbea86d 100644 (file)
@@ -1,3 +1,18 @@
+2007-07-02  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/modest-tny-account.h:
+       * src/modest-tny-account.c:
+       (modest_tny_account_new_from_server_account),
+       (modest_tny_account_new_from_server_account_name),
+       (modest_tny_account_new_from_account): Added a TnyCamelSession parameter, 
+       because this must now be set before setting the proto. This is usd in 
+       modest_tny_account_new_from_server_account(). It avoids a (maybe harmless) 
+       warning in camel_session_get_service() caused by 
+       tny_camel_transport_account_prepare().
+       
+       * src/modest-tny-account-store.c: (get_server_accounts): Pass the new 
+       session parameter.
+
 2007-06-30  Johannes Schmid <johannes.schmid@openismus.com>
 
        * src/maemo/modest-connection-specific-smtp-edit-window.c:
 2007-06-30  Johannes Schmid <johannes.schmid@openismus.com>
 
        * src/maemo/modest-connection-specific-smtp-edit-window.c:
index 9d46e75..b4119dc 100644 (file)
@@ -787,7 +787,7 @@ get_server_accounts  (TnyAccountStore *self, TnyList *list, TnyAccountType type)
                                                TnyAccount * tny_account = NULL;
                                                /* Add the account: */
                                                tny_account = modest_tny_account_new_from_server_account_name (
                                                TnyAccount * tny_account = NULL;
                                                /* Add the account: */
                                                tny_account = modest_tny_account_new_from_server_account_name (
-                                                       priv->account_mgr, transport_account_name);
+                                                       priv->account_mgr, priv->session, transport_account_name);
                                                if (tny_account) {
                                                        g_object_set_data (G_OBJECT(tny_account), "account_store",
                                                                           (gpointer)self);
                                                if (tny_account) {
                                                        g_object_set_data (G_OBJECT(tny_account), "account_store",
                                                                           (gpointer)self);
index 8b2f70d..ebb0b06 100644 (file)
@@ -195,7 +195,8 @@ on_connection_status_changed (TnyAccount *account, TnyConnectionStatus status, g
 /**
  * modest_tny_account_new_from_server_account:
  * @account_mgr: a valid account mgr instance
 /**
  * modest_tny_account_new_from_server_account:
  * @account_mgr: a valid account mgr instance
- * @account_name: the server account name for which to create a corresponding tny account
+ * @session: A valid TnySessionCamel instance.
+ * @account_data: the server account for which to create a corresponding tny account
  * @type: the type of account to create (TNY_ACCOUNT_TYPE_STORE or TNY_ACCOUNT_TYPE_TRANSPORT)
  * 
  * get a tnyaccount corresponding to the server_accounts (store or transport) for this account.
  * @type: the type of account to create (TNY_ACCOUNT_TYPE_STORE or TNY_ACCOUNT_TYPE_TRANSPORT)
  * 
  * get a tnyaccount corresponding to the server_accounts (store or transport) for this account.
@@ -205,11 +206,13 @@ on_connection_status_changed (TnyAccount *account, TnyConnectionStatus status, g
  */
 static TnyAccount*
 modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
  */
 static TnyAccount*
 modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
+                                           TnySessionCamel *session,
                                            ModestServerAccountData *account_data)
 {
        gchar *url = NULL;
 
        g_return_val_if_fail (account_mgr, NULL);
                                            ModestServerAccountData *account_data)
 {
        gchar *url = NULL;
 
        g_return_val_if_fail (account_mgr, NULL);
+       g_return_val_if_fail (session, NULL);
        g_return_val_if_fail (account_data, NULL);
 
        /* sanity checks */
        g_return_val_if_fail (account_data, NULL);
 
        /* sanity checks */
@@ -245,6 +248,9 @@ modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
        }
        tny_account_set_id (tny_account, account_data->account_name);
 
        }
        tny_account_set_id (tny_account, account_data->account_name);
 
+       /* This must be set quite early, or other set() functions will fail. */
+    tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (tny_account), session);
+    
        /* Handle connection requests:
         * This (badly-named) signal will be called when we try to use an offline account. */
        g_signal_connect (G_OBJECT (tny_account), "connection-status-changed",
        /* Handle connection requests:
         * This (badly-named) signal will be called when we try to use an offline account. */
        g_signal_connect (G_OBJECT (tny_account), "connection-status-changed",
@@ -369,7 +375,8 @@ modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
 
 TnyAccount*
 modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr,
 
 TnyAccount*
 modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr,
-                                           const gchar *server_account_name)
+                                               TnySessionCamel *session,
+                                               const gchar *server_account_name)
 {
        ModestServerAccountData *account_data = 
                modest_account_mgr_get_server_account_data (account_mgr, 
 {
        ModestServerAccountData *account_data = 
                modest_account_mgr_get_server_account_data (account_mgr, 
@@ -378,7 +385,7 @@ modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr,
                return NULL;
 
        TnyAccount *result = modest_tny_account_new_from_server_account (
                return NULL;
 
        TnyAccount *result = modest_tny_account_new_from_server_account (
-               account_mgr, account_data);
+               account_mgr, session, account_data);
 
        modest_account_mgr_free_server_account_data (account_mgr, account_data);
        
 
        modest_account_mgr_free_server_account_data (account_mgr, account_data);
        
@@ -431,7 +438,7 @@ modest_tny_account_new_from_account (ModestAccountMgr *account_mgr, const gchar
                return NULL;
        }
        
                return NULL;
        }
        
-       tny_account = modest_tny_account_new_from_server_account (account_mgr, server_data);
+       tny_account = modest_tny_account_new_from_server_account (account_mgr, session, server_data);
        if (!tny_account) { 
                g_printerr ("modest: failed to create tny account for %s (%s)\n",
                            account_data->account_name, server_data->account_name);
        if (!tny_account) { 
                g_printerr ("modest: failed to create tny account for %s (%s)\n",
                            account_data->account_name, server_data->account_name);
@@ -439,7 +446,6 @@ modest_tny_account_new_from_account (ModestAccountMgr *account_mgr, const gchar
                return NULL;
        }
        
                return NULL;
        }
        
-       tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), session);
        tny_account_set_forget_pass_func (tny_account,
                                          forget_pass_func ? forget_pass_func : forget_pass_dummy);
        tny_account_set_pass_func (tny_account,
        tny_account_set_forget_pass_func (tny_account,
                                          forget_pass_func ? forget_pass_func : forget_pass_dummy);
        tny_account_set_pass_func (tny_account,
index d4a2e3f..08e844a 100644 (file)
@@ -95,13 +95,14 @@ TnyAccount* modest_tny_account_new_for_per_account_local_outbox_folder (
 /**
  * modest_tny_account_new_from_server_account_name:
  * @account_mgr: a valid account mgr instance
 /**
  * modest_tny_account_new_from_server_account_name:
  * @account_mgr: a valid account mgr instance
+ * @session: a valid TnySessionCamel instance.
  * @server_account_name: the name of a server account in the configuration system.
  *
  * Returns: a new TnyAccount or NULL in case of error.
  */
 TnyAccount*
 modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr, 
  * @server_account_name: the name of a server account in the configuration system.
  *
  * Returns: a new TnyAccount or NULL in case of error.
  */
 TnyAccount*
 modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr, 
-       const gchar* server_account_name);
+       TnySessionCamel *session, const gchar* server_account_name);
        
 /**
  * modest_tny_account_get_special_folder:
        
 /**
  * modest_tny_account_get_special_folder: