[gnome-panel] notification-area: don't use deprecated GdkColor
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] notification-area: don't use deprecated GdkColor
- Date: Mon, 24 Nov 2014 03:35:55 +0000 (UTC)
commit d1dd54ec8ef57c95c7b763a5375cdfc7b42ad232
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Nov 24 05:28:15 2014 +0200
notification-area: don't use deprecated GdkColor
applets/notification_area/main.c | 37 +++----------
applets/notification_area/na-tray-manager.c | 74 ++++++++++++++-------------
applets/notification_area/na-tray-manager.h | 16 +++---
applets/notification_area/na-tray.c | 8 ++--
applets/notification_area/na-tray.h | 8 ++--
5 files changed, 63 insertions(+), 80 deletions(-)
---
diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c
index 16b88dd..0b05388 100644
--- a/applets/notification_area/main.c
+++ b/applets/notification_area/main.c
@@ -94,33 +94,15 @@ na_tray_applet_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (na_tray_applet_parent_class)->unrealize (widget);
}
-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;
@@ -131,16 +113,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 f7cc417..99a863e 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -96,21 +96,25 @@ na_tray_manager_init (NaTrayManager *manager)
manager->padding = 0;
manager->icon_size = 0;
- manager->fg.red = 0;
- manager->fg.green = 0;
- manager->fg.blue = 0;
-
- manager->error.red = 0xffff;
- manager->error.green = 0;
- manager->error.blue = 0;
-
- manager->warning.red = 0xffff;
- manager->warning.green = 0xffff;
- manager->warning.blue = 0;
-
- manager->success.red = 0;
- manager->success.green = 0xffff;
- manager->success.blue = 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;
}
static void
@@ -717,18 +721,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 * 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;
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (window),
@@ -951,17 +955,17 @@ na_tray_manager_set_icon_size (NaTrayManager *manager,
void
na_tray_manager_set_colors (NaTrayManager *manager,
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success)
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *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 (!gdk_rgba_equal (&manager->fg, fg) ||
+ !gdk_rgba_equal (&manager->error, error) ||
+ !gdk_rgba_equal (&manager->warning, warning) ||
+ !gdk_rgba_equal (&manager->success, success))
{
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 68cbebf..77506c0 100644
--- a/applets/notification_area/na-tray-manager.h
+++ b/applets/notification_area/na-tray-manager.h
@@ -56,10 +56,10 @@ struct _NaTrayManager
GtkOrientation orientation;
gint padding;
gint icon_size;
- GdkColor fg;
- GdkColor error;
- GdkColor warning;
- GdkColor success;
+ GdkRGBA fg;
+ GdkRGBA error;
+ GdkRGBA warning;
+ GdkRGBA success;
GList *messages;
GHashTable *socket_table;
@@ -101,10 +101,10 @@ 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,
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success);
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success);
G_END_DECLS
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index b98078f..dfc8f75 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -835,10 +835,10 @@ na_tray_set_icon_size (NaTray *tray,
void
na_tray_set_colors (NaTray *tray,
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success)
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success)
{
NaTrayPrivate *priv = tray->priv;
diff --git a/applets/notification_area/na-tray.h b/applets/notification_area/na-tray.h
index 0624c49..f06bfc6 100644
--- a/applets/notification_area/na-tray.h
+++ b/applets/notification_area/na-tray.h
@@ -63,10 +63,10 @@ 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,
- GdkColor *fg,
- GdkColor *error,
- GdkColor *warning,
- GdkColor *success);
+ GdkRGBA *fg,
+ GdkRGBA *error,
+ GdkRGBA *warning,
+ GdkRGBA *success);
void na_tray_force_redraw (NaTray *tray);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]