diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-02 21:23:58 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-03 04:14:27 +0800 |
commit | 2d2d30c05b8f54de94a89be3db54df024a11fc7e (patch) | |
tree | 69984694b034b451c178105bd4892aaac0d81d84 /modules | |
parent | 63549b9416ae30194dc1c5fb26803adc054b6397 (diff) | |
download | gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.tar gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.tar.gz gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.tar.bz2 gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.tar.lz gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.tar.xz gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.tar.zst gsoc2013-evolution-2d2d30c05b8f54de94a89be3db54df024a11fc7e.zip |
Simplify em_utils_forward_message() arguments.
Replace the EShell and CamelSession arguments with a single EMailBackend
argument, from which both the EShell and CamelSession can be obtained.
(cherry picked from commit 540acdbfa95d29a66ad94bad68222b5ae9c98720)
Conflicts:
mail/em-composer-utils.h
modules/mail/e-mail-attachment-handler.c
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mail/e-mail-attachment-handler.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index e47d11678b..db94ce7f03 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -35,8 +35,7 @@ ((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerPrivate)) struct _EMailAttachmentHandlerPrivate { - EShell *shell; - EMailSession *session; + EMailBackend *backend; }; static gpointer parent_class; @@ -143,6 +142,8 @@ mail_attachment_handler_forward (GtkAction *action, EShellSettings *shell_settings; EMailForwardStyle style; CamelMimeMessage *message; + EShellBackend *shell_backend; + EShell *shell; const gchar *property_name; priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); @@ -150,13 +151,14 @@ mail_attachment_handler_forward (GtkAction *action, message = mail_attachment_handler_get_selected_message (handler); g_return_if_fail (message != NULL); + shell_backend = E_SHELL_BACKEND (priv->backend); + shell = e_shell_backend_get_shell (shell_backend); + property_name = "mail-forward-style"; - shell_settings = e_shell_get_shell_settings (priv->shell); + shell_settings = e_shell_get_shell_settings (shell); style = e_shell_settings_get_int (shell_settings, property_name); - em_utils_forward_message ( - priv->shell, CAMEL_SESSION (priv->session), - message, style, NULL, NULL); + em_utils_forward_message (priv->backend, message, style, NULL, NULL); g_object_unref (message); } @@ -169,6 +171,8 @@ mail_attachment_handler_reply (EAttachmentHandler *handler, EShellSettings *shell_settings; EMailReplyStyle style; CamelMimeMessage *message; + EShellBackend *shell_backend; + EShell *shell; const gchar *property_name; priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler); @@ -176,13 +180,15 @@ mail_attachment_handler_reply (EAttachmentHandler *handler, message = mail_attachment_handler_get_selected_message (handler); g_return_if_fail (message != NULL); + shell_backend = E_SHELL_BACKEND (priv->backend); + shell = e_shell_backend_get_shell (shell_backend); + property_name = "mail-reply-style"; - shell_settings = e_shell_get_shell_settings (priv->shell); + shell_settings = e_shell_get_shell_settings (shell); style = e_shell_settings_get_int (shell_settings, property_name); em_utils_reply_to_message ( - priv->shell, message, - NULL, NULL, reply_type, style, NULL, NULL); + shell, message, NULL, NULL, reply_type, style, NULL, NULL); g_object_unref (message); } @@ -308,6 +314,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, CamelFolder *folder = NULL; EAttachment *attachment; EAttachmentStore *store; + EMailSession *session; GPtrArray *uids; const gchar *data; const gchar *cp, *end; @@ -356,10 +363,12 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, if (uids->len == 0) goto exit; + session = e_mail_backend_get_session (priv->backend); + /* The first string is the folder URI. */ /* FIXME Not passing a GCancellable here. */ folder = e_mail_session_uri_to_folder_sync ( - priv->session, data, 0, NULL, &local_error); + session, data, 0, NULL, &local_error); if (folder == NULL) goto exit; @@ -509,15 +518,7 @@ mail_attachment_handler_dispose (GObject *object) priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (object); - if (priv->shell != NULL) { - g_object_unref (priv->shell); - priv->shell = NULL; - } - - if (priv->session != NULL) { - g_object_unref (priv->session); - priv->session = NULL; - } + g_clear_object (&priv->backend); /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); @@ -531,7 +532,6 @@ mail_attachment_handler_constructed (GObject *object) EShellBackend *shell_backend; EAttachmentHandler *handler; EAttachmentView *view; - EMailSession *session; GtkActionGroup *action_group; GtkUIManager *ui_manager; GError *error = NULL; @@ -544,10 +544,7 @@ mail_attachment_handler_constructed (GObject *object) shell = e_shell_get_default (); shell_backend = e_shell_get_backend_by_name (shell, "mail"); - session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); - - priv->shell = g_object_ref (shell); - priv->session = g_object_ref (session); + priv->backend = g_object_ref (shell_backend); view = e_attachment_handler_get_view (handler); |