[EMAIL PROTECTED] wrote:
> On 10/31/07, Chris Rorvick <[EMAIL PROTECTED]> wrote:
>> I have a GTK application that modifies the foreground and background of
>> many different buttons rapidly.  These buttons should not be themed, so
>> it seems that the gtk_widget_modify_*() functions incur an unnecessary
>> overhead.  Is there a way to remove the theming of a widget?  I've tried
> 
> I do this by defining a set of styles in a style file (eg.
> "error_style" is reddish), then have a line binding all widgets named
> "error_widget" to "error_style". The colours there are based on the
> shades of red in the gnome HIG.
> 
> style "error_style" = "default"
> {
>         bg[NORMAL] = "#C1665A"
>         bg[PRELIGHT] = "#E0B6AF"
>         bg[ACTIVE] = "#C1665A"
>         bg[SELECTED] = "#C1665A"
>         bg[INSENSITIVE] = "#884631"
> }
> widget "*error_widget*" style "error_style"
> 
> In my code I do gtk_widget_set_name( widget, "error_widget" ); to get
> it drawn in the red style, and _set_name( "" ); to have it drawn in
> the regular style.
> 
> Hope I've unserstood you.
> 
> John

Thank you for the feedback.  I think what you are suggesting is a way to
override the default style for a particular widget.  I don't think this
achieves my primary goal, though, of avoiding the overhead incurred by
the logic in GTK that supports themes.  This overhead includes acquiring
a lock and navigating/manipulating linked lists of styles.  Use of a
profiler has shown this to be a significant burden to my application.

What I'm hoping to do is assign widgets a style that I can manipulate
directly and have GTK honor this.  gtk_widget_set_style() looks
promising for this, but its associated comment states that "it interacts
badly with themes."  GTK changes the style a widget points to under the
sheets, and I don't what events cause it to do so.

I'm not a GTK hacker (probably obvious by now) so I may be going about
this very wrong.  I'm hoping someone can point me in the right
direction.

Thanks!

Chris Rorvick
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to