[evolution] Bug 744562 - Allow insert of emoticons in plain text mode



commit 2aee680444d081bd8cf4117e42efd6b8bb963ca1
Author: Jonas Hahnfeld <hahnjo hahnjo de>
Date:   Wed Feb 18 19:07:22 2015 +0100

    Bug 744562 - Allow insert of emoticons in plain text mode

 e-util/e-html-editor-manager.ui |    3 ++-
 e-util/e-html-editor-view.c     |   17 +++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/e-util/e-html-editor-manager.ui b/e-util/e-html-editor-manager.ui
index 4ee87ae..97a4861 100644
--- a/e-util/e-html-editor-manager.ui
+++ b/e-util/e-html-editor-manager.ui
@@ -116,6 +116,8 @@
     <separator/>
     <toolitem action='unindent'/>
     <toolitem action='indent'/>
+    <separator/>
+    <toolitem action='insert-emoticon'/>
   </toolbar>
   <toolbar name='html-toolbar'>
     <separator/>
@@ -129,7 +131,6 @@
     <toolitem action='insert-link'/>
     <toolitem action='insert-rule'/>
     <toolitem action='insert-table'/>
-    <toolitem action='insert-emoticon'/>
   </toolbar>
   <popup name='context-menu'>
     <placeholder name='context-spell-suggest'/>
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 5c8c597..fee7a7a 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -1576,6 +1576,7 @@ emoticon_read_async_cb (GFile *file,
        EHTMLEditorView *view = load_context->view;
        EEmoticon *emoticon = load_context->emoticon;
        GError *error = NULL;
+       gboolean html_mode;
        gchar *html, *mime_type;
        gchar *base64_encoded, *output, *data;
        GFileInputStream *input_stream;
@@ -1600,16 +1601,20 @@ emoticon_read_async_cb (GFile *file,
        base64_encoded = g_base64_encode ((const guchar *) data, size);
        output = g_strconcat ("data:", mime_type, ";base64,", base64_encoded, NULL);
 
+       html_mode = e_html_editor_view_get_html_mode (view);
+
        /* 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 : "");
+               "class=\"-x-evo-smiley-img\" data-inline data-name=\"%s\"%s/>"
+               "<span class=\"-x-evo-smiley-text\"%s>%s</span></span>",
+               output, emoticon ? emoticon->text_face : "",
+               emoticon->icon_name, load_context->name,
+               html_mode ? "" : " style=\"display: none;\"",
+               html_mode ? " style=\"display: none;\"" : "",
+               emoticon ? emoticon->text_face : "");
 
        emoticon_insert_span (view, emoticon, html);
 
@@ -1900,7 +1905,7 @@ body_input_event_cb (WebKitDOMElement *element,
 
        e_html_editor_view_set_changed (view, TRUE);
 
-       if (view->priv->magic_smileys && view->priv->html_mode)
+       if (view->priv->magic_smileys)
                html_editor_view_check_magic_smileys (view, range);
 
        if (view->priv->return_key_pressed || view->priv->space_key_pressed) {


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