gtk4-rs
gtk4-rs copied to clipboard
[BUG] Broken EntryCompletion when using builder
Bug description
Setting the text_column of an EntryCompletion using its builder instead of using set_text_column causes weird rendering / behavior of popup completion:
EntryCompletion::builder()
.text_column(0)
.build();
Changing the entry_completion example accordingly produces this:

Additional Information
- GTK:
4.4 - OS:
Arch Linux
It seems like gtk_entry_completion_set_text_column does a bit more than simply setting the text-column property (like the builder method does).
Apparently my assumption that the builder methods are equivalent to their set_* counterparts is wrong.
Is this an intentional design of gtk-rs?
Normally properties that expect more than a change of the property value should use their setter on the value at https://github.com/GNOME/gtk/blob/50e4ca8593d12b2de76e4d092d34ec7a1655ede8/gtk/gtkentrycompletion.c#L563 but it doesn't seems to be the case for text-column property. So far we have no way to fix this easily other than:
- Manually write the builder pattern and call the corresponding method if text-column property is set
- Completely ignore the text-column property, it is blocked by https://github.com/gtk-rs/gir/issues/1302 unless we manually implement the builder pattern
- Report this upstream and see if it makes sense to call
gtk_entry_completion_set_text_columnwhen setting the value oftext-columnproperty
It seems like
gtk_entry_completion_set_text_columndoes a bit more than simply setting thetext-columnproperty (like the builder method does). Apparently my assumption that the builder methods are equivalent to theirset_*counterparts is wrong. Is this an intentional design ofgtk-rs?
Builders are basically wrappers around calling glib::Object::new and passing the various properties to it with a bit of type safety at compile time. It definitely doesn't call the set_ functions
Closing this as it is an upstream issue, setting the property should ideally call the setter instead of modifying the property value.