+static void
+psppire_var_type_dialog_set_format (PsppireVarTypeDialog *dialog,
+ const struct fmt_spec *format)
+{
+ dialog->base_format = *format;
+ psppire_var_type_dialog_set_state (dialog);
+}
+
+static const struct fmt_spec *
+psppire_var_type_dialog_get_format (const PsppireVarTypeDialog *dialog)
+{
+ return &dialog->fmt_l;
+}
+
+static void
+psppire_var_type_dialog_init (PsppireVarTypeDialog *obj)
+{
+ /* We do all of our work on widgets in the constructor function, because that
+ runs after the construction properties have been set. Otherwise
+ PsppireDialog's "orientation" property hasn't been set and therefore we
+ have no box to populate. */
+ obj->base_format = F_8_0;
+ obj->fmt_l = F_8_0;
+}
+
+static void
+psppire_var_type_dialog_class_init (PsppireVarTypeDialogClass *class)
+{
+ GObjectClass *gobject_class;
+ gobject_class = G_OBJECT_CLASS (class);
+
+ gobject_class->constructor = psppire_var_type_dialog_constructor;
+ gobject_class->set_property = psppire_var_type_dialog_set_property;
+ gobject_class->get_property = psppire_var_type_dialog_get_property;
+
+ g_object_class_install_property (
+ gobject_class, PROP_FORMAT,
+ g_param_spec_boxed ("format",
+ "Format",
+ "The format being edited.",
+ PSPPIRE_TYPE_FORMAT,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+PsppireVarTypeDialog *
+psppire_var_type_dialog_new (const struct fmt_spec *format)
+{
+ return PSPPIRE_VAR_TYPE_DIALOG (
+ g_object_new (PSPPIRE_TYPE_VAR_TYPE_DIALOG,
+ "format", format,
+ NULL));
+}
+
+void
+psppire_var_type_dialog_run (GtkWindow *parent_window,
+ struct fmt_spec *format)
+{
+ PsppireVarTypeDialog *dialog;
+
+ dialog = psppire_var_type_dialog_new (format);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), 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)
+ *format = *psppire_var_type_dialog_get_format (dialog);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+