Convert kmeans dialog to a PsppireDialogAction
[pspp-builds.git] / src / ui / gui / roc-dialog.c
index 4d1a7d30b18ad435bf2b54decf5b755f48237269..2ecb47e95d5990d704ef1fc25ae11709dd4c48ef 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2009  Free Software Foundation
+   Copyright (C) 2009, 2010, 2011, 2012  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>
 
@@ -30,6 +29,7 @@
 #include "psppire-var-view.h"
 
 #include "executor.h"
+#include "builder-wrapper.h"
 #include "helper.h"
 
 #include <gtk/gtk.h>
@@ -119,13 +119,12 @@ on_curve_button_toggle  (GtkCheckButton *curve, struct roc *rd)
 
 /* Pops up the Roc dialog box */
 void
-roc_dialog (GObject *o, gpointer data)
+roc_dialog (PsppireDataWindow *de)
 {
   struct roc rd;
   gint response;
 
   GtkBuilder *xml = builder_new ("roc.ui");
-  PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
   PsppireVarStore *vs;
 
   GtkWidget *dialog = get_widget_assert   (xml, "roc-dialog");
@@ -155,27 +154,18 @@ roc_dialog (GObject *o, gpointer data)
   psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
                                      dialog_state_valid, &rd);
 
+  psppire_selector_set_allow (PSPPIRE_SELECTOR (get_widget_assert (xml, "dep-selector")),
+                             numeric_only);
+
   response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
 
   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 (de, generate_syntax (&rd)));
       break;
     case PSPPIRE_RESPONSE_PASTE:
-      {
-       gchar *syntax = generate_syntax (&rd);
-        paste_syntax_in_new_window (syntax);
-
-       g_free (syntax);
-      }
+      g_free (paste_syntax_to_window (generate_syntax (&rd)));
       break;
     default:
       break;