From 22516191381198c85e4e480c7603e5827ac17349 Mon Sep 17 00:00:00 2001 From: monsta Date: Mon, 15 Feb 2016 11:34:31 +0300 Subject: panel-profile: less #if's again --- mate-panel/panel-profile.c | 76 +++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 42 deletions(-) (limited to 'mate-panel') diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index 9fd0a058..b5bb9078 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -238,34 +238,14 @@ panel_profile_set_background_color (PanelToplevel *toplevel, { panel_profile_set_background_gdk_rgba (toplevel, color); } -#else -void -panel_profile_set_background_color (PanelToplevel *toplevel, - PanelColor *color) -{ - panel_profile_set_background_gdk_color (toplevel, &color->gdk); - panel_profile_set_background_opacity (toplevel, color->alpha); -} -#endif -#if GTK_CHECK_VERSION (3, 0, 0) void panel_profile_get_background_color (PanelToplevel *toplevel, GdkRGBA *color) { panel_profile_get_background_gdk_rgba (toplevel, color); } -#else -void -panel_profile_get_background_color (PanelToplevel *toplevel, - PanelColor *color) -{ - panel_profile_get_background_gdk_color (toplevel, &(color->gdk)); - color->alpha = panel_profile_get_background_opacity (toplevel); -} -#endif -#if GTK_CHECK_VERSION (3, 0, 0) void panel_profile_set_background_gdk_rgba (PanelToplevel *toplevel, GdkRGBA *color) @@ -295,7 +275,41 @@ panel_profile_get_background_gdk_rgba (PanelToplevel *toplevel, g_free (color_str); } + +void +panel_profile_set_background_opacity (PanelToplevel *toplevel, + guint16 opacity) +{ + GdkRGBA color; + panel_profile_get_background_color (toplevel, &color); + color.alpha = opacity / 65535.0; + panel_profile_set_background_color (toplevel, &color); +} + +guint16 +panel_profile_get_background_opacity (PanelToplevel *toplevel) +{ + GdkRGBA color; + panel_profile_get_background_color (toplevel, &color); + return (guint16) round (color.alpha * 65535); +} #else +void +panel_profile_set_background_color (PanelToplevel *toplevel, + PanelColor *color) +{ + panel_profile_set_background_gdk_color (toplevel, &color->gdk); + panel_profile_set_background_opacity (toplevel, color->alpha); +} + +void +panel_profile_get_background_color (PanelToplevel *toplevel, + PanelColor *color) +{ + panel_profile_get_background_gdk_color (toplevel, &(color->gdk)); + color->alpha = panel_profile_get_background_opacity (toplevel); +} + void panel_profile_set_background_gdk_color (PanelToplevel *toplevel, GdkColor *gdk_color) @@ -327,36 +341,14 @@ panel_profile_get_background_gdk_color (PanelToplevel *toplevel, g_free (color_str); } -#endif -#if GTK_CHECK_VERSION (3, 0, 0) -void -panel_profile_set_background_opacity (PanelToplevel *toplevel, - guint16 opacity) -{ - GdkRGBA color; - panel_profile_get_background_color (toplevel, &color); - color.alpha = opacity / 65535.0; - panel_profile_set_background_color (toplevel, &color); -} -#else void panel_profile_set_background_opacity (PanelToplevel *toplevel, guint16 opacity) { g_settings_set_int (toplevel->background_settings, "opacity", opacity); } -#endif -#if GTK_CHECK_VERSION (3, 0, 0) -guint16 -panel_profile_get_background_opacity (PanelToplevel *toplevel) -{ - GdkRGBA color; - panel_profile_get_background_color (toplevel, &color); - return (guint16) round (color.alpha * 65535); -} -#else guint16 panel_profile_get_background_opacity (PanelToplevel *toplevel) { -- cgit v1.2.1