-
-
Notifications
You must be signed in to change notification settings - Fork 184
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] The css_classes()
in the GtkWidget builder is problematic
#1110
Comments
Should it? that is the behaviour of such "property" in general, so I don't feel like we should do anything about it. |
Well, honestly it was quite annoying to debug since I expected that function to behave like the XML "<style>" UI definition, where it does not behave like that. |
That would be an issue to report to gtk itself I guess, to either document the behaviour clearly or to make it keep the default CSS classes somehow |
An alternative would be removing the setter from the builder pattern, but we don't have any way to configure the builder pattern yet. |
See gtk-rs/gir#1302 |
Bug description
When creating a widget using a builder and using its function
css_classes
to set custom CSS classes, what it does is calling its internal setterset_css_classes
which clears any existing css classes and then it adds the one defined by the user. The problem with this is that it also removes css classes that are set by GTK internally, so this often result to undesired behavior. This is an example:In this example, GTK normally adds the css class "image-button" to style the button correctly (in this case it tweaks internal spacing), but with the code above, because of the
css_classes
, it removes that class and only set the "flat" CSS class. In this specific case it causes the widget to not have a perfectly squared allocation. I guess this can create bigger problems with other combinations.I think that
css_classes()
should probably be changed to only add CSS classes to avoid confusion.The text was updated successfully, but these errors were encountered: