2007-06-08 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Fri, 8 Jun 2007 07:38:25 +0000 (07:38 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Fri, 8 Jun 2007 07:38:25 +0000 (07:38 +0000)
* src/modest-tny-send-queue.c: (modest_tny_send_queue_add),
        (modest_tny_send_queue_class_init):
        Do not use the priv struct because it is empty, to avoid g_warnings
        about a non-existant priv struct.

        * src/modest-tny-account-store.c:
        (modest_tny_account_store_get_server_account),
        (modest_tny_account_store_get_transport_account_for_open_connection
        ): Do not try to get transport server accounts for local folders,
        because they don't have any. This avoids a g_warning().

        * src/maemo/modest-main-window.c:
        (modest_main_window_notify_send_receive_initied),
        (on_configuration_key_changed):
        * src/maemo/modest-msg-edit-window.c: (on_delete_event):
        * src/modest-defs.h:
        * src/modest-mail-operation.c:
        (modest_mail_operation_update_account):
        * src/modest-tny-account-store.h:
        * src/modest-tny-account.c:
        (modest_tny_account_get_special_folder),
        (modest_tny_account_new_for_local_folders),
        (modest_tny_account_new_for_per_account_local_outbox_folder):
        * src/modest-tny-folder.c: (modest_tny_folder_is_local_folder):
        * src/modest-tny-local-folders-account.c:
        (add_account_folders_to_merged_folder):
        * src/modest-ui-actions.c: (modest_ui_actions_on_new_msg),
        (reply_forward_cb), (modest_ui_actions_on_save_to_drafts),
        (modest_ui_actions_on_send):
        * src/widgets/modest-folder-view.c: (update_model):
        Rename MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID to
        MODEST_LOCAL_FOLDERS_ACCOUNT_ID and rename
        modest_tny_account_store_get_tny_account_by_account() to
        modest_tny_account_store_get_server_account() to make the code clearer.

pmo-trunk-r2120

13 files changed:
ChangeLog2
src/maemo/modest-main-window.c
src/maemo/modest-msg-edit-window.c
src/modest-defs.h
src/modest-mail-operation.c
src/modest-tny-account-store.c
src/modest-tny-account-store.h
src/modest-tny-account.c
src/modest-tny-folder.c
src/modest-tny-local-folders-account.c
src/modest-tny-send-queue.c
src/modest-ui-actions.c
src/widgets/modest-folder-view.c

index d1f44f7..358f405 100644 (file)
@@ -1,3 +1,40 @@
+2007-06-08  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/modest-tny-send-queue.c: (modest_tny_send_queue_add),
+       (modest_tny_send_queue_class_init):
+       Do not use the priv struct because it is empty, to avoid g_warnings 
+       about a non-existant priv struct.
+       
+       * src/modest-tny-account-store.c:
+       (modest_tny_account_store_get_server_account),
+       (modest_tny_account_store_get_transport_account_for_open_connection
+       ): Do not try to get transport server accounts for local folders, 
+       because they don't have any. This avoids a g_warning().
+       
+       * src/maemo/modest-main-window.c:
+       (modest_main_window_notify_send_receive_initied),
+       (on_configuration_key_changed):
+       * src/maemo/modest-msg-edit-window.c: (on_delete_event):
+       * src/modest-defs.h:
+       * src/modest-mail-operation.c:
+       (modest_mail_operation_update_account):
+       * src/modest-tny-account-store.h:
+       * src/modest-tny-account.c:
+       (modest_tny_account_get_special_folder),
+       (modest_tny_account_new_for_local_folders),
+       (modest_tny_account_new_for_per_account_local_outbox_folder):
+       * src/modest-tny-folder.c: (modest_tny_folder_is_local_folder):
+       * src/modest-tny-local-folders-account.c:
+       (add_account_folders_to_merged_folder):
+       * src/modest-ui-actions.c: (modest_ui_actions_on_new_msg),
+       (reply_forward_cb), (modest_ui_actions_on_save_to_drafts),
+       (modest_ui_actions_on_send):
+       * src/widgets/modest-folder-view.c: (update_model):
+       Rename MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID to 
+       MODEST_LOCAL_FOLDERS_ACCOUNT_ID and rename 
+       modest_tny_account_store_get_tny_account_by_account() to 
+       modest_tny_account_store_get_server_account() to make the code clearer.
+
 2007-06-07  Marcus Bauer  <marcusb@openismus.com>
 
        * src/dbus_api/modest-dbus-api.h:
index 22195df..2faebcc 100644 (file)
@@ -1382,18 +1382,12 @@ modest_main_window_notify_send_receive_initied (ModestMainWindow *self)
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
 
-       /* Tools menu options */
         action = modest_window_get_action (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu");        
        gtk_action_set_sensitive (action, FALSE);
         action = modest_window_get_action (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveCancelSendingMenu");      
        gtk_action_set_sensitive (action, FALSE);
         widget = modest_window_get_action_widget (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions");      
        gtk_widget_set_sensitive (widget, FALSE);
-       
-       /* Header view CSM */
-        action = modest_window_get_action (MODEST_WINDOW(self), "/HeaderViewCSM/HeaderViewCSMCancelSending");  
-       gtk_action_set_sensitive (action, FALSE);
-           
 } 
 
 void 
@@ -1494,7 +1488,7 @@ on_configuration_key_changed (ModestConf* conf,
 
        account = (TnyAccount *) modest_folder_view_get_selected (priv->folder_view);
        if (TNY_IS_ACCOUNT (account) &&
-           !strcmp (tny_account_get_id (account), MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+           !strcmp (tny_account_get_id (account), MODEST_LOCAL_FOLDERS_ACCOUNT_ID)) {
                GList *children;
                GtkLabel *label;
                const gchar *device_name;
index 9907fc2..b70cda1 100644 (file)
@@ -509,7 +509,7 @@ on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgEditWindow *self)
 /*     /\* remove old message from drafts *\/ */
 /*     if (priv->draft_msg) { */
 /*             TnyHeader *header = tny_msg_get_header (priv->draft_msg); */
-/*             TnyAccount *account = modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(), */
+/*             TnyAccount *account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store(), */
 /*                                                                                        account_name, */
 /*                                                                                        TNY_ACCOUNT_TYPE_STORE); */
 /*             TnyFolder *folder = modest_tny_account_get_special_folder (account, TNY_FOLDER_TYPE_DRAFTS); */
index e3646be..6b162b6 100644 (file)
 #define MODEST_DIR                       ".modest"
 #define MODEST_CACHE_DIR                  "cache"
 
-/** Sent, Drafts, etc, 
+#define MODEST_LOCAL_FOLDERS_ACCOUNT_ID   "local_folders"
+#define MODEST_LOCAL_FOLDERS_ACCOUNT_NAME MODEST_LOCAL_FOLDERS_ACCOUNT_ID
+
+/** Sent, Drafts, etc, are on-disk 
  * but not outbox, because outbox is a virtual folder merged from the 
  * various outboxes/<account-name>/outbox folders.
  */
-#define MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID   "local_folders"
-#define MODEST_LOCAL_FOLDERS_ACCOUNT_NAME MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID
-#define MODEST_LOCAL_FOLDERS_MAILDIR      MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID
+#define MODEST_LOCAL_FOLDERS_MAILDIR      MODEST_LOCAL_FOLDERS_ACCOUNT_ID
 
 /** There is an outboxes/<account-name>/outbox/ folder for each account,
  * though we merge them so that the user sees only one outbox.
index c93874c..c313e22 100644 (file)
@@ -1044,7 +1044,7 @@ modest_mail_operation_update_account (ModestMailOperation *self,
        
        /* Get the Modest account */
        modest_account = (TnyStoreAccount *)
-               modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store (),
+               modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
                                                                     account_name,
                                                                     TNY_ACCOUNT_TYPE_STORE);
 
index f2e4314..a41cf72 100644 (file)
@@ -1127,7 +1127,7 @@ modest_tny_account_store_get_tny_account_by_id  (ModestTnyAccountStore *self, co
 }
 
 TnyAccount*
-modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self,
+modest_tny_account_store_get_server_account (ModestTnyAccountStore *self,
                                                     const gchar *account_name,
                                                     TnyAccountType type)
 {
@@ -1143,9 +1143,13 @@ modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
        /* Special case for the local account */
-       if (!strcmp (account_name, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID) && 
-           type == TNY_ACCOUNT_TYPE_STORE) {
-               id = g_strdup (MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID);
+       if (!strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID)) {
+               if(type == TNY_ACCOUNT_TYPE_STORE)
+                       id = g_strdup (MODEST_LOCAL_FOLDERS_ACCOUNT_ID);
+               else {
+                       /* The local folders modest account has no transport server account. */
+                       return NULL;
+               }
        } else {
                ModestAccountData *account_data;
 
@@ -1240,7 +1244,12 @@ modest_tny_account_store_get_transport_account_for_open_connection (ModestTnyAcc
         * just get the regular transport account: */
        if (!account) {
                /* printf("DEBUG: %s: using regular transport account for account %s.\n", __FUNCTION__, account_name); */
-               account = modest_tny_account_store_get_tny_account_by_account (self, account_name, 
+
+               /* The special local folders don't have transport accounts. */
+               if (strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0)
+                       account = NULL;
+               else
+                       account = modest_tny_account_store_get_server_account (self, account_name, 
                                                     TNY_ACCOUNT_TYPE_TRANSPORT);
        }
                             
index 2e5cbb3..bb685bc 100644 (file)
@@ -110,17 +110,17 @@ TnyAccount* modest_tny_account_store_get_tny_account_by_id  (ModestTnyAccountSto
                                                             const gchar *id);
 
 /**
- * modest_tny_account_store_get_tny_account_by_account
+ * modest_tny_account_store_get_server_account
  * @self: a ModestTnyAccountStore instance
- * @account_name: an account name
- * @type: the tny account type
+ * @account_name: a modest account name
+ * @type: the tny account type (store or transport)
  * 
  * Get the tny account corresponding to one of the server_accounts for account with @account_name
  * 
  * Returns: the tnyaccount for the server account or NULL in case it's not found or error,
  * g_object_unref when it's no longer needed
  */
-TnyAccount* modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self,
+TnyAccount* modest_tny_account_store_get_server_account (ModestTnyAccountStore *self,
                                                                 const gchar *account_name,
                                                                 TnyAccountType type);
                                                     
index 5c76d04..5cd4ee3 100644 (file)
@@ -85,7 +85,7 @@ modest_tny_account_get_special_folder (TnyAccount *account,
        } else {
                /* Other local folders are all in one on-disk directory: */
                local_account = modest_tny_account_store_get_tny_account_by_id (modest_runtime_get_account_store(),
-                                                                               MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID);
+                                                                               MODEST_LOCAL_FOLDERS_ACCOUNT_ID);
        }
        
        if (!local_account) {
@@ -522,14 +522,14 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess
        
        
        const gchar* id = is_mmc ? MODEST_MMC_ACCOUNT_ID :
-               MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID;
+               MODEST_LOCAL_FOLDERS_ACCOUNT_ID;
        tny_account_set_id (TNY_ACCOUNT(tny_account), id);
        
        tny_account_set_forget_pass_func (TNY_ACCOUNT(tny_account), forget_pass_dummy);
        tny_account_set_pass_func (TNY_ACCOUNT(tny_account), get_pass_dummy);
        
        modest_tny_account_set_parent_modest_account_name_for_server_account (
-               TNY_ACCOUNT (tny_account), MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID);
+               TNY_ACCOUNT (tny_account), id);
        
        camel_url_free (url);
        g_free (maildir);
@@ -597,7 +597,7 @@ modest_tny_account_new_for_per_account_local_outbox_folder (ModestAccountMgr *ac
        
        /* Make this think that it belongs to the modest local-folders parent account: */
        modest_tny_account_set_parent_modest_account_name_for_server_account (
-               TNY_ACCOUNT (tny_account), MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID);
+               TNY_ACCOUNT (tny_account), MODEST_LOCAL_FOLDERS_ACCOUNT_ID);
 
        return TNY_ACCOUNT(tny_account);
 }
index f4c0014..bcf9ffa 100644 (file)
@@ -198,7 +198,7 @@ modest_tny_folder_is_local_folder   (TnyFolder *folder)
 
        g_object_unref (G_OBJECT(account));
        
-       return (strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
+       return (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
 }      
 
 
index eecb30c..7dd2c0d 100644 (file)
@@ -182,7 +182,7 @@ add_account_folders_to_merged_folder (TnyAccount *account, TnyMergeFolder* merge
 {
        const gchar* account_id = tny_account_get_id (account);
        const gboolean is_actual_local_folders_account = account_id && 
-               (strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
+               (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
                
        TnyList *list_outbox_folders = tny_simple_list_new ();
        tny_folder_store_get_folders (TNY_FOLDER_STORE (account), 
index fde2f2e..b1216be 100644 (file)
@@ -47,6 +47,7 @@ enum {
        LAST_SIGNAL
 };
 
+#if 0
 typedef struct _ModestTnySendQueuePrivate ModestTnySendQueuePrivate;
 struct _ModestTnySendQueuePrivate {
        /* empty */
@@ -54,6 +55,8 @@ struct _ModestTnySendQueuePrivate {
 #define MODEST_TNY_SEND_QUEUE_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
                                                    MODEST_TYPE_TNY_SEND_QUEUE, \
                                                    ModestTnySendQueuePrivate))
+#endif
+
 /* globals */
 static TnyCamelSendQueueClass *parent_class = NULL;
 
@@ -74,13 +77,9 @@ modest_tny_send_queue_cancel (TnySendQueue *self, gboolean remove, GError **err)
 static void
 modest_tny_send_queue_add (TnySendQueue *self, TnyMsg *msg, GError **err)
 {
-       ModestTnySendQueuePrivate *priv; 
-       
        g_return_if_fail (TNY_IS_SEND_QUEUE(self));
        g_return_if_fail (TNY_IS_CAMEL_MSG(msg));
        
-       priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
-
        /* FIXME: do something smart here... */
        
        TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->add_func (self, msg, err); /* FIXME */
@@ -169,7 +168,7 @@ modest_tny_send_queue_class_init (ModestTnySendQueueClass *klass)
         TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_sentbox_func = modest_tny_send_queue_get_sentbox;
         TNY_CAMEL_SEND_QUEUE_CLASS(klass)->cancel_func      = modest_tny_send_queue_cancel;
 
-       g_type_class_add_private (gobject_class, sizeof(ModestTnySendQueuePrivate));
+       /* g_type_class_add_private (gobject_class, sizeof(ModestTnySendQueuePrivate)); */
 }
 
 static void
index 48ebc67..a7b20ad 100644 (file)
@@ -485,7 +485,7 @@ modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win)
                goto cleanup;
        }
        
-       account = modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(),
+       account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store(),
                                                                       account_name,
                                                                       TNY_ACCOUNT_TYPE_STORE);
        if (!account) {
@@ -795,7 +795,7 @@ reply_forward_cb (ModestMailOperation *mail_op,
                goto cleanup;
        }
 
-       account = modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(),
+       account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store(),
                                                                       rf_helper->account_name,
                                                                       TNY_ACCOUNT_TYPE_STORE);
        if (!account) {
@@ -1399,12 +1399,12 @@ modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edi
                return;
        }
 
-       if (!strcmp (account_name, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+       if (!strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID)) {
                account_name = g_strdup (data->account_name);
        }
 
        transport_account =
-               TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_tny_account_by_account
+               TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account
                                      (modest_runtime_get_account_store(),
                                       account_name,
                                       TNY_ACCOUNT_TYPE_TRANSPORT));
@@ -1467,7 +1467,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window)
        }
        MsgData *data = modest_msg_edit_window_get_msg_data (edit_window);
 
-       if (!strcmp (account_name, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+       if (!strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID)) {
                account_name = g_strdup (data->account_name);
        }
        
index 19ac4b8..e03027c 100644 (file)
@@ -735,8 +735,8 @@ update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
        /* Remove the old model as observer of the local folder account */
 #if 0 /* Commented out until Sergio fixes the crash. */
        local_account = 
-               modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store (),
-                                                                    MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID,
+               modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
+                                                                    MODEST_LOCAL_FOLDERS_ACCOUNT_ID,
                                                                     TNY_ACCOUNT_TYPE_STORE);
        old_model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));