Skip to content

Commit 1da8bb8

Browse files
committed
Force shutdown from now on when requested once
1 parent 0f562e9 commit 1da8bb8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

qui/tray/domains.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ def show_shutdown_dialog(self, ex):
272272
if action == "force":
273273
dialog.add_button(_("Force shutdown"), Gtk.ResponseType.OK)
274274
elif action == "timeout":
275-
dialog.add_button(_("Retry shutdown"), Gtk.ResponseType.OK)
275+
if self.force:
276+
dialog.add_button(_("Retry force shutdown"), Gtk.ResponseType.OK)
277+
else:
278+
dialog.add_button(_("Retry shutdown"), Gtk.ResponseType.OK)
276279
dialog.add_button(_("Kill"), Gtk.ResponseType.YES)
277280
elif action == "kill":
278281
dialog.add_button(_("Kill"), Gtk.ResponseType.OK)
@@ -291,12 +294,13 @@ async def react_to_question_async(self, widget, response, action):
291294

292295
async def shutdown_from_response(self, response, action):
293296
if action == "force":
297+
self.set_force(True)
294298
await asyncio.to_thread(self.vm.shutdown, force=True, wait=True)
295299
elif action == "timeout":
296300
if response == Gtk.ResponseType.YES:
297301
await asyncio.to_thread(self.vm.kill)
298302
elif response == Gtk.ResponseType.OK:
299-
await asyncio.to_thread(self.vm.shutdown, force=False, wait=True)
303+
await asyncio.to_thread(self.vm.shutdown, force=self.force, wait=True)
300304
elif action == "kill" and response == Gtk.ResponseType.OK:
301305
await asyncio.to_thread(self.vm.kill)
302306

0 commit comments

Comments
 (0)