Advertisement
Guest User

Untitled

a guest
May 31st, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 1.33 KB | None | 0 0
  1.         public async void load_thumbs(){
  2.  
  3.         pane.set_visible(false);
  4.         pane.newmodel = new Gtk.ListStore (2, typeof (Gdk.Pixbuf), typeof (string));
  5.         pane.set_selection_mode (Gtk.SelectionMode.SINGLE);
  6.         pane.set_pixbuf_column (0);
  7.         pane.set_model(pane.newmodel);
  8.  
  9.         //Add thumbnails to the iconview
  10.         string buff;
  11.         for(int i=1; i<pane.image_list.size; i++){
  12.         buff = pane.image_list.get_full_filename(i);
  13.             var file = File.new_for_path (buff);
  14.         Gdk.Pixbuf image = null;
  15.         try{
  16.             image.new_from_stream_at_scale_async (file.read(),110,80,false);
  17.             stdout.printf("Added %s to thumbnail\n", buff);
  18.                  // Add the image name and thumbnail to the IconView
  19.                     Gtk.TreeIter root;
  20.                     pane.newmodel.append(out root);
  21.                     pane.newmodel.set(root, 0, image, -1);
  22.                     pane.newmodel.set(root, 1, pane.image_list.get_filename(i), -1);
  23.                     // Select the thumbnail if it is the first in list
  24.                     if (i==1) {
  25.                         pane.select_path (pane.newmodel.get_path (root));
  26.                      }    
  27.                     pane.iters.append (root);
  28.         }
  29.         catch(Error e){
  30.             warning (e.message);
  31.         }
  32.         }
  33.         pane.selection_changed.connect (update_selected);
  34.         pane.set_sensitive(true);
  35.         this.queue_draw();
  36.  
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement