diff options
author | Monsta <[email protected]> | 2015-02-12 14:55:25 +0300 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2015-03-15 18:58:50 +0100 |
commit | 36b3ed6c866ccec238f479163fea424fb672c912 (patch) | |
tree | 4d18c10e4862d529ec66abdca9a30b2cb08751f3 /stickynotes/stickynotes_applet_callbacks.c | |
parent | 28e2e2ea744cf845d21b15adf4e37c61b4ff59a4 (diff) | |
download | mate-applets-36b3ed6c866ccec238f479163fea424fb672c912.tar.bz2 mate-applets-36b3ed6c866ccec238f479163fea424fb672c912.tar.xz |
stickynotes: use modern color-related API in GTK+3 build
Diffstat (limited to 'stickynotes/stickynotes_applet_callbacks.c')
-rw-r--r-- | stickynotes/stickynotes_applet_callbacks.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c index 4af87044..6414db5c 100644 --- a/stickynotes/stickynotes_applet_callbacks.c +++ b/stickynotes/stickynotes_applet_callbacks.c @@ -469,23 +469,31 @@ preferences_save_cb (gpointer data) void preferences_color_cb (GtkWidget *button, gpointer data) { - GdkColor color, font_color; char *color_str, *font_color_str; - gtk_color_button_get_color ( - GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); - gtk_color_button_get_color ( - GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), - &font_color); +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA color, font_color; + + gtk_color_button_get_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); + gtk_color_button_get_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color); + + color_str = gdk_rgba_to_string (&color); + font_color_str = gdk_rgba_to_string (&font_color); +#else + GdkColor color, font_color; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); + gtk_color_button_get_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color); color_str = g_strdup_printf ("#%.2x%.2x%.2x", - color.red / 256, - color.green / 256, - color.blue / 256); + color.red / 256, + color.green / 256, + color.blue / 256); font_color_str = g_strdup_printf ("#%.2x%.2x%.2x", - font_color.red / 256, - font_color.green / 256, - font_color.blue / 256); + font_color.red / 256, + font_color.green / 256, + font_color.blue / 256); +#endif g_settings_set_string (stickynotes->settings, "default-color", color_str); g_settings_set_string (stickynotes->settings, "default-font-color", font_color_str); |