Hi,

I'm sure this question has been asked at least a million times but I
couldn't deduce the solution to it from any of the documents I've found.

I have an iconview which is populated with hundreds of thumbnails which
 takes a lot of time so I wanted to do it in a separate thread. However,
the iconview ends up with one element and segfaults if I click anywhere
outside of that one element.

I can access the elements of the treemodel just fine even while the
populate thread is doing its job.

Are there any docs on doing something similar? Or perhaps a gtkmm app
that does something like that?

In the constructor of the widget holding the iconview I do the following:

Glib::Thread* const thread = Glib::Thread::create(
        sigc::mem_fun(*this,&CPrintPreviewWidget::populate_iconview),
        false);

and populate_iconview looks like so:

void CPrintPreviewWidget::populate_iconview(void)
{
        std::list<Glib::ustring>::iterator f_iterator =
                image_filelist.begin();

        std::list<Glib::ustring>::iterator f_end = image_filelist.end();
        
        Gtk::TreeModel::iterator iter;
        Gtk::TreeModel::Row row;
        
        while( f_iterator != f_end )
                {
                iter = refImageList->append();
                row = *iter;
                
                row[ ImageListColumns.filenames_column ] =
                        Glib::path_get_basename( *f_iterator );
                
                row[ ImageListColumns.thumbnails_column ] =
                        Gdk::Pixbuf::create_from_file( *f_iterator,
                         72,
                         72 );
                
                std::cout << "populating: " << *f_iterator << std::endl;
                        
                f_iterator++;
                }
        }
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to