New file: builder-wrapper.h and builder-wrapper.c
[pspp-builds.git] / src / ui / gui / reliability-dialog.c
index 8587b723f023eea6234aaadf344e3d075c53905e..c6433c1ff11eca19a839d2eaa98b2a7a42170737 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 "reliability-dialog.h"
 #include "psppire-selector.h"
 #include "psppire-dictview.h"
@@ -27,6 +26,7 @@
 #include "psppire-var-view.h"
 
 #include "executor.h"
+#include "builder-wrapper.h"
 #include "helper.h"
 
 #include <gtk/gtk.h>
@@ -43,6 +43,7 @@ struct reliability
   GtkWidget *variables;
   GtkWidget *split_point_hbox;
   GtkWidget *split_spinbutton;
+  GtkWidget *scale_if_item_deleted_checkbutton;
 };
 
 
@@ -93,6 +94,9 @@ refresh (PsppireDialog *dialog, struct reliability *rd)
 
   gtk_spin_button_set_range (GTK_SPIN_BUTTON (rd->split_spinbutton),
                             0, 0);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->scale_if_item_deleted_checkbutton),
+                               FALSE);
 }
 
 
@@ -128,6 +132,8 @@ reliability_dialog (PsppireDataWindow *de)
   rd.model_combo = get_widget_assert   (xml, "combobox1");
   rd.split_spinbutton = get_widget_assert (xml, "spinbutton1");
 
+  rd.scale_if_item_deleted_checkbutton = get_widget_assert (xml, "totals-checkbutton");
+
   g_signal_connect_swapped (rd.model_combo, "changed",
                            G_CALLBACK (on_method_change), &rd);
 
@@ -161,22 +167,10 @@ reliability_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 (de, 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;
@@ -207,6 +201,9 @@ generate_syntax (const struct reliability *rd)
                            gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rd->split_spinbutton))
                            );
 
+  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->scale_if_item_deleted_checkbutton)))
+    g_string_append (string, "\n\t/SUMMARY = TOTAL");
+
   g_string_append (string, ".\n");
 
   text = string->str;