Syntax Window: Simplify the Edit|Paste callback.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 7 Jan 2015 19:03:09 +0000 (20:03 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 7 Jan 2015 19:03:09 +0000 (20:03 +0100)
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.

src/ui/gui/psppire-syntax-window.c

index 8491eb3142c7be207f6f3d3d7d67d3498380c611..ca047560696b40ad9d5fc77b8086ac5b72c695f2 100644 (file)
@@ -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);
 }