aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-20 01:32:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-20 01:41:14 +0800
commitd305e8ff1052c9ec109a0d220c05c669e2180662 (patch)
treee4bfa16c9165be5159b0a07f5d0e006f20f30019 /modules/mail
parent689bb1148d8494b71036f9dcce8a9f79b53cbfe6 (diff)
downloadgsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.tar
gsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.tar.gz
gsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.tar.bz2
gsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.tar.lz
gsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.tar.xz
gsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.tar.zst
gsoc2013-evolution-d305e8ff1052c9ec109a0d220c05c669e2180662.zip
Reduce GConf usage in em-composer-utils.c.
To reduce GConf usage in em-composer-utils.c: - Relevant functions in em-composer-utils.c now take arguments for reply and forward styles. - Redundant forwarding functions were removed: em_utils_forward_attached() em_utils_forward_inline() em_utils_forward_quoted() - EMailReader now has "forward-style" and "reply-style" properties, which get bound to the appropriate EShellSettings properties in modules/mail/e-mail-config-reader.c. These same EShellSettings properties are bound to the combo boxes in Composer Preferences.
Diffstat (limited to 'modules/mail')
-rw-r--r--modules/mail/Makefile.am2
-rw-r--r--modules/mail/e-mail-attachment-handler.c27
-rw-r--r--modules/mail/e-mail-config-reader.c80
-rw-r--r--modules/mail/e-mail-config-reader.h30
-rw-r--r--modules/mail/e-mail-shell-backend.c34
-rw-r--r--modules/mail/e-mail-shell-content.c48
-rw-r--r--modules/mail/e-mail-shell-settings.c4
-rw-r--r--modules/mail/evolution-module-mail.c2
8 files changed, 205 insertions, 22 deletions
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index 323820217b..884d050d78 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -21,6 +21,8 @@ libevolution_module_mail_la_SOURCES = \
e-mail-config-format-html.h \
e-mail-config-hook.c \
e-mail-config-hook.h \
+ e-mail-config-reader.c \
+ e-mail-config-reader.h \
e-mail-config-web-view.c \
e-mail-config-web-view.h \
e-mail-event-hook.c \
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index 2b74b2a1ed..b868c3069d 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -61,10 +61,13 @@ mail_attachment_handler_forward (GtkAction *action,
EAttachmentHandler *handler)
{
EMailAttachmentHandlerPrivate *priv;
+ EShellSettings *shell_settings;
EAttachment *attachment;
EAttachmentView *view;
CamelMimePart *mime_part;
CamelDataWrapper *wrapper;
+ EMailForwardStyle style;
+ const gchar *property_name;
GList *selected;
view = e_attachment_handler_get_view (handler);
@@ -77,8 +80,12 @@ mail_attachment_handler_forward (GtkAction *action,
mime_part = e_attachment_get_mime_part (attachment);
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
+ property_name = "mail-forward-style";
+ shell_settings = e_shell_get_shell_settings (priv->shell);
+ style = e_shell_settings_get_int (shell_settings, property_name);
+
em_utils_forward_message (
- priv->shell, CAMEL_MIME_MESSAGE (wrapper), NULL);
+ priv->shell, CAMEL_MIME_MESSAGE (wrapper), NULL, style);
g_list_foreach (selected, (GFunc) g_object_unref, NULL);
g_list_free (selected);
@@ -89,10 +96,13 @@ mail_attachment_handler_reply_all (GtkAction *action,
EAttachmentHandler *handler)
{
EMailAttachmentHandlerPrivate *priv;
+ EShellSettings *shell_settings;
EAttachment *attachment;
EAttachmentView *view;
CamelMimePart *mime_part;
CamelDataWrapper *wrapper;
+ EMailReplyStyle style;
+ const gchar *property_name;
GList *selected;
view = e_attachment_handler_get_view (handler);
@@ -105,9 +115,13 @@ mail_attachment_handler_reply_all (GtkAction *action,
mime_part = e_attachment_get_mime_part (attachment);
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
+ property_name = "mail-reply-style";
+ shell_settings = e_shell_get_shell_settings (priv->shell);
+ style = e_shell_settings_get_int (shell_settings, property_name);
+
em_utils_reply_to_message (
priv->shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
- REPLY_MODE_ALL, NULL);
+ E_MAIL_REPLY_TO_ALL, style, NULL);
g_list_foreach (selected, (GFunc) g_object_unref, NULL);
g_list_free (selected);
@@ -118,10 +132,13 @@ mail_attachment_handler_reply_sender (GtkAction *action,
EAttachmentHandler *handler)
{
EMailAttachmentHandlerPrivate *priv;
+ EShellSettings *shell_settings;
EAttachment *attachment;
EAttachmentView *view;
CamelMimePart *mime_part;
CamelDataWrapper *wrapper;
+ EMailForwardStyle style;
+ const gchar *property_name;
GList *selected;
view = e_attachment_handler_get_view (handler);
@@ -134,9 +151,13 @@ mail_attachment_handler_reply_sender (GtkAction *action,
mime_part = e_attachment_get_mime_part (attachment);
wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
+ property_name = "mail-reply-style";
+ shell_settings = e_shell_get_shell_settings (priv->shell);
+ style = e_shell_settings_get_int (shell_settings, property_name);
+
em_utils_reply_to_message (
priv->shell, NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
- REPLY_MODE_SENDER, NULL);
+ E_MAIL_REPLY_TO_SENDER, style, NULL);
g_list_foreach (selected, (GFunc) g_object_unref, NULL);
g_list_free (selected);
diff --git a/modules/mail/e-mail-config-reader.c b/modules/mail/e-mail-config-reader.c
new file mode 100644
index 0000000000..f1e43228d2
--- /dev/null
+++ b/modules/mail/e-mail-config-reader.c
@@ -0,0 +1,80 @@
+/*
+ * e-mail-config-reader.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-mail-config-reader.h"
+
+#include <shell/e-shell.h>
+#include <e-util/e-extension.h>
+#include <mail/e-mail-reader.h>
+
+static void
+mail_config_reader_constructed (GObject *object)
+{
+ EExtension *extension;
+ EExtensible *extensible;
+ EShellSettings *shell_settings;
+ EShell *shell;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ g_object_bind_property (
+ shell_settings, "mail-forward-style",
+ extensible, "forward-style",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ shell_settings, "mail-reply-style",
+ extensible, "reply-style",
+ G_BINDING_SYNC_CREATE);
+}
+
+static void
+mail_config_reader_class_init (EExtensionClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mail_config_reader_constructed;
+
+ class->extensible_type = E_TYPE_MAIL_READER;
+}
+
+void
+e_mail_config_reader_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EExtensionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_config_reader_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EExtension),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ NULL /* value_table */
+ };
+
+ g_type_module_register_type (
+ type_module, E_TYPE_EXTENSION,
+ "EMailConfigReader", &type_info, 0);
+}
diff --git a/modules/mail/e-mail-config-reader.h b/modules/mail/e-mail-config-reader.h
new file mode 100644
index 0000000000..6dd856c97c
--- /dev/null
+++ b/modules/mail/e-mail-config-reader.h
@@ -0,0 +1,30 @@
+/*
+ * e-mail-config-reader.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_MAIL_CONFIG_READER_H
+#define E_MAIL_CONFIG_READER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_config_reader_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_READER_H */
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 73386911ec..09db9ce0e8 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -236,6 +236,7 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
gpointer user_data)
{
EShellBackend *shell_backend = user_data;
+ EShellSettings *shell_settings;
EMailBackend *backend;
CamelURL *url = user_data;
EShell *shell;
@@ -245,6 +246,7 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
backend = E_MAIL_BACKEND (shell_backend);
shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
if (folder == NULL) {
g_warning ("Could not open folder '%s'", folder_uri);
@@ -256,36 +258,42 @@ mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
uid = camel_url_get_param (url, "uid");
if (reply != NULL) {
- gint mode;
+ EMailReplyType reply_type;
+ EMailReplyStyle reply_style;
if (g_strcmp0 (reply, "all") == 0)
- mode = REPLY_MODE_ALL;
+ reply_type = E_MAIL_REPLY_TO_ALL;
else if (g_strcmp0 (reply, "list") == 0)
- mode = REPLY_MODE_LIST;
+ reply_type = E_MAIL_REPLY_TO_LIST;
else
- mode = REPLY_MODE_SENDER;
+ reply_type = E_MAIL_REPLY_TO_SENDER;
+
+ reply_style = e_shell_settings_get_int (
+ shell_settings, "mail-reply-style");
em_utils_reply_to_message (
- shell, folder, uid, NULL, mode, NULL);
+ shell, folder, uid, NULL,
+ reply_type, reply_style, NULL);
} else if (forward != NULL) {
+ EMailForwardStyle forward_style;
GPtrArray *uids;
uids = g_ptr_array_new ();
g_ptr_array_add (uids, g_strdup (uid));
if (g_strcmp0 (forward, "attached") == 0)
- em_utils_forward_attached (
- shell, folder, uids, folder_uri);
+ forward_style = E_MAIL_FORWARD_STYLE_ATTACHED;
else if (g_strcmp0 (forward, "inline") == 0)
- em_utils_forward_inline (
- shell, folder, uids, folder_uri);
+ forward_style = E_MAIL_FORWARD_STYLE_INLINE;
else if (g_strcmp0 (forward, "quoted") == 0)
- em_utils_forward_quoted (
- shell, folder, uids, folder_uri);
+ forward_style = E_MAIL_FORWARD_STYLE_QUOTED;
else
- em_utils_forward_messages (
- shell, folder, uids, folder_uri);
+ forward_style = e_shell_settings_get_int (
+ shell_settings, "mail-forward-style");
+
+ em_utils_forward_messages (
+ shell, folder, uids, folder_uri, forward_style);
} else {
GtkWidget *browser;
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index b28b02eee0..2872da53bd 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -53,21 +53,25 @@ struct _EMailShellContentPrivate {
enum {
PROP_0,
+ PROP_FORWARD_STYLE,
PROP_GROUP_BY_THREADS,
- PROP_MAIL_VIEW
+ PROP_MAIL_VIEW,
+ PROP_REPLY_STYLE
};
static gpointer parent_class;
static GType mail_shell_content_type;
static void
-reconnect_changed_event (EMailReader *child, EMailReader *parent)
+reconnect_changed_event (EMailReader *child,
+ EMailReader *parent)
{
g_signal_emit_by_name (parent, "changed");
}
static void
-reconnect_folder_loaded_event (EMailReader *child, EMailReader *parent)
+reconnect_folder_loaded_event (EMailReader *child,
+ EMailReader *parent)
{
g_signal_emit_by_name (parent, "folder-loaded");
}
@@ -88,11 +92,23 @@ mail_shell_content_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_FORWARD_STYLE:
+ e_mail_reader_set_forward_style (
+ E_MAIL_READER (object),
+ g_value_get_enum (value));
+ return;
+
case PROP_GROUP_BY_THREADS:
e_mail_reader_set_group_by_threads (
E_MAIL_READER (object),
g_value_get_boolean (value));
return;
+
+ case PROP_REPLY_STYLE:
+ e_mail_reader_set_reply_style (
+ E_MAIL_READER (object),
+ g_value_get_enum (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -105,6 +121,12 @@ mail_shell_content_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_FORWARD_STYLE:
+ g_value_set_enum (
+ value, e_mail_reader_get_forward_style (
+ E_MAIL_READER (object)));
+ return;
+
case PROP_GROUP_BY_THREADS:
g_value_set_boolean (
value, e_mail_reader_get_group_by_threads (
@@ -116,6 +138,12 @@ mail_shell_content_get_property (GObject *object,
value, e_mail_shell_content_get_mail_view (
E_MAIL_SHELL_CONTENT (object)));
return;
+
+ case PROP_REPLY_STYLE:
+ g_value_set_enum (
+ value, e_mail_reader_get_reply_style (
+ E_MAIL_READER (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -181,7 +209,6 @@ mail_shell_content_constructed (GObject *object)
g_signal_connect (
widget, "folder-loaded",
G_CALLBACK (reconnect_folder_loaded_event), object);
-
}
static guint32
@@ -375,6 +402,13 @@ mail_shell_content_class_init (EMailShellContentClass *class)
shell_content_class->check_state = mail_shell_content_check_state;
shell_content_class->focus_search_results = mail_shell_content_focus_search_results;
+ /* Inherited from EMailReader */
+ g_object_class_override_property (
+ object_class,
+ PROP_FORWARD_STYLE,
+ "forward-style");
+
+ /* Inherited from EMailReader */
g_object_class_override_property (
object_class,
PROP_GROUP_BY_THREADS,
@@ -389,6 +423,12 @@ mail_shell_content_class_init (EMailShellContentClass *class)
NULL,
E_TYPE_MAIL_VIEW,
G_PARAM_READABLE));
+
+ /* Inherited from EMailReader */
+ g_object_class_override_property (
+ object_class,
+ PROP_REPLY_STYLE,
+ "reply-style");
}
static void
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 503edaf121..3e55a98aa8 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -144,7 +144,7 @@ e_mail_shell_settings_init (EShellBackend *shell_backend)
"mail-force-message-limit",
"/apps/evolution/mail/display/force_message_limit");
- /* This value corresponds to MailConfigForwardStyle enum. */
+ /* This value corresponds to the EMailForwardStyle enum. */
e_shell_settings_install_property_for_key (
"mail-forward-style",
"/apps/evolution/mail/format/forward_style");
@@ -195,7 +195,7 @@ e_mail_shell_settings_init (EShellBackend *shell_backend)
"mail-prompt-delete-in-vfolder",
"/apps/evolution/mail/prompts/delete_in_vfolder");
- /* This value corresponds to MailConfigReplyStyle enum,
+ /* This value corresponds to the EMailReplyStyle enum,
* but the ordering of the combo box items in preferences
* has changed. We use transformation functions there. */
e_shell_settings_install_property_for_key (
diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c
index 9e9744569b..b7e2a77be7 100644
--- a/modules/mail/evolution-module-mail.c
+++ b/modules/mail/evolution-module-mail.c
@@ -31,6 +31,7 @@
#include "e-mail-shell-view.h"
#include "e-mail-config-format-html.h"
+#include "e-mail-config-reader.h"
#include "e-mail-config-web-view.h"
/* Module Entry Points */
@@ -55,6 +56,7 @@ e_module_load (GTypeModule *type_module)
e_mail_shell_view_register_type (type_module);
e_mail_config_format_html_register_type (type_module);
+ e_mail_config_reader_register_type (type_module);
e_mail_config_web_view_register_type (type_module);
}