summaryrefslogtreecommitdiff
path: root/multiload/load-graph.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-31 23:56:30 +0200
committerraveit65 <[email protected]>2016-08-31 15:29:57 +0200
commit9684cbb449ce68a11ea9ccf4d040e9b49b189eee (patch)
tree135f5a95aeaa88f49482c4164a8ada3e87a8143a /multiload/load-graph.c
parentaf8334ea1159d64330d1c295000b78ed0daa9f63 (diff)
downloadmate-applets-9684cbb449ce68a11ea9ccf4d040e9b49b189eee.tar.bz2
mate-applets-9684cbb449ce68a11ea9ccf4d040e9b49b189eee.tar.xz
GTK+-3 multiload: port to GtkColorChooser and GdkRGBA
Diffstat (limited to 'multiload/load-graph.c')
-rw-r--r--multiload/load-graph.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/multiload/load-graph.c b/multiload/load-graph.c
index b8d648a6..c0403e85 100644
--- a/multiload/load-graph.c
+++ b/multiload/load-graph.c
@@ -73,7 +73,11 @@ load_graph_draw (LoadGraph *g)
for (j = 0; j < g->n; j++)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_cairo_set_source_rgba (cr, &(g->colors [j]));
+#else
gdk_cairo_set_source_color (cr, &(g->colors [j]));
+#endif
for (i = 0; i < g->draw_width; i++) {
if (g->data [i][j] != 0) {
@@ -260,21 +264,39 @@ load_graph_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
static void
load_graph_load_config (LoadGraph *g)
{
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gchar *name, *temp;
+#else
gchar name [BUFSIZ], *temp;
+#endif
guint i;
if (!g->colors)
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g->colors = g_new0(GdkRGBA, g->n);
+#else
g->colors = g_new0(GdkColor, g->n);
+#endif
for (i = 0; i < g->n; i++)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ name = g_strdup_printf ("%s-color%u", g->name, i);
+#else
g_snprintf(name, sizeof(name), "%s-color%u", g->name, i);
+#endif
temp = g_settings_get_string(g->multiload->settings, name);
if (!temp)
temp = g_strdup ("#000000");
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_rgba_parse(&(g->colors[i]), temp);
+#else
gdk_color_parse(temp, &(g->colors[i]));
+#endif
g_free(temp);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_free(name);
+#endif
}
}