mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
engine: connection-removed signal should only send URI
Since that's all that's really needed, and sending conn can interfere with cleanup
This commit is contained in:
parent
f8cbb6fc75
commit
8845447a98
@ -212,7 +212,7 @@ class vmmEngine(vmmGObject):
|
||||
"connection-added": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
[object]),
|
||||
"connection-removed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
[object])
|
||||
[str])
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
@ -519,8 +519,9 @@ class vmmEngine(vmmGObject):
|
||||
def remove_connection(self, uri):
|
||||
conn = self.connections[uri]["connection"]
|
||||
conn.close()
|
||||
self.emit("connection-removed", conn)
|
||||
del self.connections[uri]
|
||||
|
||||
self.emit("connection-removed", uri)
|
||||
self.config.remove_connection(conn.get_uri())
|
||||
|
||||
def connect(self, name, callback, *args):
|
||||
|
@ -855,17 +855,21 @@ class vmmManager(vmmGObjectUI):
|
||||
newname = conn.get_pretty_desc_inactive(False, True)
|
||||
self.conn_refresh_resources(conn, newname)
|
||||
|
||||
def _remove_connection(self, engine_ignore, conn):
|
||||
def _remove_connection(self, engine_ignore, uri):
|
||||
model = self.window.get_widget("vm-list").get_model()
|
||||
parent = self.rows[conn.get_uri()].iter
|
||||
if parent is not None:
|
||||
parent = self.rows[uri].iter
|
||||
|
||||
if parent is None:
|
||||
return
|
||||
|
||||
child = model.iter_children(parent)
|
||||
while child is not None:
|
||||
del self.rows[self.vm_row_key(model.get_value(child, ROW_HANDLE))]
|
||||
model.remove(child)
|
||||
child = model.iter_children(parent)
|
||||
while child is not None:
|
||||
del self.rows[self.vm_row_key(model.get_value(child, ROW_HANDLE))]
|
||||
model.remove(child)
|
||||
child = model.iter_children(parent)
|
||||
model.remove(parent)
|
||||
del self.rows[conn.get_uri()]
|
||||
model.remove(parent)
|
||||
|
||||
del self.rows[uri]
|
||||
|
||||
|
||||
#############################
|
||||
|
@ -353,10 +353,10 @@ class vmmMigrateDialog(vmmGObjectUI):
|
||||
self.destconn_rows.append(newrow)
|
||||
self.populate_dest_combo()
|
||||
|
||||
def dest_remove_connection(self, engine_ignore, conn):
|
||||
def dest_remove_connection(self, engine_ignore, uri):
|
||||
# Make sure connection isn't already present
|
||||
for row in self.destconn_rows:
|
||||
if row[1] and row[1].get_uri() == conn.get_uri():
|
||||
if row[1] and row[1].get_uri() == uri:
|
||||
self.destconn_rows.remove(row)
|
||||
|
||||
self.populate_dest_combo()
|
||||
|
@ -311,14 +311,14 @@ class vmmSystray(vmmGObject):
|
||||
self.conn_state_changed(conn)
|
||||
self.populate_vm_list(conn)
|
||||
|
||||
def conn_removed(self, engine_ignore, conn):
|
||||
if not conn.get_uri() in self.conn_menuitems:
|
||||
def conn_removed(self, engine_ignore, uri):
|
||||
if not uri in self.conn_menuitems:
|
||||
return
|
||||
|
||||
menu_item = self.conn_menuitems[conn.get_uri()]
|
||||
menu_item = self.conn_menuitems[uri]
|
||||
self.systray_menu.remove(menu_item)
|
||||
del(self.conn_menuitems[conn.get_uri()])
|
||||
self.conn_vm_menuitems[conn.get_uri()] = {}
|
||||
del(self.conn_menuitems[uri])
|
||||
self.conn_vm_menuitems[uri] = {}
|
||||
|
||||
self.repopulate_menu_list()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user