projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Separated psppire_selector_set_subjects into two individual functions
[pspp-builds.git]
/
src
/
ui
/
gui
/
t-test-independent-samples-dialog.c
diff --git
a/src/ui/gui/t-test-independent-samples-dialog.c
b/src/ui/gui/t-test-independent-samples-dialog.c
index 9a396d9b669c1926ae4b6794534b90f8fffb1cf7..473e04e02b2f86d09dd150862cff4baadb4e78dd 100644
(file)
--- a/
src/ui/gui/t-test-independent-samples-dialog.c
+++ b/
src/ui/gui/t-test-independent-samples-dialog.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007 Free Software Foundation
+ Copyright (C) 2007
, 2009
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
@@
-17,23
+17,21
@@
#include <config.h>
#include <config.h>
-#include <glade/glade.h>
#include <gtk/gtk.h>
#include "t-test-independent-samples-dialog.h"
#include "psppire-dict.h"
#include "psppire-var-store.h"
#include <gtk/gtk.h>
#include "t-test-independent-samples-dialog.h"
#include "psppire-dict.h"
#include "psppire-var-store.h"
-#include "helper.h"
-#include <gtksheet/gtksheet.h>
-#include "data-editor.h"
+#include "executor.h"
+#include "psppire-data-window.h"
#include "psppire-dialog.h"
#include "dialog-common.h"
#include "dict-display.h"
#include "widget-io.h"
#include "t-test-options.h"
#include "psppire-dialog.h"
#include "dialog-common.h"
#include "dict-display.h"
#include "widget-io.h"
#include "t-test-options.h"
-#include <
libpspp
/syntax-gen.h>
+#include <
ui
/syntax-gen.h>
#include <language/syntax-string-source.h>
#include <language/syntax-string-source.h>
-#include "
syntax-edito
r.h"
+#include "
helpe
r.h"
#include <gl/xalloc.h>
#include <gl/xalloc.h>
@@
-92,7
+90,7
@@
tt_groups_dialog_destroy (struct tt_groups_dialog *grps)
}
static struct tt_groups_dialog *
}
static struct tt_groups_dialog *
-tt_groups_dialog_create (G
ladeXML
*xml, GtkWindow *parent)
+tt_groups_dialog_create (G
tkBuilder
*xml, GtkWindow *parent)
{
struct tt_groups_dialog *grps = xmalloc (sizeof (*grps));
{
struct tt_groups_dialog *grps = xmalloc (sizeof (*grps));
@@
-119,8
+117,8
@@
tt_groups_dialog_create (GladeXML *xml, GtkWindow *parent)
gtk_window_set_transient_for (GTK_WINDOW (grps->dialog), parent);
gtk_window_set_transient_for (GTK_WINDOW (grps->dialog), parent);
- grps->val[0] = strdup ("");
- grps->val[1] = strdup ("");
+ grps->val[0] =
x
strdup ("");
+ grps->val[1] =
x
strdup ("");
return grps;
}
return grps;
}
@@
-128,7
+126,7
@@
tt_groups_dialog_create (GladeXML *xml, GtkWindow *parent)
struct tt_indep_samples_dialog
{
struct tt_indep_samples_dialog
{
- G
ladeXML
*xml; /* The xml that generated the widgets */
+ G
tkBuilder
*xml; /* The xml that generated the widgets */
GtkWidget *dialog;
PsppireDict *dict;
GtkWidget *define_groups_button;
GtkWidget *dialog;
PsppireDict *dict;
GtkWidget *define_groups_button;
@@
-162,7
+160,7
@@
generate_syntax (const struct tt_indep_samples_dialog *d)
GString *str = g_string_new ("T-TEST /VARIABLES=");
GString *str = g_string_new ("T-TEST /VARIABLES=");
- append_variable_names (str, d->dict, GTK_TREE_VIEW (tv));
+ append_variable_names (str, d->dict, GTK_TREE_VIEW (tv)
, 0
);
g_string_append (str, "\n\t/GROUPS=");
g_string_append (str, "\n\t/GROUPS=");
@@
-178,9
+176,8
@@
generate_syntax (const struct tt_indep_samples_dialog *d)
if ( var_is_alpha (group_variable))
{
if ( var_is_alpha (group_variable))
{
- struct string s;
- ds_init_cstr (&s, d->grps->val[0]);
- gen_quoted_string (&s);
+ struct string s = DS_EMPTY_INITIALIZER;
+ syntax_gen_string (&s, ss_cstr (d->grps->val[0]));
g_string_append (str, ds_cstr (&s));
ds_destroy (&s);
}
g_string_append (str, ds_cstr (&s));
ds_destroy (&s);
}
@@
-195,9
+192,8
@@
generate_syntax (const struct tt_indep_samples_dialog *d)
if ( var_is_alpha (group_variable))
{
if ( var_is_alpha (group_variable))
{
- struct string s;
- ds_init_cstr (&s, d->grps->val[1]);
- gen_quoted_string (&s);
+ struct string s = DS_EMPTY_INITIALIZER;
+ syntax_gen_string (&s, ss_cstr (d->grps->val[1]));
g_string_append (str, ds_cstr (&s));
ds_destroy (&s);
}
g_string_append (str, ds_cstr (&s));
ds_destroy (&s);
}
@@
-344,10
+340,10
@@
run_define_groups (struct tt_indep_samples_dialog *ttd)
grps->group_defn = GROUPS_VALUES;
grps->val[0] =
grps->group_defn = GROUPS_VALUES;
grps->val[0] =
- strdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[0])));
+
x
strdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[0])));
grps->val[1] =
grps->val[1] =
- strdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[1])));
+
x
strdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[1])));
}
else
{
}
else
{
@@
-356,7
+352,7
@@
run_define_groups (struct tt_indep_samples_dialog *ttd)
grps->val[1] = NULL;
grps->val[0] =
grps->val[1] = NULL;
grps->val[0] =
- strdup (gtk_entry_get_text (GTK_ENTRY (grps->cut_point_entry)));
+
x
strdup (gtk_entry_get_text (GTK_ENTRY (grps->cut_point_entry)));
}
psppire_dialog_notify_change (PSPPIRE_DIALOG (ttd->dialog));
}
psppire_dialog_notify_change (PSPPIRE_DIALOG (ttd->dialog));
@@
-395,14
+391,11
@@
t_test_independent_samples_dialog (GObject *o, gpointer data)
{
struct tt_indep_samples_dialog tt_d;
gint response;
{
struct tt_indep_samples_dialog tt_d;
gint response;
- struct data_editor *de = data;
-
- PsppireVarStore *vs;
+ PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
-
GladeXML *xml = XML_NEW ("t-test.glade")
;
+
PsppireVarStore *vs = NULL
;
- GtkSheet *var_sheet =
- GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
+ GtkBuilder *xml = builder_new ("t-test.ui");
GtkWidget *dict_view =
get_widget_assert (xml, "indep-samples-t-test-treeview1");
GtkWidget *dict_view =
get_widget_assert (xml, "indep-samples-t-test-treeview1");
@@
-417,31
+410,28
@@
t_test_independent_samples_dialog (GObject *o, gpointer data)
get_widget_assert (xml, "indep-samples-t-test-selector1");
GtkWidget *options_button =
get_widget_assert (xml, "indep-samples-t-test-selector1");
GtkWidget *options_button =
- get_widget_assert (xml, "options-button");
+ get_widget_assert (xml, "
indep-samples-t-test-
options-button");
-
vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet)
);
+
g_object_get (de->data_editor, "var-store", &vs, NULL
);
tt_d.dialog = get_widget_assert (xml, "t-test-independent-samples-dialog");
tt_d.xml = xml;
tt_d.dialog = get_widget_assert (xml, "t-test-independent-samples-dialog");
tt_d.xml = xml;
-
tt_d.dict = vs->dict
;
+
g_object_get (vs, "dictionary", &tt_d.dict, NULL)
;
tt_d.define_groups_button = get_widget_assert (xml, "define-groups-button");
tt_d.groups_entry = get_widget_assert (xml, "indep-samples-t-test-entry");
tt_d.define_groups_button = get_widget_assert (xml, "define-groups-button");
tt_d.groups_entry = get_widget_assert (xml, "indep-samples-t-test-entry");
- tt_d.opts = tt_options_dialog_create (xml,
de->parent.window
);
- tt_d.grps = tt_groups_dialog_create (xml,
de->parent.window
);
+ tt_d.opts = tt_options_dialog_create (xml,
GTK_WINDOW (de)
);
+ tt_d.grps = tt_groups_dialog_create (xml,
GTK_WINDOW (de)
);
- gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog),
de->parent.window
);
+ gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog),
GTK_WINDOW (de)
);
- attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
- vs->dict,
- GTK_SELECTION_MULTIPLE, NULL);
+ g_object_set (dict_view, "model", tt_d.dict, NULL);
- set_dest_model (GTK_TREE_VIEW (test_variables_treeview),
vs->
dict);
+ set_dest_model (GTK_TREE_VIEW (test_variables_treeview),
tt_d.
dict);
- psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
- dict_view, test_variables_treeview,
+ psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1),
insert_source_row_into_tree_view,
NULL);
insert_source_row_into_tree_view,
NULL);
@@
-449,9
+439,11
@@
t_test_independent_samples_dialog (GObject *o, gpointer data)
numeric_only);
numeric_only);
- psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2),
- dict_view, tt_d.groups_entry,
+ psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2),
insert_source_row_into_entry,
insert_source_row_into_entry,
+ NULL);
+
+ psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2),
is_currently_in_entry);
g_signal_connect_swapped (tt_d.define_groups_button, "clicked",
is_currently_in_entry);
g_signal_connect_swapped (tt_d.define_groups_button, "clicked",
@@
-479,6
+471,7
@@
t_test_independent_samples_dialog (GObject *o, gpointer data)
case GTK_RESPONSE_OK:
{
gchar *syntax = generate_syntax (&tt_d);
case GTK_RESPONSE_OK:
{
gchar *syntax = generate_syntax (&tt_d);
+
struct getl_interface *sss = create_syntax_string_source (syntax);
execute_syntax (sss);
struct getl_interface *sss = create_syntax_string_source (syntax);
execute_syntax (sss);
@@
-488,12
+481,7
@@
t_test_independent_samples_dialog (GObject *o, gpointer data)
case PSPPIRE_RESPONSE_PASTE:
{
gchar *syntax = generate_syntax (&tt_d);
case PSPPIRE_RESPONSE_PASTE:
{
gchar *syntax = generate_syntax (&tt_d);
-
- struct syntax_editor *se =
- (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
-
- gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
-
+ paste_syntax_in_new_window (syntax);
g_free (syntax);
}
break;
g_free (syntax);
}
break;