do not override peristent.json with an empty drawing when changing persistency setting
This commit is contained in:
parent
aa0a984878
commit
e0ce5e0096
9
draw.js
9
draw.js
|
|
@ -714,6 +714,15 @@ var DrawingArea = new Lang.Class({
|
|||
this._saveAsJson(Me.metadata['persistent-file-name']);
|
||||
},
|
||||
|
||||
syncPersistent: function() {
|
||||
// do not override peristent.json with an empty drawing when changing persistency setting
|
||||
if (!this.elements.length)
|
||||
this._loadPersistent();
|
||||
else
|
||||
this.savePersistent();
|
||||
|
||||
},
|
||||
|
||||
_loadJson: function(name, notify) {
|
||||
let dir = GLib.get_user_data_dir();
|
||||
let path = GLib.build_filenamev([dir, Me.metadata['data-dir'], `${name}.json`]);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ var AreaManager = new Lang.Class({
|
|||
|
||||
onPersistentSettingChanged: function() {
|
||||
if (this.settings.get_boolean('persistent-drawing'))
|
||||
this.areas[Main.layoutManager.primaryIndex].savePersistent();
|
||||
this.areas[Main.layoutManager.primaryIndex].syncPersistent();
|
||||
},
|
||||
|
||||
updateIndicator: function() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue