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

« back to all changes in this revision

Viewing changes to src/Backend/AppsManager.vala

  • Committer: Stephen Smally
  • Date: 2012-07-05 16:30:46 UTC
  • Revision ID: eco.stefi@fastwebnet.it-20120705163046-01tc1im1m9efk0zo
Added install and remove voids

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
        // PackageKit stuffs
31
31
        private Client client;
32
32
        private Control control;
 
33
        private Task task;
33
34
        private Cancellable transaction;
34
35
        
35
36
        // SQLHeavy stuffs
36
37
        private Database database;
37
38
        
 
39
        public void remove_packages (string[] ids, bool deps, bool auto) {
 
40
                        task.remove_packages_async (ids,
 
41
                                                    deps,
 
42
                                                    auto,
 
43
                                                    null,
 
44
                                                    (p) => {
 
45
                                                                                        if (p.percentage != -1) {
 
46
                                                                                                stdout.printf ("%d%\n", p.percentage);
 
47
                                                                                        }
 
48
                                                                                },
 
49
                                                    () => {
 
50
                                                                                    stdout.printf ("Finished to remove\n");
 
51
                                                                                });
 
52
                }
 
53
        
 
54
        public void install_packages (string[] ids) {
 
55
                        task.install_packages_async (ids,
 
56
                                                     null,
 
57
                                                     (p) => {
 
58
                                                                                         if (p.percentage != -1) {
 
59
                                                                                         stdout.printf ("%d%\n", p.percentage);
 
60
                                                                                         }
 
61
                                                                                 },
 
62
                                                     () => {
 
63
                                                                                         stdout.printf ("Finished to install\n");
 
64
                                                                                 });
 
65
                }
 
66
        
38
67
        public void get_pkgs (string category) {
39
68
            try {
40
69
                                Query get_query = database.prepare ("SELECT * FROM '%s';".printf (category));
114
143
        public AppsManager () {
115
144
            client = new Client();
116
145
            control = new Control();
 
146
            task = new Task();
117
147
            transaction = new Cancellable();
118
148
            
119
149
            try {
121
151
                        } catch (GLib.Error e) {
122
152
                                GLib.error ("Error opening the database: %s\nPlease run 'lsc-db-build -d /var/cache/lsc-packages.db' as root", e.message);
123
153
                        }
 
154
                        
 
155
                        try_get();
124
156
        }
125
157
    }
126
158
}