Merge lp:~donadigo/appcenter/fix-package-link-show into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Corentin Noël
Approved revision: 359
Merged at revision: 359
Proposed branch: lp:~donadigo/appcenter/fix-package-link-show
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 49 lines (+10/-11)
2 files modified
src/Application.vala (+9/-9)
src/Core/Client.vala (+1/-2)
To merge this branch: bzr merge lp:~donadigo/appcenter/fix-package-link-show
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+313902@code.launchpad.net

Commit message

* Fix link handling so that it shows the package even if the window is already shown

Description of the change

This branch fixes wrong position of the link handling, which is causing that the package will not be shown when the window is already opened.

This also simplifies the foreach loop to use "values" property instead of "entries".

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
1=== modified file 'src/Application.vala'
2--- src/Application.vala 2016-12-27 23:45:51 +0000
3+++ src/Application.vala 2016-12-28 16:32:57 +0000
4@@ -115,15 +115,6 @@
5 main_window = null;
6 });
7
8- if (link != null) {
9- var package = client.get_package_for_id (link);
10- if (package != null) {
11- main_window.show_package (package);
12- } else {
13- warning (_("Specified link '%s' could not be found, going back to the main panel").printf (link));
14- }
15- }
16-
17 add_window (main_window);
18 main_window.show_all ();
19 if (show_updates) {
20@@ -131,6 +122,15 @@
21 }
22 }
23
24+ if (link != null) {
25+ var package = client.get_package_for_id (link);
26+ if (package != null) {
27+ main_window.show_package (package);
28+ } else {
29+ warning (_("Specified link '%s' could not be found, going back to the main panel").printf (link));
30+ }
31+ }
32+
33 main_window.present ();
34 }
35
36
37=== modified file 'src/Core/Client.vala'
38--- src/Core/Client.vala 2016-12-27 23:45:51 +0000
39+++ src/Core/Client.vala 2016-12-28 16:32:57 +0000
40@@ -467,8 +467,7 @@
41 }
42
43 public AppCenterCore.Package? get_package_for_id (string id) {
44- foreach (var entry in package_list.entries) {
45- var package = entry.value;
46+ foreach (var package in package_list.values) {
47 if (package.component.id == id) {
48 return package;
49 }

Subscribers

People subscribed via source and target branches