From: John Darrington Date: Mon, 23 Apr 2012 19:08:21 +0000 (+0200) Subject: PsppireValueEntry: Clear the entry, when the underlying model changes. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=b03ff6adc04a5b79617c4fa386c424f994a18bfe PsppireValueEntry: Clear the entry, when the underlying model changes. Since the labels will have changed, the existing text is most likely inappropriate. --- diff --git a/src/ui/gui/psppire-value-entry.c b/src/ui/gui/psppire-value-entry.c index 675df83966..4cc8be9871 100644 --- a/src/ui/gui/psppire-value-entry.c +++ b/src/ui/gui/psppire-value-entry.c @@ -243,6 +243,7 @@ psppire_value_entry_refresh_model (PsppireValueEntry *obj) { GtkWidget *entry = gtk_bin_get_child (GTK_BIN (obj)); GtkTreeModel *model; + GtkTreeModel *old_model; if (val_labs_count (obj->val_labs) > 0) { @@ -270,6 +271,14 @@ psppire_value_entry_refresh_model (PsppireValueEntry *obj) else model = NULL; + old_model = gtk_combo_box_get_model (GTK_COMBO_BOX (obj)); + + if (old_model != model) + { + GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (obj))); + gtk_entry_set_text (entry, ""); + } + gtk_combo_box_set_model (GTK_COMBO_BOX (obj), model); gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (obj), COL_LABEL); gtk_widget_set_sensitive (entry, model != NULL);