Advertisement
rotrevrep

Granite SourceList bug

Aug 13th, 2016
1,114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void main (string[] args) {
  2.     Gtk.init (ref args);
  3.     var win = new Gtk.Window();
  4.     var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
  5.     var root = new Granite.Widgets.SourceList.ExpandableItem ("root");
  6.     var sl = new Granite.Widgets.SourceList (root);
  7.     root.add (new Granite.Widgets.SourceList.Item ("item1"));
  8.     root.add (new Granite.Widgets.SourceList.Item ("item2"));
  9.     root.add (new Granite.Widgets.SourceList.Item ("item3"));
  10.     var item4 = new Granite.Widgets.SourceList.ExpandableItem ("sub");
  11.     var sub1 = new Granite.Widgets.SourceList.Item ("sub1");
  12.     sub1.icon = new ThemedIcon ("media-playback-start");
  13.     var sub2 = new Granite.Widgets.SourceList.Item ("sub2");
  14.     sub2.icon = new ThemedIcon ("media-playback-start");
  15.     var sub3 = new Granite.Widgets.SourceList.Item ("sub3");
  16.     sub3.icon = new ThemedIcon ("media-playback-start");
  17.     item4.add (sub1);
  18.     item4.add (sub2);
  19.     item4.add (sub3);
  20.     root.add (item4);
  21.     box.pack_start (sl, false, false);
  22.     var model = new Gtk.ListStore (1, typeof (int));
  23.     var tree_view = new Gtk.TreeView.with_model (model);
  24.     tree_view.insert_column_with_attributes (-1, "toto", new Gtk.CellRendererText(), "text", 0);
  25.     box.pack_start (tree_view);
  26.     win.add (box);
  27.     win.show_all();
  28.     Gtk.main();
  29. }
Advertisement
RAW Paste Data Copied
Advertisement