Skip to content

Commit

Permalink
FlatpakBackend: set action enabled in main thread (#2187)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Jun 20, 2024
1 parent 1c0b22b commit d1b40f8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Core/FlatpakBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,12 @@ public class AppCenterCore.FlatpakBackend : Object {
}

private void set_actions_enabled (bool working) {
var app = Application.get_default ();
((SimpleAction) app.lookup_action ("refresh")).set_enabled (!working && !Utils.is_running_in_guest_session ());
((SimpleAction) app.lookup_action ("repair")).set_enabled (!working);
// Make sure we run on the main thread
Idle.add_once (() => {
var app = Application.get_default ();
((SimpleAction) app.lookup_action ("refresh")).set_enabled (!working && !Utils.is_running_in_guest_session ());
((SimpleAction) app.lookup_action ("repair")).set_enabled (!working);
});
}

private async void trigger_update_check () {
Expand Down

0 comments on commit d1b40f8

Please sign in to comment.