Refactor common code in dialog implementations
[pspp-builds.git] / src / ui / gui / comments-dialog.c
index 9b521a7669fb1cfbe4f6f1063807078932e42880..34c9957d4fea4ea659f56b7e02e9e91b090dc2df 100644 (file)
@@ -21,7 +21,7 @@
 #include "psppire-data-window.h"
 #include "psppire-data-editor.h"
 #include <language/syntax-string-source.h>
-#include "psppire-syntax-window.h"
+#include "helper.h"
 #include "psppire-var-store.h"
 #include <ui/syntax-gen.h>
 
@@ -168,6 +168,7 @@ comments_dialog (GObject *o, gpointer data)
     case GTK_RESPONSE_OK:
       {
        gchar *syntax = generate_syntax (&cd);
+
        struct getl_interface *sss = create_syntax_string_source (syntax);
        execute_syntax (sss);
 
@@ -178,11 +179,7 @@ comments_dialog (GObject *o, gpointer data)
       {
        gchar *syntax = generate_syntax (&cd);
 
-        GtkWidget *se = psppire_syntax_window_new ();
-
-       gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1);
-
-       gtk_widget_show (se);
+       paste_syntax_in_new_window (syntax);
 
        g_free (syntax);
       }