Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_model = new ListStore(5, typeof(int), // ID
- typeof(string), // Task name
- typeof(string), // Notes
- typeof(string), // Date due
- typeof(bool) // Done - Toggle
- );
- set_model(list_model);
- var column = new Gtk.TreeViewColumn();
- // Done toggle column
- var toggle = new CellRendererToggle();
- toggle.toggled.connect((toggle, path) => {
- var tree_path = new TreePath.from_string(path);
- TreeIter iter;
- list_model.get_iter (out iter, tree_path);
- list_model.set (iter, Columns.TOGGLE, !toggle.active);
- });
- column.pack_start (toggle, false);
- column.add_attribute (toggle, "active", Columns.TOGGLE);
- insert_column(column, 0);
- // Task name cloumn
- insert_column_with_attributes(-1, "Task", new CellRendererText(), "text", 1, null);
- // Expander column
- column = new Gtk.TreeViewColumn();
- column.set_expand(true);
- insert_column(column, 2);
- // Date column
- insert_column_with_attributes(-1, "Date", new CellRendererText(), "text", 3, null);
- // Remove column
- column = new Gtk.TreeViewColumn();
- var remove_pixbuf = new CellRendererPixbuf();
- /*Add
- remove_pixbuf.clicked.connect((path) => {
- //Delete row from backend -> refresh model
- }
- */
- remove_pixbuf.stock_id = "gtk-close";
- column.pack_start (remove_pixbuf, false);
- insert_column(column, 4);
- }
Add Comment
Please, Sign In to add comment