Merge lp:~donadigo/appcenter/fix-empty-updates into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Danielle Foré
Approved revision: 266
Merged at revision: 282
Proposed branch: lp:~donadigo/appcenter/fix-empty-updates
Merge into: lp:~elementary-apps/appcenter/appcenter
Prerequisite: lp:~donadigo/appcenter/fix-1609292-update-cache-ui
Diff against target: 55 lines (+13/-4)
2 files modified
src/Application.vala (+11/-3)
src/Core/Client.vala (+2/-1)
To merge this branch: bzr merge lp:~donadigo/appcenter/fix-empty-updates
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+303688@code.launchpad.net

Commit message

* Update cache when the network is available.

Description of the change

This branch aims to fix bug #1615270: "AppCenter is empty if apt update has never been run". AppCenter will now try to refresh the cache after network is available. It also makes sure that the badge will be displayed when there are any updates cached.

I still don't know if it fixed the issue or not, I tested a similiar case on a normal install and it seemed to work.

Note that this branch is a prerequisite to this one and it needs to be merged first: https://code.launchpad.net/~donadigo/appcenter/fix-1609292-update-cache-ui

To post a comment you must log in.
Revision history for this message
kay van der Zander (kay20) wrote :

code look fine. needs testing

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-08-23 14:41:30 +0000
3+++ src/Application.vala 2016-08-23 14:41:30 +0000
4@@ -56,15 +56,23 @@
5 }
6
7 public override void activate () {
8+ var client = AppCenterCore.Client.get_default ();
9 if (silent) {
10- AppCenterCore.Client.get_default ().update_cache.begin ();
11+ NetworkMonitor.get_default ().network_changed.connect ((available) => {
12+ if (available) {
13+ client.update_cache.begin (true);
14+ }
15+ });
16+
17+ client.update_cache.begin ();
18+
19 silent = false;
20 hold ();
21 return;
22 }
23
24 if (main_window == null) {
25- AppCenterCore.Client.get_default ().update_cache.begin (true);
26+ client.update_cache.begin (true);
27
28 main_window = new MainWindow (this);
29 main_window.destroy.connect (() => {
30@@ -77,7 +85,7 @@
31 main_window.go_to_installed ();
32 }
33 } else {
34- AppCenterCore.Client.get_default ().interface_cancellable.reset ();
35+ client.interface_cancellable.reset ();
36 }
37
38 main_window.present ();
39
40=== modified file 'src/Core/Client.vala'
41--- src/Core/Client.vala 2016-08-23 14:41:30 +0000
42+++ src/Core/Client.vala 2016-08-23 14:41:30 +0000
43@@ -391,10 +391,11 @@
44 try {
45 yield refresh_task.refresh_cache_async (false, null, (t, p) => { });
46 last_cache_update = new DateTime.now_local ();
47- refresh_updates.begin ();
48 } catch (Error e) {
49 critical (e.message);
50 }
51+
52+ refresh_updates.begin ();
53 }
54
55 GLib.Timeout.add_seconds (60*60*24, () => {

Subscribers

People subscribed via source and target branches