[gnome-shell/overlay-design02] Move the activate and select functionality inside the callbacks



commit aa77762d27bcf07ad9875677cb114827e1d879bc
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date:   Thu Jun 25 18:01:45 2009 -0400

    Move the activate and select functionality inside the callbacks
    
    Move the activate and select functionality inside the callbacks for
    'button-release-event' signals of the display item and the information
    button correspondingly. This way it is more obvious that this is an
    event handling code that needs to return a boolean value for whether
    the signal has been fully handled by the actor.

 js/ui/genericDisplay.js |   29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/genericDisplay.js b/js/ui/genericDisplay.js
index 1cc941f..e70e427 100644
--- a/js/ui/genericDisplay.js
+++ b/js/ui/genericDisplay.js
@@ -63,7 +63,13 @@ GenericDisplayItem.prototype = {
                                          width: availableWidth,
                                          height: ITEM_DISPLAY_HEIGHT });
         this.actor._delegate = this;
-        this.actor.connect('button-release-event', Lang.bind(this, this.activate));
+        this.actor.connect('button-release-event', 
+                           Lang.bind(this, 
+                                     function() {
+                                         // Activates the item by launching it
+                                         this.emit('activate');
+                                         return true;  
+                                     }));
 
         let draggable = DND.makeDraggable(this.actor);
         draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin));
@@ -93,8 +99,13 @@ GenericDisplayItem.prototype = {
                                                   function() {
                                                       return true;
                                                   }));
-        this._informationButton.connect('button-release-event', Lang.bind(this, this.select));
-
+        this._informationButton.connect('button-release-event',
+                                        Lang.bind(this, 
+                                                  function() {
+                                                      // Selects the item by highlighting it and displaying its details
+                                                      this.emit('select');
+                                                      return true;  
+                                                  }));
         this._informationButton.hide();
         this.actor.add_actor(this._informationButton);
         this._informationButton.lower_bottom();
@@ -155,18 +166,6 @@ GenericDisplayItem.prototype = {
        this._bg.background_color = color;
     },
 
-    // Activates the item by launching it
-    activate: function() {
-        this.emit('activate');
-        return true;
-    },
-
-    // Selects the item by highlighting it and displaying it details
-    select: function() {
-        this.emit('select');
-        return true;
-    },
-
     /*
      * Returns an actor containing item details. In the future details can have more information than what 
      * the preview pop-up has and be item-type specific.



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