xfdesktop icon text color

Nikolas Arend Nikolas.Arend at gmx.net
Sun May 21 12:59:50 CEST 2006


Brian J. Tarricone wrote:
> -----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).
>
>   
Thanks a lot Brian, that helped, changing both the alpha value and the 
text color via the mcs plugin seems to work now. I think I will create a 
patch for the next beta release and post it on the mailing lists, in 
case anybody is interested.

Best,   Nick.



More information about the Xfce4-dev mailing list