summaryrefslogtreecommitdiff
path: root/src/load-graph.cpp
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-02-28 16:56:54 +0100
committerraveit65 <[email protected]>2016-02-28 16:56:54 +0100
commit67f2a369d1bc9a3b834d3e49a8508ae41bcc1ede (patch)
treece642051943a11e17372551b86111ed2daf5d627 /src/load-graph.cpp
parent08924225e0a39d4a50da1c9bab824dc40986f44b (diff)
downloadmate-system-monitor-67f2a369d1bc9a3b834d3e49a8508ae41bcc1ede.tar.bz2
mate-system-monitor-67f2a369d1bc9a3b834d3e49a8508ae41bcc1ede.tar.xz
GTK+-3: Get values from GtkStyleContext states properly
Diffstat (limited to 'src/load-graph.cpp')
-rw-r--r--src/load-graph.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 56aa0fa..506f567 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -88,15 +88,24 @@ static void draw_background(LoadGraph *graph) {
cr = cairo_create (surface);
GtkStyleContext *context = gtk_widget_get_style_context (ProcData::get_instance()->notebook);
- gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg);
- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &bg);
+ gtk_style_context_get_color (context, gtk_style_context_get_state (context), &fg);
+ gtk_style_context_restore (context);
// set the background colour
gdk_cairo_set_source_rgba (cr, &bg);
cairo_paint (cr);
layout = pango_cairo_create_layout (cr);
- gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get (context,
+ gtk_style_context_get_state (context),
+ GTK_STYLE_PROPERTY_FONT,
+ &font_desc, NULL);
+ gtk_style_context_restore (context);
pango_font_description_set_size (font_desc, 0.8 * graph->fontsize * PANGO_SCALE);
pango_layout_set_font_description (layout, font_desc);
pango_font_description_free (font_desc);