-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Introduce a style manager #731
base: main
Are you sure you want to change the base?
Conversation
Regarding the demo: I opted to leave the switch that directly interfaces with gtk settings in the headerbar which can cause a mismatch between e.g. force dark in the stylemanager page and a light mode of the app. This is intended behavior because we shouldn't actually do anything with gtk settings manually but it might confuse people who use the demo. |
Fyi I switched it to per display style managers because that just makes more sense and is a lot nicer in code (no more need for lots of foreachs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm so testing this, it doesn't seem to work in the demo and I get:
** (granite-7-demo:140614): CRITICAL **: 11:57:41.997: granite_style_manager_set_color_scheme_override: assertion 'self != NULL' failed
I think we should probably remove the switch to make sure the demo is working properly and contains only good example code and not stuff we don't want other people to copy |
This should be fixed now, for some reason static construction didn't seem to work? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, looks good, just a few comments!
@alice-mkh Any thoughts on how this will/won't interact with Adw in for example Epiphany? |
This moves the provider management etc. from the init function to a separate class StyleManager.
This class now also automatically handles adjusting the theme to system preference and allowing the application to override this (which was my motivation since that's a bunch of boiler plate code that then could be removed from the applications startup functions).
Since more stuff is going to have to be done here (see e.g. https://gitlab.gnome.org/GNOME/gtk/-/issues/6821) this might be a good way to go now.
This currently is a global style manager for all displays but maybe we should follow Adw.StyleManager and make it per display?This is now per display since that makes more sense in general