diff options
author | infirit <[email protected]> | 2015-07-07 00:01:04 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-07-07 01:19:55 +0200 |
commit | 56b59ced4437300d56b7e2f1d5061f06c0a266f5 (patch) | |
tree | 3b1b960d6d0daa3a79c2ec5a75c24db3a5b8626a /sensors-applet/sensor-config-dialog.c | |
parent | 148eab649fa789ae1bfc1a0c7cfb59866045d525 (diff) | |
download | mate-sensors-applet-56b59ced4437300d56b7e2f1d5061f06c0a266f5.tar.bz2 mate-sensors-applet-56b59ced4437300d56b7e2f1d5061f06c0a266f5.tar.xz |
Gtk3: Use GdkRGBA
Diffstat (limited to 'sensors-applet/sensor-config-dialog.c')
-rw-r--r-- | sensors-applet/sensor-config-dialog.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c index bb76da6..efda54b 100644 --- a/sensors-applet/sensor-config-dialog.c +++ b/sensors-applet/sensor-config-dialog.c @@ -324,14 +324,25 @@ static void sensor_config_dialog_graph_color_set(GtkColorButton *color_button, GtkTreePath *path; GtkTreeIter iter; GtkWidget *content_area; - GdkColor color; gchar *color_string; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA color; + + gtk_color_button_get_rgba(color_button, + &color); + + color_string = g_strdup_printf ("#%02X%02X%02X", (int)(0.5 + CLAMP (color.red, 0., 1.) * 255.), + (int)(0.5 + CLAMP (color.green, 0., 1.) * 255.), + (int)(0.5 + CLAMP (color.blue, 0., 1.) * 255.)); +#else + GdkColor color; gtk_color_button_get_color(color_button, &color); color_string = g_strdup_printf("#%02X%02X%02X", color.red / 256, color.green / 256, color.blue / 256); +#endif gtk_tree_selection_get_selected(config_dialog->sensors_applet->selection, &model, @@ -361,7 +372,11 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) { IconType count; GdkPixbuf *pixbuf; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA graph_color; +#else GdkColor graph_color; +#endif gchar *sensor_label; gchar *header_text; @@ -427,10 +442,13 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) { g_free(header_text); - gdk_color_parse(graph_color_string, - &graph_color); - +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_rgba_parse(&graph_color, graph_color_string); + config_dialog->graph_color_button = GTK_COLOR_BUTTON(gtk_color_button_new_with_rgba(&graph_color)); +#else + gdk_color_parse(graph_color_string, &graph_color); config_dialog->graph_color_button = GTK_COLOR_BUTTON(gtk_color_button_new_with_color(&graph_color)); +#endif config_dialog->graph_color_button_aligner = g_object_new(GTK_TYPE_ALIGNMENT, "child", config_dialog->graph_color_button, "xalign", 0.0, |