[maemo-developers] How can I change the background color of a GtkButton when it is activated

From: Eero Tamminen eero.tamminen at nokia.com
Date: Wed Nov 26 10:14:34 EET 2008
Hi,

ext Yao Wang wrote:
> Thanks for your advice.
> 
> However, my objective is to set two different colors for two different
> buttons. That is to say, for button A, when it is pressed, the color should
> be red; while for button B, in this case, the color should be green.
> 
> Thus I do not think the GTK+ theme can solve this problem.

Sure it can.  You can theme things in Gtk by class, widget_class,
widget or their hierarchy, see gtkrc documentation:
http://library.gnome.org/devel/gtk/unstable/gtk-Resource-Files.html

Just name your button objects differently (e.g. redbutton and
greenbutton) and set suitable theme for each object name.


	- Eero

PS. For speed reasons, don't use patterns like "*name*",
if needed, single "*" should be enough for a match pattern.

More information about the maemo-developers mailing list