[gnome-shell] workspaceThumbnail: Use transient object for connecting some signals
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspaceThumbnail: Use transient object for connecting some signals
- Date: Sat, 5 Mar 2022 10:29:23 +0000 (UTC)
commit b3c7a855c65d6046789947ee4cfc0c649b399d75
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Mar 4 22:52:29 2022 +0100
workspaceThumbnail: Use transient object for connecting some signals
We want to connect and disconnect a bunch of signals when showing/hiding
the worskpace thumbnails. To make this easy, use a transient object that
we tie to these signal handlers.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2220>
js/ui/workspaceThumbnail.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index cb8a191882..af94a9d062 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -5,6 +5,7 @@ const { Clutter, Gio, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
const DND = imports.ui.dnd;
const Main = imports.ui.main;
+const { TransientSignalHolder } = imports.misc.signalTracker;
const Util = imports.misc.util;
const Workspace = imports.ui.workspace;
@@ -949,6 +950,7 @@ var ThumbnailsBox = GObject.registerClass({
return;
const { workspaceManager } = global;
+ this._transientSignalHolder = new TransientSignalHolder(this);
workspaceManager.connectObject(
'notify::n-workspaces', this._workspacesChanged.bind(this),
'active-workspace-changed', () => this._updateIndicator(),
@@ -957,9 +959,9 @@ var ThumbnailsBox = GObject.registerClass({
return a.metaWorkspace.index() - b.metaWorkspace.index();
});
this.queue_relayout();
- }, this);
+ }, this._transientSignalHolder);
Main.overview.connectObject('windows-restacked',
- this._syncStacking.bind(this), this);
+ this._syncStacking.bind(this), this._transientSignalHolder);
this._targetScale = 0;
this._scale = 0;
@@ -979,8 +981,8 @@ var ThumbnailsBox = GObject.registerClass({
if (this._thumbnails.length == 0)
return;
- global.workspace_manager.disconnectObject(this);
- Main.overview.disconnectObject(this);
+ this._transientSignalHolder.destroy();
+ delete this._transientSignalHolder;
for (let w = 0; w < this._thumbnails.length; w++)
this._thumbnails[w].destroy();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]