Common theme handling for games
@robertroth
Submitted by Robert Roth Link to original bug (#793083)
Description
Several games do use themes in one way or another, and there is an implementation for listing them, using them and selecting them in each of the games.
I would suggest having a theme manager implementation shared reducing the duplicate code between the modules.
We are using a mix of xml-based, GKeyFile-based, and descriptorless themes in the games. In my opinion having an xml-based support would be the best, as that offers the greatest flexibility, can easily be translated e.g. with an its file shipped.
A theme should consist of a theme descriptor file and additional file resources.
- get list of available themes (string[] directories) - find available themes from the given directories - maybe with a callback to decide the validity of a theme found, as theme validity (e.g. do all the required files exist) can not always be decided. The callback might not be required if we choose XML-based format listing all theme file resources, in this case we can check for the existence of these at the library level as opposed to the API using code.
- get resource from theme (theme name, resource name) - get resource from theme, e.g. get string resource from descriptor (e.g. translated theme name, theme-specific string),
- get file resource from theme directory (theme-specific file, e.g. .css or theme image)
- optionally a theme preview functionality for displaying theme preview (probably as a custom widget)
- optional theme selector widget/dialog
What do you think?
Possible games benefiting of this:
- four-in-a-row
- gnome-mines
- iagno
- quadrapassel
- five-or-more
- gnome-mahjongg
- gnome-taquin
- gnome-robots
- atomix