Blame SOURCES/0001-dashToDock-Handle-no-overview-case.patch

daa7ed
From 734ae4107b71a21f7d85ffb820e3d3542af48617 Mon Sep 17 00:00:00 2001
daa7ed
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
daa7ed
Date: Mon, 24 Feb 2020 16:17:05 +0100
daa7ed
Subject: [PATCH] dashToDock: Handle no-overview case
daa7ed
daa7ed
There is no longer an overview in GNOME Classic, so in order to be
daa7ed
used in that environment, the extension must deal with that case.
daa7ed
---
daa7ed
 extensions/dash-to-dock/docking.js | 126 ++++++++++++++++-------------
daa7ed
 1 file changed, 70 insertions(+), 56 deletions(-)
daa7ed
daa7ed
diff --git a/extensions/dash-to-dock/docking.js b/extensions/dash-to-dock/docking.js
daa7ed
index 11810a1..0763cb1 100644
daa7ed
--- a/extensions/dash-to-dock/docking.js
daa7ed
+++ b/extensions/dash-to-dock/docking.js
daa7ed
@@ -244,7 +244,7 @@ const DockedDash = new Lang.Class({
daa7ed
         // Create a new dash object
daa7ed
         this.dash = new MyDash.MyDash(this._settings, this._remoteModel, this._monitorIndex);
daa7ed
 
daa7ed
-        if (!this._settings.get_boolean('show-show-apps-button'))
daa7ed
+        if (Main.overview.isDummy || !this._settings.get_boolean('show-show-apps-button'))
daa7ed
             this.dash.hideShowAppsButton();
daa7ed
 
daa7ed
         // Create the main actor and the containers for sliding in and out and
daa7ed
@@ -283,45 +283,11 @@ const DockedDash = new Lang.Class({
daa7ed
         this.dash.actor.add_constraint(this.constrainSize);
daa7ed
 
daa7ed
         this._signalsHandler.add([
daa7ed
-            Main.overview,
daa7ed
-            'item-drag-begin',
daa7ed
-            Lang.bind(this, this._onDragStart)
daa7ed
-        ], [
daa7ed
-            Main.overview,
daa7ed
-            'item-drag-end',
daa7ed
-            Lang.bind(this, this._onDragEnd)
daa7ed
-        ], [
daa7ed
-            Main.overview,
daa7ed
-            'item-drag-cancelled',
daa7ed
-            Lang.bind(this, this._onDragEnd)
daa7ed
-        ], [
daa7ed
             // update when workarea changes, for instance if  other extensions modify the struts
daa7ed
             //(like moving th panel at the bottom)
daa7ed
             global.screen,
daa7ed
             'workareas-changed',
daa7ed
             Lang.bind(this, this._resetPosition)
daa7ed
-        ], [
daa7ed
-            Main.overview,
daa7ed
-            'showing',
daa7ed
-            Lang.bind(this, this._onOverviewShowing)
daa7ed
-        ], [
daa7ed
-            Main.overview,
daa7ed
-            'hiding',
daa7ed
-            Lang.bind(this, this._onOverviewHiding)
daa7ed
-        ], [
daa7ed
-            // Hide on appview
daa7ed
-            Main.overview.viewSelector,
daa7ed
-            'page-changed',
daa7ed
-            Lang.bind(this, this._pageChanged)
daa7ed
-        ], [
daa7ed
-            Main.overview.viewSelector,
daa7ed
-            'page-empty',
daa7ed
-            Lang.bind(this, this._onPageEmpty)
daa7ed
-        ], [
daa7ed
-            // Ensure the ShowAppsButton status is kept in sync
daa7ed
-            Main.overview.viewSelector._showAppsButton,
daa7ed
-            'notify::checked',
daa7ed
-            Lang.bind(this, this._syncShowAppsButtonToggled)
daa7ed
         ], [
daa7ed
             global.screen,
daa7ed
             'in-fullscreen-changed',
daa7ed
@@ -338,19 +304,57 @@ const DockedDash = new Lang.Class({
daa7ed
             Lang.bind(this, function() {
daa7ed
                 Main.overview.dashIconSize = this.dash.iconSize;
daa7ed
             })
daa7ed
-        ], [
daa7ed
-            // This duplicate the similar signal which is in owerview.js.
daa7ed
-            // Being connected and thus executed later this effectively
daa7ed
-            // overwrite any attempt to use the size of the default dash
daa7ed
-            //which given the customization is usually much smaller.
daa7ed
-            // I can't easily disconnect the original signal
daa7ed
-            Main.overview._controls.dash,
daa7ed
-            'icon-size-changed',
daa7ed
-            Lang.bind(this, function() {
daa7ed
-                Main.overview.dashIconSize = this.dash.iconSize;
daa7ed
-            })
daa7ed
         ]);
daa7ed
 
daa7ed
+        if (!Main.overview.isDummy) {
daa7ed
+            this._signalsHandler.add([
daa7ed
+                Main.overview,
daa7ed
+                'item-drag-begin',
daa7ed
+                Lang.bind(this, this._onDragStart)
daa7ed
+            ], [
daa7ed
+                Main.overview,
daa7ed
+                'item-drag-end',
daa7ed
+                Lang.bind(this, this._onDragEnd)
daa7ed
+            ], [
daa7ed
+                Main.overview,
daa7ed
+                'item-drag-cancelled',
daa7ed
+                Lang.bind(this, this._onDragEnd)
daa7ed
+            ], [
daa7ed
+                Main.overview,
daa7ed
+                'showing',
daa7ed
+                Lang.bind(this, this._onOverviewShowing)
daa7ed
+            ], [
daa7ed
+                Main.overview,
daa7ed
+                'hiding',
daa7ed
+                Lang.bind(this, this._onOverviewHiding)
daa7ed
+            ], [
daa7ed
+                // Hide on appview
daa7ed
+                Main.overview.viewSelector,
daa7ed
+                'page-changed',
daa7ed
+                Lang.bind(this, this._pageChanged)
daa7ed
+            ], [
daa7ed
+                Main.overview.viewSelector,
daa7ed
+                'page-empty',
daa7ed
+                Lang.bind(this, this._onPageEmpty)
daa7ed
+            ], [
daa7ed
+                // Ensure the ShowAppsButton status is kept in sync
daa7ed
+                Main.overview.viewSelector._showAppsButton,
daa7ed
+                'notify::checked',
daa7ed
+                Lang.bind(this, this._syncShowAppsButtonToggled)
daa7ed
+            ], [
daa7ed
+                // This duplicate the similar signal which is in owerview.js.
daa7ed
+                // Being connected and thus executed later this effectively
daa7ed
+                // overwrite any attempt to use the size of the default dash
daa7ed
+                //which given the customization is usually much smaller.
daa7ed
+                // I can't easily disconnect the original signal
daa7ed
+                Main.overview._controls.dash,
daa7ed
+                'icon-size-changed',
daa7ed
+                Lang.bind(this, function() {
daa7ed
+                    Main.overview.dashIconSize = this.dash.iconSize;
daa7ed
+                })
daa7ed
+            ]);
daa7ed
+        }
daa7ed
+
daa7ed
         this._injectionsHandler = new Utils.InjectionsHandler();
daa7ed
         this._themeManager = new Theming.ThemeManager(this._settings, this);
daa7ed
 
daa7ed
@@ -385,14 +389,17 @@ const DockedDash = new Lang.Class({
daa7ed
         this._dashSpacer = new OverviewControls.DashSpacer();
daa7ed
         this._dashSpacer.setDashActor(this._box);
daa7ed
 
daa7ed
-        if (this._position == St.Side.LEFT)
daa7ed
-            Main.overview._controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? -1 : 0); // insert on first
daa7ed
-        else if (this._position ==  St.Side.RIGHT)
daa7ed
-            Main.overview._controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? 0 : -1); // insert on last
daa7ed
-        else if (this._position == St.Side.TOP)
daa7ed
-            Main.overview._overview.insert_child_at_index(this._dashSpacer, 0);
daa7ed
-        else if (this._position == St.Side.BOTTOM)
daa7ed
-            Main.overview._overview.insert_child_at_index(this._dashSpacer, -1);
daa7ed
+        if (!Main.overview.isDummy) {
daa7ed
+            const { _controls, _overview } = Main.overview;
daa7ed
+            if (this._position == St.Side.LEFT)
daa7ed
+                _controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? -1 : 0); // insert on first
daa7ed
+            else if (this._position ==  St.Side.RIGHT)
daa7ed
+                _controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? 0 : -1); // insert on last
daa7ed
+            else if (this._position == St.Side.TOP)
daa7ed
+                _overview.insert_child_at_index(this._dashSpacer, 0);
daa7ed
+            else if (this._position == St.Side.BOTTOM)
daa7ed
+                _overview.insert_child_at_index(this._dashSpacer, -1);
daa7ed
+        }
daa7ed
 
daa7ed
         // Add dash container actor and the container to the Chrome.
daa7ed
         this.actor.set_child(this._slider.actor);
daa7ed
@@ -427,7 +434,7 @@ const DockedDash = new Lang.Class({
daa7ed
 
daa7ed
         // Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
daa7ed
         //animate a null target since some variables are not initialized when the viewSelector is created
daa7ed
-        if (Main.overview.viewSelector._activePage == null)
daa7ed
+        if (!Main.overview.isDummy && Main.overview.viewSelector._activePage == null)
daa7ed
             Main.overview.viewSelector._activePage = Main.overview.viewSelector._workspacesPage;
daa7ed
 
daa7ed
         this._updateVisibilityMode();
daa7ed
@@ -523,7 +530,8 @@ const DockedDash = new Lang.Class({
daa7ed
             this._settings,
daa7ed
             'changed::show-show-apps-button',
daa7ed
             Lang.bind(this, function() {
daa7ed
-                    if (this._settings.get_boolean('show-show-apps-button'))
daa7ed
+                    if (!Main.overview.isDummy &&
daa7ed
+                        this._settings.get_boolean('show-show-apps-button'))
daa7ed
                         this.dash.showShowAppsButton();
daa7ed
                     else
daa7ed
                         this.dash.hideShowAppsButton();
daa7ed
@@ -1753,6 +1761,9 @@ var DockManager = new Lang.Class({
daa7ed
         // set stored icon size  to the new dash
daa7ed
         Main.overview.dashIconSize = this._allDocks[0].dash.iconSize;
daa7ed
 
daa7ed
+        if (Main.overview.isDummy)
daa7ed
+            return;
daa7ed
+
daa7ed
         // Hide usual Dash
daa7ed
         Main.overview._controls.dash.actor.hide();
daa7ed
 
daa7ed
@@ -1779,6 +1790,9 @@ var DockManager = new Lang.Class({
daa7ed
     },
daa7ed
 
daa7ed
     _restoreDash: function() {
daa7ed
+        if (Main.overview.isDummy)
daa7ed
+            return;
daa7ed
+
daa7ed
         Main.overview._controls.dash.actor.show();
daa7ed
         Main.overview._controls.dash.actor.set_width(-1); //reset default dash size
daa7ed
         // This force the recalculation of the icon size
daa7ed
-- 
daa7ed
2.25.0
daa7ed