[gnome-documents] tracker-controller: don't flood the offset controller with changes
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] tracker-controller: don't flood the offset controller with changes
- Date: Sun, 28 Aug 2011 19:21:13 +0000 (UTC)
commit de54e497e2b9f65183d82b3cf57c65f73b34d448
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Aug 28 15:19:56 2011 -0400
tracker-controller: don't flood the offset controller with changes
src/trackerController.js | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/src/trackerController.js b/src/trackerController.js
index 168a546..acac433 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -81,16 +81,11 @@ TrackerController.prototype = {
return false;
},
- _addRowFromCursor: function(cursor) {
- this._offsetController.setItemCount(cursor.get_integer(Query.QueryColumns.TOTAL_COUNT));
- Global.documentManager.addDocument(cursor);
- },
-
_onQueryFinished: function() {
Global.selectionController.freezeSelection(false);
},
- _onCursorNext: function(cursor, res) {
+ _onCursorNext: function(cursor, res, addCount) {
try {
let valid = cursor.next_finish(res);
@@ -107,14 +102,17 @@ TrackerController.prototype = {
return;
}
- this._addRowFromCursor(cursor);
- cursor.next_async(null, Lang.bind(this, this._onCursorNext));
+ if (addCount)
+ this._offsetController.setItemCount(cursor.get_integer(Query.QueryColumns.TOTAL_COUNT));
+
+ Global.documentManager.addDocument(cursor);
+ cursor.next_async(null, Lang.bind(this, this._onCursorNext, false));
},
_onQueryExecuted: function(object, res) {
try {
let cursor = object.query_finish(res);
- cursor.next_async(null, Lang.bind(this, this._onCursorNext));
+ cursor.next_async(null, Lang.bind(this, this._onCursorNext, true));
} catch (e) {
// FIXME: error handling
log('Unable to execute query: ' + e.toString());
@@ -130,6 +128,7 @@ TrackerController.prototype = {
_refresh: function() {
Global.selectionController.freezeSelection(true);
Global.documentManager.clear();
+ this._offsetController.setItemCount(0);
this._performCurrentQuery();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]