From cd3114cbfab295c38fe629a3f6688645b3f60015 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Fri, 17 Jun 2016 18:10:34 +0200 Subject: GTK+-3 mate-theme-info: port GdkColor to GdkRGBA --- capplets/common/mate-theme-info.c | 30 ++++++++++++++++++++++++++++++ capplets/common/mate-theme-info.h | 6 ++++++ 2 files changed, 36 insertions(+) diff --git a/capplets/common/mate-theme-info.c b/capplets/common/mate-theme-info.c index 2e58b6d7..964d45c0 100644 --- a/capplets/common/mate-theme-info.c +++ b/capplets/common/mate-theme-info.c @@ -1822,7 +1822,11 @@ mate_theme_info_register_theme_change (ThemeChangedCallback func, } gboolean +#if GTK_CHECK_VERSION (3, 0, 0) +mate_theme_color_scheme_parse (const gchar *scheme, GdkRGBA *colors) +#else mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) +#endif { gchar **color_scheme_strings, **color_scheme_pair, *current_string; gint i; @@ -1849,6 +1853,23 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) g_strstrip (color_scheme_pair[1]); if (!strcmp ("fg_color", color_scheme_pair[0])) +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_rgba_parse (&colors[COLOR_FG], color_scheme_pair[1]); + else if (!strcmp ("bg_color", color_scheme_pair[0])) + gdk_rgba_parse (&colors[COLOR_BG], color_scheme_pair[1]); + else if (!strcmp ("text_color", color_scheme_pair[0])) + gdk_rgba_parse (&colors[COLOR_TEXT], color_scheme_pair[1]); + else if (!strcmp ("base_color", color_scheme_pair[0])) + gdk_rgba_parse (&colors[COLOR_BASE], color_scheme_pair[1]); + else if (!strcmp ("selected_fg_color", color_scheme_pair[0])) + gdk_rgba_parse (&colors[COLOR_SELECTED_FG], color_scheme_pair[1]); + else if (!strcmp ("selected_bg_color", color_scheme_pair[0])) + gdk_rgba_parse ( &colors[COLOR_SELECTED_BG], color_scheme_pair[1]); + else if (!strcmp ("tooltip_fg_color", color_scheme_pair[0])) + gdk_rgba_parse (&colors[COLOR_TOOLTIP_FG], color_scheme_pair[1]); + else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0])) + gdk_rgba_parse (&colors[COLOR_TOOLTIP_BG], color_scheme_pair[1]); +#else gdk_color_parse (color_scheme_pair[1], &colors[COLOR_FG]); else if (!strcmp ("bg_color", color_scheme_pair[0])) gdk_color_parse (color_scheme_pair[1], &colors[COLOR_BG]); @@ -1864,6 +1885,7 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TOOLTIP_FG]); else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0])) gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TOOLTIP_BG]); +#endif } g_strfreev (color_scheme_pair); @@ -1877,7 +1899,11 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) gboolean mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2) { +#if GTK_CHECK_VERSION (3, 0, 0) + GdkRGBA c1[NUM_SYMBOLIC_COLORS], c2[NUM_SYMBOLIC_COLORS]; +#else GdkColor c1[NUM_SYMBOLIC_COLORS], c2[NUM_SYMBOLIC_COLORS]; +#endif int i; if (!mate_theme_color_scheme_parse (s1, c1) || @@ -1885,7 +1911,11 @@ mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2) return FALSE; for (i = 0; i < NUM_SYMBOLIC_COLORS; ++i) { +#if GTK_CHECK_VERSION (3, 0, 0) + if (!gdk_rgba_equal (&c1[i], &c2[i])) +#else if (!gdk_color_equal (&c1[i], &c2[i])) +#endif return FALSE; } diff --git a/capplets/common/mate-theme-info.h b/capplets/common/mate-theme-info.h index ee2222cd..9b45951c 100644 --- a/capplets/common/mate-theme-info.h +++ b/capplets/common/mate-theme-info.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -182,8 +183,13 @@ void mate_theme_init (void); void mate_theme_info_register_theme_change (ThemeChangedCallback func, gpointer data); +#if GTK_CHECK_VERSION (3, 0, 0) +gboolean mate_theme_color_scheme_parse (const gchar *scheme, + GdkRGBA *colors); +#else gboolean mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors); +#endif gboolean mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2); -- cgit v1.2.1