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

@ -857,13 +857,13 @@ StTooltip StLabel {
background-gradient-start: rgba(0,0,0,0.01); background-gradient-start: rgba(0,0,0,0.01);
background-gradient-end: rgba(0,0,0,0.95); background-gradient-end: rgba(0,0,0,0.95);
height: 36px; height: 36px;
color: white;
} }
#notification { #notification {
font-size: 16px; font-size: 16px;
border-radius: 5px 5px 0px 0px; border-radius: 5px 5px 0px 0px;
background: rgba(0,0,0,0.9); background: rgba(0,0,0,0.9);
color: white;
padding: 8px 8px 4px 8px; padding: 8px 8px 4px 8px;
spacing-rows: 10px; spacing-rows: 10px;
spacing-columns: 10px; spacing-columns: 10px;
@ -1012,10 +1012,6 @@ StTooltip StLabel {
height: 36px; height: 36px;
} }
.summary-source {
color: white;
}
.summary-source-button { .summary-source-button {
padding-left: 3px; padding-left: 3px;
padding-right: 3px; padding-right: 3px;

View File

@ -144,7 +144,9 @@ function start() {
notificationDaemon = new NotificationDaemon.NotificationDaemon(); notificationDaemon = new NotificationDaemon.NotificationDaemon();
windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler(); windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
telepathyClient = new TelepathyClient.Client(); telepathyClient = new TelepathyClient.Client();
panel.startStatusArea(); panel.startStatusArea();
statusIconDispatcher.start(messageTray.actor);
ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager(); ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
ctrlAltTabManager.addGroup(panel.actor, _("Panel"), 'gnome-panel'); ctrlAltTabManager.addGroup(panel.actor, _("Panel"), 'gnome-panel');

View File

@ -31,7 +31,6 @@ StatusIconDispatcher.prototype = {
this._traymanager = new Shell.TrayManager(); this._traymanager = new Shell.TrayManager();
this._traymanager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded)); this._traymanager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
this._traymanager.connect('tray-icon-removed', Lang.bind(this, this._onTrayIconRemoved)); this._traymanager.connect('tray-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
this._traymanager.manage_stage(global.stage);
// Yet-another-Ubuntu-workaround - we have to kill their // Yet-another-Ubuntu-workaround - we have to kill their
// app-indicators, so that applications fall back to normal // app-indicators, so that applications fall back to normal
@ -40,6 +39,10 @@ StatusIconDispatcher.prototype = {
Util.killall('indicator-application-service'); Util.killall('indicator-application-service');
}, },
start: function(themeWidget) {
this._traymanager.manage_stage(global.stage, themeWidget);
},
_onTrayIconAdded: function(o, icon) { _onTrayIconAdded: function(o, icon) {
let wmClass = (icon.wm_class || 'unknown').toLowerCase(); let wmClass = (icon.wm_class || 'unknown').toLowerCase();
let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass]; let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];

View File

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

View File

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