[evolution] Bug 740169 - Add support for smileys via Unicode-characters



commit 99913ec7c30e8a11016a75addd65db7e2185bb69
Author: Jonas Hahnfeld <hahnjo hahnjo de>
Date:   Wed Feb 18 19:01:42 2015 +0100

    Bug 740169 - Add support for smileys via Unicode-characters

 composer/e-composer-actions.c                  |   21 +++
 composer/e-composer-actions.h                  |    2 +
 composer/e-msg-composer.c                      |    4 +
 composer/evolution-composer.ui                 |    1 +
 data/org.gnome.evolution.mail.gschema.xml.in   |    7 +-
 e-util/e-emoticon-chooser.c                    |   43 +++---
 e-util/e-emoticon.c                            |    5 +
 e-util/e-emoticon.h                            |    1 +
 e-util/e-html-editor-view.c                    |  205 +++++++++++++++++-------
 e-util/e-html-editor-view.h                    |    5 +
 mail/mail-config.ui                            |   22 +++-
 modules/mail/em-composer-prefs.c               |    6 +
 modules/settings/e-settings-html-editor-view.c |    5 +
 13 files changed, 247 insertions(+), 80 deletions(-)
---
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index cc33a6f..dbb15de 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -330,6 +330,19 @@ action_smime_sign_cb (GtkToggleAction *action,
 }
 
 static void
+action_unicode_smileys_cb (GtkToggleAction *action,
+                           EMsgComposer *composer)
+{
+       EHTMLEditor *editor;
+       EHTMLEditorView *view;
+
+       editor = e_msg_composer_get_editor (composer);
+       view = e_html_editor_get_view (editor);
+       e_html_editor_view_set_unicode_smileys (view,
+               gtk_toggle_action_get_active (action));
+}
+
+static void
 composer_actions_toolbar_option_toggled_cb (GtkToggleAction *toggle_action,
                                            EMsgComposer *composer)
 {
@@ -558,6 +571,14 @@ static GtkToggleActionEntry toggle_entries[] = {
          NULL,
          FALSE },
 
+       { "unicode-smileys",
+         NULL,
+         N_("Unicode smilyes"),
+         NULL,
+         N_("Use Unicode characters for smileys."),
+         G_CALLBACK (action_unicode_smileys_cb),
+         FALSE },
+
        { "view-bcc",
          NULL,
          N_("_Bcc Field"),
diff --git a/composer/e-composer-actions.h b/composer/e-composer-actions.h
index 968b226..6891c68 100644
--- a/composer/e-composer-actions.h
+++ b/composer/e-composer-actions.h
@@ -68,6 +68,8 @@
        E_COMPOSER_ACTION ((composer), "toolbar-smime-encrypt")
 #define E_COMPOSER_ACTION_TOOLBAR_SMIME_SIGN(composer) \
        E_COMPOSER_ACTION ((composer), "toolbar-smime-sign")
+#define E_COMPOSER_ACTION_UNICODE_SMILEYS(composer) \
+       E_COMPOSER_ACTION ((composer), "unicode-smileys")
 #define E_COMPOSER_ACTION_VIEW_BCC(composer) \
        E_COMPOSER_ACTION ((composer), "view-bcc")
 #define E_COMPOSER_ACTION_VIEW_CC(composer) \
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 9a110ae..6064a69 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2308,6 +2308,10 @@ msg_composer_constructed (GObject *object)
        action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT));
        active = g_settings_get_boolean (settings, "composer-request-receipt");
        gtk_toggle_action_set_active (action, active);
+
+       action = GTK_TOGGLE_ACTION (ACTION (UNICODE_SMILEYS));
+       active = g_settings_get_boolean (settings, "composer-unicode-smileys");
+       gtk_toggle_action_set_active (action, active);
        g_object_unref (settings);
 
        /* Clipboard Support */
diff --git a/composer/evolution-composer.ui b/composer/evolution-composer.ui
index d125618..8b107eb 100644
--- a/composer/evolution-composer.ui
+++ b/composer/evolution-composer.ui
@@ -50,6 +50,7 @@
       <menuitem action='request-read-receipt'/>
       <menuitem action='prioritize-message'/>
       <separator/>
+      <menuitem action='unicode-smileys'/>
       <menu action='charset-menu'/>
     </menu>
   </menubar>
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 58e2fbb..91095aa 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -58,7 +58,12 @@
     <key name="composer-magic-smileys" type="b">
       <default>false</default>
       <_summary>Automatic emoticon recognition</_summary>
-      <_description>Recognize emoticons in text and replace them with images.</_description>
+      <_description>Recognize emoticons in text and replace them with images or Unicode 
characters.</_description>
+    </key>
+    <key name="composer-unicode-smileys" type="b">
+      <default>false</default>
+      <_summary>Unicode smileys</_summary>
+      <_description>Use Unicode characters for smileys.</_description>
     </key>
     <key name="composer-message-attribution" type="s">
       <default>''</default>
diff --git a/e-util/e-emoticon-chooser.c b/e-util/e-emoticon-chooser.c
index 44ce06b..428e116 100644
--- a/e-util/e-emoticon-chooser.c
+++ b/e-util/e-emoticon-chooser.c
@@ -31,52 +31,53 @@
 typedef struct {
        const gchar *label;
        const gchar *icon_name;
+       const gchar *unicode_character;
        const gchar *text_face;
 } ConstantEmoticon;
 
 static ConstantEmoticon available_emoticons[] = {
        /* Translators: :-) */
-       { N_("_Smile"),         "face-smile",           ":-)"   },
+       { N_("_Smile"),         "face-smile",           "☺",    ":-)"   },
        /* Translators: :-( */
-       { N_("S_ad"),           "face-sad",             ":-("   },
+       { N_("S_ad"),           "face-sad",             "☹",    ":-("   },
        /* Translators: ;-) */
-       { N_("_Wink"),          "face-wink",            ";-)"   },
+       { N_("_Wink"),          "face-wink",            "😉",    ";-)"   },
        /* Translators: :-P */
-       { N_("Ton_gue"),        "face-raspberry",       ":-P"   },
+       { N_("Ton_gue"),        "face-raspberry",       "😛",    ":-P"   },
        /* Translators: :-)) */
-       { N_("Laug_h"),         "face-laugh",           ":-))"  },
+       { N_("Laug_h"),         "face-laugh",           "😃",    ":-D"   },
        /* Translators: :-| */
-       { N_("_Plain"),         "face-plain",           ":-|"   },
+       { N_("_Plain"),         "face-plain",           "😔",    ":-|"   },
        /* Translators: :-! */
-       { N_("Smi_rk"),         "face-smirk",           ":-!"   },
+       { N_("Smi_rk"),         "face-smirk",           "😏",    ":-!"   },
        /* Translators: :"-) */
-       { N_("_Embarrassed"),   "face-embarrassed",     ":\"-)" },
+       { N_("_Embarrassed"),   "face-embarrassed",     "😯",    ":\"-)" },
        /* Translators: :-D */
-       { N_("_Big Smile"),     "face-smile-big",       ":-D"   },
+       { N_("_Big Smile"),     "face-smile-big",       "😄",    ":-D"   },
        /* Translators: :-/ */
-       { N_("Uncer_tain"),     "face-uncertain",       ":-/"   },
+       { N_("Uncer_tain"),     "face-uncertain",       "😕",    ":-/"   },
        /* Translators: :-O */
-       { N_("S_urprise"),      "face-surprise",        ":-O"   },
+       { N_("S_urprise"),      "face-surprise",        "😲",    ":-O"   },
        /* Translators: :-S */
-       { N_("W_orried"),       "face-worried",         ":-S"   },
+       { N_("W_orried"),       "face-worried",         "😟",    ":-S"   },
        /* Translators: :-* */
-       { N_("_Kiss"),          "face-kiss",            ":-*"   },
+       { N_("_Kiss"),          "face-kiss",            "😗",    ":-*"   },
        /* Translators: X-( */
-       { N_("A_ngry"),         "face-angry",           "X-("   },
+       { N_("A_ngry"),         "face-angry",           "😠",    "X-("   },
        /* Translators: B-) */
-       { N_("_Cool"),          "face-cool",            "B-)"   },
+       { N_("_Cool"),          "face-cool",            "😎",    "B-)"   },
        /* Translators: O:-) */
-       { N_("Ange_l"),         "face-angel",           "O:-)"  },
+       { N_("Ange_l"),         "face-angel",           "😇",    "O:-)"  },
        /* Translators: :'( */
-       { N_("Cr_ying"),        "face-crying",          ":'("   },
+       { N_("Cr_ying"),        "face-crying",          "😢",    ":'("   },
        /* Translators: :-Q */
-       { N_("S_ick"),          "face-sick",            ":-Q"   },
+       { N_("S_ick"),          "face-sick",            "😨",    ":-Q"   },
        /* Translators: |-) */
-       { N_("Tire_d"),         "face-tired",           "|-)"   },
+       { N_("Tire_d"),         "face-tired",           "😫",    "|-)"   },
        /* Translators: >:-) */
-       { N_("De_vilish"),      "face-devilish",        ">:-)"  },
+       { N_("De_vilish"),      "face-devilish",        "😈",    ">:-)"  },
        /* Translators: :-(|) */
-       { N_("_Monkey"),        "face-monkey",          ":-(|)" }
+       { N_("_Monkey"),        "face-monkey",          "🐵",    ":-(|)" }
 };
 
 enum {
diff --git a/e-util/e-emoticon.c b/e-util/e-emoticon.c
index c543e52..cc2fd41 100644
--- a/e-util/e-emoticon.c
+++ b/e-util/e-emoticon.c
@@ -31,6 +31,7 @@ emoticon_copy (EEmoticon *emoticon)
        copy = g_slice_new (EEmoticon);
        copy->label = g_strdup (emoticon->label);
        copy->icon_name = g_strdup (emoticon->icon_name);
+       copy->unicode_character = g_strdup (emoticon->unicode_character);
        copy->text_face = g_strdup (emoticon->text_face);
 
        return copy;
@@ -41,6 +42,7 @@ emoticon_free (EEmoticon *emoticon)
 {
        g_free (emoticon->label);
        g_free (emoticon->icon_name);
+       g_free (emoticon->unicode_character);
        g_free (emoticon->text_face);
        g_slice_free (EEmoticon, emoticon);
 }
@@ -76,6 +78,9 @@ e_emoticon_equal (EEmoticon *emoticon_a,
        if (g_strcmp0 (emoticon_a->icon_name, emoticon_b->icon_name) != 0)
                return FALSE;
 
+       if (g_strcmp0 (emoticon_a->unicode_character, emoticon_b->unicode_character) != 0)
+               return FALSE;
+
        if (g_strcmp0 (emoticon_a->text_face, emoticon_b->text_face) != 0)
                return FALSE;
 
diff --git a/e-util/e-emoticon.h b/e-util/e-emoticon.h
index 66327ab..e77806f 100644
--- a/e-util/e-emoticon.h
+++ b/e-util/e-emoticon.h
@@ -38,6 +38,7 @@ typedef struct _EEmoticon EEmoticon;
 struct _EEmoticon {
        gchar *label;
        gchar *icon_name;
+       gchar *unicode_character;
        gchar *text_face;
 };
 
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index aa03a46..5c8c597 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -79,6 +79,7 @@ struct _EHTMLEditorViewPrivate {
        gint inline_spelling    : 1;
        gint magic_links        : 1;
        gint magic_smileys      : 1;
+       gint unicode_smileys    : 1;
        gint can_copy           : 1;
        gint can_cut            : 1;
        gint can_paste          : 1;
@@ -121,6 +122,7 @@ enum {
        PROP_INLINE_SPELLING,
        PROP_MAGIC_LINKS,
        PROP_MAGIC_SMILEYS,
+       PROP_UNICODE_SMILEYS,
        PROP_SPELL_CHECKER
 };
 
@@ -1420,39 +1422,20 @@ emoticon_load_context_free (LoadContext *load_context)
 }
 
 static void
-emoticon_read_async_cb (GFile *file,
-                        GAsyncResult *result,
-                        LoadContext *load_context)
+emoticon_insert_span (EHTMLEditorView *view,
+                      EEmoticon *emoticon,
+                      const gchar *html)
 {
-       EHTMLEditorView *view = load_context->view;
        EHTMLEditorSelection *selection;
-       EEmoticon *emoticon = load_context->emoticon;
-       GError *error = NULL;
        gboolean misplaced_selection = FALSE, empty = FALSE;
-       gchar *html, *node_text = NULL, *mime_type, *content;
-       gchar *base64_encoded, *output, *data;
+       gchar *final_html, *node_text = NULL, *content;
        const gchar *emoticon_start;
-       GFileInputStream *input_stream;
-       GOutputStream *output_stream;
-       gssize size;
        WebKitDOMDocument *document;
        WebKitDOMElement *span, *selection_start_marker, *selection_end_marker;
        WebKitDOMNode *node, *insert_before, *prev_sibling, *next_sibling;
        WebKitDOMNode *selection_end_marker_parent;
        WebKitDOMRange *range;
 
-       input_stream = g_file_read_finish (file, result, &error);
-       g_return_if_fail (!error && input_stream);
-
-       output_stream = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
-
-       size = g_output_stream_splice (
-               output_stream, G_INPUT_STREAM (input_stream),
-               G_OUTPUT_STREAM_SPLICE_NONE, NULL, &error);
-
-       if (error || (size == -1))
-               goto out;
-
        selection = e_html_editor_view_get_selection (view);
        if (!e_html_editor_selection_is_collapsed (selection))
                e_html_editor_view_exec_command (
@@ -1521,32 +1504,17 @@ emoticon_read_async_cb (GFile *file,
                if (element_has_class (WEBKIT_DOM_ELEMENT (next_sibling), "-x-evo-smiley-wrapper"))
                        misplaced_selection = TRUE;
 
-       mime_type = g_content_type_get_mime_type (load_context->content_type);
        range = html_editor_view_get_dom_range (view);
        node = webkit_dom_range_get_end_container (range, NULL);
        if (WEBKIT_DOM_IS_TEXT (node))
                node_text = webkit_dom_text_get_whole_text (WEBKIT_DOM_TEXT (node));
 
-       data = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (output_stream));
-       base64_encoded = g_base64_encode ((const guchar *) data, size);
-       output = g_strconcat ("data:", mime_type, ";base64,", base64_encoded, NULL);
-
        content = webkit_dom_node_get_text_content (selection_end_marker_parent);
        empty = !*content || (g_strcmp0 (content, UNICODE_ZERO_WIDTH_SPACE) == 0);
        g_free (content);
 
-       /* Insert span with image representation and another one with text
-        * represetation and hide/show them dependant on active composer mode */
        /* &#8203 == UNICODE_ZERO_WIDTH_SPACE */
-       html = g_strdup_printf (
-               "<span class=\"-x-evo-smiley-wrapper -x-evo-resizable-wrapper\">"
-               "<img src=\"%s\" alt=\"%s\" x-evo-smiley=\"%s\" "
-               "class=\"-x-evo-smiley-img\" data-inline data-name=\"%s\"/>"
-               "<span class=\"-x-evo-smiley-text\" style=\"display: none;\">%s"
-               "</span></span>%s",
-               output, emoticon ? emoticon->text_face : "", emoticon->icon_name,
-               load_context->name, emoticon ? emoticon->text_face : "",
-               empty ? "&#8203;" : "");
+       final_html = g_strdup_printf ("%s%s", html, empty ? "&#8203;" : "");
 
        span = webkit_dom_document_create_element (document, "SPAN", NULL);
 
@@ -1578,7 +1546,7 @@ emoticon_read_async_cb (GFile *file,
        }
 
        webkit_dom_html_element_set_outer_html (
-               WEBKIT_DOM_HTML_ELEMENT (span), html, NULL);
+               WEBKIT_DOM_HTML_ELEMENT (span), final_html, NULL);
 
        if (node_text) {
                emoticon_start = g_utf8_strrchr (
@@ -1596,8 +1564,56 @@ emoticon_read_async_cb (GFile *file,
 
        e_html_editor_view_set_changed (view, TRUE);
 
-       g_free (html);
+       g_free (final_html);
        g_free (node_text);
+}
+
+static void
+emoticon_read_async_cb (GFile *file,
+                        GAsyncResult *result,
+                        LoadContext *load_context)
+{
+       EHTMLEditorView *view = load_context->view;
+       EEmoticon *emoticon = load_context->emoticon;
+       GError *error = NULL;
+       gchar *html, *mime_type;
+       gchar *base64_encoded, *output, *data;
+       GFileInputStream *input_stream;
+       GOutputStream *output_stream;
+       gssize size;
+
+       input_stream = g_file_read_finish (file, result, &error);
+       g_return_if_fail (!error && input_stream);
+
+       output_stream = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
+
+       size = g_output_stream_splice (
+               output_stream, G_INPUT_STREAM (input_stream),
+               G_OUTPUT_STREAM_SPLICE_NONE, NULL, &error);
+
+       if (error || (size == -1))
+               goto out;
+
+       mime_type = g_content_type_get_mime_type (load_context->content_type);
+
+       data = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (output_stream));
+       base64_encoded = g_base64_encode ((const guchar *) data, size);
+       output = g_strconcat ("data:", mime_type, ";base64,", base64_encoded, NULL);
+
+       /* Insert span with image representation and another one with text
+        * represetation and hide/show them dependant on active composer mode */
+       html = g_strdup_printf (
+               "<span class=\"-x-evo-smiley-wrapper -x-evo-resizable-wrapper\">"
+               "<img src=\"%s\" alt=\"%s\" x-evo-smiley=\"%s\" "
+               "class=\"-x-evo-smiley-img\" data-inline data-name=\"%s\"/>"
+               "<span class=\"-x-evo-smiley-text\" style=\"display: none;\">%s"
+               "</span></span>",
+               output, emoticon ? emoticon->text_face : "", emoticon->icon_name,
+               load_context->name, emoticon ? emoticon->text_face : "");
+
+       emoticon_insert_span (view, emoticon, html);
+
+       g_free (html);
        g_free (base64_encoded);
        g_free (output);
        g_free (mime_type);
@@ -1632,22 +1648,31 @@ e_html_editor_view_insert_smiley (EHTMLEditorView *view,
                                   EEmoticon *emoticon)
 {
        GFile *file;
-       gchar *filename_uri;
+       gchar *html, *filename_uri;
        LoadContext *load_context;
 
-       filename_uri = e_emoticon_get_uri (emoticon);
-       g_return_if_fail (filename_uri != NULL);
+       if (e_html_editor_view_get_unicode_smileys (view)) {
+               html = g_strdup_printf ("<span>%s</span>",
+                       emoticon->unicode_character);
+
+               emoticon_insert_span (view, emoticon, html);
 
-       load_context = emoticon_load_context_new (view, emoticon);
+               g_free (html);
+       } else {
+               filename_uri = e_emoticon_get_uri (emoticon);
+               g_return_if_fail (filename_uri != NULL);
+
+               load_context = emoticon_load_context_new (view, emoticon);
 
-       file = g_file_new_for_uri (filename_uri);
-       g_file_query_info_async (
-               file,  "standard::*", G_FILE_QUERY_INFO_NONE,
-               G_PRIORITY_DEFAULT, NULL,
-               (GAsyncReadyCallback) emoticon_query_info_async_cb, load_context);
+               file = g_file_new_for_uri (filename_uri);
+               g_file_query_info_async (
+                       file,  "standard::*", G_FILE_QUERY_INFO_NONE,
+                       G_PRIORITY_DEFAULT, NULL,
+                       (GAsyncReadyCallback) emoticon_query_info_async_cb, load_context);
 
-       g_free (filename_uri);
-       g_object_unref (file);
+               g_free (filename_uri);
+               g_object_unref (file);
+       }
 }
 
 static void
@@ -2423,6 +2448,12 @@ html_editor_view_set_property (GObject *object,
                                E_HTML_EDITOR_VIEW (object),
                                g_value_get_boolean (value));
                        return;
+
+               case PROP_UNICODE_SMILEYS:
+                       e_html_editor_view_set_unicode_smileys (
+                               E_HTML_EDITOR_VIEW (object),
+                               g_value_get_boolean (value));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2495,6 +2526,12 @@ html_editor_view_get_property (GObject *object,
                                E_HTML_EDITOR_VIEW (object)));
                        return;
 
+               case PROP_UNICODE_SMILEYS:
+                       g_value_set_boolean (
+                               value, e_html_editor_view_get_unicode_smileys (
+                               E_HTML_EDITOR_VIEW (object)));
+                       return;
+
                case PROP_SPELL_CHECKER:
                        g_value_set_object (
                                value, e_html_editor_view_get_spell_checker (
@@ -3404,7 +3441,7 @@ e_html_editor_view_class_init (EHTMLEditorViewClass *class)
         * EHTMLEditorView:magic-smileys
         *
         * Determines whether automatic conversion of text smileys into
-        * images is enabled.
+        * images or Unicode characters is enabled.
         */
        g_object_class_install_property (
                object_class,
@@ -3412,7 +3449,24 @@ e_html_editor_view_class_init (EHTMLEditorViewClass *class)
                g_param_spec_boolean (
                        "magic-smileys",
                        "Magic Smileys",
-                       "Convert emoticons to images as you type",
+                       "Convert emoticons to images or Unicode characters as you type",
+                       TRUE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT |
+                       G_PARAM_STATIC_STRINGS));
+
+       /**
+        * EHTMLEditorView:unicode-smileys
+        *
+        * Determines whether Unicode characters should be used for smileys.
+        */
+       g_object_class_install_property (
+               object_class,
+               PROP_UNICODE_SMILEYS,
+               g_param_spec_boolean (
+                       "unicode-smileys",
+                       "Unicode Smileys",
+                       "Use Unicode characters for smileys",
                        TRUE,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
@@ -7756,7 +7810,7 @@ e_html_editor_view_set_magic_links (EHTMLEditorView *view,
  *
  * Returns whether automatic conversion of smileys is enabled or disabled. When
  * enabled, the editor will automatically convert text smileys ( :-), ;-),...)
- * into images.
+ * into images or Unicode characters.
  *
  * Returns: @TRUE when magic smileys are enabled, @FALSE otherwise.
  */
@@ -7790,6 +7844,47 @@ e_html_editor_view_set_magic_smileys (EHTMLEditorView *view,
 }
 
 /**
+ * e_html_editor_view_get_unicode_smileys:
+ * @view: an #EHTMLEditorView
+ *
+ * Returns whether to use Unicode characters for smileys.
+ *
+ * Returns: @TRUE when Unicode characters should be used, @FALSE otherwise.
+ *
+ * Since: 3.14
+ */
+gboolean
+e_html_editor_view_get_unicode_smileys (EHTMLEditorView *view)
+{
+       g_return_val_if_fail (E_IS_HTML_EDITOR_VIEW (view), FALSE);
+
+       return view->priv->unicode_smileys;
+}
+
+/**
+ * e_html_editor_view_set_unicode_smileys:
+ * @view: an #EHTMLEditorView
+ * @unicode_smileys: @TRUE to use Unicode characters, @FALSE to use images
+ *
+ * Enables or disables the usage of Unicode characters for smileys.
+ *
+ * Since: 3.14
+ */
+void
+e_html_editor_view_set_unicode_smileys (EHTMLEditorView *view,
+                                        gboolean unicode_smileys)
+{
+       g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view));
+
+       if (view->priv->unicode_smileys == unicode_smileys)
+               return;
+
+       view->priv->unicode_smileys = unicode_smileys;
+
+       g_object_notify (G_OBJECT (view), "unicode-smileys");
+}
+
+/**
  * e_html_editor_view_get_spell_checker:
  * @view: an #EHTMLEditorView
  *
diff --git a/e-util/e-html-editor-view.h b/e-util/e-html-editor-view.h
index 86e33d1..cef99b9 100644
--- a/e-util/e-html-editor-view.h
+++ b/e-util/e-html-editor-view.h
@@ -110,6 +110,11 @@ gboolean   e_html_editor_view_get_magic_smileys
 void           e_html_editor_view_set_magic_smileys
                                                (EHTMLEditorView *view,
                                                 gboolean magic_smileys);
+gboolean       e_html_editor_view_get_unicode_smileys
+                                               (EHTMLEditorView *view);
+void           e_html_editor_view_set_unicode_smileys
+                                               (EHTMLEditorView *view,
+                                                gboolean unicode_smileys);
 ESpellChecker *        e_html_editor_view_get_spell_checker
                                                (EHTMLEditorView *view);
 gchar *                e_html_editor_view_get_text_html
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index edb52f9..fff639a 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -238,7 +238,7 @@
                     </child>
                     <child>
                       <object class="GtkCheckButton" id="chkAutoSmileys">
-                        <property name="label" translatable="yes">Automatically insert _emoticon 
images</property>
+                        <property name="label" translatable="yes">Automatically insert _emoticons</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -253,6 +253,22 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkCheckButton" id="chkUnicodeSmileys">
+                        <property name="label" translatable="yes">Use Unicode characters for 
smile_ys</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0.5</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkCheckButton" id="chkRequestReceipt">
                         <property name="label" translatable="yes">Always request rea_d receipt</property>
                         <property name="visible">True</property>
@@ -265,7 +281,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">2</property>
+                        <property name="position">3</property>
                       </packing>
                     </child>
                     <child>
@@ -281,7 +297,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">3</property>
+                        <property name="position">4</property>
                       </packing>
                     </child>
                     <child>
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 4743822..dcd7cad 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -1121,6 +1121,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
                widget, "active",
                G_SETTINGS_BIND_DEFAULT);
 
+       widget = e_builder_get_widget (prefs->builder, "chkUnicodeSmileys");
+       g_settings_bind (
+               settings, "composer-unicode-smileys",
+               widget, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        widget = e_builder_get_widget (prefs->builder, "chkRequestReceipt");
        g_settings_bind (
                settings, "composer-request-receipt",
diff --git a/modules/settings/e-settings-html-editor-view.c b/modules/settings/e-settings-html-editor-view.c
index 1920940..c4cb99c 100644
--- a/modules/settings/e-settings-html-editor-view.c
+++ b/modules/settings/e-settings-html-editor-view.c
@@ -96,6 +96,11 @@ settings_html_editor_view_realize (GtkWidget *widget,
                widget, "magic-smileys",
                G_SETTINGS_BIND_GET);
 
+       g_settings_bind (
+               settings, "composer-unicode-smileys",
+               widget, "unicode-smileys",
+               G_SETTINGS_BIND_GET);
+
        settings_html_editor_view_load_style (extension);
 
        /* Reload the web view when certain settings change. */


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