[evolution-data-server] Bug 513779 - Select reply style per mail account



commit 55996c2f5dfcf384c46935c5efe0c3d86f589c30
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 24 15:40:29 2015 +0200

    Bug 513779 - Select reply style per mail account

 libedataserver/e-source-enums.h            |   25 +++++++++
 libedataserver/e-source-mail-composition.c |   81 +++++++++++++++++++++++++++-
 libedataserver/e-source-mail-composition.h |    7 +++
 3 files changed, 112 insertions(+), 1 deletions(-)
---
diff --git a/libedataserver/e-source-enums.h b/libedataserver/e-source-enums.h
index a13b578..5563929 100644
--- a/libedataserver/e-source-enums.h
+++ b/libedataserver/e-source-enums.h
@@ -240,4 +240,29 @@ typedef enum {
        E_SOURCE_WEATHER_UNITS_KELVIN
 } ESourceWeatherUnits;
 
+/**
+ * ESourceMailCompositionReplyStyle:
+ * @E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DEFAULT:
+ *   Use default reply style.
+ * @E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_QUOTED:
+ *   Use quoted reply style.
+ * @E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DO_NOT_QUOTE:
+ *   Do not quote anything in replies.
+ * @E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_ATTACH:
+ *   Attach original message in replies.
+ * @E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_OUTLOOK:
+ *  Use Outlook reply style.
+ *
+ * Set of preferred reply styles for an #ESourceMailComposition extension.
+ *
+ * Since: 3.20
+ **/
+typedef enum {
+       E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DEFAULT = 0,
+       E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_QUOTED,
+       E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DO_NOT_QUOTE,
+       E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_ATTACH,
+       E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_OUTLOOK
+} ESourceMailCompositionReplyStyle;
+
 #endif /* E_SOURCE_ENUMS_H */
diff --git a/libedataserver/e-source-mail-composition.c b/libedataserver/e-source-mail-composition.c
index d466a45..f47953b 100644
--- a/libedataserver/e-source-mail-composition.c
+++ b/libedataserver/e-source-mail-composition.c
@@ -34,10 +34,15 @@
  * ]|
  **/
 
-#include "e-source-mail-composition.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <libedataserver/e-data-server-util.h>
 
+#include "e-source-enumtypes.h"
+#include "e-source-mail-composition.h"
+
 #define E_SOURCE_MAIL_COMPOSITION_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_SOURCE_MAIL_COMPOSITION, ESourceMailCompositionPrivate))
@@ -48,6 +53,7 @@ struct _ESourceMailCompositionPrivate {
        gchar *drafts_folder;
        gchar *templates_folder;
        gboolean sign_imip;
+       ESourceMailCompositionReplyStyle reply_style;
 };
 
 enum {
@@ -55,6 +61,7 @@ enum {
        PROP_BCC,
        PROP_CC,
        PROP_DRAFTS_FOLDER,
+       PROP_REPLY_STYLE,
        PROP_SIGN_IMIP,
        PROP_TEMPLATES_FOLDER
 };
@@ -89,6 +96,12 @@ source_mail_composition_set_property (GObject *object,
                                g_value_get_string (value));
                        return;
 
+               case PROP_REPLY_STYLE:
+                       e_source_mail_composition_set_reply_style (
+                               E_SOURCE_MAIL_COMPOSITION (object),
+                               g_value_get_enum (value));
+                       return;
+
                case PROP_SIGN_IMIP:
                        e_source_mail_composition_set_sign_imip (
                                E_SOURCE_MAIL_COMPOSITION (object),
@@ -133,6 +146,13 @@ source_mail_composition_get_property (GObject *object,
                                E_SOURCE_MAIL_COMPOSITION (object)));
                        return;
 
+               case PROP_REPLY_STYLE:
+                       g_value_set_enum (
+                               value,
+                               e_source_mail_composition_get_reply_style (
+                               E_SOURCE_MAIL_COMPOSITION (object)));
+                       return;
+
                case PROP_SIGN_IMIP:
                        g_value_set_boolean (
                                value,
@@ -226,6 +246,20 @@ e_source_mail_composition_class_init (ESourceMailCompositionClass *class)
 
        g_object_class_install_property (
                object_class,
+               PROP_REPLY_STYLE,
+               g_param_spec_enum (
+                       "reply-style",
+                       "Reply Style",
+                       "What reply style to prefer",
+                       E_TYPE_SOURCE_MAIL_COMPOSITION_REPLY_STYLE,
+                       E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DEFAULT,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT |
+                       G_PARAM_STATIC_STRINGS |
+                       E_SOURCE_PARAM_SETTING));
+
+       g_object_class_install_property (
+               object_class,
                PROP_SIGN_IMIP,
                g_param_spec_boolean (
                        "sign-imip",
@@ -648,3 +682,48 @@ e_source_mail_composition_set_templates_folder (ESourceMailComposition *extensio
        g_object_notify (G_OBJECT (extension), "templates-folder");
 }
 
+/**
+ * e_source_mail_composition_get_reply_style:
+ * @extension: an #ESourceMailComposition
+ *
+ * Returns preferred reply style to be used when replying
+ * using the associated account. If no preference is set,
+ * the %E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DEFAULT is returned.
+ *
+ * Returns: reply style preference
+ *
+ * Since: 3.20
+ **/
+ESourceMailCompositionReplyStyle
+e_source_mail_composition_get_reply_style (ESourceMailComposition *extension)
+{
+       g_return_val_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension),
+               E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DEFAULT);
+
+       return extension->priv->reply_style;
+}
+
+/**
+ * e_source_mail_composition_set_reply_style:
+ * @extension: an #ESourceMailComposition
+ * @reply_style: an #ESourceMailCompositionReplyStyle
+ *
+ * Sets preferred reply style to be used when replying
+ * using the associated account. To unset the preference,
+ * use the %E_SOURCE_MAIL_COMPOSITION_REPLY_STYLE_DEFAULT.
+ *
+ * Since: 3.20
+ **/
+void
+e_source_mail_composition_set_reply_style (ESourceMailComposition *extension,
+                                          ESourceMailCompositionReplyStyle reply_style)
+{
+       g_return_if_fail (E_IS_SOURCE_MAIL_COMPOSITION (extension));
+
+       if (extension->priv->reply_style == reply_style)
+               return;
+
+       extension->priv->reply_style = reply_style;
+
+       g_object_notify (G_OBJECT (extension), "reply-style");
+}
diff --git a/libedataserver/e-source-mail-composition.h b/libedataserver/e-source-mail-composition.h
index 014009b..3f97007 100644
--- a/libedataserver/e-source-mail-composition.h
+++ b/libedataserver/e-source-mail-composition.h
@@ -23,6 +23,7 @@
 #define E_SOURCE_MAIL_COMPOSITION_H
 
 #include <libedataserver/e-source-extension.h>
+#include <libedataserver/e-source-enums.h>
 
 /* Standard GObject macros */
 #define E_TYPE_SOURCE_MAIL_COMPOSITION \
@@ -113,6 +114,12 @@ gchar *            e_source_mail_composition_dup_templates_folder
 void           e_source_mail_composition_set_templates_folder
                                        (ESourceMailComposition *extension,
                                         const gchar *templates_folder);
+ESourceMailCompositionReplyStyle
+               e_source_mail_composition_get_reply_style
+                                       (ESourceMailComposition *extension);
+void           e_source_mail_composition_set_reply_style
+                                       (ESourceMailComposition *extension,
+                                        ESourceMailCompositionReplyStyle reply_style);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]