Rewrite Import Dialog.
[pspp] / src / ui / gui / select-cases-dialog.c
index c3bc123c051f2fd42cc8a121ba316056ee148706..e7e8f004abea3de627bd1cac41979062ebf56095 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
 
    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,6 +17,7 @@
 #include <config.h>
 
 #include "select-cases-dialog.h"
+#include <float.h>
 #include <gtk/gtk.h>
 #include "executor.h"
 #include "psppire-dialog.h"
@@ -60,8 +61,8 @@ struct select_cases_dialog
 static gchar * generate_syntax (const struct select_cases_dialog *scd);
 
 
-static const gchar label1[]=N_("Approximately %3d%% of all cases.");
-static const gchar label2[]=N_("Exactly %3d cases from the first %3d cases.");
+static const gchar label1[] = N_("Approximately %3d%% of all cases.");
+static const gchar label2[] = N_("Exactly %3d cases from the first %3d cases.");
 
 
 static void
@@ -89,8 +90,10 @@ sample_subdialog (GtkButton *b, gpointer data)
 
       gtk_widget_show (scd->hbox1);
 
-      gtk_table_attach_defaults (GTK_TABLE (table),
-                                scd->hbox1, 1, 2, 0, 1);
+      gtk_grid_attach (GTK_GRID (table),
+                                scd->hbox1, 
+       1, 0, 
+       1, 1);
 
       g_signal_connect (percent, "toggled",
                        G_CALLBACK (set_sensitivity_from_toggle), scd->hbox1);
@@ -113,8 +116,9 @@ sample_subdialog (GtkButton *b, gpointer data)
       gtk_widget_show (scd->hbox2);
       gtk_widget_set_sensitive (scd->hbox2, FALSE);
 
-      gtk_table_attach_defaults (GTK_TABLE (table),
-                                scd->hbox2, 1, 2, 1, 2);
+      gtk_grid_attach (GTK_GRID (table),
+                                scd->hbox2, 
+       1, 1, 1, 1);
 
       g_signal_connect (sample_n_cases, "toggled",
                        G_CALLBACK (set_sensitivity_from_toggle), scd->hbox2);
@@ -388,9 +392,9 @@ generate_syntax_filter (const struct select_cases_dialog *scd)
            gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton));
 
          ds_put_c_format (&dss,
-                                 "COMPUTE %s = RV.UNIFORM (0,1) < %g.\n",
+                                 "COMPUTE %s = RV.UNIFORM (0,1) < %.*g.\n",
                                  filter,
-                                 percentage / 100.0 );
+                                  DBL_DIG + 1, percentage / 100.0 );
        }
       else
        {