[gnome-shell/wip/pressure: 13/14] js: Remove StatusIconDispatcher
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/pressure: 13/14] js: Remove StatusIconDispatcher
- Date: Mon, 30 Jul 2012 23:48:56 +0000 (UTC)
commit 5305ed1723ce7dd5ee117b1b94d5a8cdad34555e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jul 24 14:47:39 2012 -0300
js: Remove StatusIconDispatcher
With IBus in the top panel, we don't need it any more
https://bugzilla.gnome.org/show_bug.cgi?id=680800
js/Makefile.am | 1 -
js/ui/main.js | 5 ---
js/ui/notificationDaemon.js | 26 +++++++++++++++-
js/ui/panel.js | 28 ------------------
js/ui/statusIconDispatcher.js | 63 -----------------------------------------
5 files changed, 24 insertions(+), 99 deletions(-)
---
diff --git a/js/Makefile.am b/js/Makefile.am
index d018e9c..3803a64 100644
--- a/js/Makefile.am
+++ b/js/Makefile.am
@@ -82,7 +82,6 @@ nobase_dist_js_DATA = \
ui/search.js \
ui/searchDisplay.js \
ui/shellDBus.js \
- ui/statusIconDispatcher.js \
ui/status/accessibility.js \
ui/status/keyboard.js \
ui/status/network.js \
diff --git a/js/ui/main.js b/js/ui/main.js
index 790dd80..766d865 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -40,7 +40,6 @@ const UnlockDialog = imports.ui.unlockDialog;
const WindowManager = imports.ui.windowManager;
const Magnifier = imports.ui.magnifier;
const XdndHandler = imports.ui.xdndHandler;
-const StatusIconDispatcher = imports.ui.statusIconDispatcher;
const Util = imports.misc.util;
const OVERRIDES_SCHEMA = 'org.gnome.shell.overrides';
@@ -71,7 +70,6 @@ let modalActorFocusStack = [];
let uiGroup = null;
let magnifier = null;
let xdndHandler = null;
-let statusIconDispatcher = null;
let keyboard = null;
let layoutManager = null;
let networkAgent = null;
@@ -214,7 +212,6 @@ function start() {
ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
overview = new Overview.Overview();
magnifier = new Magnifier.Magnifier();
- statusIconDispatcher = new StatusIconDispatcher.StatusIconDispatcher();
screenShield = new ScreenShield.ScreenShield();
screenSaverDBus = new ShellDBus.ScreenSaverDBus();
panel = new Panel.Panel();
@@ -256,8 +253,6 @@ function start() {
Lang.bind(overview, overview.toggle));
}
- statusIconDispatcher.start(messageTray.actor);
-
// Provide the bus object for gnome-session to
// initiate logouts.
EndSessionDialog.init();
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 6c75a3e..0b01b7e 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -88,6 +88,21 @@ const rewriteRules = {
]
};
+const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
+ 'bluetooth-applet': 'bluetooth',
+ 'gnome-volume-control-applet': 'volume', // renamed to gnome-sound-applet
+ // when moved to control center
+ 'gnome-sound-applet': 'volume',
+ 'nm-applet': 'network',
+ 'gnome-power-manager': 'battery',
+ 'keyboard': 'keyboard',
+ 'a11y-keyboard': 'a11y',
+ 'kbd-scrolllock': 'keyboard',
+ 'kbd-numlock': 'keyboard',
+ 'kbd-capslock': 'keyboard',
+ 'ibus-ui-gtk': 'keyboard'
+};
+
const NotificationDaemon = new Lang.Class({
Name: 'NotificationDaemon',
@@ -100,13 +115,16 @@ const NotificationDaemon = new Lang.Class({
this._notifications = {};
this._busProxy = new Bus();
- Main.statusIconDispatcher.connect('message-icon-added', Lang.bind(this, this._onTrayIconAdded));
- Main.statusIconDispatcher.connect('message-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
+ 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));
Shell.WindowTracker.get_default().connect('notify::focus-app',
Lang.bind(this, this._onFocusAppChanged));
Main.overview.connect('hidden',
Lang.bind(this, this._onFocusAppChanged));
+
+ this._trayManager.manage_stage(global.stage, Main.messageTray.actor);
},
_iconForNotificationData: function(icon, hints) {
@@ -481,6 +499,10 @@ const NotificationDaemon = new Lang.Class({
},
_onTrayIconAdded: function(o, icon) {
+ let wmClass = icon.wm_class.toLowerCase();
+ if (STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass] !== undefined)
+ return;
+
let source = this._getSource(icon.title || icon.wm_class || C_("program", "Unknown"), icon.pid, null, null, icon);
},
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 82c9996..d9cf598 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -967,10 +967,6 @@ const Panel = new Lang.Class({
this._centerBox.add(this._dateMenu.actor, { y_fill: true });
this._menus.addMenu(this._dateMenu.menu);
- /* right */
- Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded));
- Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
-
Main.layoutManager.panelBox.add(this.actor);
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'start-here',
{ sortGroup: CtrlAltTab.SortGroup.TOP });
@@ -1151,30 +1147,6 @@ const Panel = new Lang.Class({
return indicator;
},
- _onTrayIconAdded: function(o, icon, role) {
- if (Main.sessionMode.statusArea.implementation[role]) {
- // This icon is legacy, and replaced by a Shell version
- // Hide it
- return;
- }
-
- if (Main.sessionMode.statusArea.order.indexOf(role) == -1)
- return;
-
- icon.height = PANEL_ICON_SIZE;
- let buttonBox = new PanelMenu.ButtonBox();
- let box = buttonBox.actor;
- box.add_actor(icon);
-
- this._insertStatusItem(box, Main.sessionMode.statusArea.order.indexOf(role));
- },
-
- _onTrayIconRemoved: function(o, icon) {
- let box = icon.get_parent();
- if (box && box._delegate instanceof PanelMenu.ButtonBox)
- box.destroy();
- },
-
_onLockStateChanged: function(shield, locked) {
if (this._activitiesButton)
this._activitiesButton.setLockedState(locked);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]