Re: Changing the background color of a Label



>
> "Jean-Christophe Berthon" <jean-christophe berthon cgey com> writes:
> >  rc_style->font_name = g_strdup("%s",
> > "-*-arial-medium-i-*-*-*-200-*-*-P-*-iso8859-1");
>
> You don't need the "%s" there (this shouldn't compile...)
>
> Havoc

Yep you right, it's because of a too quick copy and paste, in fact I'm not
using directly g_strdup but a macro which is using g_strdup_printf and in
this case I need to put "%s" (if not I get a warning) but if I would use
g_strdup, I would removed it. Sorry for the mistake :-)
But I guess there shoud be another mistakes in my code.

Here thanks to your last reply to :
> Subject: Re: gtk_widget_modify_style causes App to crash
> You probably need:
>  g_free (rcstyle->font_name);
>  rcstyle->font_name = g_strdup (Font_Selected);
>
> Havoc

I manage changing the font style :-)
So now I have my code using RC Style almost working, but I can't get the
background of the label or it's container to be changed...

 /** Modify background -- KO **/
 rc_style = gtk_rc_style_new();

 rc_style->bg[GTK_STATE_NORMAL]  = CouleurTitreFond;
 rc_style->color_flags[GTK_STATE_NORMAL]   |= GTK_RC_BG;

 /* gtkLabelContainer is a EventBox containing the label named
ABOUT_lblNameVersion (see below how it is modified) */
 gtk_widget_modify_style(gtkLabelContainer, rc_style);
 gtk_rc_style_unref(rc_style);


 /** Modify writing color and Font Version label -- OK **/
 rc_style = gtk_rc_style_new();

 rc_style->fg[GTK_STATE_NORMAL] = CouleurTitrePolice;
 rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;

 g_free(rc_style->font_name);
 rc_style->font_name =
    g_strdup("-*-arial-medium-i-*-*-*-200-*-*-P-*-iso8859-1");

 gtk_widget_modify_style(ABOUT_lblNameVersion, rc_style);
 gtk_rc_style_unref(rc_style);



Jean-Christophe




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