Only do redisplay when mapped
If we're not mapped, only queue up a redisplay. This avoids e.g. changes in recent documents such as saving a file in GEdit causing a lot of blocking I/O in the shell (we need to make recent loading async as well). https://bugzilla.gnome.org/show_bug.cgi?id=599560
This commit is contained in:
parent
c8b1afbad6
commit
94bd6f1718
@ -314,7 +314,7 @@ GenericDisplayItem.prototype = {
|
|||||||
// For some reason, we are not getting leave-event signal when we are dragging an item,
|
// For some reason, we are not getting leave-event signal when we are dragging an item,
|
||||||
// so we should remove the link manually.
|
// so we should remove the link manually.
|
||||||
this._informationButton.actor.hide();
|
this._informationButton.actor.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Signals.addSignalMethods(GenericDisplayItem.prototype);
|
Signals.addSignalMethods(GenericDisplayItem.prototype);
|
||||||
@ -342,6 +342,9 @@ GenericDisplay.prototype = {
|
|||||||
this._updateDisplayControl(false);
|
this._updateDisplayControl(false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this._pendingRedisplay = RedisplayFlags.NONE;
|
||||||
|
this._list.connect('notify::mapped', Lang.bind(this, this._onMappedNotify));
|
||||||
|
|
||||||
// map<itemId, Object> where Object represents the item info
|
// map<itemId, Object> where Object represents the item info
|
||||||
this._allItems = {};
|
this._allItems = {};
|
||||||
// set<itemId>
|
// set<itemId>
|
||||||
@ -642,6 +645,11 @@ GenericDisplay.prototype = {
|
|||||||
* FULL - Indicates that we need recreate all displayed items; implies RESET_CONTROLS as well
|
* FULL - Indicates that we need recreate all displayed items; implies RESET_CONTROLS as well
|
||||||
*/
|
*/
|
||||||
_redisplay: function(flags) {
|
_redisplay: function(flags) {
|
||||||
|
if (!this._list.mapped) {
|
||||||
|
this._pendingRedisplay |= flags;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let isSubSearch = (flags & RedisplayFlags.SUBSEARCH) > 0;
|
let isSubSearch = (flags & RedisplayFlags.SUBSEARCH) > 0;
|
||||||
let fullReload = (flags & RedisplayFlags.FULL) > 0;
|
let fullReload = (flags & RedisplayFlags.FULL) > 0;
|
||||||
let resetPage = (flags & RedisplayFlags.RESET_CONTROLS) > 0 || fullReload;
|
let resetPage = (flags & RedisplayFlags.RESET_CONTROLS) > 0 || fullReload;
|
||||||
@ -852,6 +860,14 @@ GenericDisplay.prototype = {
|
|||||||
let item = this._findDisplayedByIndex(index);
|
let item = this._findDisplayedByIndex(index);
|
||||||
item.markSelected(true);
|
item.markSelected(true);
|
||||||
this.emit('selected');
|
this.emit('selected');
|
||||||
|
},
|
||||||
|
|
||||||
|
_onMappedNotify: function () {
|
||||||
|
let mapped = this._list.mapped;
|
||||||
|
if (mapped && this._pendingRedisplay > RedisplayFlags.NONE)
|
||||||
|
this._redisplay(this._pendingRedisplay);
|
||||||
|
|
||||||
|
this._pendingRedisplay = RedisplayFlags.NONE;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user