gnome-system-monitor r2323 - trunk/src
- From: bdejean svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-system-monitor r2323 - trunk/src
- Date: Sat, 23 Feb 2008 09:13:22 +0000 (GMT)
Author: bdejean
Date: Sat Feb 23 09:13:22 2008
New Revision: 2323
URL: http://svn.gnome.org/viewvc/gnome-system-monitor?rev=2323&view=rev
Log:
Simplified gconf cpu_colors.
Store CPU#0 in cpu_color0 instead of cpu_color.
Modified:
trunk/src/callbacks.cpp
trunk/src/gnome-system-monitor.schemas.in
trunk/src/procman.cpp
Modified: trunk/src/callbacks.cpp
==============================================================================
--- trunk/src/callbacks.cpp (original)
+++ trunk/src/callbacks.cpp Sat Feb 23 09:13:22 2008
@@ -234,12 +234,7 @@
gint i = GPOINTER_TO_INT (data);
GConfClient *client = gconf_client_get_default ();
- if (i == 0) {
- strcpy(key, "/apps/procman/cpu_color");
- }
- else {
- g_snprintf(key, sizeof key, "/apps/procman/cpu_color%d", i);
- }
+ g_snprintf(key, sizeof key, "/apps/procman/cpu_color%d", i);
change_gconf_color(client, key, cp);
}
Modified: trunk/src/gnome-system-monitor.schemas.in
==============================================================================
--- trunk/src/gnome-system-monitor.schemas.in (original)
+++ trunk/src/gnome-system-monitor.schemas.in Sat Feb 23 09:13:22 2008
@@ -147,8 +147,8 @@
</schema>
<schema>
- <key>/schemas/apps/procman/cpu_color</key>
- <applyto>/apps/procman/cpu_color</applyto>
+ <key>/schemas/apps/procman/cpu_color0</key>
+ <applyto>/apps/procman/cpu_color0</applyto>
<owner>procman</owner>
<type>string</type>
<default>#FF6E00</default>
Modified: trunk/src/procman.cpp
==============================================================================
--- trunk/src/procman.cpp (original)
+++ trunk/src/procman.cpp Sat Feb 23 09:13:22 2008
@@ -179,21 +179,14 @@
GConfValue *value = gconf_entry_get_value (entry);
const gchar *color = gconf_value_get_string (value);
- if (g_str_equal (key, "/apps/procman/cpu_color")) {
- gdk_color_parse (color, &procdata->config.cpu_color[0]);
- procdata->cpu_graph->colors.at(0) = procdata->config.cpu_color[0];
- }
- else if (g_str_has_prefix (key, "/apps/procman/cpu_color")) {
- gint i;
-
- for (i=1;i<GLIBTOP_NCPU;i++) {
- gchar *cpu_key;
- cpu_key = g_strdup_printf ("/apps/procman/cpu_color%d",i);
- if (g_str_equal (key, cpu_key)) {
+ if (g_str_has_prefix (key, "/apps/procman/cpu_color")) {
+ for (int i = 0; i < GLIBTOP_NCPU; i++) {
+ string cpu_key = make_string(g_strdup_printf("/apps/procman/cpu_color%d", i));
+ if (cpu_key == key) {
gdk_color_parse (color, &procdata->config.cpu_color[i]);
procdata->cpu_graph->colors.at(i) = procdata->config.cpu_color[i];
+ break;
}
- g_free (cpu_key);
}
}
else if (g_str_equal (key, "/apps/procman/mem_color")) {
@@ -293,15 +286,7 @@
pd, NULL, NULL);
pd->config.current_tab = gconf_client_get_int (client, "/apps/procman/current_tab", NULL);
- color = gconf_client_get_string (client, "/apps/procman/cpu_color", NULL);
- if (!color)
- color = g_strdup ("#000000a200ff");
- gconf_client_notify_add (client, "/apps/procman/cpu_color",
- color_changed_cb, pd, NULL, NULL);
- gdk_color_parse(color, &pd->config.cpu_color[0]);
- g_free (color);
-
- for (i=1;i<GLIBTOP_NCPU;i++) {
+ for (int i = 0; i < GLIBTOP_NCPU; i++) {
gchar *key;
key = g_strdup_printf ("/apps/procman/cpu_color%d", i);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]