[evolution] Prefer text/plain in plain text mode if using 'Paste Quotation'



commit ab1730fd8517b44fdff1941f739b3a5c8cf1728f
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Dec 6 16:47:20 2016 +0100

    Prefer text/plain in plain text mode if using 'Paste Quotation'

 src/e-util/e-html-editor-actions.c          |   15 +++++++++++----
 src/modules/webkit-editor/e-webkit-editor.c |   19 ++++++++++++++-----
 2 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/src/e-util/e-html-editor-actions.c b/src/e-util/e-html-editor-actions.c
index 14e76aa..f0649e6 100644
--- a/src/e-util/e-html-editor-actions.c
+++ b/src/e-util/e-html-editor-actions.c
@@ -643,10 +643,17 @@ action_paste_quote_cb (GtkAction *action,
                gdk_display_get_default (),
                GDK_SELECTION_CLIPBOARD);
 
-       if (e_clipboard_wait_is_html_available (clipboard))
-               e_clipboard_request_html (clipboard, clipboard_html_received_for_paste_quote, editor);
-       else if (gtk_clipboard_wait_is_text_available (clipboard))
-               gtk_clipboard_request_text (clipboard, clipboard_text_received_for_paste_quote, editor);
+       if (e_content_editor_get_html_mode (cnt_editor)) {
+               if (e_clipboard_wait_is_html_available (clipboard))
+                       e_clipboard_request_html (clipboard, clipboard_html_received_for_paste_quote, editor);
+               else if (gtk_clipboard_wait_is_text_available (clipboard))
+                       gtk_clipboard_request_text (clipboard, clipboard_text_received_for_paste_quote, 
editor);
+       } else {
+               if (gtk_clipboard_wait_is_text_available (clipboard))
+                       gtk_clipboard_request_text (clipboard, clipboard_text_received_for_paste_quote, 
editor);
+               else if (e_clipboard_wait_is_html_available (clipboard))
+                       e_clipboard_request_html (clipboard, clipboard_html_received_for_paste_quote, editor);
+       }
 }
 
 static void
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index cea7f38..b4ba5fd 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -5812,17 +5812,26 @@ clipboard_text_received_for_paste_quote (GtkClipboard *clipboard,
 static void
 paste_primary_clipboard_quoted (EContentEditor *editor)
 {
+       EWebKitEditor *wk_editor;
        GtkClipboard *clipboard;
 
+       wk_editor = E_WEBKIT_EDITOR (editor);
+
        clipboard = gtk_clipboard_get_for_display (
                gdk_display_get_default (),
                GDK_SELECTION_PRIMARY);
 
-       if (e_clipboard_wait_is_html_available (clipboard))
-               e_clipboard_request_html (clipboard, clipboard_html_received_for_paste_quote, editor);
-       else if (gtk_clipboard_wait_is_text_available (clipboard))
-               gtk_clipboard_request_text (clipboard, clipboard_text_received_for_paste_quote, editor);
-
+       if (wk_editor->priv->html_mode) {
+               if (e_clipboard_wait_is_html_available (clipboard))
+                       e_clipboard_request_html (clipboard, clipboard_html_received_for_paste_quote, editor);
+               else if (gtk_clipboard_wait_is_text_available (clipboard))
+                       gtk_clipboard_request_text (clipboard, clipboard_text_received_for_paste_quote, 
editor);
+       } else {
+               if (gtk_clipboard_wait_is_text_available (clipboard))
+                       gtk_clipboard_request_text (clipboard, clipboard_text_received_for_paste_quote, 
editor);
+               else if (e_clipboard_wait_is_html_available (clipboard))
+                       e_clipboard_request_html (clipboard, clipboard_html_received_for_paste_quote, editor);
+       }
 }
 
 static gboolean


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