[gnome-documents] selections: set the new name on the model before creating the collection



commit 372e06fbdbf2133403b65a049cbc559c9df6ed80
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 8 14:46:37 2011 -0500

    selections: set the new name on the model before creating the collection
    
    Avoids flicker between the moment we create the collection and the
    moment when we get a notification for the new name back from the tracker
    daemon.

 src/selections.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/selections.js b/src/selections.js
index 79dfae3..fc95992 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -471,13 +471,18 @@ OrganizeCollectionView.prototype = {
         let path = Gtk.TreePath.new_from_string(pathStr);
         let iter = this._model.model.get_iter(path)[1];
 
-        // don't insert collections with empty names
+        cell.editable = false;
+
         if (!newText || newText == '') {
+            // don't insert collections with empty names
             this._model.model.remove(iter);
             return;
+        } else {
+            // update the new name immediately
+            this._model.model.set_value(iter, OrganizeModelColumns.NAME, newText);
         }
 
-        cell.editable = false;
+        // actually create the new collection
         let job = new CreateCollectionJob(newText);
         job.run(Lang.bind(this, this._onCollectionCreated));
     },



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