[the-board] [things] Use click action on TextThing's label



commit 33eac62a0681c0ce35ce7e9eec43e3aecb6d76cb
Author: Lucas Rocha <lucasr gnome org>
Date:   Fri Nov 12 23:04:39 2010 +0000

    [things] Use click action on TextThing's label
    
    Instead of tracking button presses. Handling clicks is more robust.

 src/js/ui/things/text.js |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/js/ui/things/text.js b/src/js/ui/things/text.js
index 9a2eda4..7b76af2 100644
--- a/src/js/ui/things/text.js
+++ b/src/js/ui/things/text.js
@@ -162,12 +162,16 @@ TextThing.prototype = {
         //this._label.clutterText.lineWrapMode = Pango.WrapMode.WORD_CHAR;
         this._label.clutterText.ellipsize = Pango.EllipsizeMode.NONE;
 
+        let clickAction = new Clutter.ClickAction();
+
+        clickAction.connect("clicked",
+                            Lang.bind(this, this._onTextClicked));
+
+        this._label.add_action(clickAction);
+
         this._label.connect("key-press-event",
                             Lang.bind(this, this._onTextKeyPressEvent));
 
-        this._label.connect("button-press-event",
-                            Lang.bind(this, this._onTextButtonPressEvent));
-
         this._label.clutterText.connect("text-changed",
                                         Lang.bind(this, this._onTextChanged));
 
@@ -200,7 +204,7 @@ TextThing.prototype = {
         return false;
    },
 
-    _onTextButtonPressEvent : function(o, event) {
+    _onTextClicked : function() {
         this.emit("activate");
         return true;
     },



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