-}
-
-
-/* Popup the dialog box */
-void
-var_type_dialog_show (struct var_type_dialog *dialog)
-{
- var_type_dialog_set_state (dialog);
-
- gtk_widget_show (dialog->window);
-}
-
-/* Fills F with an output format specification with type TYPE, width
- W, and D decimals. Iff it's a valid format, then return true.
-*/
-static bool
-make_output_format_try (struct fmt_spec *f, int type, int w, int d)
-{
- f->type = type;
- f->w = w;
- f->d = d;
- return fmt_check_output (f);
-}
-
-
-
-
-/* Callbacks for the Variable Type Dialog Box */
-
-/* Callback for when the var type dialog is closed using the OK button.
- It sets the appropriate variable accordingly. */
-static gint
-on_var_type_ok_clicked (GtkWidget *w, gpointer data)
-{
- struct var_type_dialog *dialog = data;
-
- g_assert (dialog);
- g_assert (dialog->pv);
-
- {
- gint width = atoi (gtk_entry_get_text
- (GTK_ENTRY (dialog->entry_width)));
-
- gint decimals = atoi (gtk_entry_get_text
- (GTK_ENTRY (dialog->entry_decimals)));
-
- gint new_type = VAR_NUMERIC;
- gint new_width = 0;
- bool result = false;
- struct fmt_spec spec;
- switch (dialog->active_button)
- {
- case BUTTON_STRING:
- new_type = VAR_STRING;
- new_width = width;
- result = make_output_format_try (&spec, FMT_A, width, 0);
- break;
- case BUTTON_NUMERIC:
- result = make_output_format_try (&spec, FMT_F, width, decimals);
- break;
- case BUTTON_COMMA:
- result = make_output_format_try (&spec, FMT_COMMA, width, decimals);
- break;
- case BUTTON_DOT:
- result = make_output_format_try (&spec, FMT_DOT, width, decimals);
- break;
- case BUTTON_SCIENTIFIC:
- result = make_output_format_try (&spec, FMT_E, width, decimals);
- break;
- case BUTTON_DATE:
- case BUTTON_CUSTOM:
- g_assert (fmt_check_output (&dialog->fmt_l));
- result = memcpy (&spec, &dialog->fmt_l, sizeof (struct fmt_spec));
- break;
- case BUTTON_DOLLAR:
- result = make_output_format_try (&spec, FMT_DOLLAR, width, decimals);
- break;
- default:
- g_print ("Unknown variable type: %d\n", dialog->active_button) ;
- result = false;
- break;
- }
-
- if ( result == true )
- {
- var_set_width (dialog->pv, new_width);
- var_set_both_formats (dialog->pv, &spec);
- }