diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-05 19:57:30 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-05 19:57:30 +0800 |
commit | 4ec46cc05fcb94d181fb9c2412984a1446647c85 (patch) | |
tree | d16ce30e77dd539c03509237dd4c723d46aea97a /mail/em-composer-utils.c | |
parent | 5ea7e23aef0c239af2600c95419ba0bda0f08b3c (diff) | |
parent | 19163c2b71e6128fc9b32287b99b1f4422324c2d (diff) | |
download | gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.gz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.bz2 gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.lz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.xz gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.zst gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.zip |
Merge from master
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r-- | mail/em-composer-utils.c | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index e42559ab3b..837cc31f62 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -85,6 +85,7 @@ struct _AsyncContext { gchar *folder_uri; gchar *message_uid; gboolean replace; + GtkWidget *destroy_when_done; }; struct _ForwardData { @@ -112,6 +113,9 @@ async_context_free (AsyncContext *context) if (context->ptr_array != NULL) g_ptr_array_unref (context->ptr_array); + if (context->destroy_when_done != NULL) + gtk_widget_destroy (context->destroy_when_done); + g_free (context->folder_uri); g_free (context->message_uid); @@ -1680,6 +1684,7 @@ forward_got_messages_cb (CamelFolder *folder, if (e_activity_handle_cancellation (context->activity, error)) { g_warn_if_fail (hash_table == NULL); + context->destroy_when_done = NULL; async_context_free (context); g_error_free (error); return; @@ -1690,6 +1695,7 @@ forward_got_messages_cb (CamelFolder *folder, alert_sink, "mail:get-multiple-messages", error->message, NULL); + context->destroy_when_done = NULL; async_context_free (context); g_error_free (error); return; @@ -1721,6 +1727,7 @@ forward_got_messages_cb (CamelFolder *folder, * @folder: folder containing messages to forward * @uids: uids of messages to forward * @style: the forward style to use + * @destroy_when_done: a #GtkWidget to destroy with gtk_widget_destroy() when done; can be NULL * * Forwards a group of messages in the given style. * @@ -1742,7 +1749,8 @@ void em_utils_forward_messages (EMailReader *reader, CamelFolder *folder, GPtrArray *uids, - EMailForwardStyle style) + EMailForwardStyle style, + GtkWidget *destroy_when_done) { EActivity *activity; AsyncContext *context; @@ -1760,6 +1768,7 @@ em_utils_forward_messages (EMailReader *reader, context->reader = g_object_ref (reader); context->ptr_array = g_ptr_array_ref (uids); context->style = style; + context->destroy_when_done = destroy_when_done; switch (style) { case E_MAIL_FORWARD_STYLE_ATTACHED: @@ -1837,7 +1846,7 @@ em_utils_redirect_message (EShell *shell, /* Message disposition notifications, rfc 2298 */ void -em_utils_handle_receipt (EMailSession *session, +em_utils_handle_receipt (EMailBackend *backend, CamelFolder *folder, const gchar *message_uid, CamelMimeMessage *message) @@ -1846,7 +1855,7 @@ em_utils_handle_receipt (EMailSession *session, const gchar *addr; CamelMessageInfo *info; - g_return_if_fail (E_IS_MAIL_SESSION (session)); + g_return_if_fail (E_IS_MAIL_BACKEND (backend)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); @@ -1902,23 +1911,23 @@ em_utils_handle_receipt (EMailSession *session, return; } - em_utils_send_receipt (session, folder, message); + em_utils_send_receipt (backend, folder, message); } static void em_utils_receipt_done (CamelFolder *folder, GAsyncResult *result, - EMailSession *session) + EMailBackend *backend) { /* FIXME Poor error handling. */ if (!e_mail_folder_append_message_finish (folder, result, NULL, NULL)) return; - mail_send (session); + mail_send (backend); } void -em_utils_send_receipt (EMailSession *session, +em_utils_send_receipt (EMailBackend *backend, CamelFolder *folder, CamelMimeMessage *message) { @@ -2093,7 +2102,7 @@ em_utils_send_receipt (EMailSession *session, /* FIXME Pass a GCancellable. */ e_mail_folder_append_message ( out_folder, receipt, info, G_PRIORITY_DEFAULT, NULL, - (GAsyncReadyCallback) em_utils_receipt_done, session); + (GAsyncReadyCallback) em_utils_receipt_done, backend); camel_message_info_free (info); } @@ -2476,18 +2485,24 @@ concat_unique_addrs (CamelInternetAddress *dest, } } -static void -get_reply_all (CamelMimeMessage *message, - CamelInternetAddress *to, - CamelInternetAddress *cc, - CamelNNTPAddress *postto) +void +em_utils_get_reply_all (CamelMimeMessage *message, + CamelInternetAddress *to, + CamelInternetAddress *cc, + CamelNNTPAddress *postto) { - CamelInternetAddress *reply_to, *to_addrs, *cc_addrs; + CamelInternetAddress *reply_to; + CamelInternetAddress *to_addrs; + CamelInternetAddress *cc_addrs; CamelMedium *medium; const gchar *name, *addr; const gchar *posthdr = NULL; GHashTable *rcpt_hash; + g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); + g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (to)); + g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (cc)); + medium = CAMEL_MEDIUM (message); /* check whether there is a 'Newsgroups: ' header in there */ @@ -2503,8 +2518,10 @@ get_reply_all (CamelMimeMessage *message, rcpt_hash = em_utils_generate_account_hash (); reply_to = get_reply_to (message); - to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + to_addrs = camel_mime_message_get_recipients ( + message, CAMEL_RECIPIENT_TYPE_TO); + cc_addrs = camel_mime_message_get_recipients ( + message, CAMEL_RECIPIENT_TYPE_CC); if (reply_to != NULL) { gint ii = 0; @@ -2547,15 +2564,6 @@ get_reply_all (CamelMimeMessage *message, g_hash_table_destroy (rcpt_hash); } -void -em_utils_get_reply_all (CamelMimeMessage *message, - CamelInternetAddress *to, - CamelInternetAddress *cc, - CamelNNTPAddress *postto) -{ - get_reply_all (message, to, cc, postto); -} - enum { ATTRIB_UNKNOWN, ATTRIB_CUSTOM, @@ -2938,7 +2946,7 @@ em_utils_reply_to_message (EShell *shell, if (folder) postto = camel_nntp_address_new (); - get_reply_all (message, to, cc, postto); + em_utils_get_reply_all (message, to, cc, postto); break; } @@ -2989,7 +2997,7 @@ post_header_clicked_cb (EComposerPostHeader *header, shell_backend = e_shell_get_backend_by_name (shell, "mail"); /* FIXME Limit the folder tree to the NNTP account? */ - model = em_folder_tree_model_get_default (E_MAIL_BACKEND (shell_backend)); + model = em_folder_tree_model_get_default (); dialog = em_folder_selector_new ( GTK_WINDOW (composer), |