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>
This commit is contained in:
parent
cf29ec2f22
commit
b3c7a855c6
@ -5,6 +5,7 @@ const { Clutter, Gio, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
|
|||||||
|
|
||||||
const DND = imports.ui.dnd;
|
const DND = imports.ui.dnd;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
const { TransientSignalHolder } = imports.misc.signalTracker;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
const Workspace = imports.ui.workspace;
|
const Workspace = imports.ui.workspace;
|
||||||
|
|
||||||
@ -949,6 +950,7 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const { workspaceManager } = global;
|
const { workspaceManager } = global;
|
||||||
|
this._transientSignalHolder = new TransientSignalHolder(this);
|
||||||
workspaceManager.connectObject(
|
workspaceManager.connectObject(
|
||||||
'notify::n-workspaces', this._workspacesChanged.bind(this),
|
'notify::n-workspaces', this._workspacesChanged.bind(this),
|
||||||
'active-workspace-changed', () => this._updateIndicator(),
|
'active-workspace-changed', () => this._updateIndicator(),
|
||||||
@ -957,9 +959,9 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
return a.metaWorkspace.index() - b.metaWorkspace.index();
|
return a.metaWorkspace.index() - b.metaWorkspace.index();
|
||||||
});
|
});
|
||||||
this.queue_relayout();
|
this.queue_relayout();
|
||||||
}, this);
|
}, this._transientSignalHolder);
|
||||||
Main.overview.connectObject('windows-restacked',
|
Main.overview.connectObject('windows-restacked',
|
||||||
this._syncStacking.bind(this), this);
|
this._syncStacking.bind(this), this._transientSignalHolder);
|
||||||
|
|
||||||
this._targetScale = 0;
|
this._targetScale = 0;
|
||||||
this._scale = 0;
|
this._scale = 0;
|
||||||
@ -979,8 +981,8 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
if (this._thumbnails.length == 0)
|
if (this._thumbnails.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
global.workspace_manager.disconnectObject(this);
|
this._transientSignalHolder.destroy();
|
||||||
Main.overview.disconnectObject(this);
|
delete this._transientSignalHolder;
|
||||||
|
|
||||||
for (let w = 0; w < this._thumbnails.length; w++)
|
for (let w = 0; w < this._thumbnails.length; w++)
|
||||||
this._thumbnails[w].destroy();
|
this._thumbnails[w].destroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user