summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Balneaves <[email protected]>2013-01-01 15:11:12 -0600
committerScott Balneaves <[email protected]>2013-01-01 15:11:12 -0600
commitfd824a7e03a8303801db03abf59fbdd5dfe3e39a (patch)
treeb19d8b7a19e3bdf2d5c4f20d62111f6a303e82bc /src
parent99a70e0dac224bf34ab2753bafc1344c04991b2a (diff)
downloadmate-system-monitor-fd824a7e03a8303801db03abf59fbdd5dfe3e39a.tar.bz2
mate-system-monitor-fd824a7e03a8303801db03abf59fbdd5dfe3e39a.tar.xz
Fix Issue #14
Diffstat (limited to 'src')
-rw-r--r--src/org.mate.system-monitor.gschema.xml.in.in56
-rw-r--r--src/procman.cpp22
2 files changed, 73 insertions, 5 deletions
diff --git a/src/org.mate.system-monitor.gschema.xml.in.in b/src/org.mate.system-monitor.gschema.xml.in.in
index 3caadc7..3c2a75b 100644
--- a/src/org.mate.system-monitor.gschema.xml.in.in
+++ b/src/org.mate.system-monitor.gschema.xml.in.in
@@ -53,19 +53,67 @@
<_description>0 for the System Info, 1 for the processes list, 2 for the resources and 3 for the disks list</_description>
</key>
<key name="cpu-color0" type="s">
- <default>'#FF6E00'</default>
+ <default>'#FF0000'</default>
<_summary>Default graph cpu color</_summary>
</key>
<key name="cpu-color1" type="s">
- <default>'#CB0C29'</default>
+ <default>'#0000FF'</default>
<_summary>Default graph cpu color</_summary>
</key>
<key name="cpu-color2" type="s">
- <default>'#49A835'</default>
+ <default>'#FFFF00'</default>
<_summary>Default graph cpu color</_summary>
</key>
<key name="cpu-color3" type="s">
- <default>'#2D7DB3'</default>
+ <default>'#00FF00'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color4" type="s">
+ <default>'#FF6600'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color5" type="s">
+ <default>'#6600CC'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color6" type="s">
+ <default>'#990000'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color7" type="s">
+ <default>'#000099'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color8" type="s">
+ <default>'#FFCC00'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color9" type="s">
+ <default>'#009900'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color10" type="s">
+ <default>'#CC6600'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color11" type="s">
+ <default>'#330099'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color12" type="s">
+ <default>'#CC0066'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color13" type="s">
+ <default>'#00FFCC'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color14" type="s">
+ <default>'#FFCC99'</default>
+ <_summary>Default graph cpu color</_summary>
+ </key>
+ <key name="cpu-color15" type="s">
+ <default>'#339999'</default>
<_summary>Default graph cpu color</_summary>
</key>
<key name="mem-color" type="s">
diff --git a/src/procman.cpp b/src/procman.cpp
index 9c683ef..14f3465 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -66,6 +66,18 @@ ProcData* ProcData::get_instance()
return &instance;
}
+static gboolean
+has_key (gchar **keys, const gchar *key)
+{
+ gchar **loop = keys;
+
+ while (*loop) {
+ if (!strcmp (*loop++, key))
+ return TRUE;
+ }
+
+ return FALSE;
+}
static void
tree_changed_cb (GSettings *settings, const gchar *key, gpointer data)
@@ -177,7 +189,15 @@ static void
color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- const gchar *color = g_settings_get_string (settings, key);
+ gchar **keys;
+ gchar *color = NULL;
+
+ keys = g_settings_list_keys (settings);
+ if (has_key (keys, key))
+ color = g_settings_get_string (settings, key);
+ else
+ color = "#FFFFFF"; /* white default color */
+ g_strfreev (keys);
if (g_str_has_prefix (key, "cpu-color")) {
for (int i = 0; i < procdata->config.num_cpus; i++) {