create-vol: Don't allow creating vol without a name entered

This commit is contained in:
Cole Robinson 2009-10-05 11:34:39 -04:00
parent 06623507ed
commit 5c2875aa97
2 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,7 @@ class vmmCreateVolume(gobject.GObject):
"on_vmm_create_vol_delete_event" : self.close,
"on_vol_cancel_clicked" : self.close,
"on_vol_create_clicked" : self.finish,
"on_vol_name_changed" : self.vol_name_changed,
})
format_list = self.window.get_widget("vol-format")
@ -99,6 +100,7 @@ class vmmCreateVolume(gobject.GObject):
def reset_state(self):
self.window.get_widget("vol-name").set_text("")
self.window.get_widget("vol-create").set_sensitive(False)
self.populate_vol_format()
self.populate_vol_suffix()
@ -138,6 +140,10 @@ class vmmCreateVolume(gobject.GObject):
suffix = ".img"
self.window.get_widget("vol-name-suffix").set_text(suffix)
def vol_name_changed(self, src):
text = src.get_text()
self.window.get_widget("vol-create").set_sensitive(bool(text))
def finish(self, src):
# validate input
try:

View File

@ -107,6 +107,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="on_vol_name_changed"/>
</widget>
<packing>
<property name="position">0</property>