From 16e8dd55571cd168701843168e527f8535380dc8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 25 Apr 2011 15:16:52 -0400 Subject: Adapt mailing-list-actions plugin to the new ESource API. --- .../mailing-list-actions/mailing-list-actions.c | 42 +++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'plugins') diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c index 82214c0585..f33c6e2a4f 100644 --- a/plugins/mailing-list-actions/mailing-list-actions.c +++ b/plugins/mailing-list-actions/mailing-list-actions.c @@ -29,11 +29,11 @@ #include #include +#include + #include #include -#include - #include #include #include @@ -135,16 +135,24 @@ emla_list_action_cb (CamelFolder *folder, CamelMimeMessage *message; gint send_message_response; EShell *shell; + ESource *source; EMailBackend *backend; + ESourceRegistry *registry; EShellBackend *shell_backend; - EAccount *account; GtkWindow *window; CamelStore *store; const gchar *uid; GError *error = NULL; + window = e_mail_reader_get_window (context->reader); + backend = e_mail_reader_get_backend (context->reader); alert_sink = e_activity_get_alert_sink (context->activity); + shell_backend = E_SHELL_BACKEND (backend); + shell = e_shell_backend_get_shell (shell_backend); + + registry = e_shell_get_registry (shell); + message = camel_folder_get_message_finish (folder, result, &error); if (e_activity_handle_cancellation (context->activity, error)) { @@ -173,14 +181,19 @@ emla_list_action_cb (CamelFolder *folder, store = camel_folder_get_parent_store (folder); uid = camel_service_get_uid (CAMEL_SERVICE (store)); - account = e_get_account_by_uid (uid); + source = e_source_registry_ref_source (registry, uid); - backend = e_mail_reader_get_backend (context->reader); + /* Reuse this to hold the mail identity UID. */ + uid = NULL; - shell_backend = E_SHELL_BACKEND (backend); - shell = e_shell_backend_get_shell (shell_backend); + if (source != NULL) { + ESourceMailAccount *extension; + const gchar *extension_name; - window = e_mail_reader_get_window (context->reader); + extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; + extension = e_source_get_extension (source, extension_name); + uid = e_source_mail_account_get_identity_uid (extension); + } for (t = 0; t < G_N_ELEMENTS (emla_action_headers); t++) { if (emla_action_headers[t].action == context->action && @@ -229,12 +242,14 @@ emla_list_action_cb (CamelFolder *folder, url, NULL); if (send_message_response == GTK_RESPONSE_YES) { + EComposerHeaderTable *table; + /* directly send message */ composer = e_msg_composer_new_from_url (shell, url); - if (account != NULL) - e_composer_header_table_set_account ( - e_msg_composer_get_header_table (composer), - account); + table = e_msg_composer_get_header_table (composer); + + if (uid != NULL) + e_composer_header_table_set_identity_uid (table, uid); e_msg_composer_send (composer); } else if (send_message_response == GTK_RESPONSE_NO) { /* show composer */ @@ -261,6 +276,9 @@ emla_list_action_cb (CamelFolder *folder, e_alert_run_dialog_for_args (window, MESSAGE_NO_ACTION, header, NULL); exit: + if (source != NULL) + g_object_unref (source); + g_object_unref (message); g_free (url); -- cgit v1.2.3