Re: [gtk-list] Usage of gtk_rc_parse_string()



On Fri, 11 Feb 2000, Joachim Backes wrote:

> Hi,
> 
> I want to set the background of some or all wigdets during creation
> time using the gtk_rc_parse_string() function.
> 
> The piece of code I'm using looks as follows:
> 
>   gtk_rc_parse_string("style \"background\"\n"
>   "{\n"
>   "bg[NORMAL] = \"646464\"\n"
>   "}"
>   "widget_class \"*\" style \"background\""
>   );
> 
> When running my app, I get the following err msg:
> 
>   -:3: error: invalid string constant "646464", expected valid string constant
> 
> What I'm doing wrong? In the gtk+ reference manual I found that colors
> can be specified as "rrggbb" where r/g/b are hex digits, and I mean, my
> notation is correct.

if you want to use plain numbers in strings, they have to start out with a '#'.
you don't need all the quote escapes in your rc string though, the rc scanner
is not in any way dependant on newlines and whitespaces, for instance here's an
rc string from gle:

static const gchar *gle_rc_string =
( "style'GLE-DefaultStyle'"
  "{"
  "font='-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*'"
  "fg[NORMAL]={0.,0.,0.}"
  "fg[ACTIVE]={0.,0.,0.}"
  "fg[PRELIGHT]={0.,0.,0.}"
  "fg[SELECTED]={1.,1.,1.}"
  "fg[INSENSITIVE]={.457,.457,.457}"
  "bg[NORMAL]={.83,.83,.87}"
  "bg[ACTIVE]={.76,.76,.80}"
  "bg[PRELIGHT]={.91,.91,.95}"
  "bg[SELECTED]={0.,0.,.65}"
  "bg[INSENSITIVE]={.83,.83,.87}"
  "base[NORMAL]={1.,1.,1.}"
  "base[PRELIGHT]={1.,0.,0.}"
  "base[INSENSITIVE]={.83,.83,.87}"
  "text[INSENSITIVE]={.83,.83,.87}"
  "}"
  "widget'GLE-*'style'GLE-DefaultStyle'"
  "widget'GtkWindow.GLE-*'style'GLE-DefaultStyle'"
  "widget'GtkWindow.<GLE-*'style'GLE-DefaultStyle'" );


> 
> The usage of "100.0,100.0,100.0" (usage of floats) produces similar err mgs.

floats need to appear in curly braces.

> 
> Any help appreciated.
> 
> Regards
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]