projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
psppire-data-sheet: Implement primary selection.
[pspp]
/
src
/
ui
/
gui
/
chi-square-dialog.c
diff --git
a/src/ui/gui/chi-square-dialog.c
b/src/ui/gui/chi-square-dialog.c
index c7aaf52b4cc6e7ce514dd7464dbdb077a2d97eb1..df408921d1e72d08d188fef40b222baee2703098 100644
(file)
--- a/
src/ui/gui/chi-square-dialog.c
+++ b/
src/ui/gui/chi-square-dialog.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2010, 2011 Free Software Foundation
+ Copyright (C) 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
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
@@
-23,9
+23,9
@@
#include "psppire-acr.h"
#include "dialog-common.h"
#include "psppire-acr.h"
#include "dialog-common.h"
-#include "
hel
per.h"
+#include "
builder-wrap
per.h"
#include "executor.h"
#include "executor.h"
-
+#include "helper.h"
#include <gtk/gtk.h>
#include <gtk/gtk.h>
@@
-46,14
+46,6
@@
struct chisquare_dialog
GtkListStore *expected_list;
};
GtkListStore *expected_list;
};
-static void
-set_sensitivity (GtkToggleButton *button, GtkWidget *w)
-{
- gboolean state = gtk_toggle_button_get_active (button);
- gtk_widget_set_sensitive (w, state);
-}
-
-
static gboolean
dialog_state_valid (gpointer data)
{
static gboolean
dialog_state_valid (gpointer data)
{
@@
-90,40
+82,35
@@
static char *
generate_syntax (const struct chisquare_dialog *scd)
{
gchar *text;
generate_syntax (const struct chisquare_dialog *scd)
{
gchar *text;
- GString *string;
-
+ struct string dss;
- string = g_string_new ("NPAR TEST\n\t/CHISQUARE=");
-
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (scd->var_view), 0, string);
+ ds_init_cstr (&dss, "NPAR TEST\n\t/CHISQUARE=");
+ psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (scd->var_view), 0, &dss);
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->range_button)))
{
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->range_button)))
{
-
g_string_append (string
, "(");
+
ds_put_cstr (&dss
, "(");
-
g_string_append (string
,
+
ds_put_cstr (&dss
,
gtk_entry_get_text (GTK_ENTRY (scd->value_lower)));
gtk_entry_get_text (GTK_ENTRY (scd->value_lower)));
-
g_string_append (string
, ", ");
+
ds_put_cstr (&dss
, ", ");
-
g_string_append (string
,
+
ds_put_cstr (&dss
,
gtk_entry_get_text (GTK_ENTRY (scd->value_upper)));
gtk_entry_get_text (GTK_ENTRY (scd->value_upper)));
-
g_string_append (string
, ")");
+
ds_put_cstr (&dss
, ")");
}
}
-
-
-
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->values_button)))
{
GtkListStore *ls = scd->expected_list;
GtkTreeIter iter;
gboolean ok;
if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->values_button)))
{
GtkListStore *ls = scd->expected_list;
GtkTreeIter iter;
gboolean ok;
-
g_string_append (string
, "\n\t");
-
g_string_append (string
, "/EXPECTED = ");
+
ds_put_cstr (&dss
, "\n\t");
+
ds_put_cstr (&dss
, "/EXPECTED = ");
for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(ls),
for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(ls),
@@
-135,18
+122,15
@@
generate_syntax (const struct chisquare_dialog *scd)
gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 0, &v, -1);
gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 0, &v, -1);
-
g_string_append_printf (string
, " %g", v);
+
ds_put_c_format (&dss
, " %g", v);
}
}
-
-
-
}
}
-
g_string_append (string
, ".\n");
+
ds_put_cstr (&dss
, ".\n");
- text =
string->str
;
+ text =
ds_steal_cstr (&dss)
;
-
g_string_free (string, FALSE
);
+
ds_destroy (&dss
);
return text;
}
return text;
}
@@
-162,7
+146,6
@@
chisquare_dialog (PsppireDataWindow *dw)
struct chisquare_dialog csd;
GtkBuilder *xml = builder_new ("chi-square.ui");
struct chisquare_dialog csd;
GtkBuilder *xml = builder_new ("chi-square.ui");
- PsppireVarStore *vs;
GtkWidget *dialog = get_widget_assert (xml, "chisquare-dialog");
GtkWidget *dialog = get_widget_assert (xml, "chisquare-dialog");
@@
-189,26
+172,24
@@
chisquare_dialog (PsppireDataWindow *dw)
csd.values_button = get_widget_assert (xml, "radiobutton2");
csd.values_button = get_widget_assert (xml, "radiobutton2");
- g_object_get (dw->data_editor, "var-store", &vs, NULL);
-
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (dw));
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (dw));
- g_object_get (
vs
, "dictionary", &csd.dict, NULL);
+ g_object_get (
dw->data_editor
, "dictionary", &csd.dict, NULL);
g_object_set (dict_view,
"model", csd.dict,
"predicate", var_is_numeric,
NULL);
g_object_set (dict_view,
"model", csd.dict,
"predicate", var_is_numeric,
NULL);
- g_signal_connect (csd.range_button, "toggled", G_CALLBACK (set_sensitivity),
+ g_signal_connect (csd.range_button, "toggled", G_CALLBACK (set_sensitivity
_from_toggle
),
range_table);
range_table);
- g_signal_connect (csd.values_button, "toggled", G_CALLBACK (set_sensitivity),
+ g_signal_connect (csd.values_button, "toggled", G_CALLBACK (set_sensitivity
_from_toggle
),
values_acr);
values_acr);
- g_signal_connect (csd.values_button, "toggled", G_CALLBACK (set_sensitivity),
+ g_signal_connect (csd.values_button, "toggled", G_CALLBACK (set_sensitivity
_from_toggle
),
expected_value_entry);
expected_value_entry);
@@
-237,5
+218,6
@@
chisquare_dialog (PsppireDataWindow *dw)
break;
}
break;
}
+ g_object_unref (csd.expected_list);
g_object_unref (xml);
}
g_object_unref (xml);
}