Theme engine revision



Along with the main loop changes, I've been working on
the necessary API changes for theme engines in GTK+ 2.0.
This work was inspired by (and required by) the recent
conversion of GtkStyle and GtkRcStyle to GObject.

Since it is now possible to subclass GtkStyle and GtkRcStyle,
it seemed silly to have the engine_data mechanism for 
hanging engine specific data off of a style. So, I got
rid of this, and instead require a theme engine to implement
subclasses of GtkStyle and GtkRcStyle. 

Because a theme engine will be implementing object types
in a dynamically loaded module, I've had to use the new
GObject dynamic-type facilities to make sure that 
the engine doesn't get unloaded when there are still
instances of the types around. A function
gtk_theme_engine_get_type() has been added to register
a type in such a way that a reference will be held to
the engine as long as an instance of the type is around.

All the functions have been moved out of the GtkThemeEngine
"vtable" into the class structures for GtkStyle and
GtkRcStyle. The one remaining function, create_rc_style()
which actually creates the GtkRcStyle and gets the whole
process moving, has been made an additional entry point
for the module, theme_create_rc_style(), and is located
via dlsym().

I've attached the patch implementing this. Perhaps 
more interestingly, I've (mirabile dictu) written
some documentation about how to write a theme engine
using the new system: 

 http://www.gtk.org/~otaylor/gtk/2.0/theme-engines.html

It may be a bit verbose if all you want to know is
"what changed", but it should be a solid basis for someone
trying to figure out how to use the new system.

Unless anybody has any objections, I plan to commit
these change tomorrow. I've already converted the pixbuf 
theme engine, and went smoothly and seems to work well.

Regards,
                                        Owen




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