summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-02-11 07:45:16 +0100
committerWolfgang Ulbrich <[email protected]>2016-02-12 07:04:31 +0100
commit9081a2ee5cb1e173bfbd191e9630b11be299d081 (patch)
treef72c024039d29871994d895280ef67a00b8a2a68 /applets
parent9fbaadf2b1d3cbc1a3c752f099e10fde1e086b02 (diff)
downloadmate-panel-9081a2ee5cb1e173bfbd191e9630b11be299d081.tar.bz2
mate-panel-9081a2ee5cb1e173bfbd191e9630b11be299d081.tar.xz
GTK+3 notification-area: don't use deprecated GdkColor
Taken from: https://git.gnome.org/browse/gnome-panel/commit/?id=d1dd54e
Diffstat (limited to 'applets')
-rw-r--r--applets/notification_area/main.c37
-rw-r--r--applets/notification_area/na-tray-manager.c51
-rw-r--r--applets/notification_area/na-tray-manager.h14
-rw-r--r--applets/notification_area/na-tray.c7
-rw-r--r--applets/notification_area/na-tray.h7
5 files changed, 87 insertions, 29 deletions
diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c
index 3e8426ec..448f9e39 100644
--- a/applets/notification_area/main.c
+++ b/applets/notification_area/main.c
@@ -203,33 +203,15 @@ na_tray_applet_unrealize (GtkWidget *widget)
}
#if GTK_CHECK_VERSION (3, 0, 0)
-static inline gboolean
-style_context_lookup_color (GtkStyleContext *context,
- const gchar *color_name,
- GdkColor *color)
-{
- GdkRGBA rgba;
-
- if (!gtk_style_context_lookup_color (context, color_name, &rgba))
- return FALSE;
-
- color->red = rgba.red * 65535;
- color->green = rgba.green * 65535;
- color->blue = rgba.blue * 65535;
-
- return TRUE;
-}
-
static void
na_tray_applet_style_updated (GtkWidget *widget)
{
NaTrayApplet *applet = NA_TRAY_APPLET (widget);
GtkStyleContext *context;
- GdkRGBA rgba;
- GdkColor fg;
- GdkColor error;
- GdkColor warning;
- GdkColor success;
+ GdkRGBA fg;
+ GdkRGBA error;
+ GdkRGBA warning;
+ GdkRGBA success;
gint padding;
gint icon_size;
@@ -241,16 +223,13 @@ na_tray_applet_style_updated (GtkWidget *widget)
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
- fg.red = rgba.red * 65535;
- fg.green = rgba.green * 65535;
- fg.blue = rgba.blue * 65535;
+ gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
- if (!style_context_lookup_color (context, "error_color", &error))
+ if (!gtk_style_context_lookup_color (context, "error_color", &error))
error = fg;
- if (!style_context_lookup_color (context, "warning_color", &warning))
+ if (!gtk_style_context_lookup_color (context, "warning_color", &warning))
warning = fg;
- if (!style_context_lookup_color (context, "success_color", &success))
+ if (!gtk_style_context_lookup_color (context, "success_color", &success))
success = fg;
na_tray_set_colors (applet->priv->tray, &fg, &error, &warning, &success);
diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c
index 76caa979..aaea0908 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -97,6 +97,27 @@ na_tray_manager_init (NaTrayManager *manager)
manager->padding = 0;
manager->icon_size = 0;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ manager->fg.red = 0.0;
+ manager->fg.green = 0.0;
+ manager->fg.blue = 0.0;
+ manager->fg.alpha = 1.0;
+
+ manager->error.red = 1.0;
+ manager->error.green = 0.0;
+ manager->error.blue = 0.0;
+ manager->error.alpha = 1.0;
+
+ manager->warning.red = 1.0;
+ manager->warning.green = 1.0;
+ manager->warning.blue = 0.0;
+ manager->warning.alpha = 1.0;
+
+ manager->success.red = 0.0;
+ manager->success.green = 1.0;
+ manager->success.blue = 0.0;
+ manager->success.alpha = 1.0;
+#else
manager->fg.red = 0;
manager->fg.green = 0;
manager->fg.blue = 0;
@@ -112,6 +133,7 @@ na_tray_manager_init (NaTrayManager *manager)
manager->success.red = 0;
manager->success.green = 0xffff;
manager->success.blue = 0;
+#endif
}
static void
@@ -788,6 +810,20 @@ na_tray_manager_set_colors_property (NaTrayManager *manager)
atom = gdk_x11_get_xatom_by_name_for_display (display,
"_NET_SYSTEM_TRAY_COLORS");
+#if GTK_CHECK_VERSION (3, 0, 0)
+ data[0] = manager->fg.red * 65535;
+ data[1] = manager->fg.green * 65535;
+ data[2] = manager->fg.blue * 65535;
+ data[3] = manager->error.red * 65535;
+ data[4] = manager->error.green * 65535;
+ data[5] = manager->error.blue * 65535;
+ data[6] = manager->warning.red * 65535;
+ data[7] = manager->warning.green * 65535;
+ data[8] = manager->warning.blue * 65535;
+ data[9] = manager->success.red * 65535;
+ data[10] = manager->success.green * 65535;
+ data[11] = manager->success.blue * 65535;
+#else
data[0] = manager->fg.red;
data[1] = manager->fg.green;
data[2] = manager->fg.blue;
@@ -800,6 +836,7 @@ na_tray_manager_set_colors_property (NaTrayManager *manager)
data[9] = manager->success.red;
data[10] = manager->success.green;
data[11] = manager->success.blue;
+#endif
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (window),
@@ -1037,6 +1074,19 @@ na_tray_manager_set_icon_size (NaTrayManager *manager,
void
na_tray_manager_set_colors (NaTrayManager *manager,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success)
+{
+ g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
+
+ if (!gdk_rgba_equal (&manager->fg, fg) ||
+ !gdk_rgba_equal (&manager->error, error) ||
+ !gdk_rgba_equal (&manager->warning, warning) ||
+ !gdk_rgba_equal (&manager->success, success))
+#else
GdkColor *fg,
GdkColor *error,
GdkColor *warning,
@@ -1048,6 +1098,7 @@ na_tray_manager_set_colors (NaTrayManager *manager,
!gdk_color_equal (&manager->error, error) ||
!gdk_color_equal (&manager->warning, warning) ||
!gdk_color_equal (&manager->success, success))
+#endif
{
manager->fg = *fg;
manager->error = *error;
diff --git a/applets/notification_area/na-tray-manager.h b/applets/notification_area/na-tray-manager.h
index a461510b..d1d585fe 100644
--- a/applets/notification_area/na-tray-manager.h
+++ b/applets/notification_area/na-tray-manager.h
@@ -60,10 +60,17 @@ struct _NaTrayManager
GtkOrientation orientation;
gint padding;
gint icon_size;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA fg;
+ GdkRGBA error;
+ GdkRGBA warning;
+ GdkRGBA success;
+#else
GdkColor fg;
GdkColor error;
GdkColor warning;
GdkColor success;
+#endif
GList *messages;
GHashTable *socket_table;
@@ -105,10 +112,17 @@ void na_tray_manager_set_padding (NaTrayManager *manager,
void na_tray_manager_set_icon_size (NaTrayManager *manager,
gint padding);
void na_tray_manager_set_colors (NaTrayManager *manager,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success);
+#else
GdkColor *fg,
GdkColor *error,
GdkColor *warning,
GdkColor *success);
+#endif
G_END_DECLS
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index 0232983b..9db9703b 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -922,10 +922,17 @@ na_tray_set_icon_size (NaTray *tray,
void
na_tray_set_colors (NaTray *tray,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success)
+#else
GdkColor *fg,
GdkColor *error,
GdkColor *warning,
GdkColor *success)
+#endif
{
NaTrayPrivate *priv = tray->priv;
diff --git a/applets/notification_area/na-tray.h b/applets/notification_area/na-tray.h
index 3e69ce6d..c3d3415e 100644
--- a/applets/notification_area/na-tray.h
+++ b/applets/notification_area/na-tray.h
@@ -65,10 +65,17 @@ void na_tray_set_padding (NaTray *tray,
void na_tray_set_icon_size (NaTray *tray,
gint icon_size);
void na_tray_set_colors (NaTray *tray,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success);
+#else
GdkColor *fg,
GdkColor *error,
GdkColor *warning,
GdkColor *success);
+#endif
void na_tray_force_redraw (NaTray *tray);
G_END_DECLS