X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Foneway-anova-dialog.c;h=7992b94c71c91c7637c2252fc51b1620c42e74de;hb=bea8b007855970c07083dbec5b5cc90f33990957;hp=59b65b4a2487dfc1ce793381d407cc1e6cb402f9;hpb=a992bf1121d3e1eef76fd6184b95fe079bb91558;p=pspp diff --git a/src/ui/gui/oneway-anova-dialog.c b/src/ui/gui/oneway-anova-dialog.c index 59b65b4a24..7992b94c71 100644 --- a/src/ui/gui/oneway-anova-dialog.c +++ b/src/ui/gui/oneway-anova-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007 Free Software Foundation + Copyright (C) 2007, 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 @@ -15,23 +15,21 @@ along with this program. If not, see . */ - #include #include #include "oneway-anova-dialog.h" #include "psppire-dict.h" -#include "psppire-var-store.h" -#include "helper.h" -#include "data-editor.h" +#include "psppire-var-view.h" +#include "builder-wrapper.h" +#include "psppire-data-window.h" #include "psppire-dialog.h" #include "dialog-common.h" -#include "dict-display.h" #include "psppire-acr.h" +#include "psppire-selector.h" +#include "dict-display.h" - -#include -#include "syntax-editor.h" - +#include "executor.h" +#include "helper.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -123,12 +121,9 @@ refresh (struct oneway_anova_dialog *ow) /* Pops up the dialog box */ void -oneway_anova_dialog (GObject *o, gpointer data) +oneway_anova_dialog (PsppireDataWindow *de) { gint response; - struct data_editor *de = data; - - PsppireVarStore *vs = NULL; struct oneway_anova_dialog ow; @@ -140,9 +135,6 @@ oneway_anova_dialog (GObject *o, gpointer data) GtkWidget *selector2 = get_widget_assert (builder, "oneway-anova-selector2"); - GtkWidget *selector1 = - get_widget_assert (builder, "oneway-anova-selector1"); - GtkWidget *contrasts_button = get_widget_assert (builder, "contrasts-button"); @@ -161,35 +153,18 @@ oneway_anova_dialog (GObject *o, gpointer data) ow.homogeneity = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "checkbutton2")); - g_object_get (de->data_editor, "var-store", &vs, NULL); - - ow.dict = vs->dict; + g_object_get (de->data_editor, "dictionary", &ow.dict, NULL); ow.dialog = GTK_WINDOW (get_widget_assert (builder, "oneway-anova-dialog")); - gtk_window_set_transient_for (ow.dialog, de->parent.window); - - attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view), - vs->dict, - GTK_SELECTION_MULTIPLE, NULL); - - set_dest_model (GTK_TREE_VIEW (ow.vars_treeview), vs->dict); - - - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1), - dict_view, ow.vars_treeview, - insert_source_row_into_tree_view, - NULL, - NULL); + gtk_window_set_transient_for (ow.dialog, GTK_WINDOW (de)); + g_object_set (dict_view, "model", ow.dict, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2), - dict_view, ow.factor_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 (ow.dialog, "refresh", G_CALLBACK (refresh), &ow); @@ -222,7 +197,7 @@ oneway_anova_dialog (GObject *o, gpointer data) psppire_acr_set_entry (cd->acr, entry); gtk_window_set_transient_for (GTK_WINDOW (cd->contrasts_dialog), - de->parent.window); + GTK_WINDOW (de)); } response = psppire_dialog_run (PSPPIRE_DIALOG (ow.dialog)); @@ -230,25 +205,10 @@ oneway_anova_dialog (GObject *o, gpointer data) switch (response) { case GTK_RESPONSE_OK: - { - gchar *syntax = generate_syntax (&ow); - struct getl_interface *sss = create_syntax_string_source (syntax); - execute_syntax (sss); - - g_free (syntax); - } + g_free (execute_syntax_string (de, generate_syntax (&ow))); break; case PSPPIRE_RESPONSE_PASTE: - { - gchar *syntax = generate_syntax (&ow); - - struct syntax_editor *se = - (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL); - - gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1); - - g_free (syntax); - } + g_free (paste_syntax_to_window (generate_syntax (&ow))); break; default: break; @@ -269,7 +229,7 @@ static gchar * generate_syntax (const struct oneway_anova_dialog *ow) GString *str = g_string_new ("ONEWAY /VARIABLES="); - append_variable_names (str, ow->dict, GTK_TREE_VIEW (ow->vars_treeview), 0); + psppire_var_view_append_names (PSPPIRE_VAR_VIEW (ow->vars_treeview), 0, str); g_string_append (str, " BY ");