[evolution] EMsgComposer - Prefer the plain text over HTML when pasting in plain text mode
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EMsgComposer - Prefer the plain text over HTML when pasting in plain text mode
- Date: Fri, 23 Oct 2015 07:45:34 +0000 (UTC)
commit aa46f2d7784d2b953db6e8778858088712724201
Author: Tomas Popela <tpopela redhat com>
Date: Fri Oct 23 09:19:24 2015 +0200
EMsgComposer - Prefer the plain text over HTML when pasting in plain text mode
But only when not pasting content from composer.
composer/e-msg-composer.c | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 9c7c67f..66760e2 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1699,6 +1699,9 @@ msg_composer_paste_clipboard_targets_cb (GtkClipboard *clipboard,
gint n_targets,
EMsgComposer *composer)
{
+ EHTMLEditor *editor = e_msg_composer_get_editor (composer);
+ EHTMLEditorView *editor_view = e_html_editor_get_view (editor);
+
if (targets == NULL || n_targets < 0)
return;
@@ -1710,14 +1713,29 @@ msg_composer_paste_clipboard_targets_cb (GtkClipboard *clipboard,
return;
}
- if (e_targets_include_html (targets, n_targets)) {
- e_composer_paste_html (composer, clipboard);
- return;
- }
+ /* Prefer plain text over HTML when in the plain text mode, but only
+ * when pasting content from outside the editor view. */
+ if (e_html_editor_view_get_html_mode (editor_view) ||
+ e_html_editor_view_is_pasting_content_from_itself (editor_view)) {
+ if (e_targets_include_html (targets, n_targets)) {
+ e_composer_paste_html (composer, clipboard);
+ return;
+ }
- if (gtk_targets_include_text (targets, n_targets)) {
- e_composer_paste_text (composer, clipboard);
- return;
+ if (gtk_targets_include_text (targets, n_targets)) {
+ e_composer_paste_text (composer, clipboard);
+ return;
+ }
+ } else {
+ if (gtk_targets_include_text (targets, n_targets)) {
+ e_composer_paste_text (composer, clipboard);
+ return;
+ }
+
+ if (e_targets_include_html (targets, n_targets)) {
+ e_composer_paste_html (composer, clipboard);
+ return;
+ }
}
if (gtk_targets_include_image (targets, n_targets, TRUE)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]