
Untitled
By: a guest on
May 31st, 2012 | syntax:
Vala | size: 1.33 KB | hits: 27 | expires: Never
public async void load_thumbs(){
pane.set_visible(false);
pane.newmodel = new Gtk.ListStore (2, typeof (Gdk.Pixbuf), typeof (string));
pane.set_selection_mode (Gtk.SelectionMode.SINGLE);
pane.set_pixbuf_column (0);
pane.set_model(pane.newmodel);
//Add thumbnails to the iconview
string buff;
for(int i=1; i<pane.image_list.size; i++){
buff = pane.image_list.get_full_filename(i);
var file = File.new_for_path (buff);
Gdk.Pixbuf image = null;
try{
image.new_from_stream_at_scale_async (file.read(),110,80,false);
stdout.printf("Added %s to thumbnail\n", buff);
// Add the image name and thumbnail to the IconView
Gtk.TreeIter root;
pane.newmodel.append(out root);
pane.newmodel.set(root, 0, image, -1);
pane.newmodel.set(root, 1, pane.image_list.get_filename(i), -1);
// Select the thumbnail if it is the first in list
if (i==1) {
pane.select_path (pane.newmodel.get_path (root));
}
pane.iters.append (root);
}
catch(Error e){
warning (e.message);
}
}
pane.selection_changed.connect (update_selected);
pane.set_sensitive(true);
this.queue_draw();
}