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

« back to all changes in this revision

Viewing changes to src/LscFrontend.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
 
//  Stephen Smally © 2012
2
 
//      This program is free software; you can redistribute it and/or modify
3
 
//      it under the terms of the GNU General Public License as published by
4
 
//      the Free Software Foundation; either version 2 of the License, or
5
 
//      (at your option) any later version.
6
 
//      
7
 
//      This program is distributed in the hope that it will be useful,
8
 
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
//      GNU General Public License for more details.
11
 
//      
12
 
//      You should have received a copy of the GNU General Public License
13
 
//      along with this program; if not, write to the Free Software
14
 
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15
 
//      MA 02110-1301, USA.
16
 
//      
17
 
 
18
 
using Gtk;
19
 
using Lsc.Backend;
20
 
using Lsc.Widgets;
21
 
 
22
 
namespace Lsc {
23
 
    // Enum for trick-safe check
24
 
    public enum Section {
25
 
        GET = 0,
26
 
        INSTALLED = 1,
27
 
        BASKET = 2
28
 
    }
29
 
    
30
 
    // Css Styling
31
 
    public const string CSS_STYLE = """
32
 
    .LscCategoriesGrid .viewport {
33
 
        background-color: @base_color;
34
 
    }
35
 
    """;
36
 
    
37
 
    public class LscFrontend : Window {
38
 
        // Database Manager
39
 
        public LscDatabase db_manager;
40
 
        
41
 
        // Widgets
42
 
        public LscToolbar toolbar;
43
 
        //public LscPages pages;
44
 
        
45
 
        // Css
46
 
        public CssProvider styleprovider;
47
 
        
48
 
        public LscFrontend () {
49
 
            db_manager = new LscDatabase("/var/cache/lsc_packages.db"); // Need a settings check
50
 
            
51
 
            Box main_container = new Box(Orientation.VERTICAL, 0);
52
 
            toolbar = new LscToolbar();
53
 
            //pages = new LscPages();
54
 
            
55
 
            main_container.pack_start(toolbar, false, false, 0);
56
 
            //main_container.pack_start(pages, true, true, 0);
57
 
            
58
 
            styleprovider = new CssProvider();
59
 
            try {
60
 
                styleprovider.load_from_data(CSS_STYLE, CSS_STYLE.length);
61
 
            } catch (Error e) {
62
 
                stdout.printf("CssError: %s\n", e.message);
63
 
                stdout.printf("GtkViewport won't look as intended\n");
64
 
            }
65
 
            
66
 
            title = "Lubuntu Software Center";
67
 
            window_position = WindowPosition.CENTER;
68
 
            destroy.connect(Gtk.main_quit);
69
 
            add(main_container);
70
 
            show_all();
71
 
        }
72
 
    }
73
 
}
74
 
 
75
 
int main (string[] args) {
76
 
    Gtk.init(ref args);
77
 
    new Lsc.LscFrontend();
78
 
    Gtk.main();
79
 
    return 0;
80
 
}
 
 
b'\\ No newline at end of file'