From fd824a7e03a8303801db03abf59fbdd5dfe3e39a Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Tue, 1 Jan 2013 15:11:12 -0600 Subject: Fix Issue #14 --- src/org.mate.system-monitor.gschema.xml.in.in | 56 +++++++++++++++++++++++++-- src/procman.cpp | 22 ++++++++++- 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 - '#FF6E00' + '#FF0000' <_summary>Default graph cpu color - '#CB0C29' + '#0000FF' <_summary>Default graph cpu color - '#49A835' + '#FFFF00' <_summary>Default graph cpu color - '#2D7DB3' + '#00FF00' + <_summary>Default graph cpu color + + + '#FF6600' + <_summary>Default graph cpu color + + + '#6600CC' + <_summary>Default graph cpu color + + + '#990000' + <_summary>Default graph cpu color + + + '#000099' + <_summary>Default graph cpu color + + + '#FFCC00' + <_summary>Default graph cpu color + + + '#009900' + <_summary>Default graph cpu color + + + '#CC6600' + <_summary>Default graph cpu color + + + '#330099' + <_summary>Default graph cpu color + + + '#CC0066' + <_summary>Default graph cpu color + + + '#00FFCC' + <_summary>Default graph cpu color + + + '#FFCC99' + <_summary>Default graph cpu color + + + '#339999' <_summary>Default graph cpu color 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(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++) { -- cgit v1.2.1 From 73da57f093a422229c053333a81738a97ac000fb Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Tue, 1 Jan 2013 15:45:06 -0600 Subject: Fix deprecations --- src/gsm_color_button.c | 2 +- src/gsm_color_button.h | 2 ++ src/procman.cpp | 9 ++------- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gsm_color_button.c b/src/gsm_color_button.c index e8eb320..0d69889 100644 --- a/src/gsm_color_button.c +++ b/src/gsm_color_button.c @@ -251,7 +251,7 @@ fill_image_buffer_from_file (cairo_t *cr, const char *filePath) tmp_cr = cairo_create (tmp_surface); rsvg_handle_render_cairo (handle, tmp_cr); cairo_destroy (tmp_cr); - rsvg_handle_free (handle); + g_object_unref (handle); return tmp_surface; } diff --git a/src/gsm_color_button.h b/src/gsm_color_button.h index ac8d87e..0194887 100644 --- a/src/gsm_color_button.h +++ b/src/gsm_color_button.h @@ -27,7 +27,9 @@ #include #include #include +#ifndef RSVG_CAIRO_H #include +#endif G_BEGIN_DECLS /* The GtkColorSelectionButton widget is a simple color picker in a button. diff --git a/src/procman.cpp b/src/procman.cpp index 14f3465..c534f8d 100644 --- a/src/procman.cpp +++ b/src/procman.cpp @@ -196,7 +196,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data) if (has_key (keys, key)) color = g_settings_get_string (settings, key); else - color = "#FFFFFF"; /* white default color */ + color = g_strdup("#FFFFFF"); /* white default color */ g_strfreev (keys); if (g_str_has_prefix (key, "cpu-color")) { @@ -721,8 +721,7 @@ main (int argc, char *argv[]) exit (0); } - /* initialize rsvg */ - rsvg_init (); + g_type_init (); gtk_window_set_default_icon_name ("utilities-system-monitor"); g_set_application_name(_("System Monitor")); @@ -761,10 +760,6 @@ main (int argc, char *argv[]) glibtop_close (); - // This function should only be called just before program exit. - // See MATE bug #592100 for a discussion about this. - rsvg_term (); - return 0; } -- cgit v1.2.1 From 781618080e373211921222bef4696fe9ce3edd61 Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Wed, 2 Jan 2013 15:22:54 -0600 Subject: I have to turn my head until my darkness goes --- src/procman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/procman.cpp b/src/procman.cpp index c534f8d..dc0c9ea 100644 --- a/src/procman.cpp +++ b/src/procman.cpp @@ -196,7 +196,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data) if (has_key (keys, key)) color = g_settings_get_string (settings, key); else - color = g_strdup("#FFFFFF"); /* white default color */ + color = g_strdup("#000000"); /* black default color */ g_strfreev (keys); if (g_str_has_prefix (key, "cpu-color")) { -- cgit v1.2.1