@@ -326,11 +326,7 @@ def set_force(self, force):
326326 else :
327327 self .label .set_text (_ ("Restart" ))
328328
329- async def perform_action (self , * _args , ** _kwargs ):
330- try :
331- await asyncio .to_thread (self .vm .shutdown , force = self .force , wait = True )
332- except exc .QubesException as ex :
333- self .show_shutdown_dialog (ex )
329+ async def start (self ):
334330 if self .give_up :
335331 return
336332 try :
@@ -344,6 +340,14 @@ async def perform_action(self, *_args, **_kwargs):
344340 ).format (self .vm .name , str (ex )),
345341 )
346342
343+ async def perform_action (self , * _args , ** _kwargs ):
344+ try :
345+ await asyncio .to_thread (self .vm .shutdown , force = self .force , wait = True )
346+ except exc .QubesException as ex :
347+ self .show_shutdown_dialog (ex )
348+ else :
349+ await self .start ()
350+
347351 def react_to_question (self , widget , response , action ):
348352 asyncio .create_task (self .react_to_question_async (widget , response , action ))
349353
@@ -356,7 +360,8 @@ async def react_to_question_async(self, widget, response, action):
356360 await self .shutdown_from_response (response , action )
357361 except exc .QubesException as ex :
358362 self .show_shutdown_dialog (ex )
359- self .give_up = True
363+ else :
364+ await self .start ()
360365 widget .destroy ()
361366
362367
0 commit comments