Add proper color-setting for the labels in Gtk3

This commit is contained in:
Simon Steinbeiss
2014-12-19 11:28:47 +01:00
parent ae2f118c14
commit 2ccd5469ad

View File

@@ -133,7 +133,11 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
XtmProcessStatusbar *statusbar = XTM_PROCESS_STATUSBAR (object);
gchar *text;
gchar *float_value;
#ifdef HAVE_GTK3
GdkRGBA color;
#else
GdkColor color;
#endif
switch (property_id)
{
@@ -142,8 +146,13 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
float_value = rounded_float_value (statusbar->cpu, statusbar->settings);
text = g_strdup_printf (_("CPU: %s%%"), float_value);
gtk_label_set_text (GTK_LABEL (statusbar->label_cpu), text);
#ifdef HAVE_GTK3
gdk_rgba_parse (&color, "#ff6e00");
gtk_widget_override_color (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
#else
gdk_color_parse ("#ff6e00", &color);
gtk_widget_modify_fg (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
#endif
g_free (float_value);
g_free (text);
break;
@@ -152,8 +161,13 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
g_strlcpy(statusbar->memory, g_value_get_string (value), 64);
text = g_strdup_printf (_("Memory: %s"), statusbar->memory);
gtk_label_set_text (GTK_LABEL (statusbar->label_memory), text);
#ifdef HAVE_GTK3
gdk_rgba_parse (&color, "#ab1852");
gtk_widget_override_color (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
#else
gdk_color_parse ("#ab1852", &color);
gtk_widget_modify_fg (statusbar->label_memory, GTK_STATE_NORMAL, &color);
#endif
g_free (text);
break;