X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fmissing-val-dialog.c;h=d21facefe7bda7fb89850a2e3ada4a670052c037;hb=f0a97665bec482adcf0bfe2d534cf5985e4dbb72;hp=af63af1fd3a38a00f824718dd73fa86e8c345fd5;hpb=1ba340431adf57259c6bbae1dd58bafd78cce84b;p=pspp diff --git a/src/ui/gui/missing-val-dialog.c b/src/ui/gui/missing-val-dialog.c index af63af1fd3..d21facefe7 100644 --- a/src/ui/gui/missing-val-dialog.c +++ b/src/ui/gui/missing-val-dialog.c @@ -1,5 +1,6 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2005, 2006, 2009, 2011, 2012, 2015 Free Software Foundation + Copyright (C) 2005, 2006, 2009, 2011, 2012, 2015, 2016, + 2020 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 @@ -151,7 +152,7 @@ psppire_missing_val_dialog_new (const struct variable *var) NULL)); } -void +gint psppire_missing_val_dialog_run (GtkWindow *parent_window, const struct variable *var, struct missing_values *mv) @@ -163,12 +164,14 @@ psppire_missing_val_dialog_run (GtkWindow *parent_window, gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_widget_show (GTK_WIDGET (dialog)); - if (psppire_dialog_run (PSPPIRE_DIALOG (dialog)) == GTK_RESPONSE_OK) + gint result = psppire_dialog_run (PSPPIRE_DIALOG (dialog)); + if (result == GTK_RESPONSE_OK) mv_copy (mv, psppire_missing_val_dialog_get_missing_values (dialog)); else mv_copy (mv, var_get_missing_values (var)); gtk_widget_destroy (GTK_WIDGET (dialog)); + return result; } @@ -181,7 +184,7 @@ err_dialog (const gchar *msg, GtkWindow *window) GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - msg); + "%s",msg); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -231,19 +234,19 @@ missing_val_dialog_acceptable (gpointer data) PsppireMissingValDialog *dialog = data; int var_width = fmt_var_width (&dialog->format); - if ( gtk_toggle_button_get_active (dialog->button_discrete)) + if (gtk_toggle_button_get_active (dialog->button_discrete)) { gint nvals = 0; gint i; mv_clear(&dialog->mvl); - for(i = 0 ; i < 3 ; ++i ) + for(i = 0 ; i < 3 ; ++i) { gchar *text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->mv[i]))); union value v; - if ( !text || strlen (g_strstrip (text)) == 0 ) + if (!text || strlen (g_strstrip (text)) == 0) { g_free (text); continue; @@ -260,7 +263,7 @@ missing_val_dialog_acceptable (gpointer data) g_free (text); value_destroy (&v, var_width); } - if ( nvals == 0 ) + if (nvals == 0) { err_dialog (_("At least one value must be specified"), GTK_WINDOW (dialog)); @@ -306,7 +309,7 @@ missing_val_dialog_acceptable (gpointer data) discrete_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->discrete))); - if ( discrete_text && strlen (g_strstrip (discrete_text)) > 0 ) + if (discrete_text && strlen (g_strstrip (discrete_text)) > 0) { union value discrete_val; if (!try_missing_value (dialog, discrete_text, &discrete_val)) @@ -335,7 +338,7 @@ discrete (GtkToggleButton *button, gpointer data) gint i; PsppireMissingValDialog *dialog = data; - for (i = 0 ; i < 3 ; ++i ) + for (i = 0 ; i < 3 ; ++i) { gtk_widget_set_sensitive (dialog->mv[i], gtk_toggle_button_get_active (button)); @@ -372,6 +375,9 @@ psppire_missing_val_dialog_constructor (GType type, type, n_properties, properties); dialog = PSPPIRE_MISSING_VAL_DIALOG (obj); + g_object_set (dialog, "help-page", "Missing-Observations", + "title", _("Missing Values"), NULL); + content_area = GTK_CONTAINER (PSPPIRE_DIALOG (dialog)); xml = builder_new ("missing-val-dialog.ui"); gtk_container_add (GTK_CONTAINER (content_area), @@ -452,13 +458,13 @@ psppire_missing_val_dialog_set_variable (PsppireMissingValDialog *dialog, if (var == NULL) return; - for (i = 0 ; i < 3 ; ++i ) + for (i = 0 ; i < 3 ; ++i) { gtk_entry_set_text (GTK_ENTRY (dialog->mv[i]), ""); gtk_widget_set_sensitive (dialog->mv[i], FALSE); } - if ( mv_has_range (&dialog->mvl)) + if (mv_has_range (&dialog->mvl)) { union value low, high; gchar *low_text; @@ -474,7 +480,7 @@ psppire_missing_val_dialog_set_variable (PsppireMissingValDialog *dialog, g_free (low_text); g_free (high_text); - if ( mv_has_value (&dialog->mvl)) + if (mv_has_value (&dialog->mvl)) { gchar *text; text = value_to_text__ (*mv_get_value (&dialog->mvl, 0), @@ -489,13 +495,13 @@ psppire_missing_val_dialog_set_variable (PsppireMissingValDialog *dialog, gtk_widget_set_sensitive (dialog->discrete, TRUE); } - else if ( mv_has_value (&dialog->mvl)) + else if (mv_has_value (&dialog->mvl)) { const int n = mv_n_values (&dialog->mvl); - for (i = 0 ; i < 3 ; ++i ) + for (i = 0 ; i < 3 ; ++i) { - if ( i < n) + if (i < n) { gchar *text ; @@ -508,7 +514,7 @@ psppire_missing_val_dialog_set_variable (PsppireMissingValDialog *dialog, } gtk_toggle_button_set_active (dialog->button_discrete, TRUE); } - else if ( mv_is_empty (&dialog->mvl)) + else if (mv_is_empty (&dialog->mvl)) { gtk_toggle_button_set_active (dialog->button_none, TRUE); }