[gnome-shell/modekill: 1/13] viewSelector: Use a fixed set of view tabs



commit f8460e8c879a90795c36101598bc6a3f5a63f735
Author: Joost Verdoorn <jpverdoorn gmail com>
Date:   Sat Jul 28 23:06:46 2012 +0300

    viewSelector: Use a fixed set of view tabs
    
    Design calls for views being accessible by other means than the current tab
    system, so we have no longer a need for the public viewTab API. Move the
    initialization of tabs to the viewSelector and make
    viewSelector.addViewTab() private.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682109

 js/ui/overview.js     |   71 +++++++++++++++++-------------------------------
 js/ui/viewSelector.js |   40 ++++++++++++++++++++++++++-
 2 files changed, 63 insertions(+), 48 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 925b2e6..a2257a2 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -10,19 +10,15 @@ const St = imports.gi.St;
 const Shell = imports.gi.Shell;
 const Gdk = imports.gi.Gdk;
 
-const AppDisplay = imports.ui.appDisplay;
 const Dash = imports.ui.dash;
 const DND = imports.ui.dnd;
 const Main = imports.ui.main;
 const MessageTray = imports.ui.messageTray;
 const Panel = imports.ui.panel;
 const Params = imports.misc.params;
-const PlaceDisplay = imports.ui.placeDisplay;
 const RemoteSearch = imports.ui.remoteSearch;
 const Tweener = imports.ui.tweener;
 const ViewSelector = imports.ui.viewSelector;
-const Wanda = imports.ui.wanda;
-const WorkspacesView = imports.ui.workspacesView;
 const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
 
 // Time for initial animation going into Overview mode
@@ -144,8 +140,6 @@ const Overview = new Lang.Class({
         this._capturedEventId = 0;
         this._buttonPressId = 0;
 
-        this._workspacesDisplay = null;
-
         this.visible = false;           // animating to overview, in overview, animating out
         this._shown = false;            // show() and not hide()
         this._shownTemporarily = false; // showTemporarily() and not hideTemporarily()
@@ -195,19 +189,6 @@ const Overview = new Lang.Class({
         this._viewSelector = new ViewSelector.ViewSelector();
         this._group.add_actor(this._viewSelector.actor);
 
-        this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay();
-        this._viewSelector.addViewTab('windows', _("Windows"), this._workspacesDisplay.actor, 'text-x-generic');
-
-        let appView = new AppDisplay.AllAppDisplay();
-        this._viewSelector.addViewTab('applications', _("Applications"), appView.actor, 'system-run');
-
-        // Default search providers
-        // Wanda comes obviously first
-        this.addSearchProvider(new Wanda.WandaSearchProvider());
-        this.addSearchProvider(new AppDisplay.AppSearchProvider());
-        this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
-        this.addSearchProvider(new PlaceDisplay.PlaceSearchProvider());
-
         // Load remote search providers provided by applications
         RemoteSearch.loadRemoteSearchProviders(Lang.bind(this, this.addSearchProvider));
 
@@ -565,6 +546,28 @@ const Overview = new Lang.Class({
             Lang.bind(this, this._onButtonPress));
     },
 
+    fadeInDesktop: function() {
+            this._desktopFade.opacity = 0;
+            this._desktopFade.show();
+            Tweener.addTween(this._desktopFade,
+                             { opacity: 255,
+                               time: ANIMATION_TIME,
+                               transition: 'easeOutQuad' });
+    },
+
+    fadeOutDesktop: function() {
+        if (!this._desktopFade.child)
+            this._desktopFade.child = this._getDesktopClone();
+
+        this._desktopFade.opacity = 255;
+        this._desktopFade.show();
+        Tweener.addTween(this._desktopFade,
+                         { opacity: 0,
+                           time: ANIMATION_TIME,
+                           transition: 'easeOutQuad'
+                         });
+    },
+
     _animateVisible: function() {
         if (this.visible || this.animationInProgress)
             return;
@@ -585,21 +588,7 @@ const Overview = new Lang.Class({
         global.window_group.hide();
         this._group.show();
         this._background.show();
-
-        this._workspacesDisplay.show();
-
-        if (!this._desktopFade.child)
-            this._desktopFade.child = this._getDesktopClone();
-
-        if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
-            this._desktopFade.opacity = 255;
-            this._desktopFade.show();
-            Tweener.addTween(this._desktopFade,
-                             { opacity: 0,
-                               time: ANIMATION_TIME,
-                               transition: 'easeOutQuad'
-                             });
-        }
+        this._viewSelector.show();
 
         this._group.opacity = 0;
         Tweener.addTween(this._group,
@@ -726,16 +715,7 @@ const Overview = new Lang.Class({
         this.animationInProgress = true;
         this._hideInProgress = true;
 
-        if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
-            this._desktopFade.opacity = 0;
-            this._desktopFade.show();
-            Tweener.addTween(this._desktopFade,
-                             { opacity: 255,
-                               time: ANIMATION_TIME,
-                               transition: 'easeOutQuad' });
-        }
-
-        this._workspacesDisplay.zoomFromOverview();
+        this._viewSelector.zoomFromOverview();
 
         // Make other elements fade out.
         Tweener.addTween(this._group,
@@ -777,8 +757,7 @@ const Overview = new Lang.Class({
 
         global.window_group.show();
 
-        this._workspacesDisplay.hide();
-
+        this._viewSelector.hide();
         this._desktopFade.hide();
         this._background.hide();
         this._group.hide();
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 2d11272..6f2aed5 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -9,11 +9,15 @@ const Lang = imports.lang;
 const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 
+const AppDisplay = imports.ui.appDisplay;
 const Main = imports.ui.main;
+const PlaceDisplay = imports.ui.placeDisplay;
 const Search = imports.ui.search;
 const SearchDisplay = imports.ui.searchDisplay;
 const ShellEntry = imports.ui.shellEntry;
 const Tweener = imports.ui.tweener;
+const Wanda = imports.ui.wanda;
+const WorkspacesView = imports.ui.workspacesView;
 
 const BaseTab = new Lang.Class({
     Name: 'BaseTab',
@@ -392,6 +396,21 @@ const ViewSelector = new Lang.Class({
                 this._switchTab(this._activeTab);
             }));
 
+        this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay();
+        this._windowsTab = new ViewTab('windows', _("Windows"), this._workspacesDisplay.actor, 'text-x-generic');
+        this._addViewTab(this._windowsTab);
+
+        let appView = new AppDisplay.AllAppDisplay();
+        this._appsTab = new ViewTab('applications', _("Applications"), appView.actor, 'system-run');
+        this._addViewTab(this._appsTab);
+
+        // Default search providers
+        // Wanda comes obviously first
+        this.addSearchProvider(new Wanda.WandaSearchProvider());
+        this.addSearchProvider(new AppDisplay.AppSearchProvider());
+        this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
+        this.addSearchProvider(new PlaceDisplay.PlaceSearchProvider());
+
         Main.overview.connect('item-drag-begin',
                               Lang.bind(this, this._switchDefaultTab));
 
@@ -425,6 +444,24 @@ const ViewSelector = new Lang.Class({
                                                             coordinate: Clutter.BindCoordinate.HEIGHT });
     },
 
+    show: function() {
+        this._workspacesDisplay.show();
+
+        if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
+            Main.overview.fadeOutDesktop();
+    },
+
+    zoomFromOverview: function() {
+        this._workspacesDisplay.zoomFromOverview();
+
+        if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
+            Main.overview.fadeInDesktop();
+    },
+
+    hide: function() {
+        this._workspacesDisplay.hide();
+    },
+
     _addTab: function(tab) {
         tab.page.hide();
         this._pageArea.add_actor(tab.page);
@@ -433,8 +470,7 @@ const ViewSelector = new Lang.Class({
         }));
     },
 
-    addViewTab: function(id, title, pageActor, a11yIcon) {
-        let viewTab = new ViewTab(id, title, pageActor, a11yIcon);
+    _addViewTab: function(viewTab) {
         this._tabs.push(viewTab);
         this._tabBox.add(viewTab.title);
         this._addTab(viewTab);



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