X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fhelper.c;h=492797dbbad8885b405a866329fd5d94982295b0;hb=4d7bacdd25f6404e10e8e5de894e875235e43cfa;hp=e25342ed0dc2a472a54db9c256bc3fa48642fed6;hpb=cd7df218e1f2798b4ac8e193558a67e6ad59e3ed;p=pspp-builds.git diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index e25342ed..492797db 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) +paste_syntax_to_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); }