[Patch] Support more than one css file
Submitted by Arnaud Rebillout
Link to original bug (#787426)
Description
Hi,
this is a feature request.
Use-case: I have a project where we create several GUI applications. We want the appearance to be consistent across all these apps, so we ended up creating a little toolkit that provides our custom widgets + a CSS file. This CSS file is used by all our applications.
Each application might have its own bits of CSS as well.
So in the end, each application needs to load two CSS files: the one from our toolkit, and its own CSS.
At the moment, Glade allow loading only one CSS file.
I already wrote a quick and dirty implementation for that, and here's how the glade file look like when two css files are saved.
<!-- Generated with glade 3.20.0 -->
`<interface>`
<requires lib="gtk+" version="3.20"/>
<!-- interface-css-provider-path mainwindow.css -->
<!-- interface-css-provider-path testing.css -->
...
I discovered that Glade automatically saves the location of the css file as a relative path. While it makes sense for an application css, it does not make sense anymore for the use-case I describe, where I'd like to load one custom css from a toolkit (installed somewhere on the machine), and another css that is application dependent (and which should be saved as a relative path, indeed).
I don't know how to tackle this issue, regarding the UI mainly. It's easy to allow both relative and absolute paths in the Glade file, and let the user edit the glade file by hand and enter whatever he wants, and decide by himself if he wants relative or absolute path. But how to present that in the UI, I have no idea.
If someone are interested in this feature, my work in progress is available at:
- git: https://gitlab.com/arnaud-preevio/glade
- branch: 3.20/multicss-try1
This current version already works, as long as you're willing to edit the glade file by hand, rather than using the UI, to add your css files. You can add either relatives or absolute paths.
The current issues with this version:
- the UI part is not implemented
- glade-previewer is probably broken regarding css
- code is still hacky
If there's some interest in this feature from upstream, and a will to ultimately merge it, I'd be ok to iterate until the code is good enough.
Cheers !
Arnaud