Re: GTK+ Theming improvements



Why not use the most obvious solution for the problem: Keep the theming
engine as is, but instead of using one single theming detail string,
let's attach a theming class property in the spirit of CSS class names
to widgets:

    const gchar** gtk_widget_get_style_classes (GtkWidget *widget);

    gboolean gtk_widget_has_style_class (GtkWidget   *widget,
				         const gchar *class_name);

Well, or for optimal speed let's use GQuarks instead:

    const GQuark* gtk_widget_get_style_classes (GtkWidget *widget);

    gboolean gtk_widget_has_style_class (GtkWidget *widget,
				         GQuark     class_name);

Now let's add the rule, that widgets have to provide a macro for each
style class they define, and we even get some easy way to document style
classes:

    #define GTK_STYLE_CLASS_TREE_VIEW_COLUMN_BUTTON \
            gtk_style_class_tree_view_column_button_get_quark ()

You might argue defining quarks for this purpose is quite some effort,
but Bugzilla and libegg contain the implementation of a G_DEFINE_QUARK,
respectively EGG_DEFINE_QUARK marco declaring *_get_quark functions:

    G_DEFINE_QUARK (GtkStyleClassTreeViewColumnButton,
                    gtk_style_class_tree_view_column_button);

This approach might not be a big and final solution, but its an approach
that can be implemented right now without breaking much stuff.


Ciao,
Mathias
-- 
Mathias Hasselmann <mathias hasselmann gmx de>
http://taschenorakel.de/

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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