src: correctly set display state when cancelling quit request

When the last window is closed we optionally show a confirmation dialog
to check if user wants to quit. If the user cancels, we need to ensure
the display menu state gets set back to checked.

We called g_action_change_state correctly, but a later call to
g_simple_action_set_state used the "visible" variable which was not
correctly reset back to TRUE upon cancel.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-04-27 12:22:56 +01:00 committed by Daniel P. Berrangé
parent 73f567ea94
commit 4820d05c82

View File

@ -2347,10 +2347,12 @@ virt_viewer_app_action_window(VirtViewerApp *self,
virt_viewer_window_hide(win);
} else {
virt_viewer_app_maybe_quit(self, win);
if (!priv->quitting)
if (!priv->quitting) {
/* the last item remains active, doesn't matter if we quit */
visible = TRUE;
g_action_change_state(G_ACTION(act),
g_variant_new_boolean(TRUE));
g_variant_new_boolean(visible));
}
}
}