addhw: Desensitive the 'create storage' UI for cdrom/floppy

Since we already fail in that case anyways, it makes things a bit clearer.
This commit is contained in:
Cole Robinson 2014-03-12 17:22:48 -04:00
parent abb3920ac6
commit 4f7f1adc47
4 changed files with 100 additions and 93 deletions

View File

@ -169,6 +169,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<signal name="changed" handler="on_config_storage_devtype_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="config-storage-devtype-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Device Type Field</property>

View File

@ -10,12 +10,13 @@
<object class="GtkVBox" id="config-storage-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="hbox6">
<object class="GtkBox" id="config-storage-create-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkRadioButton" id="config-storage-create">
<property name="visible">True</property>
@ -24,6 +25,7 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">config-storage-select</property>
<child>
<object class="GtkLabel" id="label123">
<property name="visible">True</property>
@ -31,49 +33,60 @@
<property name="label" translatable="yes">C_reate a disk image on the computer's hard drive</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">config-storage-create</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="bottom_padding">6</property>
<property name="left_padding">22</property>
<child>
<object class="GtkVBox" id="vbox18">
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<property name="left_padding">22</property>
<child>
<object class="GtkHBox" id="hbox7">
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="spacing">4</property>
<child>
<object class="GtkSpinButton" id="config-storage-size">
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">5</property>
<property name="text" translatable="yes">0.0</property>
<property name="xalign">1</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkSpinButton" id="config-storage-size">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">5</property>
<property name="text" translatable="yes">0.0</property>
<property name="xalign">1</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_GB</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -82,92 +95,78 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label31">
<object class="GtkLabel" id="phys-hd-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_GB</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">config-storage-size</property>
<property name="xalign">0</property>
<property name="label">&lt;span color='#484848'&gt;Free Space&lt;/span&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="phys-hd-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">&lt;span color='#484848'&gt;Free Space&lt;/span&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="config-storage-nosparse">
<property name="label" translatable="yes">_Allocate entire disk now</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="config-storage-nosparse-info">
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Fully allocating storage may take longer now, but the OS install phase will be quicker.
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="config-storage-nosparse">
<property name="label" translatable="yes">_Allocate entire disk now</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="config-storage-nosparse-info">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Fully allocating storage may take longer now, but the OS install phase will be quicker.
Skipping allocation can also cause space issues on the host machine, if the maximum image size exceeds available storage space.
Tip: Storage format qcow2 and qed do not support full allocation.</property>
<property name="stock">gtk-info</property>
<property name="stock">gtk-info</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -181,7 +180,6 @@ Tip: Storage format qcow2 and qed do not support full allocation.</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">config-storage-create</property>
<signal name="toggled" handler="on_config_storage_select_toggled" swapped="no"/>
<child>
<object class="GtkLabel" id="label124">

View File

@ -98,6 +98,7 @@ class vmmAddHardware(vmmGObjectUI):
"on_hw_list_changed": self.hw_selected,
"on_config_storage_bustype_changed": self.populate_disk_device,
"on_config_storage_devtype_changed": self.change_storage_devtype,
"on_mac_address_clicked" : self.change_macaddr_use,
@ -766,7 +767,6 @@ class vmmAddHardware(vmmGObjectUI):
if len(model) > 0:
widget.set_active(0)
def populate_disk_device(self, src):
ignore = src
@ -797,7 +797,6 @@ class vmmAddHardware(vmmGObjectUI):
if len(model) > 0:
devlist.set_active(0)
def populate_input_model(self, model):
model.clear()
model.append([_("EvTouch USB Graphics Tablet"), "tablet", "usb"])
@ -1096,6 +1095,14 @@ class vmmAddHardware(vmmGObjectUI):
act = src.get_active()
self.populate_disk_format_combo_wrapper(not act)
def change_storage_devtype(self, ignore):
devtype = self.get_config_disk_device()
allow_create = devtype not in ["cdrom", "floppy"]
self.addstorage.widget("config-storage-create-box").set_sensitive(
allow_create)
if not allow_create:
self.addstorage.widget("config-storage-select").set_active(True)
# Network listeners
def change_macaddr_use(self, ignore=None):
if self.widget("mac-address").get_active():

View File

@ -191,6 +191,7 @@ class vmmAddStorage(vmmGObjectUI):
self.widget("config-storage-size").set_value(8)
self.widget("config-storage-entry").set_text("")
self.widget("config-storage-nosparse").set_active(True)
self.widget("config-storage-create-box").set_sensitive(True)
fmt = self.conn.get_default_storage_format()
can_alloc = fmt in ["raw"]