Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 3a06116

Browse files
committed
Disconnect all signals in indicator
Upstream doesn't do this but it should be needed for cleanup.
1 parent 9acdb73 commit 3a06116

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

shell-volume-mixer@derhofbauer.at/lib/menu/indicator.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ const { GObject, Clutter } = imports.gi;
1313
const PanelMenu = imports.ui.panelMenu;
1414
const Volume = imports.ui.status.volume;
1515

16+
const { EventHandlerDelegate } = Lib.utils.eventHandlerDelegate;
1617
const { Menu } = Lib.menu.menu;
1718
const { PercentageLabel } = Lib.widget.percentageLabel;
19+
const Utils = Lib.utils.utils;
20+
1821

1922
const VolumeType = {
2023
OUTPUT: 0,
@@ -45,9 +48,9 @@ var Indicator = GObject.registerClass(class Indicator extends PanelMenu.SystemIn
4548
this.add_actor(this._percentageLabel);
4649

4750
this._percentageLabel.reactive = true;
48-
this._percentageLabel.connect('scroll-event',
51+
this.connect(this._percentageLabel, 'scroll-event',
4952
(actor, event) => this._handleScrollEvent(VolumeType.OUTPUT, event));
50-
this._percentageLabel.connect('button-press-event',
53+
this.connect(this._percentageLabel, 'button-press-event',
5154
(actor, event) => this._handleButtonPress(VolumeType.OUTPUT, event));
5255
}
5356

@@ -56,27 +59,27 @@ var Indicator = GObject.registerClass(class Indicator extends PanelMenu.SystemIn
5659
this._primaryIndicator.reactive = true;
5760
this._inputIndicator.reactive = true;
5861

59-
this._primaryIndicator.connect('scroll-event',
62+
this.connect(this._primaryIndicator, 'scroll-event',
6063
(actor, event) => this._handleScrollEvent(VolumeType.OUTPUT, event));
61-
this._inputIndicator.connect('scroll-event',
64+
this.connect(this._inputIndicator, 'scroll-event',
6265
(actor, event) => this._handleScrollEvent(VolumeType.INPUT, event));
6366

64-
this._primaryIndicator.connect('button-press-event',
67+
this.connect(this._primaryIndicator, 'button-press-event',
6568
(actor, event) => this._handleButtonPress(VolumeType.OUTPUT, event));
66-
this._inputIndicator.connect('button-press-event',
69+
this.connect(this._inputIndicator, 'button-press-event',
6770
(actor, event) => this._handleButtonPress(VolumeType.INPUT, event));
6871

6972
this._control = mixer.control;
7073
this._volumeMenu = new Menu(mixer, options);
7174
this._volumeMenu.actor.add_style_class_name(options.menuClass);
7275

73-
this._volumeMenu.connect('output-icon-changed', this.updateOutputIcon.bind(this));
76+
this.connect(this._volumeMenu, 'output-icon-changed', this.updateOutputIcon.bind(this));
7477

7578
this._inputIndicator.visible = this._volumeMenu.getInputVisible();
76-
this._volumeMenu.connect('input-visible-changed', () => {
79+
this.connect(this._volumeMenu, 'input-visible-changed', () => {
7780
this._inputIndicator.visible = this._volumeMenu.getInputVisible();
7881
});
79-
this._volumeMenu.connect('input-icon-changed', this.updateInputIcon.bind(this));
82+
this.connect(this._volumeMenu, 'input-icon-changed', this.updateInputIcon.bind(this));
8083
// initial call to get an icon (especially for "show-always" setups)
8184
this.updateInputIcon();
8285

@@ -121,6 +124,8 @@ var Indicator = GObject.registerClass(class Indicator extends PanelMenu.SystemIn
121124
}
122125

123126
destroy() {
127+
this.disconnectAll();
128+
124129
if (this.menu) {
125130
this.menu.destroy();
126131
this.menu = null;
@@ -132,3 +137,5 @@ var Indicator = GObject.registerClass(class Indicator extends PanelMenu.SystemIn
132137
}
133138
}
134139
});
140+
141+
Utils.mixin(Indicator, EventHandlerDelegate);

shell-volume-mixer@derhofbauer.at/locale/translations.pot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ msgstr ""
1010
msgid "Querying PulseAudio sound cards failed, disabling extension"
1111
msgstr ""
1212

13-
#: shell-volume-mixer@derhofbauer.at/lib/widget/volume.js:314
14-
#: shell-volume-mixer@derhofbauer.at/lib/widget/volume.js:316
13+
#: shell-volume-mixer@derhofbauer.at/lib/widget/volume.js:323
14+
#: shell-volume-mixer@derhofbauer.at/lib/widget/volume.js:325
1515
msgid "Inputs"
1616
msgstr ""
1717

18-
#: shell-volume-mixer@derhofbauer.at/lib/widget/volume.js:532
18+
#: shell-volume-mixer@derhofbauer.at/lib/widget/volume.js:541
1919
msgid "unknown"
2020
msgstr ""
2121

0 commit comments

Comments
 (0)