Blob Blame History Raw
From 3c62051c0a154ae987bb0126e8adb6cd86aa69a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 24 Feb 2020 16:17:05 +0100
Subject: [PATCH] dashToDock: Handle no-overview case

There is no longer an overview in GNOME Classic, so in order to be
used in that environment, the extension must deal with that case.
---
 extensions/dash-to-dock/docking.js | 122 ++++++++++++++++-------------
 1 file changed, 68 insertions(+), 54 deletions(-)

diff --git a/extensions/dash-to-dock/docking.js b/extensions/dash-to-dock/docking.js
index d35094b..2b8353a 100644
--- a/extensions/dash-to-dock/docking.js
+++ b/extensions/dash-to-dock/docking.js
@@ -233,7 +233,7 @@ var DockedDash = class DashToDock {
         // Create a new dash object
         this.dash = new MyDash.MyDash(this._settings, this._remoteModel, this._monitorIndex);
 
-        if (!this._settings.get_boolean('show-show-apps-button'))
+        if (Main.overview.isDummy || !this._settings.get_boolean('show-show-apps-button'))
             this.dash.hideShowAppsButton();
 
         // Create the main actor and the containers for sliding in and out and
@@ -272,45 +272,11 @@ var DockedDash = class DashToDock {
         this.dash.actor.add_constraint(this.constrainSize);
 
         this._signalsHandler.add([
-            Main.overview,
-            'item-drag-begin',
-            this._onDragStart.bind(this)
-        ], [
-            Main.overview,
-            'item-drag-end',
-            this._onDragEnd.bind(this)
-        ], [
-            Main.overview,
-            'item-drag-cancelled',
-            this._onDragEnd.bind(this)
-        ], [
             // update when workarea changes, for instance if  other extensions modify the struts
             //(like moving th panel at the bottom)
             global.display,
             'workareas-changed',
             this._resetPosition.bind(this)
-        ], [
-            Main.overview,
-            'showing',
-            this._onOverviewShowing.bind(this)
-        ], [
-            Main.overview,
-            'hiding',
-            this._onOverviewHiding.bind(this)
-        ], [
-            // Hide on appview
-            Main.overview.viewSelector,
-            'page-changed',
-            this._pageChanged.bind(this)
-        ], [
-            Main.overview.viewSelector,
-            'page-empty',
-            this._onPageEmpty.bind(this)
-        ], [
-            // Ensure the ShowAppsButton status is kept in sync
-            Main.overview.viewSelector._showAppsButton,
-            'notify::checked',
-            this._syncShowAppsButtonToggled.bind(this)
         ], [
             global.display,
             'in-fullscreen-changed',
@@ -325,15 +291,6 @@ var DockedDash = class DashToDock {
             this.dash,
             'icon-size-changed',
             () => { Main.overview.dashIconSize = this.dash.iconSize; }
-        ], [
-            // This duplicate the similar signal which is in owerview.js.
-            // Being connected and thus executed later this effectively
-            // overwrite any attempt to use the size of the default dash
-            //which given the customization is usually much smaller.
-            // I can't easily disconnect the original signal
-            Main.overview._controls.dash,
-            'icon-size-changed',
-            () => { Main.overview.dashIconSize = this.dash.iconSize; }
         ], [
             // sync hover after a popupmenu is closed
             this.dash,
@@ -341,6 +298,53 @@ var DockedDash = class DashToDock {
             () => { this._box.sync_hover() }
         ]);
 
+        if (!Main.overview.isDummy) {
+            this._signalsHandler.add([
+                Main.overview,
+                'item-drag-begin',
+                this._onDragStart.bind(this)
+            ], [
+                Main.overview,
+                'item-drag-end',
+                this._onDragEnd.bind(this)
+            ], [
+                Main.overview,
+                'item-drag-cancelled',
+                this._onDragEnd.bind(this)
+            ], [
+                Main.overview,
+                'showing',
+                this._onOverviewShowing.bind(this)
+            ], [
+                Main.overview,
+                'hiding',
+                this._onOverviewHiding.bind(this)
+            ], [
+                // Hide on appview
+                Main.overview.viewSelector,
+                'page-changed',
+                this._pageChanged.bind(this)
+            ], [
+                Main.overview.viewSelector,
+                'page-empty',
+                this._onPageEmpty.bind(this)
+            ], [
+                // Ensure the ShowAppsButton status is kept in sync
+                Main.overview.viewSelector._showAppsButton,
+                'notify::checked',
+                this._syncShowAppsButtonToggled.bind(this)
+            ], [
+                // This duplicate the similar signal which is in owerview.js.
+                // Being connected and thus executed later this effectively
+                // overwrite any attempt to use the size of the default dash
+                //which given the customization is usually much smaller.
+                // I can't easily disconnect the original signal
+                Main.overview._controls.dash,
+                'icon-size-changed',
+                () => { Main.overview.dashIconSize = this.dash.iconSize; }
+            ]);
+        }
+
         this._injectionsHandler = new Utils.InjectionsHandler();
         this._themeManager = new Theming.ThemeManager(this._settings, this);
 
@@ -370,14 +374,17 @@ var DockedDash = class DashToDock {
         this._dashSpacer = new OverviewControls.DashSpacer();
         this._dashSpacer.setDashActor(this._box);
 
-        if (this._position == St.Side.LEFT)
-            Main.overview._controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? -1 : 0); // insert on first
-        else if (this._position ==  St.Side.RIGHT)
-            Main.overview._controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? 0 : -1); // insert on last
-        else if (this._position == St.Side.TOP)
-            Main.overview._overview.insert_child_at_index(this._dashSpacer, 0);
-        else if (this._position == St.Side.BOTTOM)
-            Main.overview._overview.insert_child_at_index(this._dashSpacer, -1);
+        if (!Main.overview.isDummy) {
+            const { _controls, _overview } = Main.overview;
+            if (this._position == St.Side.LEFT)
+                _controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? -1 : 0); // insert on first
+            else if (this._position ==  St.Side.RIGHT)
+                _controls._group.insert_child_at_index(this._dashSpacer, this._rtl ? 0 : -1); // insert on last
+            else if (this._position == St.Side.TOP)
+                _overview.insert_child_at_index(this._dashSpacer, 0);
+            else if (this._position == St.Side.BOTTOM)
+                _overview.insert_child_at_index(this._dashSpacer, -1);
+        }
 
         // Add dash container actor and the container to the Chrome.
         this.actor.set_child(this._slider);
@@ -412,7 +419,7 @@ var DockedDash = class DashToDock {
 
         // Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
         //animate a null target since some variables are not initialized when the viewSelector is created
-        if (Main.overview.viewSelector._activePage == null)
+        if (!Main.overview.isDummy && Main.overview.viewSelector._activePage == null)
             Main.overview.viewSelector._activePage = Main.overview.viewSelector._workspacesPage;
 
         this._updateVisibilityMode();
@@ -493,7 +500,8 @@ var DockedDash = class DashToDock {
             this._settings,
             'changed::show-show-apps-button',
             () => {
-                    if (this._settings.get_boolean('show-show-apps-button'))
+                    if (!Main.overview.isDummy &&
+                        this._settings.get_boolean('show-show-apps-button'))
                         this.dash.showShowAppsButton();
                     else
                         this.dash.hideShowAppsButton();
@@ -1681,6 +1689,9 @@ var DockManager = class DashToDock_DockManager {
         // set stored icon size  to the new dash
         Main.overview.dashIconSize = this._allDocks[0].dash.iconSize;
 
+        if (Main.overview.isDummy)
+            return;
+
         // Hide usual Dash
         Main.overview._controls.dash.actor.hide();
 
@@ -1707,6 +1718,9 @@ var DockManager = class DashToDock_DockManager {
     }
 
     _restoreDash() {
+        if (Main.overview.isDummy)
+            return;
+
         Main.overview._controls.dash.actor.show();
         Main.overview._controls.dash.actor.set_width(-1); //reset default dash size
         // This force the recalculation of the icon size
-- 
2.25.0