[gnome-usage] cpu-sub-view: Update showing list-box acording to backend state



commit f99ff6ab67203ab861d1388bc1d13a330617dc94
Author: Petr Štětka <pstetka redhat com>
Date:   Thu May 31 14:13:17 2018 +0200

    cpu-sub-view: Update showing list-box acording to backend state

 src/cpu-sub-view.vala | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/cpu-sub-view.vala b/src/cpu-sub-view.vala
index 23516dc..55fdcbc 100644
--- a/src/cpu-sub-view.vala
+++ b/src/cpu-sub-view.vala
@@ -48,7 +48,7 @@ namespace Usage
             var spinner = new Gtk.Spinner();
             spinner.active = true;
             spinner.margin_top = 30;
-            spinner.margin_bottom = 20;
+            spinner.height_request = 250;
 
             no_process_view = new NoResultsFoundView();
 
@@ -59,11 +59,16 @@ namespace Usage
             cpu_box.pack_start(spinner, true, true, 0);
             cpu_box.add(no_process_view);
 
-            SystemMonitor.get_default().cpu_processes_ready.connect(() =>
-            {
-                cpu_box.pack_start(process_list_box, false, false, 0);
-                process_list_box.update();
-                cpu_box.remove(spinner);
+            var system_monitor = SystemMonitor.get_default();
+            system_monitor.notify["process-list-ready"].connect ((sender, property) => {
+                if(system_monitor.process_list_ready) {
+                    cpu_box.pack_start(process_list_box, false, false, 0);
+                    cpu_box.remove(spinner);
+                }
+                else {
+                    cpu_box.pack_start(spinner, true, true, 0);
+                    cpu_box.remove(process_list_box);
+                }
             });
 
             process_list_box.bind_property ("empty", no_process_view, "visible", BindingFlags.BIDIRECTIONAL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]