X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fhelper.c;h=e6f7c672b0ab7b59d41d8cbe7bc9af19036f3139;hb=5d1e3437ae5fe29a75c984b9d24b77120a56deb4;hp=e25342ed0dc2a472a54db9c256bc3fa48642fed6;hpb=26c0db0a90c83201a90583e2b9afa3c11f08ec2d;p=pspp-builds.git diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index e25342ed..e6f7c672 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -40,6 +40,7 @@ #include #include "psppire-data-store.h" +#include "psppire.h" #include "gl/configmake.h" #include "xalloc.h" @@ -274,14 +275,35 @@ clone_list_store (const GtkListStore *src) } + + +static gboolean +on_delete (GtkWindow *window, GdkEvent *e, GtkWindow **addr) +{ + *addr = NULL; + + return FALSE; +} + void paste_syntax_in_new_window (const gchar *syntax) { - GtkWidget *se = psppire_syntax_window_new (); + static GtkWidget *the_syntax_pasteboard = NULL; + + if ( NULL == the_syntax_pasteboard) + { + the_syntax_pasteboard = psppire_syntax_window_new (); + g_signal_connect (the_syntax_pasteboard, "delete-event", G_CALLBACK (on_delete), + &the_syntax_pasteboard); + } + + gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (the_syntax_pasteboard)->buffer, + syntax, -1); - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); + gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (the_syntax_pasteboard)->buffer, + "\n", 1); - gtk_widget_show (se); + gtk_widget_show (the_syntax_pasteboard); }