Merge lp:~donadigo/appcenter/main-window-cache into lp:~elementary-apps/appcenter/appcenter

Proposed by Adam Bieńkowski
Status: Rejected
Rejected by: Danielle Foré
Proposed branch: lp:~donadigo/appcenter/main-window-cache
Merge into: lp:~elementary-apps/appcenter/appcenter
Diff against target: 90 lines (+16/-29)
2 files modified
src/Application.vala (+14/-15)
src/MainWindow.vala (+2/-14)
To merge this branch: bzr merge lp:~donadigo/appcenter/main-window-cache
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+314782@code.launchpad.net

Commit message

* Cache main window once to show it immediately to the user

Description of the change

This branch does some changes to how the main window is handeled / shown. Since appcenter is always running, the main window can be cached and kept in the memory while in trunk it gets destroyed and rebuilt again when user wants to open it.

With this branch there should be a noticeable speed increase when opening the window.

Keep in mind that this branch is *experimental*, it increases memory use in the system and should be heavily tested before merging it.

To post a comment you must log in.
376. By Adam Bieńkowski

Don't get the client explicitly on activate

Revision history for this message
Danielle Foré (danrabbit) wrote :

This kind of seems like a not great idea to me. I don't think there's a need to prioritize launching appcenter faster. It already launches fast. I think the fact that we don't hold onto that memory in the background is a feature

Unmerged revisions

376. By Adam Bieńkowski

Don't get the client explicitly on activate

375. By Adam Bieńkowski

Some experimental improvements to how main window is handeled

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Application.vala'
--- src/Application.vala 2016-12-28 16:29:00 +0000
+++ src/Application.vala 2017-01-15 14:50:52 +0000
@@ -94,35 +94,34 @@
94 activate ();94 activate ();
95 }95 }
9696
97 public override void startup () {
98 base.startup ();
99
100 main_window = new MainWindow (this);
101 add_window (main_window);
102
103 var client = AppCenterCore.Client.get_default ();
104 client.update_cache.begin (true);
105 }
106
97 public override void activate () {107 public override void activate () {
98 var client = AppCenterCore.Client.get_default ();
99 if (silent) {108 if (silent) {
100 NetworkMonitor.get_default ().network_changed.connect ((available) => {109 NetworkMonitor.get_default ().network_changed.connect ((available) => {
101 schedule_cache_update (!available);110 schedule_cache_update (!available);
102 });111 });
103112
104 client.update_cache.begin (true);
105 silent = false;113 silent = false;
106 hold ();114 hold ();
107 return;115 return;
108 }116 }
109117
110 if (main_window == null) {118 main_window.show_all ();
111 client.update_cache.begin (true);119 if (show_updates) {
112120 main_window.go_to_installed ();
113 main_window = new MainWindow (this);
114 main_window.destroy.connect (() => {
115 main_window = null;
116 });
117
118 add_window (main_window);
119 main_window.show_all ();
120 if (show_updates) {
121 main_window.go_to_installed ();
122 }
123 }121 }
124122
125 if (link != null) {123 if (link != null) {
124 var client = AppCenterCore.Client.get_default ();
126 var package = client.get_package_for_id (link);125 var package = client.get_package_for_id (link);
127 if (package != null) {126 if (package != null) {
128 main_window.show_package (package);127 main_window.show_package (package);
129128
=== modified file 'src/MainWindow.vala'
--- src/MainWindow.vala 2016-12-27 23:21:25 +0000
+++ src/MainWindow.vala 2017-01-15 14:50:52 +0000
@@ -27,7 +27,6 @@
27 private Gtk.Button return_button;27 private Gtk.Button return_button;
28 private Gtk.Button search_all_button;28 private Gtk.Button search_all_button;
29 private Gtk.Stack button_stack;29 private Gtk.Stack button_stack;
30 private ulong task_finished_connection = 0U;
31 private Gee.Deque<string> return_button_history;30 private Gee.Deque<string> return_button_history;
32 31
33 public static Views.InstalledView installed_view { get; private set; }32 public static Views.InstalledView installed_view { get; private set; }
@@ -166,22 +165,11 @@
166165
167 unowned AppCenterCore.Client client = AppCenterCore.Client.get_default ();166 unowned AppCenterCore.Client client = AppCenterCore.Client.get_default ();
168 if (client.has_tasks ()) {167 if (client.has_tasks ()) {
169 if (task_finished_connection != 0U) {
170 client.disconnect (task_finished_connection);
171 }
172
173 hide ();
174 task_finished_connection = client.notify["task-count"].connect (() => {
175 if (!visible && client.task_count == 0) {
176 destroy ();
177 }
178 });
179
180 client.cancel_updates (false); //Timeouts keep running168 client.cancel_updates (false); //Timeouts keep running
181 return true;
182 }169 }
183170
184 return false;171 hide ();
172 return true;
185 }173 }
186174
187 public void show_package (AppCenterCore.Package package) {175 public void show_package (AppCenterCore.Package package) {

Subscribers

People subscribed via source and target branches