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->labs = val_labs_create (0);
}
PsppireValLabsDialog *
psppire_val_labs_dialog_new (const struct variable *var)
{
- return PSPPIRE_VAL_LABS_DIALOG (
- g_object_new (PSPPIRE_TYPE_VAL_LABS_DIALOG,
- "variable", var,
- NULL));
+ PsppireValLabsDialog *obj
+ = PSPPIRE_VAL_LABS_DIALOG (g_object_new (PSPPIRE_TYPE_VAL_LABS_DIALOG,
+ "variable", var,
+ NULL));
+
+ return obj;
}
struct val_labs *
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_widget_show (GTK_WIDGET (dialog));
- labs = (psppire_dialog_run (PSPPIRE_DIALOG (dialog)) == GTK_RESPONSE_OK
- ? val_labs_clone (psppire_val_labs_dialog_get_value_labels (dialog))
- : NULL);
+ gint response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+ switch (response)
+ {
+ case GTK_RESPONSE_OK:
+ labs = val_labs_clone (psppire_val_labs_dialog_get_value_labels (dialog));
+ break;
+ default:
+ labs = NULL;
+ break;
+ }
gtk_widget_destroy (GTK_WIDGET (dialog));
g_signal_connect (dialog->add_button, "clicked",
G_CALLBACK (on_add), dialog);
- dialog->labs = NULL;
+ /* dialog->labs must not be set here, because as a member of a singleton
+ class its value persists "between" objects. */
+ /* dialog->labs = NULL; */
g_object_unref (xml);
GTK_TREE_MODEL (list_store));
g_object_unref (list_store);
-
}
void