[evolution/gnome-3-22] Bug 773396 - Pasting with midlde mouse button and Shift pressed doesn’t cite text
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-22] Bug 773396 - Pasting with midlde mouse button and Shift pressed doesn’t cite text
- Date: Mon, 24 Oct 2016 06:55:56 +0000 (UTC)
commit d55e528e2eca7dc1c310a04e9d77d3bd65d0a6cb
Author: Tomas Popela <tpopela redhat com>
Date: Mon Oct 24 08:55:26 2016 +0200
Bug 773396 - Pasting with midlde mouse button and Shift pressed doesn’t cite text
modules/webkit-editor/e-webkit-editor.c | 61 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/modules/webkit-editor/e-webkit-editor.c b/modules/webkit-editor/e-webkit-editor.c
index f715aeb..e231c4f 100644
--- a/modules/webkit-editor/e-webkit-editor.c
+++ b/modules/webkit-editor/e-webkit-editor.c
@@ -5780,6 +5780,63 @@ webkit_editor_web_process_crashed_cb (EWebKitEditor *wk_editor)
wk_editor->priv->web_extension_user_changed_default_colors_cb_id = 0;
}
+static void
+paste_quote_text (EContentEditor *editor,
+ const gchar *text,
+ gboolean is_html)
+{
+ g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
+ g_return_if_fail (text != NULL);
+
+ e_content_editor_insert_content (
+ editor,
+ text,
+ E_CONTENT_EDITOR_INSERT_QUOTE_CONTENT |
+ (is_html ? E_CONTENT_EDITOR_INSERT_TEXT_HTML : E_CONTENT_EDITOR_INSERT_TEXT_PLAIN));
+}
+
+static void
+clipboard_html_received_for_paste_quote (GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer user_data)
+{
+ EContentEditor *editor = user_data;
+
+ g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
+ g_return_if_fail (text != NULL);
+
+ paste_quote_text (editor, text, TRUE);
+}
+
+static void
+clipboard_text_received_for_paste_quote (GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer user_data)
+{
+ EContentEditor *editor = user_data;
+
+ g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
+ g_return_if_fail (text != NULL);
+
+ paste_quote_text (editor, text, FALSE);
+}
+
+static void
+paste_primary_clipboard_quoted (EContentEditor *editor)
+{
+ GtkClipboard *clipboard;
+
+ 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);
+
+}
+
static gboolean
webkit_editor_button_press_event (GtkWidget *widget,
GdkEventButton *event)
@@ -5791,7 +5848,9 @@ webkit_editor_button_press_event (GtkWidget *widget,
wk_editor = E_WEBKIT_EDITOR (widget);
if (event->button == 2) {
- if (!e_content_editor_emit_paste_primary_clipboard (E_CONTENT_EDITOR (widget)))
+ if ((event->state & GDK_SHIFT_MASK) != 0) {
+ paste_primary_clipboard_quoted (E_CONTENT_EDITOR (widget));
+ } else if (!e_content_editor_emit_paste_primary_clipboard (E_CONTENT_EDITOR (widget)))
webkit_editor_paste_primary (E_CONTENT_EDITOR( (widget)));
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]