diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-06-25 20:13:39 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-06-25 21:59:50 +0800 |
commit | b5d682209bd8394c4fcccd6f2dd84ad53143a60c (patch) | |
tree | 8859c95fbb8e35ebff2d8c14cbc89e49d65760b2 /e-util/e-html-editor-view.c | |
parent | 177b1a6abfe7b73d7534db819d52e3d87ad76756 (diff) | |
download | gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.tar gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.tar.gz gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.tar.bz2 gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.tar.lz gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.tar.xz gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.tar.zst gsoc2013-evolution-b5d682209bd8394c4fcccd6f2dd84ad53143a60c.zip |
Bug 731508 - [webkit-composer] no option to paste as text (without formatting)
Diffstat (limited to 'e-util/e-html-editor-view.c')
-rw-r--r-- | e-util/e-html-editor-view.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index 343a0d3676..0afd7a3f78 100644 --- a/e-util/e-html-editor-view.c +++ b/e-util/e-html-editor-view.c @@ -1589,6 +1589,21 @@ html_editor_view_set_links_active (EHTMLEditorView *view, } static void +clipboard_text_received_for_paste_as_text (GtkClipboard *clipboard, + const gchar *text, + EHTMLEditorView *view) +{ + EHTMLEditorSelection *selection; + + if (!text || !*text) + return; + + selection = e_html_editor_view_get_selection (view); + + e_html_editor_selection_insert_as_text (selection, text); +} + +static void clipboard_text_received (GtkClipboard *clipboard, const gchar *text, EHTMLEditorView *view) @@ -2273,6 +2288,21 @@ html_editor_view_key_release_event (GtkWidget *widget, } static void +html_editor_view_paste_as_text (EHTMLEditorView *view) +{ + GtkClipboard *clipboard; + + clipboard = gtk_clipboard_get_for_display ( + gdk_display_get_default (), + GDK_SELECTION_CLIPBOARD); + + gtk_clipboard_request_text ( + clipboard, + (GtkClipboardTextReceivedFunc) clipboard_text_received_for_paste_as_text, + view); +} + +static void html_editor_view_paste_clipboard_quoted (EHTMLEditorView *view) { GtkClipboard *clipboard; @@ -6043,6 +6073,20 @@ e_html_editor_view_set_text_plain (EHTMLEditorView *view, } /** + * e_html_editor_view_paste_as_text: + * @view: an #EHTMLEditorView + * + * Pastes current content of clipboard into the editor without formatting + */ +void +e_html_editor_view_paste_as_text (EHTMLEditorView *view) +{ + g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view)); + + html_editor_view_paste_as_text (view); +} + +/** * e_html_editor_view_paste_clipboard_quoted: * @view: an #EHTMLEditorView * |