tray: fix so that trayicons using symbolic icons get the right colors

The tray protocol only allows setting a single set of colors for all
symbolic trayicons; we use the message-tray's theme node to set that.

https://bugzilla.gnome.org/show_bug.cgi?id=641060
This commit is contained in:
Dan Winship
2011-01-31 12:48:18 -05:00
parent e208c7e3dd
commit bd04107593
5 changed files with 46 additions and 8 deletions

View File

@ -192,9 +192,40 @@ shell_tray_manager_new (void)
return g_object_new (SHELL_TYPE_TRAY_MANAGER, NULL);
}
static void
shell_tray_manager_style_changed (StWidget *theme_widget,
gpointer user_data)
{
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);
}
void
shell_tray_manager_manage_stage (ShellTrayManager *manager,
ClutterStage *stage)
ClutterStage *stage,
StWidget *theme_widget)
{
Window stage_xwindow;
GdkWindow *stage_window;
@ -228,6 +259,10 @@ shell_tray_manager_manage_stage (ShellTrayManager *manager,
g_object_unref (stage_window);
na_tray_manager_manage_screen (manager->priv->na_manager, screen);
g_signal_connect (theme_widget, "style-changed",
G_CALLBACK (shell_tray_manager_style_changed), manager);
shell_tray_manager_style_changed (theme_widget, manager);
}
static void

View File

@ -4,6 +4,7 @@
#define __SHELL_TRAY_MANAGER_H__
#include <clutter/clutter.h>
#include "st.h"
G_BEGIN_DECLS
@ -41,7 +42,8 @@ GType shell_tray_manager_get_type (void);
ShellTrayManager *shell_tray_manager_new (void);
void shell_tray_manager_manage_stage (ShellTrayManager *manager,
ClutterStage *stage);
ClutterStage *stage,
StWidget *theme_widget);
G_END_DECLS