~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-03-04 12:59:13 UTC
  • Revision ID: eco.stefi@fastwebnet.it-20120304125913-bk1iutifwoeoyo0i
Worked a lot!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
using Gtk;
 
3
using Pk;
 
4
using Lsc.Widgets;
 
5
using Lsc.Utils;
 
6
 
 
7
namespace Lsc.Pages {
 
8
    public class AppsInfo : Box {
 
9
        private Separator separator;
 
10
        private RoundBox box;
 
11
        private Label pkg_name;
 
12
        private Label short_description;
 
13
        private Label description;
 
14
        private Label id;
 
15
        private Label version;
 
16
        private Label size;
 
17
        
 
18
        public void set_details (Package pkg, Details details) {
 
19
            pkg_name.label = "<big><b>"+nicer_pkg_name(pkg.get_name())+"</b></big>";
 
20
            short_description.label = "<i>"+pkg.get_summary()+"</i>";
 
21
            
 
22
            description.label = details.description;
 
23
            
 
24
            id.label = "<b>Id:</b> "+pkg.get_name();
 
25
            version.label = "<b>Version:</b> "+pkg.get_version();
 
26
            size.label = "<b>Size:</b> "+details.size.to_string();
 
27
        }
 
28
        
 
29
        public void pack_separator () {
 
30
            separator = new Separator(Orientation.HORIZONTAL);
 
31
            separator.margin_left = 1;
 
32
            separator.margin_right = 1;
 
33
            box.pack_start(separator, false, false, 0);
 
34
        }
 
35
        
 
36
        public AppsInfo () {
 
37
            orientation = Orientation.VERTICAL;
 
38
            spacing = 0;
 
39
            border_width = 10;
 
40
            
 
41
            // Main container
 
42
            box = new RoundBox(Orientation.VERTICAL, 0);
 
43
            box.expand = false;
 
44
            
 
45
            // Summary Box (icon, name/short_description and install button)
 
46
            Box summary_box = new Box(Orientation.HORIZONTAL, 3);
 
47
            Box label_box = new Box(Orientation.VERTICAL, 0);
 
48
            label_box.valign = Align.CENTER;
 
49
            summary_box.border_width = 5;
 
50
            summary_box.pack_start(new Image.from_stock(Stock.INFO, IconSize.DIALOG), false, false, 0);
 
51
            
 
52
            pkg_name = new Label("<big><b>Application name</b></big>");
 
53
            pkg_name.use_markup = true;
 
54
            pkg_name.halign = Align.START;
 
55
            
 
56
            short_description = new Label("<i>Application description</i>");
 
57
            short_description.use_markup = true;
 
58
            short_description.halign = Align.START;
 
59
            
 
60
            label_box.pack_start(pkg_name, false, false, 0);
 
61
            label_box.pack_start(short_description, false, false, 0);
 
62
            
 
63
            summary_box.pack_start(label_box, true, true, 0);
 
64
            Button install_button = new Button.with_label("Install");
 
65
            install_button.relief = ReliefStyle.NONE;
 
66
            summary_box.pack_start(install_button, false, false, 0);
 
67
            
 
68
            // Description
 
69
            Box description_box = new Box(Orientation.VERTICAL, 0);
 
70
            description_box.border_width = 10;
 
71
            description = new Label("Package description");
 
72
            description.wrap_mode = Pango.WrapMode.WORD_CHAR;
 
73
            description.wrap = true;
 
74
            description.halign = Align.CENTER;
 
75
            description_box.pack_start(description, false, false, 0);
 
76
            
 
77
            // Details (version and size)
 
78
            Box details_box = new Box(Orientation.VERTICAL, 0);
 
79
            details_box.border_width = 10;
 
80
            version = new Label("<b>Version:</b>");
 
81
            version.use_markup = true;
 
82
            version.halign = Align.START;
 
83
            size = new Label("<b>Size:</b>");
 
84
            size.use_markup = true;
 
85
            size.halign = Align.START;
 
86
            id = new Label("<b>Id:</b>");
 
87
            id.use_markup = true;
 
88
            id.halign = Align.START;
 
89
            details_box.pack_start(id, false, false, 0);
 
90
            details_box.pack_start(version, false, false, 0);
 
91
            details_box.pack_start(size, false, false, 0);
 
92
            
 
93
            // Adding widgets
 
94
            box.pack_start(summary_box, false, false, 0);
 
95
            pack_separator();
 
96
            box.pack_start(description_box, true, true, 0);
 
97
            pack_separator();
 
98
            box.pack_start(details_box, false, false, 0);
 
99
            
 
100
            pack_start(box, true, true, 0);
 
101
        }
 
102
    }
 
103
}
 
 
b'\\ No newline at end of file'