[gnome-shell/T29763: 81/249] viewsSelector: Create cloned versions of desktop's icon grid



commit fc8a0df2058a6bd7be438de786314c38761ba58d
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 2eb31d3ddd..b37d854bec 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -285,6 +285,7 @@ var LayoutManager = GObject.registerClass({
         global.window_group.add_child(this._backgroundGroup);
         global.window_group.set_child_below_sibling(this._backgroundGroup, null);
         this._bgManagers = [];
+        this._viewsClone = null;
 
         this._interfaceSettings = new Gio.Settings({
             schema_id: 'org.gnome.desktop.interface',
@@ -476,6 +477,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 d493197601..ee3b4ce49c 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -230,6 +230,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);
@@ -275,6 +276,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 383d549cfd..c73424e509 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -581,6 +581,9 @@ var ViewSelector = GObject.registerClass({
         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));
@@ -650,6 +653,18 @@ var ViewSelector = GObject.registerClass({
             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]