Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Broken EntryCompletion when using builder #802

Closed
panicbit opened this issue Jan 8, 2022 · 4 comments
Closed

[BUG] Broken EntryCompletion when using builder #802

panicbit opened this issue Jan 8, 2022 · 4 comments
Labels
bug Something isn't working gtk upstream

Comments

@panicbit
Copy link

panicbit commented Jan 8, 2022

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:

image

Additional Information

  • GTK: 4.4
  • OS: Arch Linux
@panicbit panicbit added the bug Something isn't working label Jan 8, 2022
@panicbit
Copy link
Author

panicbit commented Jan 8, 2022

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?

@bilelmoussaoui
Copy link
Member

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 Provide a configuration to ignore certain properties from the Builder pattern gir#1302 unless we manually implement the builder pattern
  • Report this upstream and see if it makes sense to call gtk_entry_completion_set_text_column when setting the value of text-column property

@bilelmoussaoui
Copy link
Member

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?

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

@bilelmoussaoui
Copy link
Member

Closing this as it is an upstream issue, setting the property should ideally call the setter instead of modifying the property value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gtk upstream
Projects
None yet
Development

No branches or pull requests

2 participants