@@ -13,8 +13,11 @@ const { GObject, Clutter } = imports.gi;
1313const PanelMenu = imports . ui . panelMenu ;
1414const Volume = imports . ui . status . volume ;
1515
16+ const { EventHandlerDelegate } = Lib . utils . eventHandlerDelegate ;
1617const { Menu } = Lib . menu . menu ;
1718const { PercentageLabel } = Lib . widget . percentageLabel ;
19+ const Utils = Lib . utils . utils ;
20+
1821
1922const 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 ) ;
0 commit comments