X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fselect-cases-dialog.c;h=f9d0631ea221602bee6f93258dd065ffd3a3dcdc;hb=a9a69251edd625a50f271af5d64c157533b5fe48;hp=473dcdfb7ae51c0adcd742ab01cc08deaebf617d;hpb=6270a7f035e14fbad945a148a14d7c1006166eb1;p=pspp-builds.git diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c index 473dcdfb..f9d0631e 100644 --- a/src/ui/gui/select-cases-dialog.c +++ b/src/ui/gui/select-cases-dialog.c @@ -1,35 +1,33 @@ -/* - PSPPIRE --- A Graphical User Interface for PSPP - Copyright (C) 2007 Free Software Foundation +/* PSPPIRE - a graphical user interface for PSPP. + Copyright (C) 2007, 2008, 2009 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include #include "select-cases-dialog.h" #include -#include -#include "helper.h" +#include "executor.h" #include "psppire-dialog.h" -#include "data-editor.h" -#include "dialog-common.h" +#include "psppire-data-window.h" +#include "psppire-selector.h" #include "dict-display.h" +#include "dialog-common.h" #include "widget-io.h" #include -#include "syntax-editor.h" +#include "helper.h" +#include #include @@ -39,14 +37,13 @@ /* FIXME: These shouldn't be here */ -#include #include "psppire-data-store.h" struct select_cases_dialog { /* The XML that created the dialog */ - GladeXML *xml; + GtkBuilder *xml; GtkWidget *spinbutton ; GtkWidget *spinbutton1 ; @@ -114,7 +111,7 @@ sample_subdialog (GtkButton *b, gpointer data) gtk_table_attach_defaults (GTK_TABLE (table), scd->hbox1, 1, 2, 0, 1); - g_signal_connect (G_OBJECT (percent), "toggled", + g_signal_connect (percent, "toggled", G_CALLBACK (set_sensitivity_from_toggle), scd->hbox1); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (percent), TRUE); @@ -138,7 +135,7 @@ sample_subdialog (GtkButton *b, gpointer data) gtk_table_attach_defaults (GTK_TABLE (table), scd->hbox2, 1, 2, 1, 2); - g_signal_connect (G_OBJECT (sample_n_cases), "toggled", + g_signal_connect (sample_n_cases, "toggled", G_CALLBACK (set_sensitivity_from_toggle), scd->hbox2); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_n_cases), FALSE); @@ -245,20 +242,15 @@ select_cases_dialog (GObject *o, gpointer data) gint response; struct select_cases_dialog scd = {0,0,0,0,0,0}; GtkWidget *dialog ; - struct data_editor *de = data; + PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data); GtkWidget *entry = NULL; GtkWidget *selector ; GtkWidget *button_range; GtkWidget *button_sample; - scd.xml = XML_NEW ("psppire.glade"); - - { - GtkSheet *data_sheet = - GTK_SHEET (get_widget_assert (de->xml, "data_sheet")); + scd.xml = builder_new ("psppire.ui"); - scd.data_store = PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet)); - } + g_object_get (de->data_editor, "data-store", &scd.data_store, NULL); button_range = get_widget_assert (scd.xml, "button-range"); button_sample = get_widget_assert (scd.xml, "button-sample"); @@ -329,20 +321,20 @@ select_cases_dialog (GObject *o, gpointer data) dialog = get_widget_assert (scd.xml, "select-cases-dialog"); - gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de)); { GtkWidget *source = get_widget_assert (scd.xml, "select-cases-treeview"); - attach_dictionary_to_treeview (GTK_TREE_VIEW (source), - scd.data_store->dict, - GTK_SELECTION_SINGLE, NULL); + g_object_set (source, "model", + scd.data_store->dict, + "selection-mode", + GTK_SELECTION_SINGLE, NULL); psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), - source, - entry, insert_source_row_into_entry, - is_currently_in_entry); + is_currently_in_entry, + NULL); } @@ -362,6 +354,7 @@ select_cases_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&scd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -371,11 +364,7 @@ select_cases_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&scd); - - 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); } @@ -398,7 +387,7 @@ generate_syntax (const struct select_cases_dialog *scd) (GTK_TOGGLE_BUTTON (get_widget_assert (scd->xml, "radiobutton-all")))) { - return strdup ("\n"); + return xstrdup ("\n"); } string = g_string_new ("");