Drop redundant calls to window.show()

This commit is contained in:
Cole Robinson 2010-02-23 14:18:12 -05:00
parent 7bc805e6f7
commit 182eb4bcb6
15 changed files with 20 additions and 27 deletions

View File

@ -48,7 +48,6 @@ class vmmAbout:
def show(self):
dialog = self.window.get_widget("vmm-about")
dialog.set_version(self.config.get_appversion())
dialog.show_all()
dialog.present()
def close(self,ignore1=None,ignore2=None):

View File

@ -166,7 +166,6 @@ class vmmAddHardware(gobject.GObject):
def show(self):
self.reset_state()
self.topwin.show()
self.topwin.present()
def close(self, ignore1=None,ignore2=None):

View File

@ -140,7 +140,6 @@ class vmmCloneVM(gobject.GObject):
def show(self):
self.reset_state()
self.topwin.show()
self.topwin.present()
def close(self, ignore1=None, ignore2=None):

View File

@ -108,7 +108,6 @@ class vmmConnect(gobject.GObject):
def show(self):
win = self.window.get_widget("vmm-open-connection")
win.show_all()
win.present()
self.reset_state()

View File

@ -124,7 +124,6 @@ class vmmCreateInterface(gobject.GObject):
def show(self):
self.reset_state()
self.topwin.show()
self.topwin.present()
def show_bond_config(self, src):

View File

@ -82,7 +82,6 @@ class vmmCreateNetwork(gobject.GObject):
self.set_initial_state()
def show(self):
self.topwin.show()
self.reset_state()
self.topwin.present()

View File

@ -115,7 +115,6 @@ class vmmCreatePool(gobject.GObject):
self.set_initial_state()
def show(self):
self.topwin.show()
self.reset_state()
self.topwin.present()

View File

@ -89,7 +89,6 @@ class vmmCreateVolume(gobject.GObject):
def show(self):
self.reset_state()
self.topwin.show()
self.topwin.present()
def close(self, ignore1=None, ignore2=None):

View File

@ -85,7 +85,6 @@ class vmmDeleteDialog(gobject.GObject):
def show(self):
self.reset_state()
self.topwin.show()
self.topwin.present()
def close(self, ignore1=None, ignore2=None):

View File

@ -302,7 +302,6 @@ class vmmDetails(gobject.GObject):
if self.is_visible():
self.topwin.present()
return
self.topwin.show()
self.topwin.present()
self.engine.increment_window_counter()

View File

@ -134,7 +134,7 @@ class vmmDomainBase(gobject.GObject):
def set_autostart(self, val):
raise NotImplementedError()
def attach_device(self, devobj):
def attach_device(self, devobj, devxml=None):
raise NotImplementedError()
def detach_device(self, devtype, dev_id_info):
raise NotImplementedError()
@ -1314,13 +1314,17 @@ class vmmDomain(vmmDomainBase):
def get_id(self):
return self._backend.ID()
def attach_device(self, devobj):
def attach_device(self, devobj, devxml=None):
"""
Hotplug device to running guest
"""
if self.is_active():
xml = devobj.get_xml_config()
self._backend.attachDevice(xml)
if not self.is_active():
return
if not devxml:
devxml = devobj.get_xml_config()
self._backend.attachDevice(devxml)
def detach_device(self, devtype, dev_id_info):
"""
@ -1591,7 +1595,7 @@ class vmmDomain(vmmDomainBase):
ignore, diskxml = util.xml_parse_wrapper(self.get_xml(), func,
dev_id_info, newpath, _type)
self.attach_device(diskxml)
self.attach_device(None, diskxml)
# VCPU changing
def define_vcpus(self, vcpus):

View File

@ -294,8 +294,10 @@ class vmmHost(gobject.GObject):
def show(self):
dialog = self.window.get_widget("vmm-host")
dialog.present()
if self.is_visible():
self.topwin.present()
return
self.topwin.present()
self.engine.increment_window_counter()

View File

@ -124,6 +124,8 @@ class vmmManager(gobject.GObject):
0, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
_("Unexpected Error"),
_("An unexpected error occurred"))
self.topwin = self.window.get_widget("vmm-manager")
self.config = config
self.engine = engine
@ -136,8 +138,7 @@ class vmmManager(gobject.GObject):
self.rows = {}
w, h = self.config.get_manager_window_size()
self.window.get_widget("vmm-manager").set_default_size(w or 550,
h or 550)
self.topwin.set_default_size(w or 550, h or 550)
self.init_vmlist()
self.init_stats()
@ -221,12 +222,11 @@ class vmmManager(gobject.GObject):
##################
def show(self):
win = self.window.get_widget("vmm-manager")
if self.is_visible():
win.present()
self.topwin.present()
return
win.show()
win.present()
self.topwin.present()
self.engine.increment_window_counter()
if self.startup_error:

View File

@ -37,7 +37,6 @@ class vmmPreferences(gobject.GObject):
self.config = config
self.topwin = self.window.get_widget("vmm-preferences")
self.topwin.hide()
self.config.on_view_system_tray_changed(self.refresh_view_system_tray)
self.config.on_console_popup_changed(self.refresh_console_popup)
@ -102,7 +101,6 @@ class vmmPreferences(gobject.GObject):
return 1
def show(self):
self.topwin.show()
self.topwin.present()
#########################

View File

@ -90,7 +90,6 @@ class vmmStorageBrowser(gobject.GObject):
def show(self, conn=None):
self.reset_state(conn)
self.topwin.show()
self.topwin.present()
def close(self, ignore1=None, ignore2=None):