From: Murray Cumming Date: Fri, 8 Jun 2007 07:38:25 +0000 (+0000) Subject: 2007-06-08 Murray Cumming X-Git-Tag: git_migration_finished~3377 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=c3fa140bae7b51e3bca3ae33bf2b6f924cd9386f 2007-06-08 Murray Cumming * 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 --- diff --git a/ChangeLog2 b/ChangeLog2 index d1f44f7..358f405 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,3 +1,40 @@ +2007-06-08 Murray Cumming + + * 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 * src/dbus_api/modest-dbus-api.h: diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index 22195df..2faebcc 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -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; diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 9907fc2..b70cda1 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -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); */ diff --git a/src/modest-defs.h b/src/modest-defs.h index e3646be..6b162b6 100644 --- a/src/modest-defs.h +++ b/src/modest-defs.h @@ -43,13 +43,14 @@ #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//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//outbox/ folder for each account, * though we merge them so that the user sees only one outbox. diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index c93874c..c313e22 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -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); diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index f2e4314..a41cf72 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -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); } diff --git a/src/modest-tny-account-store.h b/src/modest-tny-account-store.h index 2e5cbb3..bb685bc 100644 --- a/src/modest-tny-account-store.h +++ b/src/modest-tny-account-store.h @@ -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); diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index 5c76d04..5cd4ee3 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -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); } diff --git a/src/modest-tny-folder.c b/src/modest-tny-folder.c index f4c0014..bcf9ffa 100644 --- a/src/modest-tny-folder.c +++ b/src/modest-tny-folder.c @@ -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); } diff --git a/src/modest-tny-local-folders-account.c b/src/modest-tny-local-folders-account.c index eecb30c..7dd2c0d 100644 --- a/src/modest-tny-local-folders-account.c +++ b/src/modest-tny-local-folders-account.c @@ -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), diff --git a/src/modest-tny-send-queue.c b/src/modest-tny-send-queue.c index fde2f2e..b1216be 100644 --- a/src/modest-tny-send-queue.c +++ b/src/modest-tny-send-queue.c @@ -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 diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 48ebc67..a7b20ad 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -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); } diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index 19ac4b8..e03027c 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -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));