From 734ae4107b71a21f7d85ffb820e3d3542af48617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= 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 | 126 ++++++++++++++++------------- 1 file changed, 70 insertions(+), 56 deletions(-) diff --git a/extensions/dash-to-dock/docking.js b/extensions/dash-to-dock/docking.js index 11810a1..0763cb1 100644 --- a/extensions/dash-to-dock/docking.js +++ b/extensions/dash-to-dock/docking.js @@ -244,7 +244,7 @@ const DockedDash = new Lang.Class({ // 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 @@ -283,45 +283,11 @@ const DockedDash = new Lang.Class({ this.dash.actor.add_constraint(this.constrainSize); this._signalsHandler.add([ - Main.overview, - 'item-drag-begin', - Lang.bind(this, this._onDragStart) - ], [ - Main.overview, - 'item-drag-end', - Lang.bind(this, this._onDragEnd) - ], [ - Main.overview, - 'item-drag-cancelled', - Lang.bind(this, this._onDragEnd) - ], [ // update when workarea changes, for instance if other extensions modify the struts //(like moving th panel at the bottom) global.screen, 'workareas-changed', Lang.bind(this, this._resetPosition) - ], [ - Main.overview, - 'showing', - Lang.bind(this, this._onOverviewShowing) - ], [ - Main.overview, - 'hiding', - Lang.bind(this, this._onOverviewHiding) - ], [ - // Hide on appview - Main.overview.viewSelector, - 'page-changed', - Lang.bind(this, this._pageChanged) - ], [ - Main.overview.viewSelector, - 'page-empty', - Lang.bind(this, this._onPageEmpty) - ], [ - // Ensure the ShowAppsButton status is kept in sync - Main.overview.viewSelector._showAppsButton, - 'notify::checked', - Lang.bind(this, this._syncShowAppsButtonToggled) ], [ global.screen, 'in-fullscreen-changed', @@ -338,19 +304,57 @@ const DockedDash = new Lang.Class({ Lang.bind(this, function() { 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', - Lang.bind(this, function() { - Main.overview.dashIconSize = this.dash.iconSize; - }) ]); + if (!Main.overview.isDummy) { + this._signalsHandler.add([ + Main.overview, + 'item-drag-begin', + Lang.bind(this, this._onDragStart) + ], [ + Main.overview, + 'item-drag-end', + Lang.bind(this, this._onDragEnd) + ], [ + Main.overview, + 'item-drag-cancelled', + Lang.bind(this, this._onDragEnd) + ], [ + Main.overview, + 'showing', + Lang.bind(this, this._onOverviewShowing) + ], [ + Main.overview, + 'hiding', + Lang.bind(this, this._onOverviewHiding) + ], [ + // Hide on appview + Main.overview.viewSelector, + 'page-changed', + Lang.bind(this, this._pageChanged) + ], [ + Main.overview.viewSelector, + 'page-empty', + Lang.bind(this, this._onPageEmpty) + ], [ + // Ensure the ShowAppsButton status is kept in sync + Main.overview.viewSelector._showAppsButton, + 'notify::checked', + Lang.bind(this, this._syncShowAppsButtonToggled) + ], [ + // 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', + Lang.bind(this, function() { + Main.overview.dashIconSize = this.dash.iconSize; + }) + ]); + } + this._injectionsHandler = new Utils.InjectionsHandler(); this._themeManager = new Theming.ThemeManager(this._settings, this); @@ -385,14 +389,17 @@ const DockedDash = new Lang.Class({ 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.actor); @@ -427,7 +434,7 @@ const DockedDash = new Lang.Class({ // 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(); @@ -523,7 +530,8 @@ const DockedDash = new Lang.Class({ this._settings, 'changed::show-show-apps-button', Lang.bind(this, function() { - 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(); @@ -1753,6 +1761,9 @@ var DockManager = new Lang.Class({ // 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(); @@ -1779,6 +1790,9 @@ var DockManager = new Lang.Class({ }, _restoreDash: function() { + 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