X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-roc.c;h=16f03da1ab623edb7642e237d0772aac6697b61f;hb=06e067364d01cc28df3c2d5cddec1c8668360386;hp=babd4b306aa65dab3ab14b8c9c81340b5b1f3686;hpb=048325896ed94bda4760b5ecbb1cfff4b56c166b;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-roc.c b/src/ui/gui/psppire-dialog-action-roc.c index babd4b306a..16f03da1ab 100644 --- a/src/ui/gui/psppire-dialog-action-roc.c +++ b/src/ui/gui/psppire-dialog-action-roc.c @@ -55,17 +55,17 @@ dialog_state_valid (gpointer data) var = psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION (rd)->dict, var_name); - if ( var == NULL) + if (var == NULL) return FALSE; width = var_get_width (var); value_init (&val, width); result = psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (rd->state_value), &val, width); - + if (var_is_value_missing (var, &val, MV_SYSTEM)) result = FALSE; - + value_destroy (&val, width); return result; @@ -74,13 +74,13 @@ dialog_state_valid (gpointer data) static void on_curve_button_toggle (GtkCheckButton *curve, PsppireDialogActionRoc *rd) { - if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve))) + if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve))) { - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference))) + 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 + else { g_object_set (rd->reference, "inconsistent", FALSE, NULL); g_object_set (rd->reference, "sensitive", TRUE, NULL); @@ -105,29 +105,29 @@ refresh (PsppireDialogAction *rd_) } static void -on_state_var_changed (GtkAction *a) +on_state_var_changed (PsppireDialogAction *a) { PsppireDialogActionRoc *act = PSPPIRE_DIALOG_ACTION_ROC (a); - PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); const gchar *var_name = gtk_entry_get_text (GTK_ENTRY(act->state_variable)); const struct variable *var = psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION(act)->dict, var_name); - if ( var == NULL) + if (var == NULL) return; psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->state_value), var); } -static void -psppire_dialog_action_roc_activate (GtkAction *a) +static GtkBuilder * +psppire_dialog_action_roc_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionRoc *act = PSPPIRE_DIALOG_ACTION_ROC (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); GtkBuilder *xml = builder_new ("roc.ui"); + pda->dialog = get_widget_assert (xml, "roc-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -143,8 +143,6 @@ psppire_dialog_action_roc_activate (GtkAction *a) g_signal_connect_swapped (act->state_variable, "changed", G_CALLBACK (on_state_var_changed), act); - g_object_unref (xml); - g_signal_connect (act->curve, "toggled", G_CALLBACK (on_curve_button_toggle), act); @@ -152,15 +150,13 @@ psppire_dialog_action_roc_activate (GtkAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - - if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_roc_parent_class)->activate) - PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_roc_parent_class)->activate (pda); + return xml; } static char * -generate_syntax (PsppireDialogAction *a) +generate_syntax (const PsppireDialogAction *a) { PsppireDialogActionRoc *rd = PSPPIRE_DIALOG_ACTION_ROC (a); gchar *text; @@ -189,10 +185,10 @@ generate_syntax (PsppireDialogAction *a) { struct string str; ds_init_empty (&str); - + syntax_gen_value (&str, &val, var_get_width (var), var_get_print_format (var)); - + g_string_append (string, ds_cstr (&str)); ds_destroy (&str); } @@ -204,10 +200,10 @@ generate_syntax (PsppireDialogAction *a) /* The /PLOT subcommand */ g_string_append (string, "\n\t/PLOT "); - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->curve))) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->curve))) { g_string_append (string, "CURVE"); - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference))) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference))) g_string_append (string, " (REFERENCE)"); } else @@ -215,15 +211,15 @@ generate_syntax (PsppireDialogAction *a) /* The /PRINT subcommand */ - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)) || - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)) ) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)) || + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates))) { g_string_append (string, "\n\t/PRINT"); - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error))) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error))) g_string_append (string, " SE"); - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates))) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates))) g_string_append (string, " COORDINATES"); } @@ -239,9 +235,7 @@ generate_syntax (PsppireDialogAction *a) static void psppire_dialog_action_roc_class_init (PsppireDialogActionRocClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = psppire_dialog_action_roc_activate; + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_roc_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }