From a197ce6f539845cca9ddc04a79974bebc3880547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 8 Mar 2012 01:29:17 +0100 Subject: [PATCH] main: Add (hidden) support for static workspaces The dynamic-workspaces key was introduced to allow us to opt out of writing the num-workspaces setting (which is ignored with the dynamic workspace management anyway), but there'll be some expectations that the setting will have an effect on the UI. It's actually not very hard to support, so here's to the graybeards ... https://bugzilla.gnome.org/show_bug.cgi?id=671568 --- js/ui/main.js | 10 ++++++++++ js/ui/workspaceThumbnail.js | 3 +++ 2 files changed, 13 insertions(+) diff --git a/js/ui/main.js b/js/ui/main.js index 11dd81f97..c90df0636 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -38,6 +38,7 @@ const XdndHandler = imports.ui.xdndHandler; const StatusIconDispatcher = imports.ui.statusIconDispatcher; const Util = imports.misc.util; +const OVERRIDES_SCHEMA = 'org.gnome.shell.overrides'; const DEFAULT_BACKGROUND_COLOR = new Clutter.Color(); DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff); @@ -71,6 +72,7 @@ let _startDate; let _defaultCssStylesheet = null; let _cssStylesheet = null; let _gdmCssStylesheet = null; +let _overridesSettings = null; let background = null; @@ -250,6 +252,9 @@ function start() { Scripting.runPerfScript(module, perfOutput); } + _overridesSettings = new Gio.Settings({ schema: OVERRIDES_SCHEMA }); + _overridesSettings.connect('changed::dynamic-workspaces', _queueCheckWorkspaces); + global.screen.connect('notify::n-workspaces', _nWorkspacesChanged); global.screen.connect('window-entered-monitor', _windowEnteredMonitor); @@ -274,6 +279,11 @@ function _checkWorkspaces() { let i; let emptyWorkspaces = []; + if (!Meta.prefs_get_dynamic_workspaces()) { + _checkWorkspacesId = 0; + return false; + } + for (i = 0; i < _workspaces.length; i++) { let lastRemoved = _workspaces[i]._lastRemovedWindow; if (lastRemoved && diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 79eef04b5..7553a4c82 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -610,6 +610,9 @@ const ThumbnailsBox = new Lang.Class({ if (!source.realWindow && !source.shellWorkspaceLaunch) return DND.DragMotionResult.CONTINUE; + if (!Meta.prefs_get_dynamic_workspaces()) + return DND.DragMotionResult.CONTINUE; + let spacing = this.actor.get_theme_node().get_length('spacing'); let thumbHeight = this._porthole.height * this._scale;