From c77f999bedc4612fc12568a070c592f0b16da8cc Mon Sep 17 00:00:00 2001 From: Javier Fernandez Garcia-Boente Date: Mon, 30 Apr 2007 08:14:19 +0000 Subject: [PATCH] * Changes in the mail_operation API * new object instances require the operation id pmo-trunk-r1718 --- src/dbus_api/modest-dbus-callbacks.c | 2 +- src/modest-mail-operation.c | 7 +------ src/modest-mail-operation.h | 4 ++-- src/modest-main.c | 2 +- src/modest-ui-actions.c | 18 +++++++++--------- src/widgets/modest-folder-view.c | 4 ++-- src/widgets/modest-header-view.c | 2 +- 7 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index 2a1679d..1504c16 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -78,7 +78,7 @@ on_idle_send_mail(gpointer user_data) if (!from) { g_printerr ("modest: no from address for account '%s'\n", account_name); } else { - ModestMailOperation *mail_operation = modest_mail_operation_new (); + ModestMailOperation *mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_SEND); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation); modest_mail_operation_send_new_mail (mail_operation, diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 955a893..a60c025 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -190,7 +190,7 @@ modest_mail_operation_finalize (GObject *obj) } ModestMailOperation* -modest_mail_operation_new_with_id (ModestMailOperationId id) +modest_mail_operation_new (ModestMailOperationId id) { ModestMailOperation *obj; ModestMailOperationPrivate *priv; @@ -204,11 +204,6 @@ modest_mail_operation_new_with_id (ModestMailOperationId id) return obj; } -ModestMailOperation* -modest_mail_operation_new () -{ - return MODEST_MAIL_OPERATION(g_object_new(MODEST_TYPE_MAIL_OPERATION, NULL)); -} ModestMailOperationId diff --git a/src/modest-mail-operation.h b/src/modest-mail-operation.h index a67b0ee..e7e4081 100644 --- a/src/modest-mail-operation.h +++ b/src/modest-mail-operation.h @@ -70,6 +70,7 @@ typedef enum _ModestMailOperationId { MODEST_MAIL_OPERATION_ID_RECEIVE, MODEST_MAIL_OPERATION_ID_OPEN, MODEST_MAIL_OPERATION_ID_DELETE, + MODEST_MAIL_OPERATION_ID_INFO, MODEST_MAIL_OPERATION_ID_UNKNOWN, } ModestMailOperationId; @@ -89,8 +90,7 @@ struct _ModestMailOperationClass { GType modest_mail_operation_get_type (void) G_GNUC_CONST; /* typical parameter-less _new function */ -ModestMailOperation* modest_mail_operation_new_with_id (ModestMailOperationId id); -ModestMailOperation* modest_mail_operation_new (void); +ModestMailOperation* modest_mail_operation_new (ModestMailOperationId id); /** * modest_mail_operation_get_id diff --git a/src/modest-main.c b/src/modest-main.c index 324465c..fde670b 100644 --- a/src/modest-main.c +++ b/src/modest-main.c @@ -283,7 +283,7 @@ send_mail (const gchar* account_name, from_string = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(), account_name); - mail_operation = modest_mail_operation_new (); + mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_SEND); modest_mail_operation_send_new_mail (mail_operation, account, from_string, mailto, cc, bcc, subject, body, NULL, diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 66ac0b7..834beeb 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -168,7 +168,7 @@ modest_ui_actions_on_delete (GtkAction *action, ModestWindow *win) /* TODO: thick grain mail operation involving a list of objects. Composite pattern ??? */ /* TODO: add confirmation dialog */ - mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_DELETE); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -656,7 +656,7 @@ action_receive (const gchar* account_name) /* Create the mail operation */ /* TODO: The spec wants us to first do any pending deletions, before receiving. */ - mail_op = modest_mail_operation_new (); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); modest_mail_operation_update_account (mail_op, TNY_STORE_ACCOUNT(tny_account)); @@ -1105,7 +1105,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) from = modest_account_mgr_get_from_string (account_mgr, account_name); /* Create the mail operation */ - mail_operation = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_SEND); + mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_SEND); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation); modest_mail_operation_send_new_mail (mail_operation, @@ -1326,7 +1326,7 @@ modest_ui_actions_on_new_folder (GtkAction *action, ModestMainWindow *main_windo if (result == GTK_RESPONSE_REJECT) { finished = TRUE; } else { - ModestMailOperation *mail_op = modest_mail_operation_new (); + ModestMailOperation *mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO); TnyFolder *new_folder = NULL; modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), @@ -1380,7 +1380,7 @@ modest_ui_actions_on_rename_folder (GtkAction *action, if (folder_name != NULL && strlen (folder_name) > 0) { ModestMailOperation *mail_op; - mail_op = modest_mail_operation_new (); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -1420,7 +1420,7 @@ delete_folder (ModestMainWindow *main_window, gboolean move_to_trash) g_free (message); if (response == GTK_RESPONSE_OK) { - ModestMailOperation *mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_DELETE); + ModestMailOperation *mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -2036,7 +2036,7 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, src_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view)); if (TNY_IS_FOLDER (src_folder)) { - mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_RECEIVE); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -2066,7 +2066,7 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, /* Transfer messages */ if (response == GTK_RESPONSE_OK) { - mail_op = modest_mail_operation_new (); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -2133,7 +2133,7 @@ modest_ui_actions_on_msg_view_window_move_to (GtkAction *action, ModestMailOperation *mail_op; /* Create mail op */ - mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_RECEIVE); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index 4eaf923..9645c6d 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -991,7 +991,7 @@ drag_and_drop_from_header_view (GtkTreeModel *source_model, &folder, -1); /* Transfer message */ - mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_RECEIVE); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -1051,7 +1051,7 @@ drag_and_drop_from_folder_view (GtkTreeModel *source_model, &folder, -1); /* Do the mail operation */ - mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_RECEIVE); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); g_signal_connect (G_OBJECT (mail_op), "progress-changed", diff --git a/src/widgets/modest-header-view.c b/src/widgets/modest-header-view.c index 0b0bdcf..8d5f2a4 100644 --- a/src/widgets/modest-header-view.c +++ b/src/widgets/modest-header-view.c @@ -925,7 +925,7 @@ modest_header_view_set_folder (ModestHeaderView *self, TnyFolder *folder) g_signal_emit (G_OBJECT(self), signals[HEADER_SELECTED_SIGNAL], 0, NULL); /* Create the mail operation */ - mail_op = modest_mail_operation_new_with_id (MODEST_MAIL_OPERATION_ID_RECEIVE); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); -- 1.7.9.5