From ccf1bd9f274fba5fd4951abdb7293e346909fb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 25 Sep 2015 22:31:17 +0200 Subject: [PATCH] tray-manager: Don't use GdkColor It has been deprecated for a while in favor of GdkRgba, though in our case translating ClutterColors to an intermediate color type before setting _NET_SYSTEM_TRAY_COLORS is a bit silly, so just move to ClutterColor as the rest of the code base. --- configure.ac | 2 +- src/shell-tray-manager.c | 19 ++------------- src/tray/na-tray-manager.c | 48 +++++++++++++++++++------------------- src/tray/na-tray-manager.h | 17 +++++++------- 4 files changed, 36 insertions(+), 50 deletions(-) diff --git a/configure.ac b/configure.ac index 80d0614e5..80e2d84f9 100644 --- a/configure.ac +++ b/configure.ac @@ -117,7 +117,7 @@ PKG_CHECK_MODULES(GNOME_SHELL_JS, gio-2.0 gjs-internals-1.0 >= $GJS_MIN_VERSION) PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.8 x11) PKG_CHECK_MODULES(SHELL_PERF_HELPER, gtk+-3.0 gio-2.0) PKG_CHECK_MODULES(SHELL_HOTPLUG_SNIFFER, gio-2.0 gdk-pixbuf-2.0) -PKG_CHECK_MODULES(TRAY, gtk+-3.0) +PKG_CHECK_MODULES(TRAY, clutter-1.0 gtk+-3.0) PKG_CHECK_MODULES(GVC, libpulse >= $PULSE_MIN_VERS libpulse-mainloop-glib gobject-2.0) PKG_CHECK_MODULES(DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.13.1) diff --git a/src/shell-tray-manager.c b/src/shell-tray-manager.c index 45de21f25..3625b9edf 100644 --- a/src/shell-tray-manager.c +++ b/src/shell-tray-manager.c @@ -200,27 +200,12 @@ shell_tray_manager_style_changed (StWidget *theme_widget, ShellTrayManager *manager = user_data; StThemeNode *theme_node; StIconColors *icon_colors; - GdkColor foreground, warning, error, success; theme_node = st_widget_get_theme_node (theme_widget); icon_colors = st_theme_node_get_icon_colors (theme_node); - - foreground.red = icon_colors->foreground.red * 0x101; - foreground.green = icon_colors->foreground.green * 0x101; - foreground.blue = icon_colors->foreground.blue * 0x101; - warning.red = icon_colors->warning.red * 0x101; - warning.green = icon_colors->warning.green * 0x101; - warning.blue = icon_colors->warning.blue * 0x101; - error.red = icon_colors->error.red * 0x101; - error.green = icon_colors->error.green * 0x101; - error.blue = icon_colors->error.blue * 0x101; - success.red = icon_colors->success.red * 0x101; - success.green = icon_colors->success.green * 0x101; - success.blue = icon_colors->success.blue * 0x101; - na_tray_manager_set_colors (manager->priv->na_manager, - &foreground, &warning, - &error, &success); + &icon_colors->foreground, &icon_colors->warning, + &icon_colors->error, &icon_colors->success); } void diff --git a/src/tray/na-tray-manager.c b/src/tray/na-tray-manager.c index ceceb3558..dbdfb6614 100644 --- a/src/tray/na-tray-manager.c +++ b/src/tray/na-tray-manager.c @@ -97,16 +97,16 @@ na_tray_manager_init (NaTrayManager *manager) manager->fg.green = 0; manager->fg.blue = 0; - manager->error.red = 0xffff; + manager->error.red = 0xff; manager->error.green = 0; manager->error.blue = 0; - manager->warning.red = 0xffff; - manager->warning.green = 0xffff; + manager->warning.red = 0xff; + manager->warning.green = 0xff; manager->warning.blue = 0; manager->success.red = 0; - manager->success.green = 0xffff; + manager->success.green = 0xff; manager->success.blue = 0; } @@ -658,18 +658,18 @@ na_tray_manager_set_colors_property (NaTrayManager *manager) atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_SYSTEM_TRAY_COLORS"); - data[0] = manager->fg.red; - data[1] = manager->fg.green; - data[2] = manager->fg.blue; - data[3] = manager->error.red; - data[4] = manager->error.green; - data[5] = manager->error.blue; - data[6] = manager->warning.red; - data[7] = manager->warning.green; - data[8] = manager->warning.blue; - data[9] = manager->success.red; - data[10] = manager->success.green; - data[11] = manager->success.blue; + data[0] = manager->fg.red * 0x101; + data[1] = manager->fg.green * 0x101; + data[2] = manager->fg.blue * 0x101; + data[3] = manager->error.red * 0x101; + data[4] = manager->error.green * 0x101; + data[5] = manager->error.blue * 0x101; + data[6] = manager->warning.red * 0x101; + data[7] = manager->warning.green * 0x101; + data[8] = manager->warning.blue * 0x101; + data[9] = manager->success.red * 0x101; + data[10] = manager->success.green * 0x101; + data[11] = manager->success.blue * 0x101; XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), @@ -862,17 +862,17 @@ na_tray_manager_set_orientation (NaTrayManager *manager, void na_tray_manager_set_colors (NaTrayManager *manager, - GdkColor *fg, - GdkColor *error, - GdkColor *warning, - GdkColor *success) + ClutterColor *fg, + ClutterColor *error, + ClutterColor *warning, + ClutterColor *success) { g_return_if_fail (NA_IS_TRAY_MANAGER (manager)); - if (!gdk_color_equal (&manager->fg, fg) || - !gdk_color_equal (&manager->error, error) || - !gdk_color_equal (&manager->warning, warning) || - !gdk_color_equal (&manager->success, success)) + if (!clutter_color_equal (&manager->fg, fg) || + !clutter_color_equal (&manager->error, error) || + !clutter_color_equal (&manager->warning, warning) || + !clutter_color_equal (&manager->success, success)) { manager->fg = *fg; manager->error = *error; diff --git a/src/tray/na-tray-manager.h b/src/tray/na-tray-manager.h index 4ee346a03..95ccdfd3e 100644 --- a/src/tray/na-tray-manager.h +++ b/src/tray/na-tray-manager.h @@ -26,6 +26,7 @@ #include #endif #include +#include #include "na-tray-child.h" @@ -54,10 +55,10 @@ struct _NaTrayManager GtkWidget *invisible; GdkScreen *screen; GtkOrientation orientation; - GdkColor fg; - GdkColor error; - GdkColor warning; - GdkColor success; + ClutterColor fg; + ClutterColor error; + ClutterColor warning; + ClutterColor success; GList *messages; GHashTable *socket_table; @@ -95,10 +96,10 @@ void na_tray_manager_set_orientation (NaTrayManager *manager, GtkOrientation orientation); GtkOrientation na_tray_manager_get_orientation (NaTrayManager *manager); void na_tray_manager_set_colors (NaTrayManager *manager, - GdkColor *fg, - GdkColor *error, - GdkColor *warning, - GdkColor *success); + ClutterColor *fg, + ClutterColor *error, + ClutterColor *warning, + ClutterColor *success); G_END_DECLS