Re: [Vala] Bug with Gtk3 and structs



On Sat, Oct 22, 2011 at 15:35, Andrew Higginson <at higginson gmail com>wrote:

Thanks for the tip :) Problem is still there though :/


Yeap, it seems the problem is with using structs to use inside the list
store. I'm not sure how you could make it work with structs tough, my tests
were all unsuccessful. However, with objects it works fine, for
instance<http://pastebin.com/5JfARCLs>
:

   1.  public class MyObject : Object {
   2.     public string id;
   3.  }
   4.
   5.  public int main(string[] args) {
   6.     Gtk.init(ref args);
   7.
   8.     var o1 = new MyObject();
   9.      o1.id = "The ID";
   10.
   11.      var model = new Gtk.ListStore(1, typeof(MyObject));
   12.     Gtk.TreeIter iter;
   13.      model.append(out iter);
   14.     model.set(iter, 0, o1);
   15.
   16.     MyObject o2;
   17.      model.get(iter, 0, out o2);
   18.     stdout.printf("%s\n", o2.id);
   19.
   20.     return 0;
   21.  }




--
Andrew



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