[gnome-shell] tray: fix so that trayicons using symbolic icons get the right colors



commit bd041075939917ca5a8d550e016f4c6cc19311b4
Author: Dan Winship <danw gnome org>
Date:   Mon Jan 31 12:48:18 2011 -0500

    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

 data/theme/gnome-shell.css    |    6 +-----
 js/ui/main.js                 |    2 ++
 js/ui/statusIconDispatcher.js |    5 ++++-
 src/shell-tray-manager.c      |   37 ++++++++++++++++++++++++++++++++++++-
 src/shell-tray-manager.h      |    4 +++-
 5 files changed, 46 insertions(+), 8 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 5f5edfc..3e7cc81 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -857,13 +857,13 @@ StTooltip StLabel {
     background-gradient-start: rgba(0,0,0,0.01);
     background-gradient-end: rgba(0,0,0,0.95);
     height: 36px;
+    color: white;
 }
 
 #notification {
     font-size: 16px;
     border-radius: 5px 5px 0px 0px;
     background: rgba(0,0,0,0.9);
-    color: white;
     padding: 8px 8px 4px 8px;
     spacing-rows: 10px;
     spacing-columns: 10px;
@@ -1012,10 +1012,6 @@ StTooltip StLabel {
     height: 36px;
 }
 
-.summary-source {
-    color: white;
-}
-
 .summary-source-button {
     padding-left: 3px;
     padding-right: 3px;
diff --git a/js/ui/main.js b/js/ui/main.js
index 5366546..8f8725b 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -144,7 +144,9 @@ function start() {
     notificationDaemon = new NotificationDaemon.NotificationDaemon();
     windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
     telepathyClient = new TelepathyClient.Client();
+
     panel.startStatusArea();
+    statusIconDispatcher.start(messageTray.actor);
 
     ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
     ctrlAltTabManager.addGroup(panel.actor, _("Panel"), 'gnome-panel');
diff --git a/js/ui/statusIconDispatcher.js b/js/ui/statusIconDispatcher.js
index c48f276..e159b39 100644
--- a/js/ui/statusIconDispatcher.js
+++ b/js/ui/statusIconDispatcher.js
@@ -31,7 +31,6 @@ StatusIconDispatcher.prototype = {
         this._traymanager = new Shell.TrayManager();
         this._traymanager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
         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
         // app-indicators, so that applications fall back to normal
@@ -40,6 +39,10 @@ StatusIconDispatcher.prototype = {
         Util.killall('indicator-application-service');
     },
 
+    start: function(themeWidget) {
+        this._traymanager.manage_stage(global.stage, themeWidget);
+    },
+
     _onTrayIconAdded: function(o, icon) {
         let wmClass = (icon.wm_class || 'unknown').toLowerCase();
         let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];
diff --git a/src/shell-tray-manager.c b/src/shell-tray-manager.c
index 370297f..0d126e9 100644
--- a/src/shell-tray-manager.c
+++ b/src/shell-tray-manager.c
@@ -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
diff --git a/src/shell-tray-manager.h b/src/shell-tray-manager.h
index d991631..bc4dc4e 100644
--- a/src/shell-tray-manager.h
+++ b/src/shell-tray-manager.h
@@ -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
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]