snapshots: Fix showing async dialogs for revert/delete

This commit is contained in:
Cole Robinson 2013-10-05 10:03:56 -04:00
parent 7c3c70d3d0
commit 97f5717ef7
4 changed files with 18 additions and 13 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Tue Oct 1 09:37:34 2013 -->
<!-- Generated with glade 3.16.0 on Fri Oct 4 16:54:34 2013 -->
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkImage" id="image3">
@ -215,6 +215,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Screenshot:</property>
</object>
<packing>

View File

@ -113,7 +113,7 @@ def _simple_async_done_cb(error, details, errorintro,
finish_cb()
def _simple_async(callback, args, title, text, parent, errorintro,
def _simple_async(callback, args, parent, title, text, errorintro,
show_progress, simplecb, errorcb, finish_cb):
"""
@show_progress: Whether to actually show a progress dialog
@ -129,7 +129,7 @@ def _simple_async(callback, args, title, text, parent, errorintro,
asyncjob = vmmAsyncJob(docb, args,
_simple_async_done_cb,
(errorintro, errorcb, parent, finish_cb),
(parent, errorintro, errorcb, finish_cb),
title, text, parent.topwin,
show_progress=show_progress)
asyncjob.run()
@ -146,17 +146,17 @@ class vmmAsyncJob(vmmGObjectUI):
Displays a progress bar while executing the "callback" method.
"""
@staticmethod
def simple_async(callback, args, title, text, parent, errorintro,
def simple_async(callback, args, parent, title, text, errorintro,
simplecb=True, errorcb=None, finish_cb=None):
_simple_async(callback, args,
title, text, parent, errorintro, True,
_simple_async(callback, args, parent,
title, text, errorintro, True,
simplecb, errorcb, finish_cb)
@staticmethod
def simple_async_noshow(callback, args, parent, errorintro,
simplecb=True, errorcb=None, finish_cb=None):
_simple_async(callback, args,
"", "", parent, errorintro, False,
_simple_async(callback, args, parent,
"", "", errorintro, False,
simplecb, errorcb, finish_cb)

View File

@ -1033,8 +1033,8 @@ class vmmEngine(vmmGObject):
# VM will be restored, which can take some time, so show progress
title = _("Restoring Virtual Machine")
text = _("Restoring virtual machine memory from disk")
vmmAsyncJob.simple_async(vm.startup,
[], title, text, src, "", errorcb=errorcb)
vmmAsyncJob.simple_async(vm.startup, [], src,
title, text, "", errorcb=errorcb)
else:
# Regular startup

View File

@ -517,9 +517,11 @@ class vmmSnapshotPage(vmmGObjectUI):
return
logging.debug("Reverting to snapshot '%s'", snap.get_name())
vmmAsyncJob.simple_async_noshow(self.vm.revert_to_snapshot,
vmmAsyncJob.simple_async(self.vm.revert_to_snapshot,
[snap], self,
_("Error reverting to snapshot '%s'") %
_("Restoring snapshot"),
_("Restoring snapshot '%s'") % snap.get_name(),
_("Error restoring snapshot '%s'") %
snap.get_name(),
finish_cb=self._refresh_snapshots)
@ -535,7 +537,9 @@ class vmmSnapshotPage(vmmGObjectUI):
return
logging.debug("Deleting snapshot '%s'", snap.get_name())
vmmAsyncJob.simple_async_noshow(snap.delete, [], self,
vmmAsyncJob.simple_async(snap.delete, [], self,
_("Deleting snapshot"),
_("Deleting snapshot '%s'") % snap.get_name(),
_("Error deleting snapshot '%s'") % snap.get_name(),
finish_cb=self._refresh_snapshots)