From: John Darrington Date: Wed, 7 Jan 2015 19:03:09 +0000 (+0100) Subject: Syntax Window: Simplify the Edit|Paste callback. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=feddb0d0be4cd39cca437cab738140c9db3dd0b6 Syntax Window: Simplify the Edit|Paste callback. Apparently pasting into the Syntax Window under Windoze didn't work. This change makes the EditPaste callback simpler and apparently it fixes the problem. Thanks to Alan Mead for reporting the problem and to Harry Thissen for testing the fix. --- diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 8491eb3142..ca04756069 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -370,26 +370,6 @@ on_edit_copy (PsppireSyntaxWindow *sw) } -/* A callback for when the clipboard contents have been received */ -static void -contents_received_callback (GtkClipboard *clipboard, - GtkSelectionData *sd, - gpointer data) -{ - PsppireSyntaxWindow *syntax_window = data; - - if ( sd->length < 0 ) - return; - - if ( sd->type != gdk_atom_intern ("UTF8_STRING", FALSE)) - return; - - gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (syntax_window->buffer), - (gchar *) sd->data, - sd->length); - -} - static void on_edit_paste (PsppireSyntaxWindow *sw) { @@ -397,10 +377,7 @@ on_edit_paste (PsppireSyntaxWindow *sw) GtkClipboard *clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD); - gtk_clipboard_request_contents (clipboard, - gdk_atom_intern ("UTF8_STRING", TRUE), - contents_received_callback, - sw); + gtk_text_buffer_paste_clipboard (GTK_TEXT_BUFFER (sw->buffer), clipboard, NULL, TRUE); }