~lubuntu-software-center-team/lubuntu-software-center/vala-port

« back to all changes in this revision

Viewing changes to src/Widgets/Pages/AppsView.vala

  • Committer: Stephen Smally
  • Date: 2012-07-04 17:01:15 UTC
  • Revision ID: eco.stefi@fastwebnet.it-20120704170115-to8eoxa7g4h1z0kr
Adding #9 fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        public signal void selected_row (LscApp app);
26
26
        
27
27
        // Vars
28
 
        private IconTheme theme;
29
28
        private ListStore model;
30
29
        private TreeIter iter;
31
30
        private TreePath path;
 
31
        private string stock_image;
32
32
        
33
 
        public void append_app (LscApp app) {            
 
33
        public void append_app (LscApp app) {
 
34
            /*if (app.get_info() == Info.INSTALLED) {
 
35
                stock_image = Stock.YES;
 
36
            } else {
 
37
                stock_image = null;
 
38
            }*/
34
39
            model.append(out iter);
35
 
            model.set(iter, 0, app.icon, 1, app.name+"\n"+app.summary, 2, app);
 
40
            model.set(iter, 0, app.icon, 1, app.name+"\n"+app.summary, 2, stock_image, 3, app);
36
41
        }
37
42
        
38
43
        public void clear () {
44
49
            if (path != null) {
45
50
                                LscApp val;
46
51
                model.get_iter(out iter, path);
47
 
                model.get(iter, 2, out val);
 
52
                model.get(iter, 3, out val);
48
53
                selected_row(val);
49
54
            }
50
55
        }
51
56
        
52
57
        public AppsTree () {
53
 
                        theme = IconTheme.get_default ();
54
 
                        theme.append_search_path ("/usr/share/app-install/icons");
55
 
                        
56
 
                        Type t_string = typeof (string);
57
 
            model = new ListStore(3,
58
 
                t_string, // Icon name
59
 
                t_string, // Name and description
 
58
            model = new ListStore(4,
 
59
                typeof(string), // Icon name
 
60
                typeof(string), // Name and description
 
61
                typeof(string), // Installed (Gtk.Stock)
60
62
                typeof(LscApp)  // LscApp object
61
63
            );
62
64
            
69
71
            text.ellipsize = Pango.EllipsizeMode.END;
70
72
            
71
73
            insert_column_with_attributes(-1, "Icon", icon_cell, "icon-name", 0);
 
74
            insert_column_with_attributes(-1, "Inst", new CellRendererPixbuf(), "stock-id", 2);
72
75
            insert_column_with_attributes(-1, "Name", text, "text", 1);
73
76
            
74
 
            get_column(1).set_sort_column_id(1);
75
 
            get_column(1).set_expand(true);
76
 
            get_column(1).clicked();
 
77
            get_column(2).set_sort_column_id(1);
 
78
            get_column(2).set_expand(true);
 
79
            get_column(2).clicked();
77
80
            
78
 
            rules_hint = true;
 
81
            get_column(1).set_sort_column_id(2);
79
82
            
80
83
            cursor_changed.connect(on_cursor_changed);
81
84
            
100
103
            
101
104
            apps_tree.selected_row.connect(info_message.update);
102
105
            
 
106
            pack_start(apps_tree_scroll, true, true, 0);
103
107
            pack_start(info_message, false, false, 0);
104
 
            pack_start(apps_tree_scroll, true, true, 0);
105
108
        }
106
109
    }
107
110
}