[gnome-shell/wip/message-tray: 18/35] js: Use global.focus_manager, rather than grabbing it ourselves



commit 96379fdfa0b16397d6eec6e71ff368d83a1eccbf
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Aug 15 12:22:01 2012 -0400

    js: Use global.focus_manager, rather than grabbing it ourselves

 js/ui/ctrlAltTab.js  |    5 ++---
 js/ui/messageTray.js |    9 +++------
 js/ui/panelMenu.js   |    3 +--
 3 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index 193f14e..3462eac 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -27,7 +27,6 @@ const CtrlAltTabManager = new Lang.Class({
 
     _init: function() {
         this._items = [];
-        this._focusManager = St.FocusManager.get_for_stage(global.stage);
     },
 
     addGroup: function(root, name, icon, params) {
@@ -41,11 +40,11 @@ const CtrlAltTabManager = new Lang.Class({
 
         this._items.push(item);
         root.connect('destroy', Lang.bind(this, function() { this.removeGroup(root); }));
-        this._focusManager.add_group(root);
+        global.focus_manager.add_group(root);
     },
 
     removeGroup: function(root) {
-        this._focusManager.remove_group(root);
+        global.focus_manager.remove_group(root);
         for (let i = 0; i < this._items.length; i++) {
             if (this._items[i].root == root) {
                 this._items.splice(i, 1);
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index c0344ec..0580e6e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -314,8 +314,6 @@ const Notification = new Lang.Class({
         this._table.connect('style-changed', Lang.bind(this, this._styleChanged));
         this.actor.set_child(this._table);
 
-        this._buttonFocusManager = St.FocusManager.get_for_stage(global.stage);
-
         // The first line should have the title, followed by the
         // banner text, but ellipsized if they won't both fit. We can't
         // make St.Table or St.BoxLayout do this the way we want (don't
@@ -638,10 +636,10 @@ const Notification = new Lang.Class({
         }
 
         if (this._buttonBox.get_n_children() > 0)
-            this._buttonFocusManager.remove_group(this._buttonBox);
+            global.focus_manager.remove_group(this._buttonBox);
 
         this._buttonBox.add(button);
-        this._buttonFocusManager.add_group(this._buttonBox);
+        global.focus_manager.add_group(this._buttonBox);
         button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
 
         this.updated();
@@ -1211,8 +1209,7 @@ const SummaryItem = new Lang.Class({
             this.rightClickMenu.add(item.actor);
 	}
 
-        let focusManager = St.FocusManager.get_for_stage(global.stage);
-        focusManager.add_group(this.rightClickMenu);
+        global.focus_manager.add_group(this.rightClickMenu);
     },
 
     prepareNotificationStackForShowing: function() {
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index f180069..542bb72 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -182,8 +182,7 @@ const Button = new Lang.Class({
     _onMenuKeyPress: function(actor, event) {
         let symbol = event.get_key_symbol();
         if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
-            let focusManager = St.FocusManager.get_for_stage(global.stage);
-            let group = focusManager.get_group(this.actor);
+            let group = global.focus_manager.get_group(this.actor);
             if (group) {
                 let direction = (symbol == Clutter.KEY_Left) ? Gtk.DirectionType.LEFT : Gtk.DirectionType.RIGHT;
                 group.navigate_focus(this.actor, direction, false);



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