[gnome-shell] switcherPopup: Move _createSwitcher implementations into constructors
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] switcherPopup: Move _createSwitcher implementations into constructors
- Date: Thu, 11 Sep 2014 17:35:44 +0000 (UTC)
commit 547cdf86cc7ee66a027d28038f00f84521299dde
Author: Rui Matos <tiagomatos gmail com>
Date: Wed Sep 3 17:15:31 2014 +0200
switcherPopup: Move _createSwitcher implementations into constructors
We don't really need this step as a separate method since all
implementations are supposed to be created and shown immediately. This
also ensures that we have items to show in all subclasses.
https://bugzilla.gnome.org/show_bug.cgi?id=735976
js/ui/altTab.js | 43 +++++++++++++++----------------------------
js/ui/ctrlAltTab.js | 5 +++--
js/ui/status/keyboard.js | 3 ---
js/ui/switcherPopup.js | 6 +-----
4 files changed, 19 insertions(+), 38 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index efbb238..b11c4f1 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -58,6 +58,14 @@ const AppSwitcherPopup = new Lang.Class({
this._currentWindow = -1;
this.thumbnailsVisible = false;
+
+ let apps = Shell.AppSystem.get_default().get_running ();
+
+ if (apps.length == 0)
+ return;
+
+ this._switcherList = new AppSwitcher(apps, this);
+ this._items = this._switcherList.icons;
},
_allocate: function (actor, box, flags) {
@@ -99,20 +107,6 @@ const AppSwitcherPopup = new Lang.Class({
}
},
- _createSwitcher: function() {
- let apps = Shell.AppSystem.get_default().get_running ();
-
- if (apps.length == 0)
- return false;
-
- this._switcherList = new AppSwitcher(apps, this);
- this._items = this._switcherList.icons;
- if (this._items.length == 0)
- return false;
-
- return true;
- },
-
_initialSelection: function(backward, binding) {
if (binding == 'switch-group') {
if (backward) {
@@ -365,30 +359,23 @@ const WindowSwitcherPopup = new Lang.Class({
Name: 'WindowSwitcherPopup',
Extends: SwitcherPopup.SwitcherPopup,
- _init: function(items) {
- this.parent(items);
+ _init: function() {
+ this.parent();
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
- },
- _getWindowList: function() {
- let workspace = this._settings.get_boolean('current-workspace-only') ?
global.screen.get_active_workspace() : null;
- return global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
- },
-
- _createSwitcher: function() {
let windows = this._getWindowList();
if (windows.length == 0)
- return false;
+ return;
let mode = this._settings.get_enum('app-icon-mode');
this._switcherList = new WindowList(windows, mode);
this._items = this._switcherList.icons;
+ },
- if (this._items.length == 0)
- return false;
-
- return true;
+ _getWindowList: function() {
+ let workspace = this._settings.get_boolean('current-workspace-only') ?
global.screen.get_active_workspace() : null;
+ return global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
},
_initialSelection: function(backward, binding) {
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index fc884ae..85e39df 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -140,9 +140,10 @@ const CtrlAltTabPopup = new Lang.Class({
Name: 'CtrlAltTabPopup',
Extends: SwitcherPopup.SwitcherPopup,
- _createSwitcher: function() {
+ _init: function(items) {
+ this.parent(items);
+
this._switcherList = new CtrlAltTabSwitcher(this._items);
- return true;
},
_initialSelection: function(backward, binding) {
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 8889959..ea02f6f 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -265,11 +265,8 @@ const InputSourcePopup = new Lang.Class({
this._action = action;
this._actionBackward = actionBackward;
- },
- _createSwitcher: function() {
this._switcherList = new InputSourceSwitcher(this._items);
- return true;
},
_initialSelection: function(backward, binding) {
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index ccb774d..c9d3884 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -102,16 +102,12 @@ const SwitcherPopup = new Lang.Class({
this._switcherList.actor.allocate(childBox, flags);
},
- _createSwitcher: function() {
- throw new Error('Not implemented');
- },
-
_initialSelection: function(backward, binding) {
throw new Error('Not implemented');
},
show: function(backward, binding, mask) {
- if (!this._createSwitcher())
+ if (this._items.length == 0)
return false;
if (!Main.pushModal(this.actor)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]