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

« back to all changes in this revision

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

  • Committer: Stephen Smally
  • Date: 2012-07-05 13:49:59 UTC
  • Revision ID: eco.stefi@fastwebnet.it-20120705134959-y5vg66cadej8vix1
Added mutable install/remove button

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        private Label id;
36
36
        private Label version;
37
37
        private Label size;
 
38
        private Button action_button;
38
39
        
39
40
        private void hide_children (Widget c) {
40
41
                        c.set_visible (false);
43
44
                        c.set_visible (true);
44
45
                }
45
46
        
46
 
        public void set_status (string data) {
 
47
        public void set_action (ActionType type) {
 
48
                        switch (type) {
 
49
                                case ActionType.INSTALL:
 
50
                                    action_button.label = "Install";
 
51
                                    break;
 
52
                                case ActionType.REMOVE:
 
53
                                    action_button.label = "Remove";
 
54
                                    break;
 
55
                        }
 
56
                }
 
57
        
 
58
        public void set_status (Info data) {
47
59
                        switch (data) {
48
 
                                case "installed":
 
60
                                case Info.INSTALLED:
49
61
                                    status_icon.set_from_stock (Stock.YES, IconSize.MENU);
50
62
                                    status_label.label = "<i>%s</i>".printf ("Installed");
51
 
                                    break;
52
 
                                case "local":
53
 
                                    status_icon.set_from_icon_name ("deb", IconSize.MENU);
54
 
                                    status_label.label = "<i>%s</i>".printf ("Local");
 
63
                                    set_action (ActionType.REMOVE);
55
64
                                    break;
56
65
                                default:
57
66
                                    status_icon.set_from_icon_name ("applications-internet", IconSize.MENU);
58
67
                                    status_label.label = "<i>%s</i>".printf ("Available");
 
68
                                    set_action (ActionType.INSTALL);
59
69
                                    break;
60
70
                        }
61
71
                }
65
75
                        load_label.set_visible (false);
66
76
                        reviews_box.set_visible (false);
67
77
                        
68
 
                        set_status (pkg.get_data ());
 
78
                        set_status ((Info)pkg.info);
69
79
                        
70
80
            pkg_name.label = "<big><b>"+app.name+"</b></big>";
71
81
            short_description.label = "<i>"+app.summary+"</i>";
193
203
            b_container.homogeneous = false;
194
204
            
195
205
            Button bt = new Button.with_label("Check for reviews");
 
206
            action_button = new Button();
196
207
            
197
208
            b_container.pack_start(bt, false, false, 0);
198
 
            b_container.pack_start(new Button.with_label("Install"), false, false, 0);
 
209
            b_container.pack_start(action_button, false, false, 0);
199
210
            b_container.foreach((child) => {
200
211
                b_container.set_child_non_homogeneous(child, true);
201
212
            });