host: Don't try to confirm changes on window close

It's a bit of a pain to get right, so only do it on net/pool list
change
This commit is contained in:
Cole Robinson 2019-04-14 16:28:58 -04:00
parent f7ba2f2f99
commit c3ea2d3119
3 changed files with 12 additions and 13 deletions

View File

@ -100,8 +100,6 @@ class vmmHost(vmmGObjectUI):
if not self.is_visible():
return
self._confirm_changes()
self.topwin.hide()
vmmEngine.get_instance().decrement_window_counter()
@ -189,9 +187,6 @@ class vmmHost(vmmGObjectUI):
self._hostnets.close()
self._storagelist.close()
def _confirm_changes(self):
return True
################
# UI listeners #
@ -217,7 +212,6 @@ class vmmHost(vmmGObjectUI):
self.conn.set_autoconnect(src.get_active())
def _page_changed_cb(self, src, child, pagenum):
self._confirm_changes()
if pagenum == 1:
self._hostnets.refresh_page()
elif pagenum == 2:

View File

@ -450,9 +450,12 @@ class vmmHostNets(vmmGObjectUI):
self._active_edits.add(edittype)
def _confirm_changes(self):
if self._active_edits and self.err.confirm_unapplied_changes():
if (self.is_visible() and
self._active_edits and
self.err.confirm_unapplied_changes()):
self._net_apply()
self._active_edits = set()
self._disable_net_apply()
return True

View File

@ -485,13 +485,12 @@ class vmmStorageList(vmmGObjectUI):
_("Error deleting pool '%s'") % pool.get_name())
def _pool_refresh_cb(self, src):
if not self._confirm_changes():
return
pool = self._current_pool()
if pool is None:
return
self._confirm_changes()
logging.debug("Refresh pool '%s'", pool.get_name())
vmmAsyncJob.simple_async_noshow(pool.refresh, [], self,
_("Error refreshing pool '%s'") % pool.get_name())
@ -584,9 +583,12 @@ class vmmStorageList(vmmGObjectUI):
self.widget("pool-apply").set_sensitive(False)
def _confirm_changes(self):
if self._active_edits and self.err.confirm_unapplied_changes():
if (self.is_visible() and
self._active_edits and
self.err.confirm_unapplied_changes()):
self._pool_apply()
self._active_edits = set()
self._disable_pool_apply()
return True