[gnome-shell/T27795: 98/138] viewsSelector: Create cloned versions of desktop's icon grid



commit b7eed5d24fb2f004145a970a7f1d76eeb9ffdb76
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Jun 14 18:13:30 2017 +0100

    viewsSelector: Create cloned versions of desktop's icon grid
    
    Create two instances of ViewsClone, one for the main layout manager
    and another one for the overview, and set them in both places.
    
    https://phabricator.endlessm.com/T17662

 js/ui/layout.js       |  6 ++++++
 js/ui/overview.js     |  6 ++++++
 js/ui/viewSelector.js | 15 +++++++++++++++
 3 files changed, 27 insertions(+)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index ca5bd8630b..78f8f6a131 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -156,6 +156,7 @@ var LayoutManager = GObject.registerClass({
         global.window_group.add_child(this._backgroundGroup);
         this._backgroundGroup.lower_bottom();
         this._bgManagers = [];
+        this._viewsClone = null;
 
         this._interfaceSettings = new Gio.Settings({
             schema_id: 'org.gnome.desktop.interface'
@@ -346,6 +347,11 @@ var LayoutManager = GObject.registerClass({
         this.emit('hot-corners-changed');
     }
 
+    setViewsClone(actor) {
+        this._viewsClone = actor;
+        this._backgroundGroup.add_child(this._viewsClone);
+    }
+
     _addBackgroundMenu(bgManager) {
         let clickAction = new Clutter.ClickAction();
         bgManager.backgroundActor.add_action(clickAction);
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 9c686f4108..c4f83e39fe 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -199,6 +199,7 @@ var Overview = class {
         this._backgroundGroup = new Meta.BackgroundGroup({ reactive: true });
         Main.layoutManager.overviewGroup.add_child(this._backgroundGroup);
         this._bgManagers = [];
+        this._viewsClone = null;
 
         this._desktopFade = new St.Widget();
         Main.layoutManager.overviewGroup.add_child(this._desktopFade);
@@ -247,6 +248,11 @@ var Overview = class {
             this.init();
     }
 
+    setViewsClone(actor) {
+        this._viewsClone = actor;
+        this._backgroundGroup.add_child(this._viewsClone);
+    }
+
     _updateBackgrounds() {
         for (let i = 0; i < this._bgManagers.length; i++)
             this._bgManagers[i].destroy();
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index adb86c0426..ba019bd47f 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -620,6 +620,9 @@ var ViewSelector = class {
         this._entry = this._viewsDisplay.entry;
 
         this._stageKeyPressId = 0;
+
+        this._addViewsPageClone();
+
         Main.overview.connect('showing', () => {
             this._stageKeyPressId = global.stage.connect('key-press-event',
                                                          this._onStageKeyPress.bind(this));
@@ -689,6 +692,18 @@ var ViewSelector = class {
             Main.overview.show();
     }
 
+    _addViewsPageClone() {
+        let layoutViewsClone = new ViewsClone(this, this._viewsDisplay, false);
+        Main.layoutManager.setViewsClone(layoutViewsClone);
+
+        let overviewViewsClone = new ViewsClone(this, this._viewsDisplay, true);
+        Main.overview.setViewsClone(overviewViewsClone);
+        this._appsPage.bind_property('visible',
+                                     overviewViewsClone, 'visible',
+                                     GObject.BindingFlags.SYNC_CREATE |
+                                     GObject.BindingFlags.INVERT_BOOLEAN);
+    }
+
     _onEmptySpaceClicked() {
         this.setActivePage(ViewPage.APPS);
     }


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