[gnome-system-monitor/wip-charts: 1/25] Add a dazzle cpu graph with proper style



commit 6c00e3a80d94e5f0bd4a8bad47fe5b8fcdb411b2
Author: Robert Roth <robert roth off gmail com>
Date:   Sun Feb 11 01:23:17 2018 +0200

    Add a dazzle cpu graph with proper style

 configure.ac      |    2 ++
 src/interface.cpp |   23 ++++++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d94b410..953d5cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ GLIBMM_REQUIRED=2.46
 LIBXML_REQUIRED=2.0
 RSVG_REQUIRED=2.35
 SYSTEMD_REQUIRED=44
+DAZZLE_REQUIRED=3.26.3
 
 PKG_CHECK_MODULES(GSM,
   glib-2.0 >= $GLIB_REQUIRED
@@ -48,6 +49,7 @@ PKG_CHECK_MODULES(GSM,
   librsvg-2.0 >= $RSVG_REQUIRED
   glibmm-2.4 >= $GLIBMM_REQUIRED
   giomm-2.4 >= $GIOMM_REQUIRED
+  libdazzle-1.0 >= $DAZZLE_REQUIRED
   gmodule-2.0
 )
 
diff --git a/src/interface.cpp b/src/interface.cpp
index 7d0c449..47dae96 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -29,6 +29,7 @@
 #include <signal.h>
 #include <gdk/gdkkeysyms.h>
 #include <math.h>
+#include <dazzle.h>
 
 #include "interface.h"
 #include "proctable.h"
@@ -51,6 +52,17 @@ static const char* LOAD_GRAPH_CSS = "\
                       );\
     color: mix (@theme_fg_color, @theme_bg_color, 0.5);\
 }\
+dzlgraphview.view { \
+  background-color: @theme_bg_color; \
+  background-size:100% 100%; \
+  background: linear-gradient(180deg, alpha(@theme_fg_color,0.3) 1px, transparent 0%),\
+              linear-gradient(90deg, alpha(@theme_fg_color,0.3) 1px, transparent 0% ),\
+              linear-gradient(-90deg, alpha(@theme_fg_color,0.3) 1px, transparent 0% ),\
+              linear-gradient(0deg, alpha(@theme_fg_color,0.3) 1px, transparent 0% ),\
+              repeating-linear-gradient(0deg, alpha(@theme_fg_color,0.15), alpha(@theme_fg_color,0.15) 1px, 
transparent 1px, transparent 20%), \
+              repeating-linear-gradient(-90deg,  alpha(@theme_fg_color,0.15), alpha(@theme_fg_color,0.15) 
1px, transparent 1px, transparent 20%), \
+              linear-gradient(to bottom, @theme_bg_color, @theme_base_color);\
+}\
 ";
 
 static gboolean
@@ -185,7 +197,9 @@ create_sys_view (GsmApplication *app, GtkBuilder * builder)
     GsmColorButton *color_picker;
     GtkCssProvider *provider;
 
-    LoadGraph *cpu_graph, *mem_graph, *net_graph;
+    LoadGraph *mem_graph, *net_graph;
+    LoadGraph *cpu_graph;
+    GtkWidget *dzl_graph;
 
     gint i;
     gchar *title_text;
@@ -203,9 +217,12 @@ create_sys_view (GsmApplication *app, GtkBuilder * builder)
     cpu_graph_box = GTK_BOX (gtk_builder_get_object (builder, "cpu_graph_box"));
 
     cpu_graph = new LoadGraph(LOAD_GRAPH_CPU);
-    gtk_widget_set_size_request (GTK_WIDGET(load_graph_get_widget(cpu_graph)), -1, 70);
+    dzl_graph = GTK_WIDGET(g_object_new (DZL_TYPE_CPU_GRAPH, "timespan", G_TIME_SPAN_MINUTE, 
+                                                             "max-samples", 120, NULL));
+    gtk_widget_set_size_request (GTK_WIDGET(dzl_graph), -1, 70);
+    gtk_widget_show (dzl_graph);
     gtk_box_pack_start (cpu_graph_box,
-                        GTK_WIDGET (load_graph_get_widget(cpu_graph)),
+                        GTK_WIDGET (dzl_graph),
                         TRUE,
                         TRUE,
                         0);


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