Improve how we load styles
To style widgets, we have many tiny CSS files scattered in the source code, they are loaded and added widget instance by widget instance, and are limited to that widget's node: they won't cascade. That implies that encapsulated widgets wihtin a widget's implementation must load the style too. That's cumbersome and limit what we can do without making the code look insane.
There is another option though: having a single style file and loading it on initialization for the whole screen. We would then just have to track changes of the default screen to automatically reload the style. It has to be done after initializing GTK, or it won't work. We could init GTK in the library constructor and then load the CSS, but there is a problem: there are cases when you need to do things before initializing GTK, e.g. for tests (gtk_test_init()
does a few things like calling g_test_init()
and then initializes GTK). Also, g_test_init()
and hence by extension gtk_test_init()
require we pass the command line arguments (NULL
isn't valid) so we need to init that in main()
somehow.
I see two options:
- either we keep the status quo and load styles widget per widget,
- or we add
hdy_init()
back andhdy_test_init()
and load a single style sheet from there.