Re: Pixbufs in ComboBox columns



On Fri, 2006-03-17 at 10:01 +0100, Murray Cumming wrote:
> On Thu, 2006-03-16 at 20:08 -0700, Rick L Vinyard Jr wrote:
> > I have a model that looks like this:
> > 
> > class ModelColumns: public Gtk::TreeModelColumnRecord {
> >   public:
> >     ModelColumns() {
> >       add(picture);
> >       add(name);
> >     }
> >     
> >     Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > picture;
> >     Gtk::TreeModelColumn<Glib::ustring> name;
> >   };
> > 
> > After doing "all the other stuff" like declaring an instance of the
> > ColumnRecord, creating a ListStore instance, loading the pixbufs
(tested
> > the pixbufs in a Gtk::Image and they're fine), filling the model,
etc.,
> > I'm adding the columns with just:
> >   pack_start(columns.picture);
> >   pack_start(columns.name);
> > 
> > 
> > But, I'm getting errors like below:
> > 
> > (process:23146): GLib-GObject-CRITICAL **: gtype.c:2215:
initialization
> > assertion failed, use IA__g_type_init() prior to this function
> 
> That code is somehow running before Gtk::Main runs, I guess. Maybe
it's
> a static instance, or a member of a static instance.
> 

Thanks, a static member was precisely the problem. The code from the
TreeView example was a wrong turn, and the whole issue was the static
member.

Since this is a widget that will have a fixed set of children for all
instances I was trying to get a little too efficient and statically
allocate the TreeModelColumnRecord descendant and the ListStore.

Making the ListStore static isn't a problem (although after further
thought, it's not a tremendous savings and probably shouldn't be) but
making the TreeModelColumnRecord did cause an initialization problem
with the static being initialized before main().






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