diff options
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 * |