# HG changeset patch # User Cole Robinson # Date 1254757810 14400 # Node ID 97c40c4fb29f7b1b1aadcebd42781f0d471d4697 # Parent c0cffb13680c120ceff22386754104f66bb01d25 create-vol: Don't allow allocation to be higher than capacity. Also tweak the spin button climb rates to be more useful. diff -r c0cffb13680c -r 97c40c4fb29f src/virtManager/createvol.py --- a/src/virtManager/createvol.py Mon Oct 05 11:34:39 2009 -0400 +++ b/src/virtManager/createvol.py Mon Oct 05 11:50:10 2009 -0400 @@ -63,6 +63,8 @@ "on_vol_cancel_clicked" : self.close, "on_vol_create_clicked" : self.finish, "on_vol_name_changed" : self.vol_name_changed, + "on_vol_allocation_value_changed" : self.vol_allocation_changed, + "on_vol_capacity_value_changed" : self.vol_capacity_changed, }) format_list = self.window.get_widget("vol-format") @@ -144,6 +146,24 @@ text = src.get_text() self.window.get_widget("vol-create").set_sensitive(bool(text)) + def vol_allocation_changed(self, src): + cap_widget = self.window.get_widget("vol-capacity") + + alloc = src.get_value() + cap = cap_widget.get_value() + + if alloc > cap: + cap_widget.set_value(alloc) + + def vol_capacity_changed(self, src): + alloc_widget = self.window.get_widget("vol-allocation") + + cap = src.get_value() + alloc = self.window.get_widget("vol-allocation").get_value() + + if cap < alloc: + alloc_widget.set_value(cap) + def finish(self, src): # validate input try: diff -rup old/src/vmm-create-vol.glade virt-manager-0.8.0/src/vmm-create-vol.glade --- old/src/vmm-create-vol.glade 2009-10-05 13:18:10.212062000 -0400 +++ virt-manager-0.8.0/src/vmm-create-vol.glade 2009-10-05 13:19:57.343395000 -0400 @@ -237,8 +237,9 @@ True True - 1 0 100000 1 10 0 - 1 + 1 0 100000 1 1000 0 + 10 + 1 @@ -251,8 +252,9 @@ True True - 1 0 100000 1 10 0 - 1 + 1 0 100000 1 1000 0 + 10 + 1