diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-14 08:49:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-14 08:56:33 +0800 |
commit | 6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f (patch) | |
tree | 8ac6832a905017845b3095112b83bb14da112617 /modules | |
parent | caed9460b2d518005abe34035d5b414ff07c0212 (diff) | |
download | gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.tar gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.tar.gz gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.tar.bz2 gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.tar.lz gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.tar.xz gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.tar.zst gsoc2013-evolution-6cb0cbd0be5791aa0af1f78ce44c7a6563611d8f.zip |
Pass an EShell to EMsgComposer instances.
Reduce the composer's dependency on e_shell_get_default().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/addressbook/e-book-shell-content.c | 11 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view-actions.c | 20 | ||||
-rw-r--r-- | modules/addressbook/eab-composer-util.c | 14 | ||||
-rw-r--r-- | modules/addressbook/eab-composer-util.h | 8 | ||||
-rw-r--r-- | modules/mail/e-mail-attachment-handler.c | 18 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 26 |
6 files changed, 77 insertions, 20 deletions
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c index bc374079a3..13b9b4bd49 100644 --- a/modules/addressbook/e-book-shell-content.c +++ b/modules/addressbook/e-book-shell-content.c @@ -61,9 +61,18 @@ book_shell_content_send_message_cb (EBookShellContent *book_shell_content, EDestination *destination, EABContactDisplay *display) { + EShell *shell; + EShellContent *shell_content; + EShellWindow *shell_window; + EShellView *shell_view; GList node = { destination, NULL, NULL }; - eab_send_as_to (&node); + shell_content = E_SHELL_CONTENT (book_shell_content); + shell_view = e_shell_content_get_shell_view (shell_content); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + + eab_send_as_to (shell, &node); } static void diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index 6bb9d7036b..9008002c33 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -358,10 +358,17 @@ static void action_contact_forward_cb (GtkAction *action, EBookShellView *book_shell_view) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; EBookShellContent *book_shell_content; EAddressbookView *view; GList *list, *iter; + shell_view = E_SHELL_VIEW (book_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + book_shell_content = book_shell_view->priv->book_shell_content; view = e_book_shell_content_get_current_view (book_shell_content); g_return_if_fail (view != NULL); @@ -381,7 +388,8 @@ action_contact_forward_cb (GtkAction *action, iter->data = destination; } - eab_send_as_attachment (list); + eab_send_as_attachment (shell, list); + g_list_foreach (list, (GFunc) g_object_unref, NULL); g_list_free (list); } @@ -581,10 +589,17 @@ static void action_contact_send_message_cb (GtkAction *action, EBookShellView *book_shell_view) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; EBookShellContent *book_shell_content; EAddressbookView *view; GList *list, *iter; + shell_view = E_SHELL_VIEW (book_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + book_shell_content = book_shell_view->priv->book_shell_content; view = e_book_shell_content_get_current_view (book_shell_content); g_return_if_fail (view != NULL); @@ -604,7 +619,8 @@ action_contact_send_message_cb (GtkAction *action, iter->data = destination; } - eab_send_as_to (list); + eab_send_as_to (shell, list); + g_list_foreach (list, (GFunc) g_object_unref, NULL); g_list_free (list); } diff --git a/modules/addressbook/eab-composer-util.c b/modules/addressbook/eab-composer-util.c index 968a6b3c06..542e423d4d 100644 --- a/modules/addressbook/eab-composer-util.c +++ b/modules/addressbook/eab-composer-util.c @@ -28,7 +28,8 @@ #include "addressbook/gui/widgets/eab-gui-util.h" void -eab_send_as_to (GList *destinations) +eab_send_as_to (EShell *shell, + GList *destinations) { EMsgComposer *composer; EComposerHeaderTable *table; @@ -40,10 +41,12 @@ eab_send_as_to (GList *destinations) EDestination **destinations; } convert; + g_return_if_fail (E_IS_SHELL (shell)); + if (destinations == NULL) return; - composer = e_msg_composer_new (); + composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); to_array = g_ptr_array_new (); @@ -107,7 +110,8 @@ get_email (EContact *contact, EContactField field_id, gchar **to_free) } void -eab_send_as_attachment (GList *destinations) +eab_send_as_attachment (EShell *shell, + GList *destinations) { EMsgComposer *composer; EComposerHeaderTable *table; @@ -115,10 +119,12 @@ eab_send_as_attachment (GList *destinations) GList *contacts, *iter; gchar *data; + g_return_if_fail (E_IS_SHELL (shell)); + if (destinations == NULL) return; - composer = e_msg_composer_new (); + composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); attachment = camel_mime_part_new (); diff --git a/modules/addressbook/eab-composer-util.h b/modules/addressbook/eab-composer-util.h index 4aec23074d..a2feb2f999 100644 --- a/modules/addressbook/eab-composer-util.h +++ b/modules/addressbook/eab-composer-util.h @@ -19,12 +19,14 @@ #ifndef EAB_COMPOSER_UTIL_H #define EAB_COMPOSER_UTIL_H -#include <gtk/gtk.h> +#include <shell/e-shell.h> G_BEGIN_DECLS -void eab_send_as_to (GList *destinations); -void eab_send_as_attachment (GList *destinations); +void eab_send_as_to (EShell *shell, + GList *destinations); +void eab_send_as_attachment (EShell *shell, + GList *destinations); G_END_DECLS diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index 3240c560de..313dddeac4 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -59,11 +59,15 @@ static void mail_attachment_handler_forward (GtkAction *action, EAttachmentView *view) { + EShell *shell; EAttachment *attachment; CamelMimePart *mime_part; CamelDataWrapper *wrapper; GList *selected; + /* FIXME Pass this in somehow. */ + shell = e_shell_get_default (); + selected = e_attachment_view_get_selected_attachments (view); g_return_if_fail (g_list_length (selected) == 1); @@ -71,7 +75,7 @@ mail_attachment_handler_forward (GtkAction *action, mime_part = e_attachment_get_mime_part (attachment); wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); - em_utils_forward_message (CAMEL_MIME_MESSAGE (wrapper), NULL); + em_utils_forward_message (shell, CAMEL_MIME_MESSAGE (wrapper), NULL); g_list_foreach (selected, (GFunc) g_object_unref, NULL); g_list_free (selected); @@ -81,11 +85,15 @@ static void mail_attachment_handler_reply_all (GtkAction *action, EAttachmentView *view) { + EShell *shell; EAttachment *attachment; CamelMimePart *mime_part; CamelDataWrapper *wrapper; GList *selected; + /* FIXME Pass this in somehow. */ + shell = e_shell_get_default (); + selected = e_attachment_view_get_selected_attachments (view); g_return_if_fail (g_list_length (selected) == 1); @@ -94,7 +102,7 @@ mail_attachment_handler_reply_all (GtkAction *action, wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); em_utils_reply_to_message ( - NULL, NULL, CAMEL_MIME_MESSAGE (wrapper), + shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper), REPLY_MODE_ALL, NULL); g_list_foreach (selected, (GFunc) g_object_unref, NULL); @@ -105,11 +113,15 @@ static void mail_attachment_handler_reply_sender (GtkAction *action, EAttachmentView *view) { + EShell *shell; EAttachment *attachment; CamelMimePart *mime_part; CamelDataWrapper *wrapper; GList *selected; + /* FIXME Pass this in somehow. */ + shell = e_shell_get_default (); + selected = e_attachment_view_get_selected_attachments (view); g_return_if_fail (g_list_length (selected) == 1); @@ -118,7 +130,7 @@ mail_attachment_handler_reply_sender (GtkAction *action, wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); em_utils_reply_to_message ( - NULL, NULL, CAMEL_MIME_MESSAGE (wrapper), + shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper), REPLY_MODE_SENDER, NULL); g_list_foreach (selected, (GFunc) g_object_unref, NULL); diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 09f5068e82..d740094a15 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -136,10 +136,13 @@ action_mail_message_new_cb (GtkAction *action, EMailShellSidebar *mail_shell_sidebar; EShellSidebar *shell_sidebar; EShellView *shell_view; + EShell *shell; EMFolderTree *folder_tree; const gchar *view_name; gchar *uri = NULL; + shell = e_shell_window_get_shell (shell_window); + if (!em_utils_check_user_can_send_mail ()) return; @@ -156,7 +159,7 @@ action_mail_message_new_cb (GtkAction *action, uri = em_folder_tree_get_selected_uri (folder_tree); exit: - em_utils_compose_new_message (uri); + em_utils_compose_new_message (shell, uri); g_free (uri); } @@ -235,10 +238,13 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri, { EShellBackend *shell_backend = user_data; CamelURL *url = user_data; + EShell *shell; const gchar *forward; const gchar *reply; const gchar *uid; + shell = e_shell_backend_get_shell (shell_backend); + if (folder == NULL) { g_warning ("Could not open folder '%s'", folder_uri); goto exit; @@ -258,7 +264,8 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri, else mode = REPLY_MODE_SENDER; - em_utils_reply_to_message (folder, uid, NULL, mode, NULL); + em_utils_reply_to_message ( + shell, folder, uid, NULL, mode, NULL); } else if (forward != NULL) { GPtrArray *uids; @@ -267,13 +274,17 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri, g_ptr_array_add (uids, g_strdup (uid)); if (g_strcmp0 (forward, "attached") == 0) - em_utils_forward_attached (folder, uids, folder_uri); + em_utils_forward_attached ( + shell, folder, uids, folder_uri); else if (g_strcmp0 (forward, "inline") == 0) - em_utils_forward_inline (folder, uids, folder_uri); + em_utils_forward_inline ( + shell, folder, uids, folder_uri); else if (g_strcmp0 (forward, "quoted") == 0) - em_utils_forward_quoted (folder, uids, folder_uri); + em_utils_forward_quoted ( + shell, folder, uids, folder_uri); else - em_utils_forward_messages (folder, uids, folder_uri); + em_utils_forward_messages ( + shell, folder, uids, folder_uri); } else { GtkWidget *browser; @@ -299,7 +310,8 @@ mail_shell_backend_handle_uri_cb (EShell *shell, if (g_str_has_prefix (uri, "mailto:")) { if (em_utils_check_user_can_send_mail ()) - em_utils_compose_new_message_with_mailto (uri, NULL); + em_utils_compose_new_message_with_mailto ( + shell, uri, NULL); } else if (g_str_has_prefix (uri, "email:")) { CamelURL *url; |