diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm_color_button.c | 2 | ||||
-rw-r--r-- | src/gsm_color_button.h | 2 | ||||
-rw-r--r-- | src/org.mate.system-monitor.gschema.xml.in.in | 48 | ||||
-rw-r--r-- | src/procman.cpp | 29 |
4 files changed, 73 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 <gtk/gtk.h> #include <cairo.h> #include <librsvg/rsvg.h> +#ifndef RSVG_CAIRO_H #include <librsvg/rsvg-cairo.h> +#endif G_BEGIN_DECLS /* The GtkColorSelectionButton widget is a simple color picker in a button. diff --git a/src/org.mate.system-monitor.gschema.xml.in.in b/src/org.mate.system-monitor.gschema.xml.in.in index 3caadc7..008432a 100644 --- a/src/org.mate.system-monitor.gschema.xml.in.in +++ b/src/org.mate.system-monitor.gschema.xml.in.in @@ -68,6 +68,54 @@ <default>'#2D7DB3'</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"> <default>'#AB1852'</default> <_summary>Default graph mem color</_summary> diff --git a/src/procman.cpp b/src/procman.cpp index 9c683ef..dc0c9ea 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 = g_strdup("#000000"); /* black default color */ + g_strfreev (keys); if (g_str_has_prefix (key, "cpu-color")) { for (int i = 0; i < procdata->config.num_cpus; i++) { @@ -701,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")); @@ -741,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; } |