[gnome-documents] selections: Exit the selection mode when an action has been performed



commit ba89058587e1011dad9244b21c375b917b4bd6a3
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Aug 5 14:55:56 2013 +0200

    selections: Exit the selection mode when an action has been performed
    
    If the action opens a modal dialog then we only exit the mode when the
    "response" from the dialog has been positive.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699910

 src/documents.js  |    6 ++++++
 src/selections.js |   11 +++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 8b37c17..c8eabdc 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -557,6 +557,12 @@ const DocCommon = new Lang.Class({
                 }
 
                 let printOp = EvView.PrintOperation.new(docModel.get_document());
+                printOp.connect('done', Lang.bind(this,
+                    function(op, res) {
+                        if (res == Gtk.PrintOperationResult.APPLY)
+                            Application.selectionController.setSelectionMode(false);
+                    }));
+
                 let printNotification = new Notifications.PrintNotification(printOp, doc);
 
                 printOp.run(toplevel);
diff --git a/src/selections.js b/src/selections.js
index 3c73709..56f0ce7 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -872,17 +872,17 @@ const SelectionToolbar = new Lang.Class({
             return;
 
         let dialog = new OrganizeCollectionDialog(toplevel);
-        this.widget.set_reveal_child(false);
 
         dialog.widget.connect('response', Lang.bind(this,
             function(widget, response) {
                 dialog.widget.destroy();
-                this.widget.set_reveal_child(true);
+                Application.selectionController.setSelectionMode(false);
             }));
     },
 
     _onToolbarOpen: function(widget) {
         let selection = Application.selectionController.getSelection();
+        Application.selectionController.setSelectionMode(false);
 
         selection.forEach(Lang.bind(this,
             function(urn) {
@@ -893,6 +893,7 @@ const SelectionToolbar = new Lang.Class({
 
     _onToolbarTrash: function(widget) {
         let selection = Application.selectionController.getSelection();
+        Application.selectionController.setSelectionMode(false);
 
         selection.forEach(Lang.bind(this,
             function(urn) {
@@ -904,24 +905,22 @@ const SelectionToolbar = new Lang.Class({
     _onToolbarProperties: function(widget) {
         let selection = Application.selectionController.getSelection();
         let dialog = new Properties.PropertiesDialog(selection[0]);
-        this.widget.set_reveal_child(false);
 
         dialog.widget.connect('response', Lang.bind(this,
             function(widget, response) {
                 dialog.widget.destroy();
-                this.widget.set_reveal_child(true);
+                Application.selectionController.setSelectionMode(false);
             }));
     },
 
    _onToolbarShare: function(widget) {
        let dialog = new Sharing.SharingDialog();
-       this.widget.set_reveal_child(false);
 
        dialog.widget.connect('response', Lang.bind(this,
            function(widget, response) {
                if (response == Gtk.ResponseType.OK) {
                    dialog.widget.destroy();
-                   this.widget.set_reveal_child(true);
+                   Application.selectionController.setSelectionMode(false);
                }
            }));
     },


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