[gnome-weather/gnome-3-8] SelectionToolbar: fix deleting multiple locations at once



commit 93f6748f7c844a6c7911a00de7422d450a5f7bee
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Mar 16 01:00:42 2013 +0100

    SelectionToolbar: fix deleting multiple locations at once
    
    Deletion must happen in reverse order, because deleting causes all
    subsequent paths to change meaning.

 src/window.js |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/window.js b/src/window.js
index d08a815..fe52d77 100644
--- a/src/window.js
+++ b/src/window.js
@@ -59,11 +59,11 @@ const SelectionToolbar = new Lang.Class({
             let items = this._worldView.get_selection();
             let model = this._worldView.get_model();
 
-            items.forEach(function(itemPath) {
-                let [res, iter] = model.get_iter(itemPath);
+            for (let i = items.length - 1; i >= 0; i--) {
+                let [res, iter] = model.get_iter(items[i]);
                 if (res)
                     model.removeLocation(iter);
-            });
+            }
         }));
     },
 


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