[gnome-shell] ViewSelector: use Params to pass optional parameters to addPage



commit c97b4dd48e142ec1c7cc6eab2d62c2a89de7f0b6
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Dec 13 23:20:46 2012 +0100

    ViewSelector: use Params to pass optional parameters to addPage
    
    This allows to introduce new parameters without making the signature
    overly complex.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690171

 js/ui/viewSelector.js |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index ba09ae2..1ece4a0 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -12,6 +12,7 @@ const St = imports.gi.St;
 
 const AppDisplay = imports.ui.appDisplay;
 const Main = imports.ui.main;
+const Params = imports.misc.params;
 const RemoteSearch = imports.ui.remoteSearch;
 const Search = imports.ui.search;
 const SearchDisplay = imports.ui.searchDisplay;
@@ -77,16 +78,17 @@ const ViewSelector = new Lang.Class({
         this._capturedEventId = 0;
 
         this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay();
-        this._workspacesPage = this._addPage(this._workspacesDisplay.actor, null,
+        this._workspacesPage = this._addPage(this._workspacesDisplay.actor,
                                              _("Windows"), 'emblem-documents-symbolic');
 
         this._appDisplay = new AppDisplay.AllAppDisplay();
-        this._appsPage = this._addPage(this._appDisplay.actor, null,
+        this._appsPage = this._addPage(this._appDisplay.actor,
                                        _("Applications"), 'view-grid-symbolic');
 
         this._searchResults = new SearchDisplay.SearchResults(this._searchSystem);
-        this._searchPage = this._addPage(this._searchResults.actor, this._entry,
-                                         _("Search"), 'edit-find-symbolic');
+        this._searchPage = this._addPage(this._searchResults.actor,
+                                         _("Search"), 'edit-find-symbolic',
+                                         { a11yFocus: this._entry });
 
         this._searchSettings = new Gio.Settings({ schema: Search.SEARCH_PROVIDERS_SCHEMA });
         this._searchSettings.connect('changed::disabled', Lang.bind(this, this._reloadRemoteProviders));
@@ -169,14 +171,16 @@ const ViewSelector = new Lang.Class({
         this._workspacesDisplay.hide();
     },
 
-    _addPage: function(actor, a11yFocus, name, a11yIcon) {
+    _addPage: function(actor, name, a11yIcon, params) {
+        params = Params.parse(params, { a11yFocus: null });
+
         let page = new St.Bin({ child: actor,
                                 x_align: St.Align.START,
                                 y_align: St.Align.START,
                                 x_fill: true,
                                 y_fill: true });
-        if (a11yFocus)
-            Main.ctrlAltTabManager.addGroup(a11yFocus, name, a11yIcon);
+        if (params.a11yFocus)
+            Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
         else
             Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon,
                                             { proxy: this.actor,



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