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
=== modified file 'src/Views/AppListView.vala'
--- src/Views/AppListView.vala 2016-06-26 23:28:28 +0000
+++ src/Views/AppListView.vala 2016-07-04 22:13:07 +0000
@@ -20,7 +20,7 @@
2020
21using AppCenterCore;21using AppCenterCore;
2222
23public class AppCenter.Views.AppListView : Gtk.ScrolledWindow {23public class AppCenter.Views.AppListView : Gtk.Grid {
24 public signal void show_app (AppCenterCore.Package package);24 public signal void show_app (AppCenterCore.Package package);
2525
26 private bool _updating_cache = true;26 private bool _updating_cache = true;
@@ -39,7 +39,9 @@
39 }39 }
4040
41 private bool updates_on_top;41 private bool updates_on_top;
42 private Gtk.Stack stack;
42 private Gtk.ListBox list_box;43 private Gtk.ListBox list_box;
44 private Gtk.Spinner spinner;
43 private Gtk.SizeGroup update_button_group;45 private Gtk.SizeGroup update_button_group;
4446
45 public AppListView (bool updates_on_top = false) {47 public AppListView (bool updates_on_top = false) {
@@ -50,9 +52,22 @@
50 }52 }
5153
52 construct {54 construct {
53 hscrollbar_policy = Gtk.PolicyType.NEVER;
54 var alert_view = new Granite.Widgets.AlertView (_("No Results"), _("No apps could be found. Try changing search terms."), "edit-find-symbolic");55 var alert_view = new Granite.Widgets.AlertView (_("No Results"), _("No apps could be found. Try changing search terms."), "edit-find-symbolic");
55 alert_view.show_all ();56 alert_view.show_all ();
57
58 stack = new Gtk.Stack ();
59
60 var spinner_box = new Gtk.Grid ();
61 spinner_box.expand = true;
62 spinner_box.show_all ();
63
64 spinner = new Gtk.Spinner ();
65 spinner.halign = Gtk.Align.CENTER;
66 spinner.valign = Gtk.Align.CENTER;
67
68 var scrolled_window = new Gtk.ScrolledWindow (null, null);
69 scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER;
70
56 list_box = new Gtk.ListBox ();71 list_box = new Gtk.ListBox ();
57 list_box.expand = true;72 list_box.expand = true;
58 list_box.activate_on_single_click = true;73 list_box.activate_on_single_click = true;
@@ -64,7 +79,12 @@
64 show_app (packagerow.package);79 show_app (packagerow.package);
65 }80 }
66 });81 });
67 add (list_box);82
83 scrolled_window.add (list_box);
84
85 stack.add_named (scrolled_window, "list");
86 stack.add_named (spinner, "spinner");
87 add (stack);
6888
69 update_button_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);89 update_button_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
70 }90 }
@@ -96,6 +116,16 @@
96 return tree_set;116 return tree_set;
97 }117 }
98118
119 public void set_show_spinner (bool show) {
120 if (show) {
121 spinner.start ();
122 stack.set_visible_child_name ("spinner");
123 } else {
124 spinner.stop ();
125 stack.set_visible_child_name ("list");
126 }
127 }
128
99 public void clear () {129 public void clear () {
100 list_box.get_children ().foreach ((child) => {130 list_box.get_children ().foreach ((child) => {
101 child.destroy ();131 child.destroy ();
102132
=== modified file 'src/Views/InstalledView.vala'
--- src/Views/InstalledView.vala 2016-06-25 15:34:25 +0000
+++ src/Views/InstalledView.vala 2016-07-04 22:13:07 +0000
@@ -49,6 +49,7 @@
49 }49 }
5050
51 public async void get_apps () {51 public async void get_apps () {
52 app_list_view.set_show_spinner (true);
52 unowned Client client = Client.get_default ();53 unowned Client client = Client.get_default ();
5354
54 var installed_apps = yield client.get_installed_applications ();55 var installed_apps = yield client.get_installed_applications ();
@@ -56,6 +57,7 @@
56 app_list_view.add_package (app);57 app_list_view.add_package (app);
57 }58 }
5859
60 app_list_view.set_show_spinner (false);
59 yield client.get_updates ();61 yield client.get_updates ();
60 }62 }
61 63

Subscribers

People subscribed via source and target branches