Merge lp:~donadigo/appcenter/extensions into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Danielle Foré
Approved revision: 215
Merged at revision: 215
Proposed branch: lp:~donadigo/appcenter/extensions
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 106 lines (+50/-2)
3 files modified
src/Core/Client.vala (+10/-0)
src/Core/Package.vala (+5/-1)
src/Views/AppInfoView.vala (+35/-1)
To merge this branch: bzr merge lp:~donadigo/appcenter/extensions
Reviewer Review Type Date Requested Status
Danielle Foré code Approve
elementary Apps team code Pending
Review via email: mp+298248@code.launchpad.net

Commit message

Show add ons for apps in app info view

Description of the change

Fixes bug #1528412: "Show add ons for apps in app info view".

* Note 1: this branch will not function properly due to the broken PackageRow class, the extensions as normal packages will propose to "update" instead of install. I tested it locally and the installation of extensions is working. After the bug #1593609 is fixed it will be fully working.
Optionally you can merge the lp:~benwaffle/appcenter/buttons locally and test it out.

* Note 2: The PackageRow class is unchanged so the other branch can be later merged.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

LGTM. I think Rico would say to not even create those widgets if there are no extensions instead of hiding and showing.

review: Approve (testing)
lp:~donadigo/appcenter/extensions updated
215. By Adam Bieńkowski

Add support for extensions

Revision history for this message
Danielle Foré (danrabbit) wrote :

Works as expected. The package row buttons are broken, but that is not within the scope of this branch. Ben's branch corrects that issue.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Core/Client.vala'
2--- src/Core/Client.vala 2016-06-19 21:09:16 +0000
3+++ src/Core/Client.vala 2016-06-24 17:12:47 +0000
4@@ -97,6 +97,16 @@
5 }
6 }
7
8+ public AppStream.Component? get_extension (string extension) throws GLib.Error {
9+ try {
10+ return appstream_database.get_component_by_id (extension);
11+ } catch (Error e) {
12+ warning ("%s\n", e.message);
13+ }
14+
15+ return null;
16+ }
17+
18 public async void install_package (Package package, Pk.ProgressCallback cb, GLib.Cancellable cancellable) throws GLib.Error {
19 AppCenter.Task install_task = request_task ();
20 AppCenter.Task search_task = request_task ();
21
22=== modified file 'src/Core/Package.vala'
23--- src/Core/Package.vala 2016-06-21 18:18:51 +0000
24+++ src/Core/Package.vala 2016-06-24 17:12:47 +0000
25@@ -180,7 +180,11 @@
26 });
27
28 if (icon == null) {
29- icon = new ThemedIcon ("application-default-icon");
30+ if (component.get_kind () == AppStream.ComponentKind.ADDON) {
31+ icon = new ThemedIcon ("extension");
32+ } else {
33+ icon = new ThemedIcon ("application-default-icon");
34+ }
35 }
36
37 return icon;
38
39=== modified file 'src/Views/AppInfoView.vala'
40--- src/Views/AppInfoView.vala 2016-06-21 17:43:40 +0000
41+++ src/Views/AppInfoView.vala 2016-06-24 17:12:47 +0000
42@@ -34,7 +34,10 @@
43 Gtk.Button action_button;
44 Gtk.Button uninstall_button;
45 Gtk.ProgressBar progress_bar;
46+ Gtk.Grid content_grid;
47+ Gtk.ListBox extension_box;
48 Gtk.Label progress_label;
49+ Gtk.Label extension_label;
50 Gtk.Button cancel_button;
51 Gtk.Stack action_stack;
52
53@@ -45,6 +48,21 @@
54 parse_description (package.component.get_description ());
55 app_icon.gicon = package.get_icon (128);
56
57+ if (package.component.get_extensions ().length > 0) {
58+ extension_box = new Gtk.ListBox ();
59+ extension_box.selection_mode = Gtk.SelectionMode.NONE;
60+
61+ extension_label = new Gtk.Label ("<b>" + _("Extensions:") + "</b>");
62+ extension_label.margin_top = 12;
63+ extension_label.use_markup = true;
64+ extension_label.get_style_context ().add_class ("h3");
65+ extension_label.halign = Gtk.Align.START;
66+
67+ content_grid.add (extension_label);
68+ content_grid.add (extension_box);
69+ load_extensions.begin ();
70+ }
71+
72 if (package.update_available) {
73 action_button.label = _("Update");
74 } else if (package.installed) {
75@@ -179,7 +197,7 @@
76 progress_grid.attach (progress_bar, 0, 1, 1, 1);
77 progress_grid.attach (cancel_button, 1, 0, 1, 2);
78
79- var content_grid = new Gtk.Grid ();
80+ content_grid = new Gtk.Grid ();
81 content_grid.width_request = 800;
82 content_grid.halign = Gtk.Align.CENTER;
83 content_grid.margin = 24;
84@@ -207,6 +225,22 @@
85 });
86 }
87
88+ private async void load_extensions () {
89+ package.component.get_extensions ().@foreach ((cid) => {
90+ try {
91+ var extension = Client.get_default ().get_extension (cid);
92+ if (extension != null) {
93+ var row = new Widgets.PackageRow (new Package (extension));
94+ if (extension_box != null) {
95+ extension_box.add (row);
96+ }
97+ }
98+ } catch (Error e) {
99+ warning ("%s\n", e.message);
100+ }
101+ });
102+ }
103+
104 public void load_more_content () {
105 new Thread<void*> ("content loading", () => {
106 string url = null;

Subscribers

People subscribed via source and target branches