X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Froc-dialog.c;h=a024c9c46dbb080f7ac2bc2057cc17659ab5b5e7;hb=724be9e4720784aafeac395b3f6df47a89fc5e07;hp=6896ef7b2d183997c63dc5183eec9f192e8af811;hpb=bb025f49673d66a2e490a781d7d59b2f32da0087;p=pspp diff --git a/src/ui/gui/roc-dialog.c b/src/ui/gui/roc-dialog.c index 6896ef7b2d..a024c9c46d 100644 --- a/src/ui/gui/roc-dialog.c +++ b/src/ui/gui/roc-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2009 Free Software Foundation + Copyright (C) 2009, 2010, 2011 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,7 +17,6 @@ #include #include "dialog-common.h" -#include #include #include @@ -100,16 +99,31 @@ dialog_state_valid (gpointer data) return TRUE; } +static void +on_curve_button_toggle (GtkCheckButton *curve, struct roc *rd) +{ + if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve))) + { + if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference))) + g_object_set (rd->reference, "inconsistent", TRUE, NULL); + g_object_set (rd->reference, "sensitive", FALSE, NULL); + } + else + { + g_object_set (rd->reference, "inconsistent", FALSE, NULL); + g_object_set (rd->reference, "sensitive", TRUE, NULL); + } +} + /* Pops up the Roc dialog box */ void -roc_dialog (GObject *o, gpointer data) +roc_dialog (PsppireDataWindow *de) { struct roc rd; gint response; GtkBuilder *xml = builder_new ("roc.ui"); - PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data); PsppireVarStore *vs; GtkWidget *dialog = get_widget_assert (xml, "roc-dialog"); @@ -132,32 +146,25 @@ roc_dialog (GObject *o, gpointer data) g_object_get (vs, "dictionary", &rd.dict, NULL); g_object_set (source, "model", rd.dict, NULL); + g_signal_connect (rd.curve, "toggled", G_CALLBACK (on_curve_button_toggle), &rd); + g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh), &rd); psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog), dialog_state_valid, &rd); + psppire_selector_set_allow (PSPPIRE_SELECTOR (get_widget_assert (xml, "dep-selector")), + numeric_only); + response = psppire_dialog_run (PSPPIRE_DIALOG (dialog)); switch (response) { case GTK_RESPONSE_OK: - { - gchar *syntax = generate_syntax (&rd); - - struct getl_interface *sss = create_syntax_string_source (syntax); - execute_syntax (sss); - - g_free (syntax); - } + g_free (execute_syntax_string (de, generate_syntax (&rd))); break; case PSPPIRE_RESPONSE_PASTE: - { - gchar *syntax = generate_syntax (&rd); - paste_syntax_in_new_window (syntax); - - g_free (syntax); - } + g_free (paste_syntax_to_window (generate_syntax (&rd))); break; default: break;