After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 338776 - Background color of the result list does not use theme
Background color of the result list does not use theme
Status: RESOLVED FIXED
Product: deskbar-applet
Classification: Deprecated
Component: general
2.14.x
Other All
: High major
: ---
Assigned To: Mikkel Kamstrup Erlandsen
Deskbar Applet Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2006-04-17 12:24 UTC by Thomas HAMEL
Modified: 2006-08-14 19:01 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Demonstrates the problem (753 bytes, text/x-python)
2006-05-14 17:07 UTC, Sebastian Pölsterl
  Details
Workaround to display the correct background (1.76 KB, patch)
2006-05-14 17:22 UTC, Sebastian Pölsterl
none Details | Review

Description Thomas HAMEL 2006-04-17 12:24:47 UTC
I'm using a dark theme since a few days (Clearlooks-DarkBlue). The entry of the
deskbar applet is consistent with the rest of the desktop (light blue on grey)
but not the result list (light blue on white).

It makes the deskbar results very hard to read.

Other information:
Comment 1 Mikkel Kamstrup Erlandsen 2006-04-17 15:54:20 UTC
Well. The colors are set on deskbar/ui/cuemiac/Cuemiac.py lines 440 and 441. Namely by:

	self.header_bg = gtk_style.bg[gtk.STATE_NORMAL]
	self.match_bg = gtk_style.base [gtk.STATE_NORMAL]

So they do infact use the theme colors, but it is a more or less hacky way to apply them. If any one can find a better way to get good colors, feel free :-) I'm stomped...
Comment 2 Mikkel Kamstrup Erlandsen 2006-04-17 15:55:38 UTC
Perhaps this could be marked as gnome-love.
Comment 3 Raphael Slinckx 2006-04-18 10:01:04 UTC
Not it's too complicated in the GTK api for a beginner.

Why do you have to specify explicitely the background color in the normal case ?

Couldn't you just use the standard BG color when the renderer is instancied, and only switch to grey when you have a category ? (or better, use a themed grey, like the insensitive one) ?
Comment 4 Mikkel Kamstrup Erlandsen 2006-04-19 16:07:16 UTC
I need those color values because I set the cell color in CuemiacTreeView.__get_*_for_cell() for category headers, and I need to reset it for normal match entries.

And basically the colors I choose should actually be the default colors If I'm not totally off? Somehow I just fail to pick up the correct color values in the two lines above, and I can't get my head around as to why...

gtk_style (in the two lines of code above) can be swiched to self.style which is a widget property that should be pointing to the current widgets style, but this gives the same result (no theming)...

I must be using gtk.Style in a wrong way. Any clues?
Comment 5 Sebastian Pölsterl 2006-05-12 13:53:43 UTC
I wrote a short scripts that prints me the colors.
But even if I changed the theme the values didn't change.
Maybe this is a pyGTK bug?
Comment 6 Raphael Slinckx 2006-05-14 13:12:41 UTC
Hmm, possible we should check with some pygtk gurus, like gjc or jdahlin maybe they know..
Comment 7 Sebastian Pölsterl 2006-05-14 17:07:16 UTC
Created attachment 65449 [details]
Demonstrates the problem

Okay, I did some further investigations.
Finally, it turned out that the style only gets the right values, if the widget is packed. Otherwise, some default values are set.

Run python theme-color.py to see what happens if the treeview is not packed, and add a random argument to the call above to see what happens otherwise.
Comment 8 Sebastian Pölsterl 2006-05-14 17:22:15 UTC
Created attachment 65450 [details] [review]
Workaround to display the correct background

This patch applies the colors after the widget has been packed. Therefore, the background colors are those specified in the theme. But the text color of the categories still remains black. I guess this problem refers to all custom widgets.
Comment 9 Thomas HAMEL 2006-05-21 11:55:28 UTC
I don't think that leaving the text color of the categories black is a problem if the background remains grey. Theming problems apears only when the background or the foreground is themed.

Comment 10 Jeremy Nickurak 2006-05-21 16:20:36 UTC
It should still be a goal to make sure that the theme colors are used so that this dialog doesn't stick out like a sore thumb. But as someone who gets hit by this problem *alot*, yes, a suitable make-it-work-for-now workaround is to set the background whenever the foreground is set, and to set the foreground whenever the background is set.

Because under the right theme conditions this makes a large part of the deskbar impossible to use, I'm increasing the severity on this one.
Comment 11 Raphael Slinckx 2006-05-21 17:08:02 UTC
Err, does that mean the workaround proposed by seb can be applied in the meantime ?
Comment 12 Jeremy Nickurak 2006-06-02 19:20:02 UTC
If it makes it ugly but usable, it's a good workaround as far as i'm concerned :)

BTW, with the invisible text in the result list, it appears it's possible to accidentally run commands thinking they'd be something else like a URL. Not fun :)
Comment 13 Mikkel Kamstrup Erlandsen 2006-06-28 19:46:58 UTC
I think I ran into something related to this problem. Sebastian mentions that the theme only is correctly set if the widget is packed.

I discovered that widget.style starts out as the default gtk style (gray and dark blue) until the widget is mapped, at which point the correct theme is set in .style.

I have found two ways to compute the style correctly.

1) Connect to the "map" signal of the widget (note that in this case CellRenderers are not widgets but just gobjects) and then apply the sytle in that that signal handler. And as the last thing in the handler source_remove the id of the handler.

2) Connect to "notify::style" on the widget. This has the added benefit of picking up theme changes.

I think we should use 2) somehow. Maybe connecting the cellrenderer to "notify::style" on the treeview somehow. There is an example of this in deskbar/ui/cuemiac/CuemiacHeader.py.
Comment 14 Raphael Slinckx 2006-07-10 08:42:49 UTC
Polling to see wtf ?
Should we apply sebastian's workaround, or mikkel do you have a real fix ? (or workaround ?)
Comment 15 Raphael Slinckx 2006-07-10 08:43:55 UTC
Polling to see wtf ?
Should we apply sebastian's workaround, or mikkel do you have a real fix ? (or workaround ?)
Comment 16 Jeremy Nickurak 2006-07-10 16:56:42 UTC
grdb (and more recently xchat-gnome) extract the gtk colors via the following code:

> GtkWidget* w;
> w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_widget_ensure_style (w);
> theme_colors[0] = w->style->text[GTK_STATE_NORMAL];
> theme_colors[1] = w->style->base[GTK_STATE_NORMAL];
> theme_colors[2] = w->style->text[GTK_STATE_SELECTED];
> theme_colors[3] = w->style->base[GTK_STATE_SELECTED];
> theme_colors[4] = w->style->text[GTK_STATE_INSENSITIVE];
> gtk_widget_destroy (w);

then catching and updating those colors on theme change:

> g_signal_connect (G_OBJECT (panel), "style_set", G_CALLBACK (style_set_callback), panel);

This helpful at all?
Comment 17 Mikkel Kamstrup Erlandsen 2006-07-13 06:23:12 UTC
Yes Jeremy. I did some related work lately using some theming tricks, and I think I know how to fix this now (very close to what you describe). Now I just need some time :-) (unless somebody else grabs this bugger before me..?)
Comment 18 Mikkel Kamstrup Erlandsen 2006-08-02 20:36:41 UTC
I just commited a fix to cvs head. Please verify, and reopen if necessary.

Cheers!
Comment 19 Thomas HAMEL 2006-08-14 19:01:07 UTC
The fix reached Ubuntu edgy, it works fine. Thanks a lot.