[gnome-system-monitor] Reset CPU chart data on stacked area chart toggle (Bug 804182) https://bugzilla.gnome.org/show_bug.c



commit 16de0bb6d62b435a4177bdf1ac0eff336dc1e514
Author: Robert Roth <robert roth off gmail com>
Date:   Mon Jul 15 01:16:42 2013 +0300

    Reset CPU chart data on stacked area chart toggle (Bug 804182)
    https://bugzilla.gnome.org/show_bug.cgi?id=704182

 src/load-graph.cpp  |    6 ++++++
 src/load-graph.h    |    4 ++++
 src/procman-app.cpp |    1 +
 3 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 6ede62f..9a69840 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -303,6 +303,12 @@ load_graph_draw (GtkWidget *widget,
     return TRUE;
 }
 
+void
+load_graph_reset (LoadGraph *graph)
+{
+    std::fill(graph->data_block.begin(), graph->data_block.end(), -1.0f);
+}
+
 static void
 get_load (LoadGraph *graph)
 {
diff --git a/src/load-graph.h b/src/load-graph.h
index 3549fda..0ea1c62 100644
--- a/src/load-graph.h
+++ b/src/load-graph.h
@@ -110,6 +110,10 @@ void
 load_graph_change_speed (LoadGraph *g,
                          guint new_speed);
 
+/* Clear the history data. */
+void
+load_graph_reset (LoadGraph *g);
+
 LoadGraphLabels*
 load_graph_get_labels (LoadGraph *g) G_GNUC_CONST;
 
diff --git a/src/procman-app.cpp b/src/procman-app.cpp
index 98aa06f..62f009f 100644
--- a/src/procman-app.cpp
+++ b/src/procman-app.cpp
@@ -66,6 +66,7 @@ draw_stacked_changed_cb(GSettings *settings, const gchar *key, gpointer data)
 
     app->config.draw_stacked = g_settings_get_boolean(settings, key);
     app->cpu_graph->clear_background();
+    load_graph_reset(app->cpu_graph);
 }
 
 


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