X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fpsppire-value-entry.c;h=a21f10b84b9bba0ce736524d5789040422881d08;hb=e4955eebfee4b79846bbb5ba27daaa39a02ef05c;hp=731b6b3fb16e688a90738fda591ca4472a035d7c;hpb=052d5200b83af2855b3f1c582b2d6edc483a56f7;p=pspp diff --git a/src/ui/gui/psppire-value-entry.c b/src/ui/gui/psppire-value-entry.c index 731b6b3fb1..a21f10b84b 100644 --- a/src/ui/gui/psppire-value-entry.c +++ b/src/ui/gui/psppire-value-entry.c @@ -145,7 +145,7 @@ on_realize (GtkWidget *w) GtkEntryBuffer *buffer = gtk_entry_get_buffer (entry); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (w), COL_LABEL); - + g_signal_connect (buffer, "notify::text", G_CALLBACK (psppire_value_entry_text_changed), w); @@ -154,6 +154,26 @@ on_realize (GtkWidget *w) GTK_WIDGET_CLASS (psppire_value_entry_parent_class)->realize (w); } + +/* + The "has-entry" property for the parent class (GTK_COMBO_BOX) is + a) Construct-only ; and b) defaults to FALSE. + We want it to default to TRUE. So we override it here. +*/ +static GObject* +my_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GObject *o = + G_OBJECT_CLASS (psppire_value_entry_parent_class)->constructor + (type, n_construct_properties, construct_properties); + + g_object_set (o, "has-entry", TRUE, NULL); + + return o; +} + static void psppire_value_entry_class_init (PsppireValueEntryClass *class) { @@ -164,6 +184,7 @@ psppire_value_entry_class_init (PsppireValueEntryClass *class) gobject_class->finalize = psppire_value_entry_finalize; gobject_class->set_property = psppire_value_entry_set_property; gobject_class->get_property = psppire_value_entry_get_property; + gobject_class->constructor = my_constructor; widget_class->realize = on_realize; g_object_class_install_property ( @@ -248,7 +269,7 @@ psppire_value_entry_finalize (GObject *gobject) GtkWidget * psppire_value_entry_new (void) { - return GTK_WIDGET (g_object_new (PSPPIRE_TYPE_VALUE_ENTRY, "has-entry", TRUE, NULL)); + return GTK_WIDGET (g_object_new (PSPPIRE_TYPE_VALUE_ENTRY, NULL)); } static void @@ -421,6 +442,10 @@ psppire_value_entry_set_value (PsppireValueEntry *obj, gchar *string; obj->cur_value = NULL; + + if (value == NULL) + return; + if (obj->show_value_label) { struct val_lab *vl = val_labs_lookup (obj->val_labs, value);