problems changing styles



I'd like to change a widget style without calling gtk_widget_set_style
because this causes the widget to resize when I change the font.

What I've been doing is the following:

  previous_style = entry->style; 
  style = gtk_style_copy(entry->style); 
 
  if(style->font != font){
   gdk_font_unref(style->font); 
   style->font = attributes.font; 
   gdk_font_ref(style->font); 
  }
 
  gtk_style_detach(previous_style); 
  entry->style=style; 
  gtk_style_ref(style); 
  gtk_style_attach(style, entry->window); 
  gtk_style_unref(previous_style); 
 
This causes my widget to chash. I know the problem is when the style is
detached, because everything goes fine if I commentariate that line, but
the program crashes when the widget is destroyed. By the way, what I'm
trying to do is just changing the widget font, is there any other way to
do this without changing the style, and without resizing the widget?
 Any help?
TNX
<ADRIAN>



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