[gnome-usage] graphs: Replace rg library with Dazzle library



commit cd5a5e388e06f03a85ae6ced3386b39c8719d538
Author: Petr Štětka <pstetka redhat com>
Date:   Tue Nov 6 09:39:21 2018 +0100

    graphs: Replace rg library with Dazzle library

 meson.build                                        |   2 +-
 src/{cpu-graph-table.vala => cpu-graph-model.vala} |  71 +++++-------
 src/cpu-graph.vala                                 |  46 ++++----
 src/cpu-sub-view.vala                              |   2 +-
 src/graph-box.vala                                 |   2 +-
 src/graph-stacked-renderer.vala                    | 126 +++++++++++++++++++++
 src/graph-switcher-button.vala                     |   6 +-
 ...ry-graph-table.vala => memory-graph-model.vala} |  41 +++----
 src/memory-graph.vala                              |  80 ++-----------
 src/meson.build                                    |  12 +-
 10 files changed, 216 insertions(+), 172 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8f03d28..36f98ba 100644
--- a/meson.build
+++ b/meson.build
@@ -12,6 +12,7 @@ glib_dep = dependency('glib-2.0', version : '>=2.38')
 gobject_dep = dependency('gobject-2.0')
 gio_dep = dependency('gio-2.0')
 gtk_dep = dependency('gtk+-3.0', version : '>=3.20.10')
+libdazzle_dep = dependency('libdazzle-1.0', version : '>=3.30')
 
 gnome = import('gnome')
 i18n = import('i18n')
@@ -21,7 +22,6 @@ vapi_dir = join_paths (meson.source_root (), 'vapi')
 
 subdir('data')
 subdir('po')
-subdir('external')
 subdir('src')
 
 meson.add_install_script(
diff --git a/src/cpu-graph-table.vala b/src/cpu-graph-model.vala
similarity index 69%
rename from src/cpu-graph-table.vala
rename to src/cpu-graph-model.vala
index f63ed88..a1ed7ee 100644
--- a/src/cpu-graph-table.vala
+++ b/src/cpu-graph-model.vala
@@ -1,6 +1,6 @@
-/* cpu-graph-table.vala
+/* cpu-graph-model.vala
  *
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2018 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
@@ -18,32 +18,29 @@
  * Authors: Petr Štětka <pstetka redhat com>
  */
 
-using Rg;
+using Dazzle;
 
 namespace Usage {
 
-    public class CpuGraphTableComplex : Rg.Table
-    {
+    public class CpuGraphModel : GraphModel {
         public signal void big_process_usage (int column);
         public signal void small_process_usage (int column);
         private bool[] change_big_process_usage;
         private bool[] change_small_process_usage;
 
-        public CpuGraphTableComplex ()
-        {
+        public CpuGraphModel () {
             var settings = Settings.get_default();
             set_timespan (settings.graph_timespan * 1000);
             set_max_samples (settings.graph_max_samples);
 
-            var column_total = new Rg.Column("TOTAL CPU", Type.from_name("gdouble"));
+            var column_total = new GraphColumn("TOTAL CPU", Type.from_name("gdouble"));
             add_column(column_total);
 
             change_big_process_usage = new bool[get_num_processors()];
             change_small_process_usage = new bool[get_num_processors()];
 
-            for (int i = 0; i < get_num_processors(); i++)
-            {
-                var column_x_cpu = new Rg.Column("CPU: " + i.to_string(), Type.from_name("gdouble"));
+            for (int i = 0; i < get_num_processors(); i++) {
+                var column_x_cpu = new GraphColumn("CPU: " + i.to_string(), Type.from_name("gdouble"));
                 add_column(column_x_cpu);
 
                 change_big_process_usage[i] = true;
@@ -53,30 +50,24 @@ namespace Usage {
             Timeout.add(settings.graph_update_interval, update_data);
         }
 
-        bool update_data()
-        {
-            Rg.TableIter iter;
+        bool update_data() {
+            GraphModelIter iter;
             push (out iter, get_monotonic_time ());
 
             SystemMonitor monitor = SystemMonitor.get_default();
 
-            for (int i = 0; i < get_num_processors(); i++)
-            {
-                iter.set (i, monitor.x_cpu_load[i], -1);
+            for (int i = 0; i < get_num_processors(); i++) {
+                iter_set_value(iter, i, monitor.x_cpu_load[i]);
 
-                if(monitor.x_cpu_load[i] >= 90)
-                {
-                    if(change_big_process_usage[i])
-                    {
+                if(monitor.x_cpu_load[i] >= 90) {
+                    if(change_big_process_usage[i]) {
                         big_process_usage(i);
                         change_big_process_usage[i] = false;
                         change_small_process_usage[i] = true;
                     }
                 }
-                else
-                {
-                    if(change_small_process_usage[i])
-                    {
+                else {
+                    if(change_small_process_usage[i]) {
                         small_process_usage(i);
                         change_small_process_usage[i] = false;
                         change_big_process_usage[i] = true;
@@ -88,54 +79,46 @@ namespace Usage {
         }
     }
 
-    public class CpuGraphTableMostUsedCore : Rg.Table
-    {
+    public class CpuGraphModelMostUsedCore : GraphModel {
         public signal void big_process_usage ();
         public signal void small_process_usage ();
         private bool change_big_process_usage = true;
         private bool change_small_process_usage = true;
 
-        public CpuGraphTableMostUsedCore ()
-        {
+        public CpuGraphModelMostUsedCore () {
             var settings = Settings.get_default();
             set_timespan (settings.graph_timespan * 1000);
             set_max_samples (settings.graph_max_samples);
 
-            var column = new Rg.Column("MOST USED CORE", Type.from_name("gdouble"));
+            var column = new GraphColumn("MOST USED CORE", Type.from_name("gdouble"));
             add_column(column);
 
             Timeout.add(settings.graph_update_interval, update_data);
         }
 
-        bool update_data()
-        {
-            Rg.TableIter iter;
+        bool update_data() {
+            GraphModelIter iter;
             push (out iter, get_monotonic_time ());
 
             SystemMonitor monitor = SystemMonitor.get_default();
             double most_used_core = monitor.x_cpu_load[0];
 
-            for (int i = 1; i < get_num_processors(); i++)
-            {
+            for (int i = 1; i < get_num_processors(); i++) {
                 if(monitor.x_cpu_load[i] > most_used_core)
                     most_used_core = monitor.x_cpu_load[i];
             }
 
-            iter.set (0, most_used_core, -1);
+            iter_set_value(iter, 0, most_used_core);
 
-            if(most_used_core >= 90)
-            {
-                if(change_big_process_usage)
-                {
+            if(most_used_core >= 90) {
+                if(change_big_process_usage) {
                     big_process_usage();
                     change_big_process_usage = false;
                     change_small_process_usage = true;
                 }
             }
-            else
-            {
-                if(change_small_process_usage)
-                {
+            else {
+                if(change_small_process_usage) {
                     small_process_usage();
                     change_small_process_usage = false;
                     change_big_process_usage = true;
diff --git a/src/cpu-graph.vala b/src/cpu-graph.vala
index 6c2edec..e86c9aa 100644
--- a/src/cpu-graph.vala
+++ b/src/cpu-graph.vala
@@ -1,6 +1,6 @@
 /* cpu-graph.vala
  *
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2018 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
@@ -18,17 +18,17 @@
  * Authors: Petr Štětka <pstetka redhat com>
  */
 
-using Rg;
+using Dazzle;
 
 namespace Usage
 {
     /**
      *  Graph showing most used core
     **/
-    public class CpuGraphMostUsed : Rg.Graph
+    public class CpuGraphMostUsedCore : GraphView
     {
-               private static CpuGraphTableMostUsedCore rg_table;
-               private StackedRenderer renderer;
+        private static CpuGraphModelMostUsedCore graph_model;
+        private GraphStackedRenderer renderer;
                private Gdk.RGBA line_color_max;
         private Gdk.RGBA line_color_normal;
         private Gdk.RGBA color_max;
@@ -39,7 +39,7 @@ namespace Usage
             set_css_name("rg-graph");
         }
 
-        public CpuGraphMostUsed ()
+        public CpuGraphMostUsedCore ()
         {
             get_style_context().add_class("line_max");
             line_color_max = get_style_context().get_color(get_style_context().get_state());
@@ -54,23 +54,23 @@ namespace Usage
             color_normal = get_style_context().get_color(get_style_context().get_state());
             get_style_context().remove_class("stacked");
 
-            if(rg_table == null)
-                rg_table = new CpuGraphTableMostUsedCore();
+            if(graph_model == null)
+                graph_model = new CpuGraphModelMostUsedCore();
 
-            set_table(rg_table);
+            set_model(graph_model);
 
-            renderer = new StackedRenderer();
+            renderer = new GraphStackedRenderer();
             renderer.stroke_color_rgba = line_color_normal;
             renderer.stacked_color_rgba = color_normal;
             renderer.line_width = 1.0;
             add_renderer(renderer);
 
-            rg_table.big_process_usage.connect (() => {
+            graph_model.big_process_usage.connect (() => {
                 renderer.stroke_color_rgba = line_color_max;
                 renderer.stacked_color_rgba = color_max;
             });
 
-            rg_table.small_process_usage.connect (() => {
+            graph_model.small_process_usage.connect (() => {
                 renderer.stroke_color_rgba = line_color_normal;
                 renderer.stacked_color_rgba = color_normal;
             });
@@ -80,10 +80,10 @@ namespace Usage
     /**
      *  Graph showing all processor cores.
     **/
-    public class CpuGraphBig : Rg.Graph
+    public class CpuGraph : GraphView
     {
-       private static CpuGraphTableComplex rg_table;
-        private LineRenderer[] renderers;
+        private static CpuGraphModel graph_model;
+        private GraphLineRenderer[] renderers;
         private Gdk.RGBA line_color_max;
         private Gdk.RGBA line_color_normal;
 
@@ -92,7 +92,7 @@ namespace Usage
             set_css_name("rg-graph");
         }
 
-        public CpuGraphBig()
+        public CpuGraph()
         {
             get_style_context().add_class("line_max");
             line_color_max = get_style_context().get_color(get_style_context().get_state());
@@ -102,27 +102,27 @@ namespace Usage
             get_style_context().remove_class("line");
             get_style_context().add_class("big");
 
-            if(rg_table == null)
-                rg_table = new CpuGraphTableComplex();
+            if(graph_model == null)
+                graph_model = new CpuGraphModel();
 
-            set_table(rg_table);
+            set_model(graph_model);
 
-            renderers = new LineRenderer[get_num_processors()];
+            renderers = new GraphLineRenderer[get_num_processors()];
             for(int i = 0; i < get_num_processors(); i++)
             {
-                renderers[i] = new LineRenderer();
+                renderers[i] = new GraphLineRenderer();
                 renderers[i].column = i;
                 renderers[i].stroke_color_rgba = line_color_normal;
                 renderers[i].line_width = 1.5;
                 add_renderer(renderers[i]);
             }
 
-            rg_table.big_process_usage.connect ((column) => {
+            graph_model.big_process_usage.connect ((column) => {
                 renderers[column].stroke_color_rgba = line_color_max;
                 renderers[column].line_width = 2.5;
             });
 
-            rg_table.small_process_usage.connect ((column) => {
+            graph_model.small_process_usage.connect ((column) => {
                 renderers[column].stroke_color_rgba = line_color_normal;
                 renderers[column].line_width = 1.5;
             });
diff --git a/src/cpu-sub-view.vala b/src/cpu-sub-view.vala
index 73d0451..be6941a 100644
--- a/src/cpu-sub-view.vala
+++ b/src/cpu-sub-view.vala
@@ -34,7 +34,7 @@ namespace Usage
             label.margin_top = 25;
             label.margin_bottom = 15;
 
-            var cpu_graph = new CpuGraphBig();
+            var cpu_graph = new CpuGraph();
             cpu_graph.hexpand = true;
             var cpu_graph_box = new GraphBox(cpu_graph);
             cpu_graph_box.height_request = 225;
diff --git a/src/graph-box.vala b/src/graph-box.vala
index bc1c7cf..ab0e35f 100644
--- a/src/graph-box.vala
+++ b/src/graph-box.vala
@@ -29,7 +29,7 @@ namespace Usage {
             set_css_name("graph-box");
         }
 
-        public GraphBox (Rg.Graph graph) {
+        public GraphBox (Dazzle.GraphView graph) {
             add(graph);
         }
     }
diff --git a/src/graph-stacked-renderer.vala b/src/graph-stacked-renderer.vala
new file mode 100644
index 0000000..48915e7
--- /dev/null
+++ b/src/graph-stacked-renderer.vala
@@ -0,0 +1,126 @@
+/* graph-stacked-renderer.vala
+ *
+ * Copyright (C) 2018 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>
+ */
+
+using Dazzle;
+using Cairo;
+
+namespace Usage {
+
+    public class GraphStackedRenderer : Object, GraphRenderer {
+
+        public uint column { set; get; }
+        public double line_width { set; get; default = 1.0; }
+        public Gdk.RGBA stroke_color_rgba { set; get; }
+        public Gdk.RGBA stacked_color_rgba { set; get; }
+
+        public void render(GraphModel model, int64 x_begin, int64 x_end, double y_begin, double y_end, 
Context cr, RectangleInt area) {
+            GraphModelIter iter;
+            cr.save();
+
+            if (model.get_iter_first(out iter)) {
+                double chunk = area.width / (double) (model.max_samples - 1) / 2.0;
+                double last_x = calc_x (iter, x_begin, x_end, area.width);
+                double last_y = area.height;
+
+                cr.move_to (last_x, area.height);
+
+                while (GraphModel.iter_next (ref iter))
+                {
+                    double x = calc_x (iter, x_begin, x_end, area.width);
+                    double y = calc_y (iter, y_begin, y_end, area.height, column);
+
+                    cr.curve_to (last_x + chunk, last_y, last_x + chunk, y, x, y);
+
+                    last_x = x;
+                    last_y = y;
+                }
+            }
+
+            cr.set_line_width (line_width);
+            cr.set_source_rgba (stacked_color_rgba.red, stacked_color_rgba.green, stacked_color_rgba.blue, 
stacked_color_rgba.alpha);
+            cr.rel_line_to (0, area.height);
+            cr.stroke_preserve ();
+            cr.close_path();
+            cr.fill();
+
+            if (model.get_iter_first(out iter)) {
+                double chunk = area.width / (double) (model.max_samples - 1) / 2.0;
+                double last_x = calc_x (iter, x_begin, x_end, area.width);
+                double last_y = area.height;
+
+                cr.move_to (last_x, last_y);
+
+                while (GraphModel.iter_next (ref iter))
+                {
+                    double x = calc_x (iter, x_begin, x_end, area.width);
+                    double y = calc_y (iter, y_begin, y_end, area.height, column);
+
+                    cr.curve_to (last_x + chunk, last_y, last_x + chunk, y, x, y);
+
+                    last_x = x;
+                    last_y = y;
+                }
+            }
+
+            cr.set_source_rgba (stroke_color_rgba.red, stroke_color_rgba.green, stroke_color_rgba.blue, 
stacked_color_rgba.alpha);
+            cr.stroke ();
+            cr.restore ();
+        }
+
+        private static double calc_x (GraphModelIter iter, int64 begin, int64 end, uint width) {
+            var timestamp = GraphModel.iter_get_timestamp(iter);
+
+            return ((timestamp - begin) / (double) (end - begin) * width);
+        }
+
+        private static double calc_y (GraphModelIter iter, double range_begin, double range_end, uint 
height, uint column) {
+            double y;
+
+            var val = GraphModel.iter_get_value(iter, column);
+            switch (val.type())
+            {
+                case Type.DOUBLE:
+                    y = val.get_double();
+                    break;
+                case Type.UINT:
+                    y = val.get_uint();
+                    break;
+                case Type.UINT64:
+                    y = val.get_uint64();
+                    break;
+                case Type.INT:
+                    y = val.get_int();
+                    break;
+                case Type.INT64:
+                    y = val.get_int64();
+                    break;
+                default:
+                    y = 0.0;
+                    break;
+            }
+
+            y -= range_begin;
+            y /= (range_end - range_begin);
+            y = height - (y * height);
+
+            return y;
+        }
+    }
+}
diff --git a/src/graph-switcher-button.vala b/src/graph-switcher-button.vala
index 452dc93..f0863c4 100644
--- a/src/graph-switcher-button.vala
+++ b/src/graph-switcher-button.vala
@@ -26,17 +26,17 @@ namespace Usage
 
         public GraphSwitcherButton.processor(string label)
         {
-            Rg.Graph processor_graph = new CpuGraphMostUsed();
+            var processor_graph = new CpuGraphMostUsedCore();
             child = createContent(processor_graph, label);
         }
 
         public GraphSwitcherButton.memory(string label)
         {
-            Rg.Graph memory_graph = new MemoryGraph();
+            var memory_graph = new MemoryGraph();
             child = createContent(memory_graph, label);
         }
 
-        private Gtk.Box createContent(Rg.Graph graph, string label_text)
+        private Gtk.Box createContent(Dazzle.GraphView graph, string label_text)
         {
             graph.height_request = 80;
             graph.hexpand = true;
diff --git a/src/memory-graph-table.vala b/src/memory-graph-model.vala
similarity index 72%
rename from src/memory-graph-table.vala
rename to src/memory-graph-model.vala
index 22a28f6..2e5f029 100644
--- a/src/memory-graph-table.vala
+++ b/src/memory-graph-model.vala
@@ -1,6 +1,6 @@
-/* memory-graph-table.vala
+/* memory-graph-model.vala
  *
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2018 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
@@ -18,36 +18,33 @@
  * Authors: Petr Štětka <pstetka redhat com>
  */
 
-using Rg;
+using Dazzle;
 
 namespace Usage {
 
-    public class MemoryGraphTable : Rg.Table
-    {
-        public const int column_ram_id = 0;
-        public const int column_swap_id = 1;
+    public class MemoryGraphModel : GraphModel {
+        public const int COLUMN_RAM = 0;
+        public const int COLUMN_SWAP = 1;
         public signal void big_ram_usage();
         public signal void small_ram_usage();
         private bool change_big_ram_usage = true;
         private bool change_small_ram_usage = true;
 
-        public MemoryGraphTable ()
-        {
+        public MemoryGraphModel () {
             var settings = Settings.get_default();
             set_timespan (settings.graph_timespan * 1000);
             set_max_samples (settings.graph_max_samples);
 
-            var column_ram = new Rg.Column("RAM", Type.from_name("gdouble"));
+            var column_ram = new GraphColumn("RAM", Type.from_name("gdouble"));
             add_column(column_ram);
-            var column_swap = new Rg.Column("SWAP", Type.from_name("gdouble"));
+            var column_swap = new GraphColumn("SWAP", Type.from_name("gdouble"));
             add_column(column_swap);
 
             Timeout.add(settings.graph_update_interval, update_data);
         }
 
-        bool update_data()
-        {
-            Rg.TableIter iter;
+        bool update_data() {
+            GraphModelIter iter;
             push (out iter, get_monotonic_time ());
 
             SystemMonitor monitor = SystemMonitor.get_default();
@@ -59,22 +56,18 @@ namespace Usage {
             if(monitor.ram_total != 0)
                 swap_usage = (((double) monitor.swap_usage / monitor.swap_total) * 100);
 
-            iter.set (column_ram_id, ram_usage, -1);
-            iter.set (column_swap_id, swap_usage, -1);
+            iter_set_value(iter, COLUMN_RAM, ram_usage);
+            iter_set_value(iter, COLUMN_SWAP, swap_usage);
 
-            if(ram_usage >= 90)
-            {
-                if(change_big_ram_usage)
-                {
+            if(ram_usage >= 90) {
+                if(change_big_ram_usage) {
                     big_ram_usage();
                     change_big_ram_usage = false;
                     change_small_ram_usage = true;
                 }
             }
-            else
-            {
-                if(change_small_ram_usage)
-                {
+            else {
+                if(change_small_ram_usage) {
                     small_ram_usage();
                     change_small_ram_usage = false;
                     change_big_ram_usage = true;
diff --git a/src/memory-graph.vala b/src/memory-graph.vala
index da03ac5..1858bcf 100644
--- a/src/memory-graph.vala
+++ b/src/memory-graph.vala
@@ -1,6 +1,6 @@
 /* memory-graph.vala
  *
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2018 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
@@ -18,13 +18,13 @@
  * Authors: Petr Štětka <pstetka redhat com>
  */
 
-using Rg;
+using Dazzle;
 
 namespace Usage
 {
-    public class MemoryGraph : Rg.Graph
+    public class MemoryGraph : GraphView
     {
-               private static MemoryGraphTable rg_table;
+        private static MemoryGraphModel graph_model;
                private Gdk.RGBA line_color_max;
         private Gdk.RGBA line_color_normal;
         private Gdk.RGBA color_max;
@@ -50,83 +50,27 @@ namespace Usage
             color_normal = get_style_context().get_color(get_style_context().get_state());
             get_style_context().remove_class("stacked");
 
-            if(rg_table == null)
+            if(graph_model == null)
             {
-                rg_table = new MemoryGraphTable();
-                set_table(rg_table);
+                graph_model = new MemoryGraphModel();
+                set_model(graph_model);
             }
             else
-                set_table(rg_table);
+                set_model(graph_model);
 
-            var renderer_ram = new StackedRenderer();
-            renderer_ram.column = MemoryGraphTable.column_ram_id;
+            var renderer_ram = new GraphStackedRenderer();
+            renderer_ram.column = MemoryGraphModel.COLUMN_RAM;
             renderer_ram.stroke_color_rgba = line_color_normal;
             renderer_ram.stacked_color_rgba = color_normal;
             renderer_ram.line_width = 1.2;
             add_renderer(renderer_ram);
 
-            rg_table.big_ram_usage.connect (() => {
+            graph_model.big_ram_usage.connect (() => {
                 renderer_ram.stroke_color_rgba = line_color_max;
                 renderer_ram.stacked_color_rgba = color_max;
             });
 
-            rg_table.small_ram_usage.connect (() => {
-                renderer_ram.stroke_color_rgba = line_color_normal;
-                renderer_ram.stacked_color_rgba = color_normal;
-            });
-        }
-    }
-
-    public class MemoryGraphBig : Rg.Graph
-    {
-               private static MemoryGraphTable rg_table;
-               private Gdk.RGBA line_color_max;
-        private Gdk.RGBA line_color_normal;
-        private Gdk.RGBA color_max;
-        private Gdk.RGBA color_normal;
-
-        class construct
-        {
-            set_css_name("rg-graph");
-        }
-
-        public MemoryGraphBig()
-        {
-            get_style_context().add_class("line_max");
-            line_color_max = get_style_context().get_color(get_style_context().get_state());
-            get_style_context().remove_class("line_max");
-            get_style_context().add_class("line");
-            line_color_normal = get_style_context().get_color(get_style_context().get_state());
-            get_style_context().remove_class("line");
-            get_style_context().add_class("stacked_max");
-            color_max = get_style_context().get_color(get_style_context().get_state());
-            get_style_context().remove_class("stacked_max");
-            get_style_context().add_class("stacked");
-            color_normal = get_style_context().get_color(get_style_context().get_state());
-            get_style_context().remove_class("stacked");
-            get_style_context().add_class("big");
-
-            if(rg_table == null)
-            {
-                rg_table = new MemoryGraphTable();
-                set_table(rg_table);
-            }
-            else
-                set_table(rg_table);
-
-            var renderer_ram = new StackedRenderer();
-            renderer_ram.column = MemoryGraphTable.column_ram_id;
-            renderer_ram.stroke_color_rgba = line_color_normal;
-            renderer_ram.stacked_color_rgba = color_normal;
-            renderer_ram.line_width = 1.5;
-            add_renderer(renderer_ram);
-
-            rg_table.big_ram_usage.connect (() => {
-                renderer_ram.stroke_color_rgba = line_color_normal;
-                renderer_ram.stacked_color_rgba = color_normal;
-            });
-
-            rg_table.small_ram_usage.connect (() => {
+            graph_model.small_ram_usage.connect (() => {
                 renderer_ram.stroke_color_rgba = line_color_normal;
                 renderer_ram.stacked_color_rgba = color_normal;
             });
diff --git a/src/meson.build b/src/meson.build
index 8484bc5..cd32505 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -2,7 +2,7 @@ vala_sources = [
   'animated-scrolled-window.vala',
   'application.vala',
   'color-rectangle.vala',
-  'cpu-graph-table.vala',
+  'cpu-graph-model.vala',
   'cpu-graph.vala',
   'cpu-monitor.vala',
   'cpu-sub-view.vala',
@@ -10,10 +10,11 @@ vala_sources = [
   'graph-block-row.vala',
   'graph-block.vala',
   'graph-box.vala',
+  'graph-stacked-renderer.vala',
   'graph-stack-switcher.vala',
   'graph-switcher-button.vala',
   'header-bar.vala',
-  'memory-graph-table.vala',
+  'memory-graph-model.vala',
   'memory-graph.vala',
   'memory-monitor.vala',
   'memory-speedometer.vala',
@@ -49,14 +50,11 @@ deps = [
   glib_dep,
   gobject_dep,
   gtk_dep,
-  libegg_dep,
-  librg_dep,
   dependency('libgtop-2.0', version : '>= 2.34.0'),
+  libdazzle_dep,
   cc.find_library('m'),
   valac.find_library('config', dirs: vapi_dir),
-  valac.find_library('egg', dirs: vapi_dir),
-  valac.find_library('posix'),
-  valac.find_library('rg', dirs: vapi_dir)
+  valac.find_library('posix')
 ]
 
 c_args = [


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