-/* 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 check_output_specifier (f, true);
-}
-
-
-
-
-/* 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 = NUMERIC;
- gint new_width = 0;
- bool result = false;
- struct fmt_spec spec;
- switch (dialog->active_button)
- {
- case BUTTON_STRING:
- new_type = ALPHA;
- 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(check_output_specifier(&dialog->fmt_l, TRUE));
- 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 )
- {
- psppire_variable_set_type(dialog->pv, new_type);
- psppire_variable_set_width(dialog->pv, new_width);
- psppire_variable_set_write_spec(dialog->pv, spec);
- psppire_variable_set_print_spec(dialog->pv, spec);
- }
-
- }
- gtk_widget_hide(dialog->window);
-
- return FALSE;