Skip to content

Commit

Permalink
permissions: Prevent monitors updates on changes made by the user
Browse files Browse the repository at this point in the history
  • Loading branch information
tchx84 committed Sep 14, 2023
1 parent 2f8f5fd commit fef7d03
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/models/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ var FlatpakPermissionsModel = GObject.registerClass({
this._delayedHandlerId = 0;
this._monitors = [];
this._monitorsDelayedHandlerId = 0;
this._changedbyUser = false;
this._applications = applications.getDefault();
this._notifyHandlerId = this.connect('notify', this._delayedUpdate.bind(this));
this._ensureBaseOverridesPath();
Expand Down Expand Up @@ -277,6 +278,7 @@ var FlatpakPermissionsModel = GObject.registerClass({
});
});

this._changedbyUser = true;
this._saveOverrides();
this._updateStatusProperties();

Expand Down Expand Up @@ -334,7 +336,10 @@ var FlatpakPermissionsModel = GObject.registerClass({
}

_updateFromMonitors() {
this._setup();
if (!this._changedbyUser)
this._setup();

this._changedbyUser = false;
this._monitorsDelayedHandlerId = 0;
return GLib.SOURCE_REMOVE;
}
Expand Down Expand Up @@ -367,6 +372,7 @@ var FlatpakPermissionsModel = GObject.registerClass({
}

undo() {
this._changedbyUser = true;
const path = this._getOverridesPath();
this._backup.save_to_file(path);
MODELS.portals.restore();
Expand All @@ -380,6 +386,7 @@ var FlatpakPermissionsModel = GObject.registerClass({
}

reset() {
this._changedbyUser = true;
this.backup();
const path = this._getOverridesPath();
GLib.unlink(path);
Expand Down

0 comments on commit fef7d03

Please sign in to comment.