Dynamically setting style

I have a problem dynamically setting styles in gtk2 perl application. What I am trying to implement is some kind of theme selection so that users could change the program's style without restarting it. I have a few different themes in different directories each with a gtkrc file unique to that theme. When user selects a style, I call:

Gtk2::Rc->parse("$directory/gtkrc"); # to parse selected theme
$window->reset_rc_styles; # to reset main window widget style to the new style

Unfortunately, if any of the element in the window widget have been clicked, typed in, or otherwise modified upon setting the style those element retain a style from the previous configuration which creates a mix of multiple themes. I found out that you need to reset each and individual "touched" element before it will adapt the new theme which is impossible just because of the number of different elements i have in my program (I mean calling reset_rc_styles on every signle button, toolbar, etc.). So I am wondering if there is a better way to do dynamically apply gtkrc style themes to my application?

Thanks for any help.

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