Add signal management in _manageEventAction()
This commit is contained in:
parent
fbf138faee
commit
c8dc01fe62
36
extension.js
36
extension.js
|
@ -290,7 +290,7 @@ class MonitorWidget extends PanelMenu.Button {
|
|||
return box;
|
||||
}
|
||||
|
||||
_manageEventAction(action) {
|
||||
_manageEventAction(action, signalName) {
|
||||
if (action === 'open-popup')
|
||||
this.menu.open(true);
|
||||
else if (action === 'close-popup')
|
||||
|
@ -299,6 +299,8 @@ class MonitorWidget extends PanelMenu.Button {
|
|||
this.menu.toggle();
|
||||
else if (action == 'delete')
|
||||
this.dbus.deleteItem(this, this.group);
|
||||
else if (action === 'signal')
|
||||
this.dbus.emitSignal(signalName, this.fullname);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
@ -310,10 +312,12 @@ class MonitorWidget extends PanelMenu.Button {
|
|||
_doClickCallback() {
|
||||
let right = '';
|
||||
let nbClicks = '';
|
||||
|
||||
if (this.button == 3)
|
||||
right = 'Right';
|
||||
if (this.nbClicks > 1)
|
||||
nbClicks = 'Dbl';
|
||||
|
||||
let signalName = 'on' + right + nbClicks + 'Click';
|
||||
|
||||
let action = 'signal';
|
||||
|
@ -324,10 +328,8 @@ class MonitorWidget extends PanelMenu.Button {
|
|||
case 'onRightDblClick': action = this.onRightDblClick; break;
|
||||
}
|
||||
|
||||
if (action === 'signal')
|
||||
this.dbus.emitSignal(signalName, this.fullname);
|
||||
else
|
||||
this._manageEventAction(action);
|
||||
this._manageEventAction(action, signalName);
|
||||
|
||||
this.nbClicks = 0;
|
||||
this.button = -1;
|
||||
|
||||
|
@ -349,34 +351,22 @@ class MonitorWidget extends PanelMenu.Button {
|
|||
}
|
||||
|
||||
_onEnter(/*actor, event*/) {
|
||||
if (this.onEnter === 'signal')
|
||||
this.dbus.emitSignal('onEnter', this.fullname);
|
||||
else
|
||||
return this._manageEventAction(this.onEnter);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
return this._manageEventAction(this.onEnter, 'onEnter');
|
||||
}
|
||||
|
||||
_onLeave(/*actor, event*/) {
|
||||
if (this.onLeave === 'signal')
|
||||
this.dbus.emitSignal('onLeave', this.fullname);
|
||||
else
|
||||
return this._manageEventAction(this.onLeave);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
return this._manageEventAction(this.onLeave, 'onLeave');
|
||||
}
|
||||
|
||||
_onScroll(actor, event) {
|
||||
if (this.onScroll === 'signal') {
|
||||
let signalName = '';
|
||||
let direction = event.get_scroll_direction ();
|
||||
if (direction == Clutter.ScrollDirection.UP)
|
||||
this.dbus.emitSignal('onScrollUp', this.fullname);
|
||||
signalName = 'onScrollUp';
|
||||
else if (direction == Clutter.ScrollDirection.DOWN)
|
||||
this.dbus.emitSignal('onScrollDown', this.fullname);
|
||||
} else
|
||||
return this._manageEventAction(this.onScroll);
|
||||
signalName = 'onScrollDown';
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
return this._manageEventAction(this.onScroll, signalName);
|
||||
}
|
||||
|
||||
update(item) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user