background: use of CHANGES_DONE_HINT events to avoid reloads
Instead of potentially loading a background mid-way when it changes, and loading it again for every file monitor event, leverage CHANGES_DONE_HINT events, which allow us to ignore CREATED and CHANGED signals from the file monitor. https://bugzilla.gnome.org/show_bug.cgi?id=747794
This commit is contained in:
parent
c1e478eb53
commit
a432653c87
@ -154,7 +154,11 @@ var BackgroundCache = new Lang.Class({
|
||||
|
||||
let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
|
||||
monitor.connect('changed',
|
||||
Lang.bind(this, function() {
|
||||
Lang.bind(this, function(obj, file, otherFile, eventType) {
|
||||
// Ignore CHANGED and CREATED events, since in both cases
|
||||
// we'll get a CHANGES_DONE_HINT event when done.
|
||||
if (eventType != Gio.FileMonitorEvent.CHANGED &&
|
||||
eventType != Gio.FileMonitorEvent.CREATED)
|
||||
this.emit('file-changed', file);
|
||||
}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user