Merge lp:~donadigo/appcenter/fix-1609292-update-cache-ui into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski on 2016-08-09
Status: Merged
Approved by: Daniel Fore on 2016-08-24
Approved revision: 265
Merged at revision: 281
Proposed branch: lp:~donadigo/appcenter/fix-1609292-update-cache-ui
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 53 lines (+5/-6)
2 files modified
src/Application.vala (+3/-1)
src/Core/Client.vala (+2/-5)
To merge this branch: bzr merge lp:~donadigo/appcenter/fix-1609292-update-cache-ui
Reviewer Review Type Date Requested Status
Jeremy Wootten code 2016-08-09 Approve on 2016-08-22
Review via email: mp+302406@code.launchpad.net

Commit message

* Update count badge on launch.

Description of the change

Fixes bug #1609292: "Notification for AppCenter indicates new packages though there are none".

This branch fixes that the UpdateView updates and shows no updates while the count badge is still there not updating how many updates there are remaining.

To post a comment you must log in.
Jeremy Wootten (jeremywootten) wrote :

Approved (code - function not tested)

review: Approve (code)

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-06-19 21:09:16 +0000
3+++ src/Application.vala 2016-08-09 13:00:13 +0000
4@@ -57,13 +57,15 @@
5
6 public override void activate () {
7 if (silent) {
8+ AppCenterCore.Client.get_default ().update_cache.begin ();
9 silent = false;
10- AppCenterCore.Client.get_default ();
11 hold ();
12 return;
13 }
14
15 if (main_window == null) {
16+ AppCenterCore.Client.get_default ().update_cache.begin (true);
17+
18 main_window = new MainWindow (this);
19 main_window.destroy.connect (() => {
20 main_window = null;
21
22=== modified file 'src/Core/Client.vala'
23--- src/Core/Client.vala 2016-07-18 17:20:11 +0000
24+++ src/Core/Client.vala 2016-08-09 13:00:13 +0000
25@@ -40,8 +40,6 @@
26 } catch (Error e) {
27 error (e.message);
28 }
29-
30- update_cache.begin ();
31 }
32
33 construct {
34@@ -338,7 +336,6 @@
35 return package;
36 }
37
38-
39 public async void refresh_updates () {
40 var update_task = new AppCenter.Task ();
41 try {
42@@ -387,9 +384,9 @@
43 return size;
44 }
45
46- public async void update_cache () {
47+ public async void update_cache (bool force = false) {
48 // One cache update a day, keeps the doctor away!
49- if (last_cache_update == null || (new DateTime.now_local ()).difference (last_cache_update) >= GLib.TimeSpan.DAY) {
50+ if (force || last_cache_update == null || (new DateTime.now_local ()).difference (last_cache_update) >= GLib.TimeSpan.DAY) {
51 var refresh_task = new AppCenter.Task ();
52 try {
53 yield refresh_task.refresh_cache_async (false, null, (t, p) => { });

Subscribers

People subscribed via source and target branches