[gnome-panel] na: add support for _NET_SYSTEM_TRAY_COLORS
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] na: add support for _NET_SYSTEM_TRAY_COLORS
- Date: Tue, 1 Feb 2011 22:52:49 +0000 (UTC)
commit c0aec6f4a6a896fe95ab02a114fe5224eadb261c
Author: Dan Winship <danw gnome org>
Date: Tue Feb 1 14:31:57 2011 -0500
na: add support for _NET_SYSTEM_TRAY_COLORS
This adds support for setting _NET_SYSTEM_TRAY_COLORS value, but does
not include a call to set it to match the theme/panel colors.
https://bugzilla.gnome.org/show_bug.cgi?id=614711
applets/notification_area/na-tray-manager.c | 79 +++++++++++++++++++++++++++
applets/notification_area/na-tray-manager.h | 10 ++++
applets/notification_area/na-tray.c | 13 +++++
applets/notification_area/na-tray.h | 5 ++
4 files changed, 107 insertions(+), 0 deletions(-)
---
diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c
index 79e6cf9..5354619 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -96,6 +96,22 @@ na_tray_manager_init (NaTrayManager *manager)
{
manager->invisible = NULL;
manager->socket_table = g_hash_table_new (NULL, NULL);
+
+ 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;
}
static void
@@ -634,6 +650,45 @@ na_tray_manager_set_visual_property (NaTrayManager *manager)
#endif
}
+static void
+na_tray_manager_set_colors_property (NaTrayManager *manager)
+{
+#ifdef GDK_WINDOWING_X11
+ GdkWindow *window;
+ GdkDisplay *display;
+ Atom atom;
+ gulong data[12];
+
+ g_return_if_fail (manager->invisible != NULL);
+ window = gtk_widget_get_window (manager->invisible);
+ g_return_if_fail (window != NULL);
+
+ display = gtk_widget_get_display (manager->invisible);
+ 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;
+
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ atom,
+ XA_CARDINAL, 32,
+ PropModeReplace,
+ (guchar *) &data, 12);
+#endif
+}
+
#ifdef GDK_WINDOWING_X11
static gboolean
@@ -679,6 +734,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
na_tray_manager_set_orientation_property (manager);
na_tray_manager_set_visual_property (manager);
+ na_tray_manager_set_colors_property (manager);
window = gtk_widget_get_window (invisible);
@@ -813,6 +869,29 @@ na_tray_manager_set_orientation (NaTrayManager *manager,
}
}
+void
+na_tray_manager_set_colors (NaTrayManager *manager,
+ GdkColor *fg,
+ GdkColor *error,
+ GdkColor *warning,
+ GdkColor *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))
+ {
+ manager->fg = *fg;
+ manager->error = *error;
+ manager->warning = *warning;
+ manager->success = *success;
+
+ na_tray_manager_set_colors_property (manager);
+ }
+}
+
GtkOrientation
na_tray_manager_get_orientation (NaTrayManager *manager)
{
diff --git a/applets/notification_area/na-tray-manager.h b/applets/notification_area/na-tray-manager.h
index 901934e..1350bdf 100644
--- a/applets/notification_area/na-tray-manager.h
+++ b/applets/notification_area/na-tray-manager.h
@@ -56,6 +56,10 @@ struct _NaTrayManager
GtkWidget *invisible;
GdkScreen *screen;
GtkOrientation orientation;
+ GdkColor fg;
+ GdkColor error;
+ GdkColor warning;
+ GdkColor success;
GList *messages;
GHashTable *socket_table;
@@ -92,6 +96,12 @@ gboolean na_tray_manager_manage_screen (NaTrayManager *manager,
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);
+
G_END_DECLS
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index ec858a6..a32a4ff 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -817,6 +817,19 @@ idle_redraw_cb (NaTray *tray)
}
void
+na_tray_set_colors (NaTray *tray,
+ GdkColor *fg,
+ GdkColor *error,
+ GdkColor *warning,
+ GdkColor *success)
+{
+ NaTrayPrivate *priv = tray->priv;
+
+ if (get_tray (priv->trays_screen) == tray)
+ na_tray_manager_set_colors (priv->trays_screen->tray_manager, fg, error, warning, success);
+}
+
+void
na_tray_force_redraw (NaTray *tray)
{
NaTrayPrivate *priv = tray->priv;
diff --git a/applets/notification_area/na-tray.h b/applets/notification_area/na-tray.h
index 57baddd..1a48eb0 100644
--- a/applets/notification_area/na-tray.h
+++ b/applets/notification_area/na-tray.h
@@ -60,6 +60,11 @@ NaTray *na_tray_new_for_screen (GdkScreen *screen,
void na_tray_set_orientation (NaTray *tray,
GtkOrientation orientation);
GtkOrientation na_tray_get_orientation (NaTray *tray);
+void na_tray_set_colors (NaTray *tray,
+ GdkColor *fg,
+ GdkColor *error,
+ GdkColor *warning,
+ GdkColor *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]