[gnome-documents] view: keep controller selection list in sync with the model
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] view: keep controller selection list in sync with the model
- Date: Mon, 12 Mar 2012 20:18:23 +0000 (UTC)
commit acc0ec55ae3a56ffa96edec0896e1f39eab5266b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 12 16:08:35 2012 -0400
view: keep controller selection list in sync with the model
When we restore the selection programmatically after a query/refresh,
make sure the model values and the controller values stay in sync.
src/view.js | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index 7d35d3a..2022252 100644
--- a/src/view.js
+++ b/src/view.js
@@ -268,7 +268,8 @@ View.prototype = {
},
_updateSelection: function() {
- let selected = Global.selectionController.getSelection().slice(0);
+ let selected = Global.selectionController.getSelection();
+ let newSelection = [];
if (!selected.length)
return;
@@ -282,7 +283,7 @@ View.prototype = {
if (idIndex != -1) {
this._treeModel.set_value(iter, Gd.MainColumns.SELECTED, true);
- selected.splice(idIndex, 1);
+ newSelection.push(id);
if (first) {
generic.scroll_to_path(path);
@@ -290,11 +291,13 @@ View.prototype = {
}
}
- if (selected.length == 0)
+ if (newSelection.length == selected.length)
return true;
return false;
}));
+
+ Global.selectionController.setSelection(newSelection);
},
_onSelectionModeChanged: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]