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.
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.
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.
23
// Elements which should be accessible to every void or class
24
public enum PageType {
29
public string to_string () {
42
public PageType[] get_all () {
43
return { HOMEPAGE, APPSVIEW, APPSINFO };
47
// Apps Manager which handle the PackageKit connection
48
public AppsManager apps_manager;
50
public class Frontend : Window {
53
public MainToolbar toolbar;
54
public PagesView pages_view;
55
public ProgressInfo progress_info;
57
public void load_packages (string filters) {
58
pages_view.set_current_page(PageType.APPSVIEW);
59
pages_view.apps_view.apps_tree.clear();
60
apps_manager.get_pkgs(filters);
63
public void update_back_button (Notebook nb, Widget pg, uint page_n) {
64
switch ((PageType) page_n) {
69
public void connect_signals () {
70
apps_manager.app_added.connect(pages_view.apps_view.apps_tree.append_app);
71
apps_manager.loading_started.connect(progress_info.load_undefined);
72
apps_manager.loading_finished.connect(progress_info.clear);
73
apps_manager.category_added.connect(pages_view.home_page.categories_view.add_category);
74
apps_manager.details_received.connect(pages_view.apps_info.set_details);
75
pages_view.switch_page.connect(update_back_button);
76
pages_view.home_page.categories_view.category_choosed.connect(() => {
77
load_packages("installed;gui");
82
apps_manager = new AppsManager();
84
destroy.connect(Gtk.main_quit);
85
window_position = WindowPosition.CENTER;
86
title = "Light Software Center";
87
set_default_size(600, 400);
89
main_box = new Box(Orientation.VERTICAL, 0);
91
toolbar = new MainToolbar();
92
main_box.pack_start(toolbar, false, false, 0);
94
progress_info = new ProgressInfo();
95
main_box.pack_start(progress_info, false, false, 0);
97
pages_view = new PagesView();
99
main_box.pack_start(pages_view, true, true, 0);
106
apps_manager.get_categories();
107
pages_view.home_page.categories_view.fill_space();
109
progress_info.set_visible(false);
111
pages_view.set_current_page(PageType.APPSINFO);
112
apps_manager.get_details("app-install-data;0.11.10.6;all;");
117
int main (string[] args) {