why gtk_label_set_attributes not change anything?



Dear sirs:
    I'm using gnome 2.0 on solaris, the follow code did not change any thing, the label is always black font 
on screen. What's the correct method to change property of GtkLabel? thanks.

 PangoAttribute *pa;
 PangoAttrList *tmpattr,*oldattr=NULL;
 guint16 r,g,b;
 int rgb;
 GtkLabel *DestLabel=NULL;
 tmpattr = pango_attr_list_new();
 rgb = COLORS[2];
   r=((rgb>>16)&0x000000FF)*255;
   g=((rgb>>8)&0x000000FF)*255;
   b=((rgb)&0x000000FF)*255;
 pa = pango_attr_foreground_new(r,g,b);
 pango_attr_list_insert(tmpattr,pa);
   rgb = COLORS[9];
   r=((rgb>>16)&0x000000FF)*255;
   g=((rgb>>8)&0x000000FF)*255;
   b=((rgb)&0x000000FF)*255;
   pa = pango_attr_background_new(r,g,b);
   pango_attr_list_insert(tmpattr,pa);
 
 DestLabel = (GtkLabel *)lookup_widget(drawingcanvas->parent,
                                        "sware_work_name");
 if (DestLabel==NULL) return;
 gtk_label_set_label(DestLabel,"hello");
 if (DestLabel)
 {
  oldattr = gtk_label_get_attributes(DestLabel);
  if (oldattr) pango_attr_list_unref(oldattr);
  else debug(1)("no oldattr \n");
  gtk_label_set_attributes(DestLabel,tmpattr);
 }



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