зеркало из https://github.com/mozilla/snowl.git
Bug 480375 - adding messages to long list view horks UI thread
This commit is contained in:
Родитель
fdde299293
Коммит
25fbaf8d3e
|
@ -478,7 +478,7 @@ this._log.info("onClick: START itemIds - " +this.itemIds.toSource());
|
|||
for (let i=0; i < selectedNodes.length && !all; i++) {
|
||||
// Create places query object from tree item uri
|
||||
query = new SnowlQuery(selectedNodes[i].uri);
|
||||
if (query.queryFolder == SnowlPlaces.collectionsAllID ||
|
||||
if (query.queryFolder == SnowlPlaces.collectionsSystemID ||
|
||||
query.queryFolder == SnowlPlaces.collectionsSourcesID ||
|
||||
query.queryFolder == SnowlPlaces.collectionsAuthorsID) {
|
||||
all = true;
|
||||
|
@ -937,7 +937,8 @@ this._log.info("_buildCollectionTree: Convert to Places: START");
|
|||
break;
|
||||
}
|
||||
for each (let group in collection.groups) {
|
||||
//this._log.info(table+" group.name:group.groupID - " + group.name + " : " + group.groupID);
|
||||
//this._log.info(table+" group.name:group.groupID - " +
|
||||
// group.name + " : " + group.groupID);
|
||||
if (table == "sources") {
|
||||
value = group.groupID;
|
||||
machineURI = SnowlService.sourcesByID[group.groupID].machineURI;
|
||||
|
@ -965,8 +966,8 @@ this._log.info("_buildCollectionTree: Convert to Places: START");
|
|||
gMessageViewWindow.XULBrowserWindow.
|
||||
setOverLink("Converted to Places: " +
|
||||
table + " - " + group.name);
|
||||
this._log.info("Converted to places - " +
|
||||
group.name + " : " + group.groupID + " : " + placeID);
|
||||
//this._log.info("Converted to places - " +
|
||||
// group.name + " : " + group.groupID + " : " + placeID);
|
||||
|
||||
yield sleep(10);
|
||||
}
|
||||
|
|
|
@ -206,8 +206,8 @@ let SnowlMessageView = {
|
|||
onMessageAdded: function(message) {
|
||||
// Refresh list view on each new message, if collection selected.
|
||||
//this._log.info("onMessageAdded: REFRESH LIST");
|
||||
this._collection.invalidate();
|
||||
this._rebuildView();
|
||||
this._collection.messages.push(message);
|
||||
this._rebuildView();
|
||||
},
|
||||
|
||||
onFilter: function(aFilters) {
|
||||
|
|
|
@ -137,7 +137,7 @@ SnowlCollection.prototype = {
|
|||
parameters: { groupValue: statement.row.name } });
|
||||
|
||||
let group = new SnowlCollection(null, name, iconURL, constraints, this);
|
||||
this._log.info("got group name: " + group.name);
|
||||
//this._log.info("got group name: " + group.name);
|
||||
|
||||
if (this.groupIDColumn)
|
||||
group.groupID = statement.row.groupID;
|
||||
|
|
|
@ -1242,12 +1242,19 @@ this._log.info("buildNameItemMap: " + queryName + " - " + items[i]);
|
|||
return map;
|
||||
},
|
||||
|
||||
// Check for snowl Places structure and create if not found
|
||||
// Init snowl Places structure, delay to allow logger to set up.
|
||||
init: function() {
|
||||
// Only do once for session
|
||||
// Only do once for session.
|
||||
if (this._placesInitialized)
|
||||
return;
|
||||
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
let callback = { notify: function(aTimer) { SnowlPlaces.delayedInit() } };
|
||||
timer.initWithCallback(callback, 10, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
// Check for snowl Places structure and create if not found.
|
||||
delayedInit: function() {
|
||||
let items, itemID, collsysID, colluserID;
|
||||
let snowlPlacesRoot = -1;
|
||||
items = PlacesUtils.annotations
|
||||
|
|
|
@ -335,11 +335,7 @@ SnowlFeed.prototype = {
|
|||
}
|
||||
|
||||
// Update the current flag.
|
||||
SnowlDatastore.dbConnection.executeSimpleSQL(
|
||||
"UPDATE messages SET current = (CASE WHEN id IN " +
|
||||
"(" + currentMessageIDs.join(", ") + ")" +
|
||||
" THEN 1 ELSE 0 END) WHERE sourceID = " + this.id
|
||||
);
|
||||
this.updateCurrentMessages(currentMessageIDs);
|
||||
|
||||
// Notify list and collections views on completion of messages download, list
|
||||
// also notified of each message addition.
|
||||
|
|
|
@ -481,6 +481,25 @@ this._log.info("persist placeID:sources.id - " + placeID + " : " + this.id);
|
|||
// It isn't a type we understand, so don't do anything with it.
|
||||
// XXX If it's text/*, shouldn't we fulltext index it anyway?
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the current flag for messages in a source, after a refresh.
|
||||
* If message's current flag = 1 set to 0, then set current flag for messages
|
||||
* in the current refresh list to 1.
|
||||
*
|
||||
* @param aCurrentMessageIDs {array} messages table ids of the current list
|
||||
*/
|
||||
updateCurrentMessages: function(aCurrentMessageIDs) {
|
||||
SnowlDatastore.dbConnection.executeSimpleSQL(
|
||||
"UPDATE messages SET current = 0" +
|
||||
" WHERE sourceID = " + this.id + " AND current = 1"
|
||||
);
|
||||
SnowlDatastore.dbConnection.executeSimpleSQL(
|
||||
"UPDATE messages SET current = 1" +
|
||||
" WHERE sourceID = " + this.id + " AND id IN " +
|
||||
"(" + aCurrentMessageIDs.join(", ") + ")"
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -560,11 +560,7 @@ SnowlTwitter.prototype = {
|
|||
}
|
||||
|
||||
// Update the current flag.
|
||||
SnowlDatastore.dbConnection.executeSimpleSQL(
|
||||
"UPDATE messages SET current = (CASE WHEN id IN " +
|
||||
"(" + currentMessageIDs.join(", ") + ")" +
|
||||
" THEN 1 ELSE 0 END) WHERE sourceID = " + this.id
|
||||
);
|
||||
this.updateCurrentMessages(currentMessageIDs);
|
||||
|
||||
// Notify list and collections views on completion of messages download, list
|
||||
// also notified of each message addition.
|
||||
|
|
Загрузка…
Ссылка в новой задаче