# HG changeset patch # User Cole Robinson # Date 1271861766 14400 # Node ID 679b824e92dc7c8c1966b0a01a37eaaea61ea1ef # Parent 33ec21628630a9b468150b1eba635b1a83fc8a36 host: storage: Add pool refresh button diff -r 33ec21628630 -r 679b824e92dc src/virtManager/host.py --- a/src/virtManager/host.py Wed Apr 21 10:08:04 2010 -0400 +++ b/src/virtManager/host.py Wed Apr 21 10:56:06 2010 -0400 @@ -128,6 +128,7 @@ "on_pool_stop_clicked": self.stop_pool, "on_pool_start_clicked": self.start_pool, "on_pool_delete_clicked": self.delete_pool, + "on_pool_refresh_clicked": self.pool_refresh, "on_pool_autostart_toggled": self.pool_autostart_changed, "on_vol_delete_clicked": self.delete_vol, "on_vol_list_button_press_event": self.popup_vol_menu, @@ -604,6 +605,19 @@ self.err.show_err(_("Error deleting pool: %s") % str(e), "".join(traceback.format_exc())) + def pool_refresh(self, src): + pool = self.current_pool() + if pool is None: + return + + try: + pool.refresh() + self.refresh_current_pool() + except Exception, e: + self.err.show_err(_("Error refreshing pool '%s': %s") % \ + (pool.get_name(), str(e)), + "".join(traceback.format_exc())) + def delete_vol(self, src): vol = self.current_vol() if vol is None: diff -r 33ec21628630 -r 679b824e92dc src/virtManager/storagepool.py --- a/src/virtManager/storagepool.py Wed Apr 21 10:08:04 2010 -0400 +++ b/src/virtManager/storagepool.py Wed Apr 21 10:56:06 2010 -0400 @@ -25,7 +25,9 @@ from virtManager.storagevol import vmmStorageVolume class vmmStoragePool(gobject.GObject): - __gsignals__ = { } + __gsignals__ = { + "refreshed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, []), + } def __init__(self, config, connection, pool, uuid, active): self.__gobject_init__() @@ -40,8 +42,6 @@ self._xml = None # xml cache self.refresh() - self._update_xml() - self.update_volumes() def set_active(self, state): self.active = state @@ -120,9 +120,13 @@ return self._volumes[uuid] def refresh(self): - if self.active: - self.pool.refresh(0) - self._update_xml() + if not self.active: + return + + self.pool.refresh(0) + self._update_xml() + self.update_volumes() + self.emit("refreshed") def update_volumes(self): if not self.is_active(): diff -r 33ec21628630 -r 679b824e92dc src/vmm-host.glade --- a/src/vmm-host.glade Wed Apr 21 10:08:04 2010 -0400 +++ b/src/vmm-host.glade Wed Apr 21 10:56:06 2010 -0400 @@ -1229,11 +1229,40 @@ vertical 3 - + True - 0 - <b>Volumes</b> - True + 6 + + + True + 0 + <b>Volumes</b> + True + + + False + False + 0 + + + + + True + True + True + + + + True + gtk-refresh + + + + + False + 1 + + False