[gnome-usage] monitor: CpuMonitor, MemoryMonitor must implement Monitor interface



commit 334621d9a2dd3b24cef7591d6e1b68a69aec5c23
Author: Petr Štětka <pstetka redhat com>
Date:   Fri May 26 13:19:07 2017 +0200

    monitor: CpuMonitor, MemoryMonitor must implement Monitor interface
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781542

 src/cpu-monitor.vala    |    2 +-
 src/memory-monitor.vala |    2 +-
 src/meson.build         |    1 +
 src/monitor.vala        |   25 +++++++++++++++++++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/cpu-monitor.vala b/src/cpu-monitor.vala
index 42f6b72..142f6fe 100644
--- a/src/cpu-monitor.vala
+++ b/src/cpu-monitor.vala
@@ -20,7 +20,7 @@
 
 namespace Usage
 {
-    public class CpuMonitor
+    public class CpuMonitor : Monitor
     {
         private double cpu_load;
         private double[] x_cpu_load;
diff --git a/src/memory-monitor.vala b/src/memory-monitor.vala
index cf3433e..9183c41 100644
--- a/src/memory-monitor.vala
+++ b/src/memory-monitor.vala
@@ -20,7 +20,7 @@
 
 namespace Usage
 {
-    public class MemoryMonitor
+    public class MemoryMonitor : Monitor
     {
         private uint64 ram_usage;
         private uint64 ram_total;
diff --git a/src/meson.build b/src/meson.build
index 0d9896e..dd14435 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -18,6 +18,7 @@ vala_sources = [
     'memory-graph.vala',
     'memory-monitor.vala',
     'memory-sub-view.vala',
+    'monitor.vala',
     'performance-view.vala',
     'pie-chart.vala',
     'power-view.vala',
diff --git a/src/monitor.vala b/src/monitor.vala
new file mode 100644
index 0000000..2cdf32d
--- /dev/null
+++ b/src/monitor.vala
@@ -0,0 +1,25 @@
+/* monitor.vala
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Petr Štětka <pstetka redhat com>
+ */
+
+public interface Monitor
+{
+    public abstract void update ();
+    public abstract void update_process (ref Usage.Process process);
+}


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