gui: Factor out duplicated code for executing and pasting syntax.
[pspp-builds.git] / src / ui / gui / correlation-dialog.c
index afc23447a7af3636e58b1b69b28f3864951e5b48..e0dfd89fe1251204f5c22198e4cde8d6dc23dc3c 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2009  Free Software Foundation
+   Copyright (C) 2009, 2010  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
 #include <config.h>
 
 #include "dialog-common.h"
-#include <language/syntax-string-source.h>
 #include <ui/syntax-gen.h>
 #include <libpspp/str.h>
 
@@ -118,22 +117,10 @@ correlation_dialog (PsppireDataWindow *de)
   switch (response)
     {
     case GTK_RESPONSE_OK:
-      {
-       gchar *syntax = generate_syntax (&rd);
-
-       struct getl_interface *sss = create_syntax_string_source (syntax);
-       execute_syntax (sss);
-
-       g_free (syntax);
-      }
+      g_free (execute_syntax_string (generate_syntax (&rd)));
       break;
     case PSPPIRE_RESPONSE_PASTE:
-      {
-       gchar *syntax = generate_syntax (&rd);
-        paste_syntax_to_window (syntax);
-
-       g_free (syntax);
-      }
+      g_free (paste_syntax_to_window (generate_syntax (&rd)));
       break;
     default:
       break;