From 36b3ed6c866ccec238f479163fea424fb672c912 Mon Sep 17 00:00:00 2001 From: Monsta Date: Thu, 12 Feb 2015 14:55:25 +0300 Subject: stickynotes: use modern color-related API in GTK+3 build --- stickynotes/stickynotes_applet.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'stickynotes/stickynotes_applet.c') diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c index 133ca2bf..ed5563ae 100644 --- a/stickynotes/stickynotes_applet.c +++ b/stickynotes/stickynotes_applet.c @@ -452,10 +452,13 @@ stickynotes_applet_update_prefs (void) gboolean sys_color, sys_font, sticky, force_default, desktop_hide; char *font_str; char *color_str, *font_color_str; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA color, font_color; +#else GdkColor color, font_color; +#endif width = g_settings_get_int (stickynotes->settings, "default-width"); - width = MAX (width, 1); height = g_settings_get_int (stickynotes->settings, "default-height"); height = MAX (height, 1); @@ -483,10 +486,15 @@ stickynotes_applet_update_prefs (void) font_color_str = g_strdup ("#000000"); } +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_rgba_parse (&color, color_str); + gdk_rgba_parse (&font_color, font_color_str); +#else gdk_color_parse (color_str, &color); - g_free (color_str); - gdk_color_parse (font_color_str, &font_color); +#endif + + g_free (color_str); g_free (font_color_str); gtk_adjustment_set_value (stickynotes->w_prefs_width, width); @@ -507,13 +515,15 @@ stickynotes_applet_update_prefs (void) GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop), desktop_hide); - gtk_color_button_set_color ( - GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); - gtk_color_button_set_color ( - GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), - &font_color); - gtk_font_button_set_font_name ( - GTK_FONT_BUTTON (stickynotes->w_prefs_font), font_str); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_color_button_set_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); + gtk_color_button_set_rgba (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color); +#else + gtk_color_button_set_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color); +#endif + + gtk_font_button_set_font_name (GTK_FONT_BUTTON (stickynotes->w_prefs_font), font_str); g_free (font_str); if (g_settings_is_writable (stickynotes->settings, "default-color")) -- cgit v1.2.1