Merge lp:~donadigo/appcenter/updates-show-loading into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski
Status: Rejected
Rejected by: Danielle Foré
Proposed branch: lp:~donadigo/appcenter/updates-show-loading
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 96 lines (+35/-3)
2 files modified
src/Views/AppListView.vala (+33/-3)
src/Views/InstalledView.vala (+2/-0)
To merge this branch: bzr merge lp:~donadigo/appcenter/updates-show-loading
Reviewer Review Type Date Requested Status
Jeremy Wootten Needs Fixing
Review via email: mp+299094@code.launchpad.net

Commit message

- Show a spinner when loading apps in Updates page.

Description of the change

This branch fixes that when opening AppCenter and immediatly going to Updates, the page will show that there are no results and after all apps are loaded the view is presented. Now the page will show a spinner instead of no results message.

To post a comment you must log in.
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

I could not get this to work as it stands - See inline comments.

This will conflict with the restructuring branches, but not badly.

review: Needs Fixing

Unmerged revisions

238. By Adam Bieńkowski

Show spinner when loading apps in Updates page

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Views/AppListView.vala'
2--- src/Views/AppListView.vala 2016-06-26 23:28:28 +0000
3+++ src/Views/AppListView.vala 2016-07-04 22:13:07 +0000
4@@ -20,7 +20,7 @@
5
6 using AppCenterCore;
7
8-public class AppCenter.Views.AppListView : Gtk.ScrolledWindow {
9+public class AppCenter.Views.AppListView : Gtk.Grid {
10 public signal void show_app (AppCenterCore.Package package);
11
12 private bool _updating_cache = true;
13@@ -39,7 +39,9 @@
14 }
15
16 private bool updates_on_top;
17+ private Gtk.Stack stack;
18 private Gtk.ListBox list_box;
19+ private Gtk.Spinner spinner;
20 private Gtk.SizeGroup update_button_group;
21
22 public AppListView (bool updates_on_top = false) {
23@@ -50,9 +52,22 @@
24 }
25
26 construct {
27- hscrollbar_policy = Gtk.PolicyType.NEVER;
28 var alert_view = new Granite.Widgets.AlertView (_("No Results"), _("No apps could be found. Try changing search terms."), "edit-find-symbolic");
29 alert_view.show_all ();
30+
31+ stack = new Gtk.Stack ();
32+
33+ var spinner_box = new Gtk.Grid ();
34+ spinner_box.expand = true;
35+ spinner_box.show_all ();
36+
37+ spinner = new Gtk.Spinner ();
38+ spinner.halign = Gtk.Align.CENTER;
39+ spinner.valign = Gtk.Align.CENTER;
40+
41+ var scrolled_window = new Gtk.ScrolledWindow (null, null);
42+ scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER;
43+
44 list_box = new Gtk.ListBox ();
45 list_box.expand = true;
46 list_box.activate_on_single_click = true;
47@@ -64,7 +79,12 @@
48 show_app (packagerow.package);
49 }
50 });
51- add (list_box);
52+
53+ scrolled_window.add (list_box);
54+
55+ stack.add_named (scrolled_window, "list");
56+ stack.add_named (spinner, "spinner");
57+ add (stack);
58
59 update_button_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
60 }
61@@ -96,6 +116,16 @@
62 return tree_set;
63 }
64
65+ public void set_show_spinner (bool show) {
66+ if (show) {
67+ spinner.start ();
68+ stack.set_visible_child_name ("spinner");
69+ } else {
70+ spinner.stop ();
71+ stack.set_visible_child_name ("list");
72+ }
73+ }
74+
75 public void clear () {
76 list_box.get_children ().foreach ((child) => {
77 child.destroy ();
78
79=== modified file 'src/Views/InstalledView.vala'
80--- src/Views/InstalledView.vala 2016-06-25 15:34:25 +0000
81+++ src/Views/InstalledView.vala 2016-07-04 22:13:07 +0000
82@@ -49,6 +49,7 @@
83 }
84
85 public async void get_apps () {
86+ app_list_view.set_show_spinner (true);
87 unowned Client client = Client.get_default ();
88
89 var installed_apps = yield client.get_installed_applications ();
90@@ -56,6 +57,7 @@
91 app_list_view.add_package (app);
92 }
93
94+ app_list_view.set_show_spinner (false);
95 yield client.get_updates ();
96 }
97

Subscribers

People subscribed via source and target branches