Don't mix GJS and GObject signal systems

GJS implements a basic signal system that allows monkey-patching
JS objects with signal methods resembling the GObject ones. However
it's clearly not a good idea to replace the actual GObject methods,
so use the proper GObject facilities when inheriting from GObject.

https://bugzilla.gnome.org/show_bug.cgi?id=778660
This commit is contained in:
Florian Müllner 2017-02-14 18:24:50 +01:00
parent 30e17036e8
commit e08f2a4a04
3 changed files with 5 additions and 4 deletions

View File

@ -899,6 +899,8 @@ const ControlsBoxLayout = Lang.Class({
const ViewStackLayout = new Lang.Class({ const ViewStackLayout = new Lang.Class({
Name: 'ViewStackLayout', Name: 'ViewStackLayout',
Extends: Clutter.BinLayout, Extends: Clutter.BinLayout,
Signals: { 'allocated-size-changed': { param_types: [GObject.TYPE_INT,
GObject.TYPE_INT] } },
vfunc_allocate: function (actor, box, flags) { vfunc_allocate: function (actor, box, flags) {
let availWidth = box.x2 - box.x1; let availWidth = box.x2 - box.x1;
@ -909,7 +911,6 @@ const ViewStackLayout = new Lang.Class({
this.parent(actor, box, flags); this.parent(actor, box, flags);
} }
}); });
Signals.addSignalMethods(ViewStackLayout.prototype);
const AppDisplay = new Lang.Class({ const AppDisplay = new Lang.Class({
Name: 'AppDisplay', Name: 'AppDisplay',

View File

@ -14,6 +14,7 @@ const DRAG_DISTANCE = 80;
const EdgeDragAction = new Lang.Class({ const EdgeDragAction = new Lang.Class({
Name: 'EdgeDragAction', Name: 'EdgeDragAction',
Extends: Clutter.GestureAction, Extends: Clutter.GestureAction,
Signals: { 'activated': {} },
_init : function(side, allowedModes) { _init : function(side, allowedModes) {
this.parent(); this.parent();
@ -81,4 +82,3 @@ const EdgeDragAction = new Lang.Class({
this.emit('activated'); this.emit('activated');
} }
}); });
Signals.addSignalMethods(EdgeDragAction.prototype);

View File

@ -554,6 +554,7 @@ Signals.addSignalMethods(TouchpadWorkspaceSwitchAction.prototype);
const WorkspaceSwitchAction = new Lang.Class({ const WorkspaceSwitchAction = new Lang.Class({
Name: 'WorkspaceSwitchAction', Name: 'WorkspaceSwitchAction',
Extends: Clutter.SwipeAction, Extends: Clutter.SwipeAction,
Signals: { 'activated': { param_types: [Meta.MotionDirection.$gtype] } },
_init : function() { _init : function() {
const MOTION_THRESHOLD = 50; const MOTION_THRESHOLD = 50;
@ -591,11 +592,11 @@ const WorkspaceSwitchAction = new Lang.Class({
this.emit('activated', dir); this.emit('activated', dir);
} }
}); });
Signals.addSignalMethods(WorkspaceSwitchAction.prototype);
const AppSwitchAction = new Lang.Class({ const AppSwitchAction = new Lang.Class({
Name: 'AppSwitchAction', Name: 'AppSwitchAction',
Extends: Clutter.GestureAction, Extends: Clutter.GestureAction,
Signals: { 'activated': {} },
_init : function() { _init : function() {
this.parent(); this.parent();
@ -657,7 +658,6 @@ const AppSwitchAction = new Lang.Class({
return true; return true;
} }
}); });
Signals.addSignalMethods(AppSwitchAction.prototype);
const ResizePopup = new Lang.Class({ const ResizePopup = new Lang.Class({
Name: 'ResizePopup', Name: 'ResizePopup',