X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Ft-test-independent-samples-dialog.c;h=2da218e529058762dff7fe321848b4bb317189ff;hb=0c5217288cb57d0994d4c99997f5341e2c3a6871;hp=a54a94addccebf7bf758a1d4e848cf650d126338;hpb=c7b5e2dcfaeb0221b801dc3cc9fa1ab9a4ec5861;p=pspp-builds.git diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c index a54a94ad..2da218e5 100644 --- 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. - Copyright (C) 2007 Free Software Foundation + Copyright (C) 2007, 2009, 2010 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,12 +17,12 @@ #include -#include #include #include "t-test-independent-samples-dialog.h" #include "psppire-dict.h" #include "psppire-var-store.h" -#include "helper.h" +#include "psppire-var-view.h" +#include "executor.h" #include "psppire-data-window.h" #include "psppire-dialog.h" #include "dialog-common.h" @@ -31,8 +31,7 @@ #include "t-test-options.h" #include -#include -#include "psppire-syntax-window.h" +#include "helper.h" #include @@ -91,7 +90,7 @@ tt_groups_dialog_destroy (struct tt_groups_dialog *grps) } static struct tt_groups_dialog * -tt_groups_dialog_create (GladeXML *xml, GtkWindow *parent) +tt_groups_dialog_create (GtkBuilder *xml, GtkWindow *parent) { struct tt_groups_dialog *grps = xmalloc (sizeof (*grps)); @@ -118,8 +117,8 @@ tt_groups_dialog_create (GladeXML *xml, GtkWindow *parent) gtk_window_set_transient_for (GTK_WINDOW (grps->dialog), parent); - grps->val[0] = strdup (""); - grps->val[1] = strdup (""); + grps->val[0] = xstrdup (""); + grps->val[1] = xstrdup (""); return grps; } @@ -127,7 +126,7 @@ tt_groups_dialog_create (GladeXML *xml, GtkWindow *parent) struct tt_indep_samples_dialog { - GladeXML *xml; /* The xml that generated the widgets */ + GtkBuilder *xml; /* The xml that generated the widgets */ GtkWidget *dialog; PsppireDict *dict; GtkWidget *define_groups_button; @@ -161,7 +160,7 @@ generate_syntax (const struct tt_indep_samples_dialog *d) GString *str = g_string_new ("T-TEST /VARIABLES="); - append_variable_names (str, d->dict, GTK_TREE_VIEW (tv), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (tv), 0, str); g_string_append (str, "\n\t/GROUPS="); @@ -341,10 +340,10 @@ run_define_groups (struct tt_indep_samples_dialog *ttd) grps->group_defn = GROUPS_VALUES; grps->val[0] = - strdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[0]))); + xstrdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[0]))); grps->val[1] = - strdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[1]))); + xstrdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[1]))); } else { @@ -353,7 +352,7 @@ run_define_groups (struct tt_indep_samples_dialog *ttd) grps->val[1] = NULL; grps->val[0] = - strdup (gtk_entry_get_text (GTK_ENTRY (grps->cut_point_entry))); + xstrdup (gtk_entry_get_text (GTK_ENTRY (grps->cut_point_entry))); } psppire_dialog_notify_change (PSPPIRE_DIALOG (ttd->dialog)); @@ -388,22 +387,18 @@ dialog_state_valid (gpointer data) /* Pops up the dialog box */ void -t_test_independent_samples_dialog (GObject *o, gpointer data) +t_test_independent_samples_dialog (PsppireDataWindow *de) { struct tt_indep_samples_dialog tt_d; gint response; - PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data); PsppireVarStore *vs = NULL; - GladeXML *xml = XML_NEW ("t-test.glade"); + GtkBuilder *xml = builder_new ("t-test.ui"); GtkWidget *dict_view = get_widget_assert (xml, "indep-samples-t-test-treeview1"); - GtkWidget *test_variables_treeview = - get_widget_assert (xml, "indep-samples-t-test-treeview2"); - GtkWidget *selector2 = get_widget_assert (xml, "indep-samples-t-test-selector2"); @@ -417,7 +412,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) 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"); @@ -427,28 +422,14 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) 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); - - set_dest_model (GTK_TREE_VIEW (test_variables_treeview), vs->dict); - - - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1), - dict_view, test_variables_treeview, - insert_source_row_into_tree_view, - NULL, - NULL); + g_object_set (dict_view, "model", tt_d.dict, NULL); psppire_selector_set_allow (PSPPIRE_SELECTOR (selector1), numeric_only); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2), - dict_view, tt_d.groups_entry, - insert_source_row_into_entry, - is_currently_in_entry, - NULL); + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), + is_currently_in_entry); g_signal_connect_swapped (tt_d.define_groups_button, "clicked", G_CALLBACK (run_define_groups), &tt_d); @@ -473,26 +454,10 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) switch (response) { case GTK_RESPONSE_OK: - { - gchar *syntax = generate_syntax (&tt_d); - struct getl_interface *sss = create_syntax_string_source (syntax); - execute_syntax (sss); - - g_free (syntax); - } + g_free (execute_syntax_string (generate_syntax (&tt_d))); break; case PSPPIRE_RESPONSE_PASTE: - { - gchar *syntax = generate_syntax (&tt_d); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - - g_free (syntax); - } + g_free (paste_syntax_to_window (generate_syntax (&tt_d))); break; default: break;