[gnome-usage/pstetka/gnome-usage-disk-io: 5/7] Update cpu & memory subviews according to changes in SystemMonitor



commit 94a407030c85907650e12eb6254adaa516f4b95b
Author: Petr Štětka <stetka peta gmail com>
Date:   Thu Apr 4 15:31:52 2019 +0200

    Update cpu & memory subviews according to changes in SystemMonitor

 data/ui/no-results-found-view.ui |  5 ++++-
 src/cpu-sub-view.vala            |  8 ++------
 src/memory-sub-view.vala         | 19 +------------------
 3 files changed, 7 insertions(+), 25 deletions(-)
---
diff --git a/data/ui/no-results-found-view.ui b/data/ui/no-results-found-view.ui
index 1fe4852..e4e4167 100644
--- a/data/ui/no-results-found-view.ui
+++ b/data/ui/no-results-found-view.ui
@@ -2,16 +2,17 @@
 <interface>
   <!-- interface-requires gtk+ 3.9 -->
   <template class="UsageNoResultsFoundView" parent="UsageView">
-    <property name="visible">True</property>
     <child>
       <object class="GtkBox">
         <property name="margin-top">40</property>
         <property name="orientation">vertical</property>
+        <property name="visible">True</property>
         <child>
           <object class="GtkImage">
             <property name="margin">10</property>
             <property name="icon-name">system-run-symbolic</property>
             <property name="pixel-size">72</property>
+            <property name="visible">True</property>
           </object>
         </child>
         <child>
@@ -22,6 +23,7 @@
             </attributes>
             <property name="label" translatable="yes">No results found</property>
             <property name="margin">10</property>
+            <property name="visible">True</property>
           </object>
         </child>
         <child>
@@ -30,6 +32,7 @@
               <attribute name="font-desc" value="12"/>
             </attributes>
             <property name="label" translatable="yes">Try a different search</property>
+            <property name="visible">True</property>
             <style>
               <class name="dim-label"/>
             </style>
diff --git a/src/cpu-sub-view.vala b/src/cpu-sub-view.vala
index ebed774..31f5c5b 100644
--- a/src/cpu-sub-view.vala
+++ b/src/cpu-sub-view.vala
@@ -61,15 +61,11 @@ namespace Usage
             cpu_box.add(no_process_view);
 
             var system_monitor = SystemMonitor.get_default();
-            system_monitor.notify["process-list-ready"].connect ((sender, property) => {
-                if(system_monitor.process_list_ready) {
+            system_monitor.notify["cpu-process-list-ready"].connect ((sender, property) => {
+                if(system_monitor.cpu_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);
diff --git a/src/memory-sub-view.vala b/src/memory-sub-view.vala
index 3a44393..bc5bbf9 100644
--- a/src/memory-sub-view.vala
+++ b/src/memory-sub-view.vala
@@ -39,11 +39,6 @@ namespace Usage
             process_list_box.margin_bottom = 20;
             process_list_box.margin_top = 30;
 
-            var spinner = new Gtk.Spinner();
-            spinner.active = true;
-            spinner.margin_top = 30;
-            spinner.height_request = 250;
-
             no_process_view = new NoResultsFoundView();
 
             var memory_graph = new MemorySpeedometer();
@@ -59,21 +54,9 @@ namespace Usage
             memory_box.halign = Gtk.Align.CENTER;
             memory_box.pack_start(label, false, false, 0);
             memory_box.pack_start(speedometers, false, false, 0);
-            memory_box.pack_start(spinner, true, true, 0);
+            memory_box.pack_start(process_list_box, false, false, 0);
             memory_box.add(no_process_view);
 
-            var system_monitor = SystemMonitor.get_default();
-            system_monitor.notify["process-list-ready"].connect ((sender, property) => {
-                if(system_monitor.process_list_ready) {
-                    memory_box.pack_start(process_list_box, false, false, 0);
-                    memory_box.remove(spinner);
-                }
-                else {
-                    memory_box.pack_start(spinner, true, true, 0);
-                    memory_box.remove(process_list_box);
-                }
-            });
-
             process_list_box.bind_property ("empty", no_process_view, "visible", BindingFlags.BIDIRECTIONAL);
             add(memory_box);
             show_all();


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