xfdesktop icon text color

Brian J. Tarricone bjt23 at cornell.edu
Sat May 20 23:20:50 CEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nikolas Arend wrote:

> This color is stored as an mcs-setting in desktop.xml (just like 
> color1/2 for the desktop background). It's read at startup by 
> behavior_settings_load() and applied by 
> xfce_desktop_settings_load_initial() which calls the function 
> xfce_desktop_set_icon_text_color(desktop, &color). The subsequently 
> called functions work in principle just like 
> xfdesktop_icon_view_set_font_size()/xfdesktop_icon_view_modify_font_size() 
> in xfdesktop-icon-view.c. Well, they're supposed to, that is.
> In my function xfdesktop_icon_view_modify_font_color(icon_view, 
> text_color) I'd like to make the appropriate changes to the icon text 
> color which then get applied by 
> gtk_widget_queue_draw(GTK_WIDGET(icon_view)). But I'm not sure what 
> exactly in the _XfdesktopIconViewPrivate structure I have to modify to 
> alter the icon text color. I tried
> 
> gdk_gc_set_rgb_fg_color(*icon_view->priv->parent_window->style->text_gc, 
> text_color),
> 
> but that, as I said, changes the text color for the entire parent window 
> of course (which looks funny).
> I basically tried to stick to the way your code is organized for desktop 
> "Behavior" settings, the function and variable structure is actually the 
> same.
> 
> I could make the code available on my web site, if needed. I didn't 
> create any patches yet.
> 
> Does this help?

See:
http://ometer.com/gtk-colors.html
(See the gtk 2.0 section for the easy way, gtk 1.2 section for the hard
way.)

Xfdesktop uses GTK_STATE_NORMAL, GTK_STATE_ACTIVE, and
GTK_STATE_SELECTED, so you'll need three calls to gtk_widget_modify_fg().

Modifying the text background is a little more annoying, as there is no
gtk_widget_modify_base().  You can either use an inline resource file,
or gtk_widget_modify_style(), which is left as an exercise for the
reader ^_^.

Note that you probably need to reapply all this when the gtk theme
changes (you can put something in xfdesktop_icon_view_style_set(), which
just appeared in SVN a few minutes ago).

	-brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEb4gy6XyW6VEeAnsRAtO4AJ4mUZcPsHd0pIpka3n+0kltqnw4CgCfUifK
ZuzZIPcJrMZ3yVxNg0JHKZA=
=5WR/
-----END PGP SIGNATURE-----



More information about the Xfce4-dev mailing list