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 346751 - symbolic colors can't be use in properties
symbolic colors can't be use in properties
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.10.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-07-06 12:19 UTC by Frederic Crozat
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase (640 bytes, text/plain)
2006-07-06 12:20 UTC, Frederic Crozat
  Details
correct testcase (882 bytes, text/plain)
2006-07-06 12:24 UTC, Frederic Crozat
  Details
working testcase (881 bytes, text/plain)
2006-07-06 12:32 UTC, Frederic Crozat
  Details
Patch that should fix the bug (9.29 KB, patch)
2006-07-20 13:39 UTC, Michael Natterer
none Details | Review
Next try (9.58 KB, patch)
2006-07-20 14:20 UTC, Michael Natterer
none Details | Review
Grrr (9.63 KB, patch)
2006-07-20 14:36 UTC, Michael Natterer
committed Details | Review

Description Frederic Crozat 2006-07-06 12:19:48 UTC
Symbolic colors can't be used in properties, for instance, in a gtkrc file :
" GtkTreeView::odd_row_color  = @mycolor "


The following testcase (it is an improved version of the one from bug #346668) shows this problem.
Comment 1 Frederic Crozat 2006-07-06 12:20:39 UTC
Created attachment 68465 [details]
testcase
Comment 2 Frederic Crozat 2006-07-06 12:24:08 UTC
Created attachment 68466 [details]
correct testcase

sorry, I uploaded the wrong testcase, this one is ok.
Comment 3 Frederic Crozat 2006-07-06 12:32:51 UTC
Created attachment 68468 [details]
working testcase

ok, this time, testcase compiles.

Sorry for the wrong uploads..
Comment 4 Michael Natterer 2006-07-20 13:39:19 UTC
Created attachment 69252 [details] [review]
Patch that should fix the bug
Comment 5 Michael Natterer 2006-07-20 14:20:37 UTC
Created attachment 69257 [details] [review]
Next try
Comment 6 Michael Natterer 2006-07-20 14:36:52 UTC
Created attachment 69258 [details] [review]
Grrr
Comment 7 Frederic Crozat 2006-07-20 14:41:33 UTC
grrr patch works fine :)
Comment 8 Matthias Clasen 2006-07-20 19:25:45 UTC
Mitch, do you want to commit the  grrr patch ?
Comment 9 Michael Natterer 2006-07-21 08:28:18 UTC
Fixed in CVS:

2006-07-21  Michael Natterer  <mitch@imendio.com>

	Enable symbolic colors and color expressions in style
	properties. Fixes bug #346751.

	* gtk/gtkrc.c (rc_parse_token_or_compound): add GtkRcStyle
	parameter and replace symbolic colors by color constants.

	(gtk_rc_parse_assignment): likewise. Also support parsing of
	expressions of the form identifier(compound).

	(gtk_rc_parse_style): pass the GtkRcStyle to
	gtk_rc_parse_assignment().

	(gtk_rc_parse_statement): pass NULL since we don't have a
	GtkRcStyle here.
Comment 10 Frederic Crozat 2006-08-17 18:25:56 UTC
reopening, I'm seeing some regressions with gtk 2.10.1 final :

Gtk-Message: /usr/share/themes/Ia Ora Blue/gtk-2.0/gtkrc:67: failed to retrieve property 'GtkTreeView:even-row-color' of type 'GdkColor' from rc file value "((GString*) 0x8215370)" of type "GString"

interesting lines in gtkrc being :

    color["white"]= "#FFFFFF" #2
    color["gray2"]= "#CFD7DF" #5

    GtkTreeView::odd-row-color        = @gray1
    GtkTreeView::even-row-color       = @white

Comment 11 Matthias Clasen 2006-08-17 22:10:50 UTC
Is it relevant that the color is named gray1 at the one place, and
gray2 at the other ?
Comment 12 Matthias Clasen 2006-08-18 02:10:58 UTC
mmy quick testing with 

style "treeview" {
   color["white"]= "red"
   color["gray1"]= "blue"

   GtkTreeView::odd-row-color        = @gray1
   GtkTreeView::even-row-color       = @white
}

class "GtkTreeView" style "treeview"

worked fine. So I'm assuming this is fixed in cvs.
Comment 13 Frederic Crozat 2006-08-18 11:45:41 UTC
strange, I've tested with your gtkrc file and I'm still getting the same error with gtk+ 2.10.2

backtrace when running gtk-demo with breakpoint on g_log :

Breakpoint 1, IA__g_log (log_domain=0xb7df5001 "Gtk", 
    log_level=G_LOG_LEVEL_MESSAGE, 
    format=0xb7e87e84 "%s: failed to retrieve property `%s::%s' of type `%s' from rc file value \"%s\" of type `%s'") at gmessages.c:513
513     {
(gdb) bt
  • #0 IA__g_log
    at gmessages.c line 513
  • #1 _gtk_style_peek_property_value
    at gtk/gtkstyle.c line 1744
  • #2 IA__gtk_widget_style_get_valist
    at gtk/gtkwidget.c line 7576
  • #3 IA__gtk_widget_style_get
    at gtk/gtkwidget.c line 7614
  • #4 gtk_default_draw_flat_box
    at gtk/gtkstyle.c line 3464
  • #5 IA__gtk_paint_flat_box
    at gtk/gtkstyle.c line 5906
  • #6 gtk_tree_view_expose
    at gtk/gtktreeview.c line 4416
  • #7 _gtk_marshal_BOOLEAN__BOXED
    at gtk/gtkmarshalers.c line 83
  • #8 g_type_class_meta_marshal
    at gclosure.c line 567
  • #9 IA__g_closure_invoke
    at gclosure.c line 490
  • #10 signal_emit_unlocked_R
    at gsignal.c line 2476
  • #11 IA__g_signal_emit_valist
    at gsignal.c line 2207
  • #12 IA__g_signal_emit
    at gsignal.c line 2241
  • #13 gtk_widget_event_internal
    at gtk/gtkwidget.c line 3901
  • #14 IA__gtk_main_do_event
    at gtk/gtkmain.c line 1379
  • #15 gdk_window_process_updates_internal
    at gdk/gdkwindow.c line 2324
  • #16 IA__gdk_window_process_all_updates
    at gdk/gdkwindow.c line 2387
  • #17 gdk_window_update_idle
    at gdk/gdkwindow.c line 2245
  • #18 g_idle_dispatch
    at gmain.c line 3924
  • #19 IA__g_main_context_dispatch
    at gmain.c line 2043
  • #20 g_main_context_iterate
    at gmain.c line 2675
  • #21 IA__g_main_loop_run
    at gmain.c line 2879
  • #22 IA__gtk_main
    at gtk/gtkmain.c line 1000
  • #23 ??
  • #24 _IO_stdin_used
  • #25 ??
  • #26 ??

Comment 14 Michael Natterer 2006-08-28 09:29:24 UTC
The gtkrc snippet from Matthias works just fine here. You are probably
linking against some old gtk version. Can you check this please?
Comment 15 Frederic Crozat 2006-08-31 15:20:45 UTC
ok, I just found what was causing the bug to appear : locale ;)

using LC_ALL=fr_FR, I get the error, using LC_ALL=C, I don't..
Comment 16 Michael Natterer 2006-09-04 10:29:15 UTC
I see what's going wrong. Will be fixed in CVS today. Thanks for the
locale hint :)
Comment 17 Michael Natterer 2006-09-04 11:25:47 UTC
Fixed in cvs (HEAD and 2.10):

2006-09-04  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkrc.c (rc_parse_token_or_compound)
	(gtk_rc_parse_assignment): serialize floating point values using
	locale-independent functions. (#346751, Frederic Crozat)