~pimvullers/ergo/fix-983560

« back to all changes in this revision

Viewing changes to Ergo/Widgets/ErgoTaskLists.vala

  • Committer:
  • Date: 2011-10-08 14:07:42 UTC
  • Revision ID: karlis.lukstins@gmail.com-20111008140742-t3l6j7yqm449e88l
MergedĀ lp:~karlislukstins/ergo/sqlite

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  
 
2
//  Copyright (C) 2011 Ergo Developers
 
3
// 
 
4
//  This program is free software: you can redistribute it and/or modify
 
5
//  it under the terms of the GNU General Public License as published by
 
6
//  the Free Software Foundation, either version 3 of the License, or
 
7
//  (at your option) any later version.
 
8
// 
 
9
//  This program is distributed in the hope that it will be useful,
 
10
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
//  GNU General Public License for more details.
 
13
// 
 
14
//  You should have received a copy of the GNU General Public License
 
15
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
// 
 
17
 
 
18
using Gtk;
 
19
using Ergo;
 
20
using Ergo.Backend;
 
21
 
 
22
namespace Ergo.Widgets {
 
23
 
 
24
        public class ErgoTaskList : Gtk.TreeView {
 
25
        
 
26
            public ListStore listmodel { get; public set; }
 
27
    
 
28
        public void add_task_list(int id, string list_name ,int tasks,  int tasks_done){
 
29
            
 
30
            TreeIter iter;
 
31
            listmodel.append(out iter); 
 
32
            listmodel.set(iter, 0, id, 1, list_name, 2, tasks, 3, tasks_done);
 
33
        }
 
34
        
 
35
        public void update(){       
 
36
            listmodel.clear();
 
37
        }
 
38
 
 
39
        private ErgoWindow window;
 
40
                public ErgoTaskList(ErgoWindow window) {
 
41
            
 
42
            this.window = window;
 
43
                    headers_visible = false;
 
44
                    //even_row_color = gtk.gdk.color_parse ( "#e9e9e9");
 
45
                    //odd_row_color = gtk.gdk.color_parse ( "#f3f3f3");
 
46
                
 
47
 
 
48
                    listmodel = new ListStore(4,                typeof(int),                // ID
 
49
                                                        typeof(string),         // TaskList name
 
50
                                                                                                typeof(int),            // Tasks
 
51
                                                                                                typeof(int)     // Tasks done                                                                                           
 
52
            );                                                                                          
 
53
                    set_model(listmodel);
 
54
                    
 
55
                        // Task name cloumn
 
56
                insert_column_with_attributes(-1, "Task", new CellRendererText(), "text", 1);
 
57
                                
 
58
                // Expander column
 
59
                var column = new Gtk.TreeViewColumn();
 
60
            column.set_expand(true);
 
61
            insert_column(column, -1);
 
62
            
 
63
            
 
64
            // Remove column
 
65
            column = new Gtk.TreeViewColumn();
 
66
            var remove_pixbuf = new CellRendererPixbuf();
 
67
            /*//Removes
 
68
            remove_pixbuf.clicked.connect((path) => {
 
69
                //Delete row from backend -> refresh model
 
70
                print("\nDelete something\n");
 
71
                        });
 
72
                        //*/                        
 
73
            remove_pixbuf.stock_id = "gtk-close";
 
74
            column.pack_start (remove_pixbuf, false);
 
75
                        insert_column(column, -1);
 
76
                }
 
77
        }
 
78
}
 
79