@@ -18,7 +18,6 @@ const Clutter = imports.gi.Clutter;
18
18
const GLib = imports . gi . GLib ;
19
19
const Lang = imports . lang ;
20
20
const Main = imports . ui . main ;
21
- const Mainloop = imports . mainloop ;
22
21
const Meta = imports . gi . Meta
23
22
const Settings = imports . ui . settings ;
24
23
const St = imports . gi . St ;
@@ -34,6 +33,19 @@ const TimelineSwitcher = imports.ui.appSwitcher.timelineSwitcher;
34
33
const ClassicSwitcher = imports . ui . appSwitcher . classicSwitcher ;
35
34
const AppSwitcher = imports . ui . appSwitcher . appSwitcher ;
36
35
36
+ const {
37
+ _sourceIds,
38
+ timeout_add_seconds,
39
+ timeout_add,
40
+ setTimeout,
41
+ clearTimeout,
42
+ setInterval,
43
+ clearInterval,
44
+ source_exists,
45
+ source_remove,
46
+ remove_all_sources
47
+ } = require ( "./mainloopTools" ) ;
48
+
37
49
38
50
let newSmartPanelExt = null ;
39
51
@@ -99,6 +111,7 @@ SmartPanelExt.prototype = {
99
111
100
112
disable : function ( ) {
101
113
this . is_disabled = true ;
114
+ remove_all_sources ( ) ;
102
115
// FIXME: These lines make Cinnamon unstable!
103
116
//~ if (this.sr != null) this._panel.disconnect(this.sr);
104
117
//~ if (this.en != null) this._panel.disconnect(this.en);
@@ -110,11 +123,16 @@ SmartPanelExt.prototype = {
110
123
enable : function ( ) {
111
124
this . _panel . reactive = true ;
112
125
this . is_disabled = false ;
113
- this . sr = this . _panel . connect ( 'scroll-event' , Lang . bind ( this , this . _onScroll ) ) ;
114
- this . en = this . _panel . connect ( 'enter-event' , Lang . bind ( this , this . _onEntered ) ) ;
115
- this . lv = this . _panel . connect ( 'leave-event' , Lang . bind ( this , this . _onLeave ) ) ;
116
- this . bp = this . _panel . connect ( 'button-press-event' , Lang . bind ( this , this . _onButtonPress ) ) ;
117
- this . br = this . _panel . connect ( 'button-release-event' , Lang . bind ( this , this . _onButtonRelease ) ) ;
126
+ //~ this.sr = this._panel.connect('scroll-event' , Lang.bind(this, this._onScroll));
127
+ //~ this.en = this._panel.connect('enter-event' , Lang.bind(this, this._onEntered));
128
+ //~ this.lv = this._panel.connect('leave-event' , Lang.bind(this, this._onLeave));
129
+ //~ this.bp = this._panel.connect('button-press-event' , Lang.bind(this, this._onButtonPress));
130
+ //~ this.br = this._panel.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
131
+ this . sr = this . _panel . connect ( 'scroll-event' , ( actor , event ) => { this . _onScroll ( actor , event ) } ) ;
132
+ this . en = this . _panel . connect ( 'enter-event' , ( actor , event ) => { this . _onEntered ( actor , event ) } ) ;
133
+ this . lv = this . _panel . connect ( 'leave-event' , ( actor , event ) => { this . _onLeave ( actor , event ) } ) ;
134
+ this . bp = this . _panel . connect ( 'button-press-event' , ( actor , event ) => { this . _onButtonPress ( actor , event ) } ) ;
135
+ this . br = this . _panel . connect ( 'button-release-event' , ( actor , event ) => { this . _onButtonRelease ( actor , event ) } ) ;
118
136
} ,
119
137
120
138
_onEntered : function ( actor , event ) {
@@ -146,7 +164,7 @@ SmartPanelExt.prototype = {
146
164
}
147
165
else {
148
166
this . dblb = true ;
149
- Mainloop . timeout_add ( this . dblb_T , Lang . bind ( this , function ( ) { this . dblb = false ; } ) ) ;
167
+ timeout_add ( this . dblb_T , ( ) => { this . dblb = false ; } ) ;
150
168
}
151
169
}
152
170
else if ( button == 2 ) {
@@ -361,13 +379,15 @@ SmartPanelExt.prototype = {
361
379
if ( ! this . _switcherIsRuning ) new myCoverflowSwitcher ( this ) ;
362
380
this . _switcherIsRuning = true ;
363
381
let delay = global . settings . get_int ( "alttab-switcher-delay" ) ;
364
- Mainloop . timeout_add ( delay , Lang . bind ( this , function ( ) { this . _switcherIsRuning = false ; } ) ) ;
382
+ //~ timeout_add(delay, Lang.bind(this, function(){ this._switcherIsRuning = false; }));
383
+ timeout_add ( delay , ( ) => { this . _switcherIsRuning = false ; } ) ;
365
384
}
366
385
else if ( style == 'timeline' ) {
367
386
if ( ! this . _switcherIsRuning ) new myTimelineSwitcher ( this ) ;
368
387
this . _switcherIsRuning = true ;
369
388
let delay = global . settings . get_int ( "alttab-switcher-delay" ) ;
370
- Mainloop . timeout_add ( delay , Lang . bind ( this , function ( ) { this . _switcherIsRuning = false ; } ) ) ;
389
+ //~ timeout_add(delay, Lang.bind(this, function(){ this._switcherIsRuning = false; }));
390
+ timeout_add ( delay , ( ) => { this . _switcherIsRuning = false ; } ) ;
371
391
}
372
392
else {
373
393
new myClassicSwitcher ( this ) ;
@@ -519,9 +539,12 @@ myClassicSwitcher.prototype = {
519
539
520
540
this . _updateList ( 0 ) ;
521
541
522
- this . actor . connect ( 'get-preferred-width' , Lang . bind ( this , this . _getPreferredWidth ) ) ;
523
- this . actor . connect ( 'get-preferred-height' , Lang . bind ( this , this . _getPreferredHeight ) ) ;
524
- this . actor . connect ( 'allocate' , Lang . bind ( this , this . _allocate ) ) ;
542
+ //~ this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
543
+ //~ this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
544
+ //~ this.actor.connect('allocate', Lang.bind(this, this._allocate));
545
+ this . actor . connect ( 'get-preferred-width' , ( ) => { this . _getPreferredWidth ( ) } ) ;
546
+ this . actor . connect ( 'get-preferred-height' , ( ) => { this . _getPreferredHeight ( ) } ) ;
547
+ this . actor . connect ( 'allocate' , ( ) => { this . _allocate ( ) } ) ;
525
548
526
549
// Need to force an allocation so we can figure out whether we
527
550
// need to scroll when selecting
@@ -537,12 +560,16 @@ myClassicSwitcher.prototype = {
537
560
else {
538
561
this . _disableHover ( ) ;
539
562
540
- this . actor . connect ( 'key-press-event' , Lang . bind ( this , this . _keyPressEvent ) ) ;
541
- this . actor . connect ( 'key-release-event' , Lang . bind ( this , this . _keyReleaseEvent ) ) ;
542
- this . actor . connect ( 'scroll-event' , Lang . bind ( this , this . _scrollEvent ) ) ;
543
- this . actor . connect ( 'button-press-event' , Lang . bind ( this , this . owndestroy ) ) ;
563
+ //~ this.actor.connect('key-press-event', Lang.bind(this, this._keyPressEvent));
564
+ //~ this.actor.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent));
565
+ //~ this.actor.connect('scroll-event', Lang.bind(this, this._scrollEvent));
566
+ //~ this.actor.connect('button-press-event', Lang.bind(this, this.owndestroy));
567
+ this . actor . connect ( 'key-press-event' , ( ) => { this . _keyPressEvent ( ) } ) ;
568
+ this . actor . connect ( 'key-release-event' , ( ) => { this . _keyReleaseEvent ( ) } ) ;
569
+ this . actor . connect ( 'scroll-event' , ( ) => { this . _scrollEvent ( ) } ) ;
570
+ this . actor . connect ( 'button-press-event' , ( ) => { this . owndestroy ( ) } ) ;
544
571
let delay = global . settings . get_int ( "alttab-switcher-delay" ) ;
545
- this . _initialDelayTimeoutId = Mainloop . timeout_add ( delay , Lang . bind ( this , this . _show ) ) ;
572
+ this . _initialDelayTimeoutId = timeout_add ( delay , ( ) => { this . _show ( ) } ) ;
546
573
this . _currentIndex -- ;
547
574
}
548
575
return this . _haveModal ;
@@ -580,12 +607,16 @@ myTimelineSwitcher.prototype = {
580
607
else {
581
608
this . _disableHover ( ) ;
582
609
583
- this . actor . connect ( 'key-press-event' , Lang . bind ( this , this . _keyPressEvent ) ) ;
584
- this . actor . connect ( 'key-release-event' , Lang . bind ( this , this . _keyReleaseEvent ) ) ;
585
- this . actor . connect ( 'scroll-event' , Lang . bind ( this , this . _scrollEvent ) ) ;
586
- this . actor . connect ( 'button-press-event' , Lang . bind ( this , this . owndestroy ) ) ;
610
+ //~ this.actor.connect('key-press-event', Lang.bind(this, this._keyPressEvent));
611
+ //~ this.actor.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent));
612
+ //~ this.actor.connect('scroll-event', Lang.bind(this, this._scrollEvent));
613
+ //~ this.actor.connect('button-press-event', Lang.bind(this, this.owndestroy));
614
+ this . actor . connect ( 'key-press-event' , ( ) => { this . _keyPressEvent ( ) } ) ;
615
+ this . actor . connect ( 'key-release-event' , ( ) => { this . _keyReleaseEvent ( ) } ) ;
616
+ this . actor . connect ( 'scroll-event' , ( ) => { this . _scrollEvent ( ) } ) ;
617
+ this . actor . connect ( 'button-press-event' , ( ) => { this . owndestroy ( ) } ) ;
587
618
let delay = global . settings . get_int ( "alttab-switcher-delay" ) ;
588
- this . _initialDelayTimeoutId = Mainloop . timeout_add ( delay , Lang . bind ( this , this . _show ) ) ;
619
+ this . _initialDelayTimeoutId = timeout_add ( delay , ( ) => { this . _show ( ) } ) ;
589
620
this . _currentIndex -- ;
590
621
}
591
622
return this . _haveModal ;
@@ -624,12 +655,16 @@ myCoverflowSwitcher.prototype = {
624
655
else {
625
656
this . _disableHover ( ) ;
626
657
627
- this . actor . connect ( 'key-press-event' , Lang . bind ( this , this . _keyPressEvent ) ) ;
628
- this . actor . connect ( 'key-release-event' , Lang . bind ( this , this . _keyReleaseEvent ) ) ;
629
- this . actor . connect ( 'scroll-event' , Lang . bind ( this , this . _scrollEvent ) ) ;
630
- this . actor . connect ( 'button-press-event' , Lang . bind ( this , this . owndestroy ) ) ;
658
+ //~ this.actor.connect('key-press-event', Lang.bind(this, this._keyPressEvent));
659
+ //~ this.actor.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent));
660
+ //~ this.actor.connect('scroll-event', Lang.bind(this, this._scrollEvent));
661
+ //~ this.actor.connect('button-press-event', Lang.bind(this, this.owndestroy));
662
+ this . actor . connect ( 'key-press-event' , ( ) => { this . _keyPressEvent ( ) } ) ;
663
+ this . actor . connect ( 'key-release-event' , ( ) => { this . _keyReleaseEvent ( ) } ) ;
664
+ this . actor . connect ( 'scroll-event' , ( ) => { this . _scrollEvent ( ) } ) ;
665
+ this . actor . connect ( 'button-press-event' , ( ) => { this . owndestroy ( ) } ) ;
631
666
let delay = global . settings . get_int ( "alttab-switcher-delay" ) ;
632
- this . _initialDelayTimeoutId = Mainloop . timeout_add ( delay , Lang . bind ( this , this . _show ) ) ;
667
+ this . _initialDelayTimeoutId = timeout_add ( delay , ( ) => { this . _show ( ) } ) ;
633
668
this . _currentIndex -- ;
634
669
}
635
670
return this . _haveModal ;
0 commit comments