Re: How to support application specific theming?



On 6/6/07, Tommi Komulainen <tommi komulainen nokia com> wrote:
Hi,

We're trying to make our theme maintenance more modular by splitting
application specific details out of the main gtkrc, and then load the
additional gtkrc file only by the said application. This would allow
developing applications with specific theming needs more independently
without having centralized gtkrc maintenance becoming a bottleneck. It
would also improve application startup time and memory consumption when
your Aisleriot doesn't need to load the theming also for the browser,
the media player, the calculator, ... and so on.

However there doesn't seem to be any clean way to do it with gtk
currently.

gtk_rc_parse() and gtk_rc_add_default_file() don't use the normal search
paths for themes, but worse handling theme switching would be quite
awful (rereading gtkrc files, replacing an absolute file in a list of
files with another, and rereading gtkrc files again) if even possible.

GnomeProgram supports loading ~/.gnome2/<application>rc if it exists,
but that scheme doesn't allow taking the current overall theme into
account (bluish or reddish, light or dark, etc.) and load a themed
bitmap from the right location.

Supporting plugin specific theming adds its own problems as plugins can
be installed after the application has been started.



PROPOSAL:

For application specific gtkrc file loading I'm proposing to add the
capability of loading <application>rc in addition to gtkrc,
gtkrc@<locale> to gtk. It should seamlessly handle search paths and
theme switching.

For plugins I'm thinking of providing an API for the plugin to call when
they're loaded (or unloaded) and the filename given as parameter would
be added to (or removed from) the list of files to be searched for
similar to gtkrc.

Main point here is that gtk+ is already handling the 'gtkrc' file nice
and automatic, there just seems to be missing an API for applications to
add their own files to be handled the same way.


Comments?

I'll only add that gtkrc separation is especially important for
bitmap-based theming. Our current hildon global gtkrc is around 168K
in size.

--
Michael.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]