[gnome-shell] Don't mix GJS and GObject signal systems



commit e08f2a4a04189a51443fea950182b2ce9b55c68e
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 14 18:24:50 2017 +0100

    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

 js/ui/appDisplay.js     |    3 ++-
 js/ui/edgeDragAction.js |    2 +-
 js/ui/windowManager.js  |    4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 5b48d5e..7ebd968 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -899,6 +899,8 @@ const ControlsBoxLayout = Lang.Class({
 const ViewStackLayout = new Lang.Class({
     Name: 'ViewStackLayout',
     Extends: Clutter.BinLayout,
+    Signals: { 'allocated-size-changed': { param_types: [GObject.TYPE_INT,
+                                                         GObject.TYPE_INT] } },
 
     vfunc_allocate: function (actor, box, flags) {
         let availWidth = box.x2 - box.x1;
@@ -909,7 +911,6 @@ const ViewStackLayout = new Lang.Class({
         this.parent(actor, box, flags);
     }
 });
-Signals.addSignalMethods(ViewStackLayout.prototype);
 
 const AppDisplay = new Lang.Class({
     Name: 'AppDisplay',
diff --git a/js/ui/edgeDragAction.js b/js/ui/edgeDragAction.js
index 5fc4e72..115b89c 100644
--- a/js/ui/edgeDragAction.js
+++ b/js/ui/edgeDragAction.js
@@ -14,6 +14,7 @@ const DRAG_DISTANCE = 80;
 const EdgeDragAction = new Lang.Class({
     Name: 'EdgeDragAction',
     Extends: Clutter.GestureAction,
+    Signals: { 'activated': {} },
 
     _init : function(side, allowedModes) {
         this.parent();
@@ -81,4 +82,3 @@ const EdgeDragAction = new Lang.Class({
             this.emit('activated');
     }
 });
-Signals.addSignalMethods(EdgeDragAction.prototype);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 324927f..79b2092 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -554,6 +554,7 @@ Signals.addSignalMethods(TouchpadWorkspaceSwitchAction.prototype);
 const WorkspaceSwitchAction = new Lang.Class({
     Name: 'WorkspaceSwitchAction',
     Extends: Clutter.SwipeAction,
+    Signals: { 'activated': { param_types: [Meta.MotionDirection.$gtype] } },
 
     _init : function() {
         const MOTION_THRESHOLD = 50;
@@ -591,11 +592,11 @@ const WorkspaceSwitchAction = new Lang.Class({
         this.emit('activated', dir);
     }
 });
-Signals.addSignalMethods(WorkspaceSwitchAction.prototype);
 
 const AppSwitchAction = new Lang.Class({
     Name: 'AppSwitchAction',
     Extends: Clutter.GestureAction,
+    Signals: { 'activated': {} },
 
     _init : function() {
         this.parent();
@@ -657,7 +658,6 @@ const AppSwitchAction = new Lang.Class({
         return true;
     }
 });
-Signals.addSignalMethods(AppSwitchAction.prototype);
 
 const ResizePopup = new Lang.Class({
     Name: 'ResizePopup',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]