[virt-tools-list] [virt-manager PATCH] virt-manager: fix --show-domain-creator to not depend on manager window

Pavel Hrdina phrdina at redhat.com
Fri May 20 13:27:17 UTC 2016


Commit a0c2fdf4 fixed a bug that there was no way how to close the app.

The original issue isn't present anymore but reverting that commit isn't
enough.  We need to increment/decrement window count while
showing/closing the create window in order to not exit right after
the create window is opened.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1331707

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 virtManager/create.py | 5 +++++
 virtManager/engine.py | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/virtManager/create.py b/virtManager/create.py
index df92709..f4f9d05 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -110,6 +110,8 @@ def _remove_vmm_device(guest, devkey):
 class vmmCreate(vmmGObjectUI):
     __gsignals__ = {
         "action-show-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
+        "create-opened": (GObject.SignalFlags.RUN_FIRST, None, []),
+        "create-closed": (GObject.SignalFlags.RUN_FIRST, None, []),
     }
 
     def __init__(self, engine):
@@ -197,12 +199,15 @@ class vmmCreate(vmmGObjectUI):
         if not self.is_visible():
             self._reset_state(uri)
             self.topwin.set_transient_for(parent)
+            self.emit("create-opened")
 
         self.topwin.present()
 
     def _close(self, ignore1=None, ignore2=None):
         if self.is_visible():
             logging.debug("Closing new vm wizard")
+            self.emit("create-closed")
+
         self.topwin.hide()
 
         self._cleanup_customize_window()
diff --git a/virtManager/engine.py b/virtManager/engine.py
index 7b10c91..001ef91 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -893,6 +893,8 @@ class vmmEngine(vmmGObject):
 
         obj = vmmCreate(self)
         obj.connect("action-show-domain", self._do_show_vm)
+        obj.connect("create-opened", self.increment_window_counter)
+        obj.connect("create-closed", self.decrement_window_counter)
         self.windowCreate = obj
         return self.windowCreate
 
@@ -968,7 +970,6 @@ class vmmEngine(vmmGObject):
         self._do_show_host(self.get_manager(), uri)
 
     def _show_domain_creator(self, uri):
-        self._show_manager()
         self._do_show_create(self.get_manager(), uri)
 
     def _show_domain_console(self, uri, clistr):
-- 
2.8.2




More information about the virt-tools-list mailing list