Merge lp:~mefrio-g/light-software-center/libappstore-port into lp:light-software-center

Proposed by Mario Guerriero
Status: Merged
Merged at revision: 46
Proposed branch: lp:~mefrio-g/light-software-center/libappstore-port
Merge into: lp:light-software-center
Diff against target: 653 lines (+54/-315)
8 files modified
build.sh (+1/-1)
src/Backend/AppsManager.vala (+0/-207)
src/Backend/Backend.vala (+0/-51)
src/Frontend.vala (+21/-22)
src/Widgets/InfoMessage.vala (+5/-6)
src/Widgets/Pages/AppsInfo.vala (+13/-12)
src/Widgets/Pages/AppsView.vala (+6/-7)
src/Widgets/Pages/CategoriesView.vala (+8/-9)
To merge this branch: bzr merge lp:~mefrio-g/light-software-center/libappstore-port
Reviewer Review Type Date Requested Status
Lubuntu Software Center Team Pending
Review via email: mp+117167@code.launchpad.net

Description of the change

This is a porting to libappstore lib

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'build.sh'
--- build.sh 2012-07-10 16:27:53 +0000
+++ build.sh 2012-07-28 20:36:19 +0000
@@ -5,7 +5,7 @@
5echo -e "\t * libsqlheavy-dev"5echo -e "\t * libsqlheavy-dev"
66
77
8VALAC_PKGS="--pkg gio-2.0 --pkg packagekit-glib2 --pkg gtk+-3.0 --pkg sqlheavy-0.1"8VALAC_PKGS="--pkg gio-2.0 --pkg packagekit-glib2 --pkg gtk+-3.0 --pkg sqlheavy-0.1 --pkg appstore"
9VALAC_FLAGS="--vapidir=vapi/ -X 9VALAC_FLAGS="--vapidir=vapi/ -X
10-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE"10-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE"
11BIN="light-software-center"11BIN="light-software-center"
1212
=== removed directory 'src/Backend'
=== removed file 'src/Backend/AppsManager.vala'
--- src/Backend/AppsManager.vala 2012-07-12 14:59:00 +0000
+++ src/Backend/AppsManager.vala 1970-01-01 00:00:00 +0000
@@ -1,207 +0,0 @@
1// Copyright © 2012 Stephen Smally
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
18using PackageKit;
19using SQLHeavy;
20
21namespace Lsc.Backend {
22 public class AppsManager : Object {
23 // Signals
24 public signal void app_added (LscApp app);
25 public signal void category_added (LscCategory cat);
26 public signal void loading_started (LoadingType load, string text);
27 public signal void loading_finished (LoadingType load);
28 public signal void loading_progress (int percentage);
29 public signal void details_received (LscApp app, Package pkg, Details details);
30
31 // PackageKit stuffs
32 private Client client;
33 private Control control;
34 private Task task;
35 private Cancellable transaction;
36
37 // SQLHeavy stuffs
38 private Database database;
39
40 public void remove_packages (string[] ids, bool deps, bool auto) {
41 loading_started (LoadingType.REMOVE, "Removing packages...");
42 task.remove_packages_async (ids,
43 deps,
44 auto,
45 null,
46 (p) => {
47 if (p.percentage != -1) {
48 loading_progress (p.percentage);
49 }
50 },
51 () => {
52 loading_finished (LoadingType.REMOVE);
53 });
54 }
55
56 public void install_packages (string[] ids) {
57 loading_started (LoadingType.INSTALL, "Installing packages...");
58 task.install_packages_async (ids,
59 null,
60 (p) => {
61 if (p.percentage != -1) {
62 loading_progress (p.percentage);
63 }
64 },
65 () => {
66 loading_finished (LoadingType.INSTALL);
67 });
68 }
69
70 public void get_pkgs (string category) {
71 try {
72 Query get_query = database.prepare ("SELECT * FROM '%s';".printf (category));
73 QueryResult result = get_query.execute ();
74
75 for (int record = 1; ! result.finished; record++, result.next ()) {
76 app_added (new LscApp (
77 result.fetch_string (0),
78 result.fetch_string (1),
79 result.fetch_string (2),
80 result.fetch_string (3)));
81 //if ("x" in result.fetch_string (0))
82 //stdout.printf ("\n%s", result.fetch_string (0));
83 }
84 } catch (GLib.Error e) {
85 GLib.error ("Error retrieving packages: %s\n", e.message);
86 }
87
88 }
89
90 private void get_details_2 (LscApp pkg, Package p) {
91 client.get_details_async({p.get_id(), null},
92 null,
93 () => {
94 while (Gtk.events_pending()) {
95 Gtk.main_iteration();
96 }
97 },
98 (obj, resu) => {
99 try {
100 Results res = client.generic_finish (resu);
101 details_received (pkg, p, res.get_details_array()[0]);
102 } catch (GLib.Error e) {
103 stderr.printf ("ERROR! %s\n", e.message);
104 }
105 loading_finished (LoadingType.DETAILS);
106 }
107 );
108 }
109
110 public void get_details (LscApp pkg) {
111 loading_started (LoadingType.DETAILS, "Loading infos...");
112 client.resolve_async(0,
113 {pkg.id, null},
114 null,
115 () => {
116 while (Gtk.events_pending()) {
117 Gtk.main_iteration();
118 }
119 },
120 (obj, resu) => {
121 try {
122 Results res = client.generic_finish (resu);
123 get_details_2 (pkg, res.get_package_array()[0]);
124 } catch (GLib.Error e) {
125 stdout.printf ("ERROR! %s\n", e.message);
126 }
127 });
128 }
129
130 private int count_category (string category) {
131 try {
132 Query q = database.prepare ("SELECT COUNT (*) FROM '%s';".printf (category));
133 QueryResult r = q.execute();
134 return r.fetch_int (0);
135 } catch (GLib.Error e) {
136 stdout.printf ("ERROR! %s\n", e.message);
137 }
138 return -1;
139 }
140
141 public void get_categories () {
142 loading_started(LoadingType.CATEGORIES, "Loading categories...");
143 try {
144 Query cat_query = database.prepare ("SELECT * FROM 'DIRECTORIES';");
145 QueryResult result = cat_query.execute ();
146
147 for (int record = 1; ! result.finished; record++, result.next ()) {
148 category_added (new LscCategory (result.fetch_string (0),
149 result.fetch_string (1),
150 result.fetch_string (2),
151 result.fetch_string (3),
152 count_category (result.fetch_string (0))));
153 }
154 } catch (GLib.Error e) {
155 GLib.error ("Error retrieving packages: %s\n", e.message);
156 }
157
158 loading_finished(LoadingType.CATEGORIES);
159 }
160
161 public void search_for_apps (string search_string) {
162
163 // Categories
164 try {
165 Query get_query = database.prepare ("SELECT * FROM 'DIRECTORIES';");
166 QueryResult result = get_query.execute ();
167
168 // Foreach category
169 for (int record = 1; ! result.finished; record++, result.next ()) {
170 // Check for a package
171 stdout.printf ("\n%s", result.fetch_string (0));
172 try {
173 get_query = database.prepare ("SELECT * FROM '%s';".printf (result.fetch_string (0)));
174 result = get_query.execute ();
175
176 for (record = 1; ! result.finished; record++, result.next ()) {
177 if (search_string in result.fetch_string (0)) // If something is found let's send the application
178 app_added (new LscApp (
179 result.fetch_string (0),
180 result.fetch_string (1),
181 result.fetch_string (2),
182 result.fetch_string (3)));
183 }
184 } catch (GLib.Error e) {
185 GLib.error ("Error retrieving packages: %s\n", e.message);
186 }
187 }
188 } catch (GLib.Error e) {
189 GLib.error ("Error retrieving packages: %s\n", e.message);
190 }
191 }
192
193 public AppsManager () {
194 client = new Client();
195 control = new Control();
196 task = new Task();
197 transaction = new Cancellable();
198 stdout.printf ("Cache age: %ld\n", client.get_cache_age());
199
200 try {
201 database = new Database ("/var/cache/lsc-vala.db", FileMode.READ);
202 } catch (GLib.Error e) {
203 GLib.error ("Error opening the database: %s\nPlease run 'lsc-db-build -d /var/cache/lsc-packages.db' as root", e.message);
204 }
205 }
206 }
207}
2080
=== removed file 'src/Backend/Backend.vala'
--- src/Backend/Backend.vala 2012-07-12 09:21:39 +0000
+++ src/Backend/Backend.vala 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
1
2namespace Lsc.Backend {
3 public enum LoadingType {
4 PACKAGES, // Loaded packages
5 CATEGORIES, // Loaded categories
6 DETAILS, // Loading details
7 INSTALL,
8 REMOVE, // Installed or so
9 SEARCH; // When it is searching apps
10 }
11
12 public enum ActionType {
13 INSTALL,
14 REMOVE;
15 }
16
17 public enum ResponseId {
18 INFO,
19 INSTALL;
20 }
21
22 public class LscCategory : Object {
23 public string id;
24 public string name;
25 public string summary;
26 public string icon;
27 public int records;
28
29 public LscCategory (string id, string name, string summary, string icon, int records = 0) {
30 this.id = id;
31 this.name = name;
32 this.summary = summary;
33 this.icon = icon;
34 this.records = records;
35 }
36 }
37
38 public class LscApp : Object {
39 public string id { get; private set; } // A valid id retrieved from a PkPackage
40 public string name { get; private set; }
41 public string summary { get; private set; }
42 public string icon { get; set; }
43
44 public LscApp (string id, string name, string summary, string icon) {
45 this.id = id;
46 this.name = name;
47 this.summary = summary;
48 this.icon = icon;
49 }
50 }
51}
520
=== modified file 'src/Frontend.vala'
--- src/Frontend.vala 2012-07-12 09:21:39 +0000
+++ src/Frontend.vala 2012-07-28 20:36:19 +0000
@@ -16,14 +16,13 @@
16// 16//
1717
18using Gtk;18using Gtk;
19using Lsc.Backend;
20using Lsc.Utils;19using Lsc.Utils;
21using Lsc.Widgets;20using Lsc.Widgets;
2221
23namespace Lsc {22namespace Lsc {
24 // Elements which should be accessible to every void or class23 // Elements which should be accessible to every void or class
25 public LscCategory last_category;24 public AppStore.Category last_category;
26 public LscApp last_app;25 public AppStore.ModelApp last_app;
27 26
28 public enum PageType {27 public enum PageType {
29 HOMEPAGE,28 HOMEPAGE,
@@ -49,7 +48,7 @@
49 }48 }
50 49
51 // Apps Manager which handle the PackageKit connection50 // Apps Manager which handle the PackageKit connection
52 public AppsManager apps_manager;51 public AppStore.AppsManager apps_manager;
53 52
54 public class Frontend : Window {53 public class Frontend : Window {
55 // Widgets54 // Widgets
@@ -64,7 +63,7 @@
64 private int _width = 0;63 private int _width = 0;
65 64
66 public Frontend () {65 public Frontend () {
67 apps_manager = new AppsManager();66 apps_manager = new AppStore.AppsManager();
68 67
69 destroy.connect(Gtk.main_quit);68 destroy.connect(Gtk.main_quit);
70 size_allocate.connect(on_size_allocate);69 size_allocate.connect(on_size_allocate);
@@ -110,35 +109,35 @@
110 set_focus(null);109 set_focus(null);
111 }110 }
112 111
113 public void on_info_message_response (ResponseId id, LscApp app) {112 public void on_info_message_response (AppStore.ResponseId id, AppStore.ModelApp app) {
114 switch (id) {113 switch (id) {
115 case ResponseId.INFO:114 case AppStore.ResponseId.INFO:
116 load_details (app);115 load_details (app);
117 break;116 break;
118 case ResponseId.INSTALL:117 case AppStore.ResponseId.INSTALL:
119 break;118 break;
120 }119 }
121 }120 }
122 121
123 public void load_details (LscApp app) {122 public void load_details (AppStore.ModelApp app) {
124 info_message.set_visible (false);123 info_message.set_visible (false);
125 last_app = app;124 last_app = app;
126 apps_manager.get_details (app);125 apps_manager.get_details (app);
127 pages_view.set_page(PageType.APPSINFO);126 pages_view.set_page(PageType.APPSINFO);
128 }127 }
129 128
130 public void load_packages (LscCategory category) {129 public void load_packages (AppStore.Category category) {
131 last_category = category;130 last_category = category;
132 pages_view.set_page(PageType.APPSVIEW);131 pages_view.set_page(PageType.APPSVIEW);
133 pages_view.apps_view.apps_tree.clear();132 pages_view.apps_view.apps_tree.clear();
134 apps_manager.get_pkgs(category.id);133 apps_manager.get_apps(category.id);
135 toolbar.label.label = category.name;134 toolbar.label.label = category.name;
136 info_message.set_visible (false);135 info_message.set_visible (false);
137 }136 }
138 137
139 public void on_action_response (ActionType type, string id) {138 public void on_action_response (AppStore.ActionType type, string id) {
140 switch (type) {139 switch (type) {
141 case ActionType.INSTALL:140 case AppStore.ActionType.INSTALL:
142 apps_manager.install_packages ({id, null});141 apps_manager.install_packages ({id, null});
143 break;142 break;
144 default:143 default:
@@ -247,18 +246,18 @@
247 return true;246 return true;
248 }247 }
249 248
250 public void on_load_started (LoadingType load, string comment) {249 public void on_load_started (AppStore.LoadingType load, string comment) {
251 switch (load) {250 switch (load) {
252 case LoadingType.PACKAGES:251 case AppStore.LoadingType.PACKAGES:
253 progress_info.load (comment);252 progress_info.load (comment);
254 break;253 break;
255 case LoadingType.DETAILS:254 case AppStore.LoadingType.DETAILS:
256 pages_view.apps_info.start_load();255 pages_view.apps_info.start_load();
257 break;256 break;
258 case LoadingType.INSTALL:257 case AppStore.LoadingType.INSTALL:
259 progress_info.load (comment);258 progress_info.load (comment);
260 break;259 break;
261 case LoadingType.REMOVE:260 case AppStore.LoadingType.REMOVE:
262 progress_info.load (comment);261 progress_info.load (comment);
263 break;262 break;
264 default:263 default:
@@ -267,15 +266,15 @@
267 info_box.set_visible (true);266 info_box.set_visible (true);
268 }267 }
269 268
270 public void on_load_finished (LoadingType load) {269 public void on_load_finished (AppStore.LoadingType load) {
271 switch (load) {270 switch (load) {
272 case LoadingType.CATEGORIES:271 case AppStore.LoadingType.CATEGORIES:
273 rework_categories_columns();272 rework_categories_columns();
274 break;273 break;
275 case LoadingType.PACKAGES:274 case AppStore.LoadingType.PACKAGES:
276 progress_info.clear();275 progress_info.clear();
277 break;276 break;
278 case LoadingType.DETAILS:277 case AppStore.LoadingType.DETAILS:
279 progress_info.clear();278 progress_info.clear();
280 break;279 break;
281 default:280 default:
282281
=== modified file 'src/Widgets/InfoMessage.vala'
--- src/Widgets/InfoMessage.vala 2012-07-10 09:44:20 +0000
+++ src/Widgets/InfoMessage.vala 2012-07-28 20:36:19 +0000
@@ -16,27 +16,26 @@
16// 16//
1717
18using Gtk;18using Gtk;
19using Lsc.Backend;
2019
21namespace Lsc.Widgets {20namespace Lsc.Widgets {
22 public class InfoMessage : InfoBar {21 public class InfoMessage : InfoBar {
23 // Signals22 // Signals
24 public signal void choosed (ResponseId id, LscApp app);23 public signal void choosed (AppStore.ResponseId id, AppStore.ModelApp app);
25 24
26 // Widgets25 // Widgets
27 public Label text;26 public Label text;
28 public Button info_button;27 public Button info_button;
29 public Button action_button;28 public Button action_button;
30 private LscApp current_app;29 private AppStore.ModelApp current_app;
31 30
32 public void update (LscApp app) {31 public void update (AppStore.ModelApp app) {
33 current_app = app;32 current_app = app;
34 set_visible (true);33 set_visible (true);
35 text.set_label("Selected package <b>%s</b>".printf (app.id));34 text.set_label("Selected package <b>%s</b>".printf (app.id));
36 }35 }
37 36
38 public void get_response (InfoBar bar, int id) {37 public void get_response (InfoBar bar, int id) {
39 choosed ((ResponseId) id, current_app);38 choosed ((AppStore.ResponseId) id, current_app);
40 }39 }
41 40
42 public InfoMessage () {41 public InfoMessage () {
@@ -51,7 +50,7 @@
51 text.use_markup = true;50 text.use_markup = true;
52 text.ellipsize = Pango.EllipsizeMode.END;51 text.ellipsize = Pango.EllipsizeMode.END;
53 52
54 add_button(Stock.INFO, ResponseId.INFO);53 add_button(Stock.INFO, AppStore.ResponseId.INFO);
55 54
56 focus_out_event.connect(() => {55 focus_out_event.connect(() => {
57 set_visible(false);56 set_visible(false);
5857
=== modified file 'src/Widgets/Pages/AppsInfo.vala'
--- src/Widgets/Pages/AppsInfo.vala 2012-07-10 19:06:05 +0000
+++ src/Widgets/Pages/AppsInfo.vala 2012-07-28 20:36:19 +0000
@@ -18,12 +18,11 @@
18using Gtk;18using Gtk;
19using PackageKit;19using PackageKit;
20using Lsc.Widgets;20using Lsc.Widgets;
21using Lsc.Backend;
22using Granite.Widgets;21using Granite.Widgets;
2322
24namespace Lsc.Pages {23namespace Lsc.Pages {
25 public class AppsInfo : BlankBox {24 public class AppsInfo : BlankBox {
26 public signal void action_response (ActionType type, string id);25 public signal void action_response (AppStore.ActionType type, string id);
27 26
28 private Separator separator;27 private Separator separator;
29 public RoundBox reviews_box;28 public RoundBox reviews_box;
@@ -42,15 +41,15 @@
42 private Label license;41 private Label license;
43 private Button action_button;42 private Button action_button;
44 private string pkg_id;43 private string pkg_id;
45 private ActionType action_type;44 private AppStore.ActionType action_type;
46 45
47 public void set_action (ActionType type) {46 public void set_action (AppStore.ActionType type) {
48 action_type = type;47 action_type = type;
49 switch (type) {48 switch (type) {
50 case ActionType.INSTALL:49 case AppStore.ActionType.INSTALL:
51 action_button.label = "Install";50 action_button.label = "Install";
52 break;51 break;
53 case ActionType.REMOVE:52 case AppStore.ActionType.REMOVE:
54 action_button.label = "Remove";53 action_button.label = "Remove";
55 break;54 break;
56 }55 }
@@ -61,17 +60,19 @@
61 case Info.INSTALLED:60 case Info.INSTALLED:
62 status_icon.set_from_stock (Stock.YES, IconSize.MENU);61 status_icon.set_from_stock (Stock.YES, IconSize.MENU);
63 status_label.label = "Installed";62 status_label.label = "Installed";
64 set_action (ActionType.REMOVE);63 set_action (AppStore.ActionType.REMOVE);
65 break;64 break;
66 default:65 default:
67 status_icon.set_from_icon_name ("applications-internet", IconSize.MENU);66 status_icon.set_from_icon_name ("applications-internet", IconSize.MENU);
68 status_label.label = "Available";67 status_label.label = "Available";
69 set_action (ActionType.INSTALL);68 set_action (AppStore.ActionType.INSTALL);
70 break;69 break;
71 }70 }
72 }71 }
73 72
74 public void set_details (LscApp app, Package pkg, Details details) {73 public void set_details (AppStore.App app) {
74 var pkg = app.package;
75
75 pkg_id = pkg.get_id();76 pkg_id = pkg.get_id();
76 77
77 this.show_children();78 this.show_children();
@@ -84,14 +85,14 @@
84 pkg_name.label = "<span size='x-large'><b>%s</b></span>".printf (app.name);85 pkg_name.label = "<span size='x-large'><b>%s</b></span>".printf (app.name);
85 short_description.label = "<big>%s</big>".printf (app.summary);86 short_description.label = "<big>%s</big>".printf (app.summary);
86 87
87 description.label = details.description;88 description.label = app.description;
88 89
89 image.set_from_icon_name (app.icon, IconSize.DIALOG);90 image.set_from_icon_name (app.icon, IconSize.DIALOG);
90 91
91 id.label = pkg.get_name();92 id.label = pkg.get_name();
92 version.label = pkg.get_version();93 version.label = pkg.get_version();
93 size.label = Utils.size_to_str ((int) details.size);94 size.label = Utils.size_to_str ((int) app.size);
94 license.label = details.license;95 license.label = app.license;
95 details_box.set_visible (false);96 details_box.set_visible (false);
96 s_nb.page = 0;97 s_nb.page = 0;
97 }98 }
9899
=== modified file 'src/Widgets/Pages/AppsView.vala'
--- src/Widgets/Pages/AppsView.vala 2012-07-12 09:21:39 +0000
+++ src/Widgets/Pages/AppsView.vala 2012-07-28 20:36:19 +0000
@@ -17,13 +17,12 @@
1717
18using Gtk;18using Gtk;
19using PackageKit;19using PackageKit;
20using Lsc.Backend;
2120
22namespace Lsc.Widgets {21namespace Lsc.Widgets {
23 public class AppsTree : TreeView {22 public class AppsTree : TreeView {
24 // Signals23 // Signals
25 public signal void selected_row (LscApp app);24 public signal void selected_row (AppStore.ModelApp app);
26 public signal void activated_row (LscApp app);25 public signal void activated_row (AppStore.ModelApp app);
27 26
28 // Vars27 // Vars
29 private IconTheme theme;28 private IconTheme theme;
@@ -31,7 +30,7 @@
31 private TreeIter iter;30 private TreeIter iter;
32 private new TreePath path;31 private new TreePath path;
33 32
34 public void append_app (LscApp app) { 33 public void append_app (AppStore.ModelApp app) {
35 model.append(out iter);34 model.append(out iter);
36 //model.set(iter, 0, app.icon, 1, "<span size='medium'>"+Utils.escape_text (app.name)+"</span>\n<span size='small'>"+Utils.escape_text (app.summary)+"</span>", 2, app);35 //model.set(iter, 0, app.icon, 1, "<span size='medium'>"+Utils.escape_text (app.name)+"</span>\n<span size='small'>"+Utils.escape_text (app.summary)+"</span>", 2, app);
37 model.set(iter, 0, app.icon, 1, "<b>"+Utils.escape_text (app.name)+"</b>\n"+Utils.escape_text (app.summary), 2, app); // FIXME: this actually take time36 model.set(iter, 0, app.icon, 1, "<b>"+Utils.escape_text (app.name)+"</b>\n"+Utils.escape_text (app.summary), 2, app); // FIXME: this actually take time
@@ -44,7 +43,7 @@
44 public void on_cursor_changed (TreeView widget) {43 public void on_cursor_changed (TreeView widget) {
45 get_cursor(out path, null);44 get_cursor(out path, null);
46 if (path != null) {45 if (path != null) {
47 LscApp val;46 AppStore.ModelApp val;
48 model.get_iter(out iter, path);47 model.get_iter(out iter, path);
49 model.get(iter, 2, out val);48 model.get(iter, 2, out val);
50 selected_row(val);49 selected_row(val);
@@ -54,7 +53,7 @@
54 public void on_row_activated (TreePath path, TreeViewColumn column) {53 public void on_row_activated (TreePath path, TreeViewColumn column) {
55 get_cursor(out this.path, null);54 get_cursor(out this.path, null);
56 if (path != null) {55 if (path != null) {
57 LscApp val;56 AppStore.ModelApp val;
58 model.get_iter(out iter, this.path);57 model.get_iter(out iter, this.path);
59 model.get(iter, 2, out val);58 model.get(iter, 2, out val);
60 activated_row(val);59 activated_row(val);
@@ -69,7 +68,7 @@
69 model = new ListStore(3,68 model = new ListStore(3,
70 t_string, // Icon name69 t_string, // Icon name
71 t_string, // Name and description70 t_string, // Name and description
72 typeof(LscApp) // LscApp object71 typeof(AppStore.ModelApp) // AppStore.App object
73 );72 );
74 73
75 set_model(model);74 set_model(model);
7675
=== modified file 'src/Widgets/Pages/CategoriesView.vala'
--- src/Widgets/Pages/CategoriesView.vala 2012-07-11 18:59:07 +0000
+++ src/Widgets/Pages/CategoriesView.vala 2012-07-28 20:36:19 +0000
@@ -16,19 +16,18 @@
16// 16//
1717
18using Gtk;18using Gtk;
19using Lsc.Backend;
2019
21namespace Lsc.Widgets { 20namespace Lsc.Widgets {
22 public class CategoryButton : EventBox {21 public class CategoryButton : EventBox {
23 private LscCategory desc;22 private AppStore.Category desc;
24 public signal void category_clicked (LscCategory cat);23 public signal void category_clicked (AppStore.Category cat);
25 24
26 private bool emit_clicked (Widget box, Gdk.EventButton button) {25 private bool emit_clicked (Widget box, Gdk.EventButton button) {
27 category_clicked (desc);26 category_clicked (desc);
28 return true;27 return true;
29 }28 }
30 29
31 public CategoryButton (LscCategory desc, bool fill = false) {30 public CategoryButton (AppStore.Category desc, bool fill = false) {
32 this.desc = desc;31 this.desc = desc;
33 32
34 sensitive = ! fill;33 sensitive = ! fill;
@@ -69,16 +68,16 @@
69 }68 }
70 69
71 public class CategoriesView : GridView {70 public class CategoriesView : GridView {
72 public signal void category_choosed (LscCategory cat);71 public signal void category_choosed (AppStore.Category cat);
73 72
74 // Vars73 // Vars
75 private Box box_child;74 private Box box_child;
76 private CategoryButton button_child;75 private CategoryButton button_child;
77 public int columns { get; set; }76 public int columns { get; set; }
78 private int actual_col;77 private int actual_col;
79 private new List<LscCategory> children = null;78 private new List<AppStore.Category> children = null;
80 79
81 public void add_category (LscCategory cat) {80 public void add_category (AppStore.Category cat) {
82 children.append(cat);81 children.append(cat);
83 }82 }
84 83
@@ -89,7 +88,7 @@
89 box_child = null;88 box_child = null;
90 actual_col = columns;89 actual_col = columns;
91 90
92 foreach (LscCategory button_desc in children) {91 foreach (AppStore.Category button_desc in children) {
93 if (actual_col == columns) {92 if (actual_col == columns) {
94 box_child = new Box(Orientation.HORIZONTAL, 5);93 box_child = new Box(Orientation.HORIZONTAL, 5);
95 box_child.homogeneous = true;94 box_child.homogeneous = true;
@@ -109,7 +108,7 @@
109 }108 }
110 109
111 while (actual_col != columns) {110 while (actual_col != columns) {
112 button_child = new CategoryButton(new LscCategory("", "", "", "", 0), true);111 button_child = new CategoryButton(new AppStore.Category("", "", "", "", 0), true);
113 box_child.pack_start(button_child, true, true, 0);112 box_child.pack_start(button_child, true, true, 0);
114 button_child.show_all();113 button_child.show_all();
115 actual_col++;114 actual_col++;

Subscribers

People subscribed via source and target branches