[gnome-music] Only allow left-button click to trigger events



commit a543620a3b9c31119c5a630b75773837f2beb7c2
Author: Fabiano FidĂȘncio <fidencio redhat com>
Date:   Sat Jun 8 09:05:59 2013 +0200

    Only allow left-button click to trigger events
    
    By design we don't want that {right,middle}-button click triggers
    any kind of action in gnome-music.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700539

 src/view.js    |   12 ++++++++++++
 src/widgets.js |   10 +++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index 7f766f6..647b0dd 100644
--- a/src/view.js
+++ b/src/view.js
@@ -303,6 +303,10 @@ const Albums = new Lang.Class({
     },
 
     _onItemActivated: function (widget, id, path) {
+        let button = Gtk.get_current_event().get_button()[1];
+        if (button != 1)
+            return;
+
         let iter = this._model.get_iter (path)[1];
         let title = this._model.get_value (iter, 2);
         let artist = this._model.get_value (iter, 3);
@@ -341,6 +345,10 @@ const Songs = new Lang.Class({
     },
 
     _onItemActivated: function (widget, id, path) {
+        let button = Gtk.get_current_event().get_button()[1];
+        if (button != 1)
+            return;
+
         var iter = this._model.get_iter(path)[1]
         if (this._model.get_value(iter, 8) != errorIconName) {
             this.player.setPlaylist("Songs", null, this._model, iter, 5);
@@ -548,6 +556,10 @@ const Artists = new Lang.Class({
     },
 
     _onItemActivated: function (widget, id, path) {
+        let button = Gtk.get_current_event().get_button()[1];
+        if (button != 1)
+            return;
+
         let children = this._artistAlbumsWidget.get_children();
         for (let i=0; i<children.length; i++)
             this._artistAlbumsWidget.remove(children[i]);
diff --git a/src/widgets.js b/src/widgets.js
index de53bc4..122a45f 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -124,6 +124,10 @@ const AlbumWidget = new Lang.Class({
         this.album=null;
         this.view.connect('item-activated', Lang.bind(this,
             function(widget, id, path) {
+                let button = Gtk.get_current_event().get_button()[1];
+                if (button != 1)
+                    return;
+
                 let iter = this.model.get_iter(path)[1];
                 if (this.model.get_value(iter, 7) != errorIconName) {
                     if (this.iterToClean && this.player.playlistId == this.album){
@@ -641,7 +645,11 @@ const ArtistAlbumWidget = new Lang.Class({
             }));
     },
 
-    trackSelected: function(widget, iter) {
+    trackSelected: function(widget, event) {
+        let button = event.get_button()[1];
+        if (button != 1)
+            return;
+
         this.player.stop();
         this.player.setPlaylist ("Artist", this.album, widget.model, widget.iter, 5);
         this.player.setPlaying(true);


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