[gnome-documents] preview: remove context menu from the preview



commit b636bfc2b27e7baba74ebd18d3abbafbf0fc425a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jul 19 15:20:48 2012 -0400

    preview: remove context menu from the preview
    
    Now that we have a toolbar button, using both is confusing.

 src/preview.js |   19 ---------------
 src/view.js    |   68 --------------------------------------------------------
 2 files changed, 0 insertions(+), 87 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index a6fccd4..b3ab4a1 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -61,8 +61,6 @@ const PreviewView = new Lang.Class({
 
         this.view.connect('button-press-event',
                             Lang.bind(this, this._onButtonPressEvent));
-        this.view.connect('button-release-event',
-                            Lang.bind(this, this._onButtonReleaseEvent));
         this.view.connect('key-press-event',
                             Lang.bind(this, this._onKeyPressEvent));
     },
@@ -97,21 +95,6 @@ const PreviewView = new Lang.Class({
         return false;
      },
 
-    _onButtonReleaseEvent: function(widget, event) {
-        let button = event.get_button()[1];
-        let timestamp = event.get_time();
-
-        if (button != 3)
-            return false;
-
-        let doc = Global.documentManager.getActiveItem();
-        let menu = new View.ContextMenu([ doc.id ]);
-
-        menu.widget.popup_for_device(null, null, null, null, null, null, button, timestamp);
-
-        return true;
-    },
-
     _onButtonPressEvent: function(widget, event) {
         let button = event.get_button()[1];
         let clickCount = event.get_click_count()[1];
@@ -472,8 +455,6 @@ const PreviewFullscreenToolbar = new Lang.Class({
     _init: function(previewView) {
         this.parent(previewView);
 
-        log(this.actor);
-
         this.actor.y = -(this.widget.get_preferred_height()[1]);
     },
 
diff --git a/src/view.js b/src/view.js
index 2eb7375..20940b0 100644
--- a/src/view.js
+++ b/src/view.js
@@ -90,74 +90,6 @@ const LoadMoreButton = new Lang.Class({
     }
 });
 
-const ContextMenu = new Lang.Class({
-    Name: 'ContextMenu',
-
-    _init: function(urns) {
-        let favCount = 0;
-        let apps = [];
-        let docs = [];
-
-        this.widget = new Gtk.Menu();
-        let showFavorite = (Global.modeController.getWindowMode() != WindowMode.WindowMode.PREVIEW);
-
-        urns.forEach(Lang.bind(this,
-            function(urn) {
-                let doc = Global.documentManager.getItemById(urn);
-                if (doc.favorite)
-                    favCount++;
-
-                if (apps.indexOf(doc.defaultAppName) == -1) {
-                    apps.push(doc.defaultAppName);
-                }
-
-                docs.push(doc);
-            }));
-
-        showFavorite &= ((favCount == 0) || (favCount == urns.length));
-
-        let openLabel = null;
-        if (apps.length == 1) {
-            // Translators: this is the Open action in a context menu
-            openLabel = _("Open with %s").format(apps[0]);
-        } else {
-            // Translators: this is the Open action in a context menu
-            openLabel = _("Open");
-        }
-
-        let openItem = new Gtk.MenuItem({ label: openLabel });
-        openItem.show();
-        this.widget.append(openItem);
-
-        let favoriteItem = null;
-        if (showFavorite) {
-            let isFavorite = (favCount == urns.length);
-            let favoriteLabel = (isFavorite) ? _("Remove from favorites") : _("Add to favorites");
-
-            favoriteItem = new Gtk.MenuItem({ label: favoriteLabel });
-            favoriteItem.show();
-            this.widget.append(favoriteItem);
-        }
-
-        docs.forEach(Lang.bind(this,
-            function(doc) {
-                openItem.connect('activate', Lang.bind(this,
-                    function(item) {
-                        doc.open(item.get_screen(), Gtk.get_current_event_time());
-                    }));
-
-                if (favoriteItem) {
-                    favoriteItem.connect('activate', Lang.bind(this,
-                        function() {
-                            doc.setFavorite(!doc.favorite);
-                        }));
-                }
-            }));
-
-        this.widget.show_all();
-    }
-});
-
 const ViewModel = new Lang.Class({
     Name: 'ViewModel',
 



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