addhardware: Make bus list dependent on device type

And not the other way around. It's less confusing this way IMO, particularly
if virtio is selected by default and the user is confused, wondering
where the cdrom option is.

Take the opportunity to actually share the bus combo logic between details
and addhardware
This commit is contained in:
Cole Robinson 2015-04-07 19:31:30 -04:00
parent 1d98af2c47
commit ec162888f5
3 changed files with 110 additions and 147 deletions

View File

@ -41,6 +41,7 @@
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow1"> <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width_request">50</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property> <property name="hscrollbar_policy">never</property>
@ -78,13 +79,13 @@
<object class="GtkLabel" id="page-title-label"> <object class="GtkLabel" id="page-title-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">6</property> <property name="xpad">6</property>
<property name="ypad">6</property> <property name="ypad">6</property>
<property name="label">Page title</property> <property name="label">Page title</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="justify">fill</property> <property name="justify">fill</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object> </object>
</child> </child>
</object> </object>
@ -104,6 +105,7 @@
<object class="GtkNotebook" id="create-pages"> <object class="GtkNotebook" id="create-pages">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tab_pos">left</property>
<property name="show_border">False</property> <property name="show_border">False</property>
<child> <child>
<object class="GtkLabel" id="hardware-info"> <object class="GtkLabel" id="hardware-info">
@ -153,14 +155,14 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Device type:</property> <property name="label" translatable="yes">_Device type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">config-storage-devtype</property> <property name="mnemonic_widget">config-storage-devtype</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">1</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -177,21 +179,21 @@
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">1</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label21"> <object class="GtkLabel" id="label21">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Bus type:</property> <property name="label" translatable="yes">_Bus type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">config-storage-bustype</property> <property name="mnemonic_widget">config-storage-bustype</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -199,11 +201,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<signal name="changed" handler="on_config_storage_bustype_changed" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">0</property> <property name="top_attach">1</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -227,10 +228,10 @@
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Stor_age format:</property> <property name="label" translatable="yes">Stor_age format:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">storage-format-combobox-entry</property> <property name="mnemonic_widget">storage-format-combobox-entry</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -241,10 +242,10 @@
<object class="GtkLabel" id="label28"> <object class="GtkLabel" id="label28">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Cac_he mode:</property> <property name="label" translatable="yes">Cac_he mode:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">config-storage-cache</property> <property name="mnemonic_widget">config-storage-cache</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -322,10 +323,10 @@
<object class="GtkLabel" id="label29"> <object class="GtkLabel" id="label29">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Type:</property> <property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">controller-type</property> <property name="mnemonic_widget">controller-type</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -336,10 +337,10 @@
<object class="GtkLabel" id="controller-model-label"> <object class="GtkLabel" id="controller-model-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Model:</property> <property name="label" translatable="yes">_Model:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">controller-model</property> <property name="mnemonic_widget">controller-model</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -459,11 +460,11 @@
<object class="GtkLabel" id="label386"> <object class="GtkLabel" id="label386">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_MAC address:</property> <property name="label" translatable="yes">_MAC address:</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">create-mac-address</property> <property name="mnemonic_widget">create-mac-address</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -474,10 +475,10 @@
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Device mode_l:</property> <property name="label" translatable="yes">Device mode_l:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">net-model</property> <property name="mnemonic_widget">net-model</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -575,10 +576,10 @@
<object class="GtkLabel" id="label395"> <object class="GtkLabel" id="label395">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Type:</property> <property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">input-type</property> <property name="mnemonic_widget">input-type</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -659,10 +660,10 @@
<object class="GtkLabel" id="label10"> <object class="GtkLabel" id="label10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Model:</property> <property name="label" translatable="yes">_Model:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">sound-model</property> <property name="mnemonic_widget">sound-model</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -696,11 +697,11 @@
<object class="GtkLabel" id="label20"> <object class="GtkLabel" id="label20">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">1</property> <property name="xpad">1</property>
<property name="label" translatable="yes">Host _Device:</property> <property name="label" translatable="yes">Host _Device:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">host-device</property> <property name="mnemonic_widget">host-device</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -805,10 +806,10 @@
<object class="GtkLabel" id="char-port-label"> <object class="GtkLabel" id="char-port-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Port:</property> <property name="label" translatable="yes">_Port:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-port</property> <property name="mnemonic_widget">char-port</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -854,10 +855,10 @@
<object class="GtkLabel" id="char-bind-port-label"> <object class="GtkLabel" id="char-bind-port-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Po_rt:</property> <property name="label" translatable="yes">Po_rt:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-bind-port</property> <property name="mnemonic_widget">char-bind-port</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -887,10 +888,10 @@
<object class="GtkLabel" id="char-path-label"> <object class="GtkLabel" id="char-path-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Path:</property> <property name="label" translatable="yes">_Path:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-path</property> <property name="mnemonic_widget">char-path</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -901,10 +902,10 @@
<object class="GtkLabel" id="char-mode-label"> <object class="GtkLabel" id="char-mode-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Mode:</property> <property name="label" translatable="yes">_Mode:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-mode</property> <property name="mnemonic_widget">char-mode</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -915,10 +916,10 @@
<object class="GtkLabel" id="char-host-label"> <object class="GtkLabel" id="char-host-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">H_ost:</property> <property name="label" translatable="yes">H_ost:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-host</property> <property name="mnemonic_widget">char-host</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -929,10 +930,10 @@
<object class="GtkLabel" id="char-bind-host-label"> <object class="GtkLabel" id="char-bind-host-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Bind Host:</property> <property name="label" translatable="yes">_Bind Host:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-mode</property> <property name="mnemonic_widget">char-mode</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -943,10 +944,10 @@
<object class="GtkLabel" id="char-use-telnet-label"> <object class="GtkLabel" id="char-use-telnet-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Use Te_lnet:</property> <property name="label" translatable="yes">Use Te_lnet:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-use-telnet</property> <property name="mnemonic_widget">char-use-telnet</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -957,10 +958,10 @@
<object class="GtkLabel" id="label9"> <object class="GtkLabel" id="label9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Device _Type:</property> <property name="label" translatable="yes">Device _Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-device-type</property> <property name="mnemonic_widget">char-device-type</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -983,10 +984,10 @@
<object class="GtkLabel" id="char-target-type-label"> <object class="GtkLabel" id="char-target-type-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">T_ype:</property> <property name="label" translatable="yes">T_ype:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-target-type</property> <property name="mnemonic_widget">char-target-type</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1008,10 +1009,10 @@
<object class="GtkLabel" id="char-target-name-label"> <object class="GtkLabel" id="char-target-name-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property> <property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">combobox-entry</property> <property name="mnemonic_widget">combobox-entry</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1068,10 +1069,10 @@
<object class="GtkLabel" id="char-channel-label"> <object class="GtkLabel" id="char-channel-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Channel:</property> <property name="label" translatable="yes">_Channel:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">char-channel</property> <property name="mnemonic_widget">char-channel</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1127,10 +1128,10 @@
<object class="GtkLabel" id="label23"> <object class="GtkLabel" id="label23">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Model:</property> <property name="label" translatable="yes">_Model:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">video-model</property> <property name="mnemonic_widget">video-model</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -1177,10 +1178,10 @@
<object class="GtkLabel" id="label26"> <object class="GtkLabel" id="label26">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Model:</property> <property name="label" translatable="yes">_Model:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">watchdog-model</property> <property name="mnemonic_widget">watchdog-model</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -1279,10 +1280,10 @@
<object class="GtkLabel" id="label30"> <object class="GtkLabel" id="label30">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Mode:</property> <property name="label" translatable="yes">_Mode:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">smartcard-mode</property> <property name="mnemonic_widget">smartcard-mode</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -1332,10 +1333,10 @@
<object class="GtkLabel" id="label439"> <object class="GtkLabel" id="label439">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Port:</property> <property name="label" translatable="yes">_Port:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">usbredir-service</property> <property name="mnemonic_widget">usbredir-service</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -1366,9 +1367,9 @@
<object class="GtkLabel" id="label3213"> <object class="GtkLabel" id="label3213">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Type:</property> <property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1379,10 +1380,10 @@
<object class="GtkLabel" id="label438"> <object class="GtkLabel" id="label438">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Host:</property> <property name="label" translatable="yes">_Host:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">usbredir-host</property> <property name="mnemonic_widget">usbredir-host</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1439,10 +1440,10 @@
<object class="GtkLabel" id="tpm-device-path-label"> <object class="GtkLabel" id="tpm-device-path-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Device _Path:</property> <property name="label" translatable="yes">Device _Path:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">tpm-device-path</property> <property name="mnemonic_widget">tpm-device-path</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1464,10 +1465,10 @@
<object class="GtkLabel" id="label35"> <object class="GtkLabel" id="label35">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Backend:</property> <property name="label" translatable="yes">_Backend:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">tpm-type</property> <property name="mnemonic_widget">tpm-type</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1500,10 +1501,10 @@
<object class="GtkLabel" id="label4"> <object class="GtkLabel" id="label4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Type:</property> <property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-type</property> <property name="mnemonic_widget">rng-type</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1525,10 +1526,10 @@
<object class="GtkLabel" id="label8"> <object class="GtkLabel" id="label8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Backend Type:</property> <property name="label" translatable="yes">_Backend Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-backend-type</property> <property name="mnemonic_widget">rng-backend-type</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1550,10 +1551,10 @@
<object class="GtkLabel" id="label12"> <object class="GtkLabel" id="label12">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Backend _Mode:</property> <property name="label" translatable="yes">Backend _Mode:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-backend-mode</property> <property name="mnemonic_widget">rng-backend-mode</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1575,10 +1576,10 @@
<object class="GtkLabel" id="label17"> <object class="GtkLabel" id="label17">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Host:</property> <property name="label" translatable="yes">_Host:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-connect-host</property> <property name="mnemonic_widget">rng-connect-host</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1606,10 +1607,10 @@
<object class="GtkLabel" id="char-port-label1"> <object class="GtkLabel" id="char-port-label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Port:</property> <property name="label" translatable="yes">_Port:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-connect-service</property> <property name="mnemonic_widget">rng-connect-service</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -1640,10 +1641,10 @@
<object class="GtkLabel" id="rng-bind-host-label"> <object class="GtkLabel" id="rng-bind-host-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">B_ind Host:</property> <property name="label" translatable="yes">B_ind Host:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-bind-host</property> <property name="mnemonic_widget">rng-bind-host</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1671,10 +1672,10 @@
<object class="GtkLabel" id="char-port-label2"> <object class="GtkLabel" id="char-port-label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">P_ort:</property> <property name="label" translatable="yes">P_ort:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-bind-service</property> <property name="mnemonic_widget">rng-bind-service</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -1705,10 +1706,10 @@
<object class="GtkLabel" id="label5"> <object class="GtkLabel" id="label5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Device:</property> <property name="label" translatable="yes">_Device:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rng-device</property> <property name="mnemonic_widget">rng-device</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1752,10 +1753,10 @@
<object class="GtkLabel" id="panic-type-label"> <object class="GtkLabel" id="panic-type-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Address _Type:</property> <property name="label" translatable="yes">Address _Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">panic-type</property> <property name="mnemonic_widget">panic-type</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -1776,10 +1777,10 @@
<object class="GtkLabel" id="panic-iobase-label"> <object class="GtkLabel" id="panic-iobase-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_IO Base:</property> <property name="label" translatable="yes">_IO Base:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">panic-iobase</property> <property name="mnemonic_widget">panic-iobase</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>

View File

@ -99,7 +99,6 @@ class vmmAddHardware(vmmGObjectUI):
"on_create_finish_clicked" : self.finish, "on_create_finish_clicked" : self.finish,
"on_hw_list_changed": self.hw_selected, "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_config_storage_devtype_changed": self.change_storage_devtype,
"on_mac_address_clicked" : self.change_macaddr_use, "on_mac_address_clicked" : self.change_macaddr_use,
@ -199,11 +198,8 @@ class vmmAddHardware(vmmGObjectUI):
self.build_network_model_combo(self.vm, netmodel_list) self.build_network_model_combo(self.vm, netmodel_list)
# Disk bus type # Disk bus type
widget = self.widget("config-storage-bustype") self.build_disk_bus_combo(self.vm,
# [bus, label] self.widget("config-storage-bustype"))
model = Gtk.ListStore(str, str)
widget.set_model(model)
uiutil.set_combo_text_column(widget, 1)
# Disk device type # Disk device type
target_list = self.widget("config-storage-devtype") target_list = self.widget("config-storage-devtype")
@ -218,6 +214,16 @@ class vmmAddHardware(vmmGObjectUI):
text.set_property("xpad", 6) text.set_property("xpad", 6)
target_list.pack_start(text, True) target_list.pack_start(text, True)
target_list.add_attribute(text, 'text', 2) target_list.add_attribute(text, 'text', 2)
target_model.append([virtinst.VirtualDisk.DEVICE_DISK,
"drive-harddisk", _("Disk device")])
target_model.append([virtinst.VirtualDisk.DEVICE_CDROM,
"media-cdrom", _("CDROM device")])
target_model.append([virtinst.VirtualDisk.DEVICE_FLOPPY,
"media-floppy", _("Floppy device")])
if self.conn.is_qemu() or self.conn.is_test_conn():
target_model.append([virtinst.VirtualDisk.DEVICE_LUN,
"drive-harddisk", _("LUN Passthrough")])
target_list.set_active(0)
# Disk cache mode # Disk cache mode
cache_list = self.widget("config-storage-cache") cache_list = self.widget("config-storage-cache")
@ -403,7 +409,8 @@ class vmmAddHardware(vmmGObjectUI):
def reset_state(self): def reset_state(self):
# Storage init # Storage init
self.populate_disk_format_combo_wrapper(True) self.populate_disk_format_combo_wrapper(True)
self.populate_disk_bus() self.widget("config-storage-devtype").set_active(0)
self.widget("config-storage-devtype").emit("changed")
self.addstorage.reset_state() self.addstorage.reset_state()
# Network init # Network init
@ -572,11 +579,12 @@ class vmmAddHardware(vmmGObjectUI):
# [xml value, label] # [xml value, label]
model.append([None, _("Hypervisor default")]) model.append([None, _("Hypervisor default")])
if vm.is_hvm(): if vm.is_hvm():
mod_list = ["rtl8139", "ne2k_pci", "pcnet", "e1000"] mod_list = []
if vm.get_hv_type() in ["kvm", "qemu", "test"]: if vm.get_hv_type() in ["kvm", "qemu", "test"]:
mod_list.append("virtio") mod_list.append("virtio")
if (vm.get_hv_type() == "kvm" and mod_list.append("rtl8139")
vm.get_machtype() == "pseries"): mod_list.append("e1000")
if (vm.get_hv_type() == "kvm" and vm.get_machtype() == "pseries"):
mod_list.append("spapr-vlan") mod_list.append("spapr-vlan")
if vm.get_hv_type() in ["xen", "test"]: if vm.get_hv_type() in ["xen", "test"]:
mod_list.append("netfront") mod_list.append("netfront")
@ -701,17 +709,50 @@ class vmmAddHardware(vmmGObjectUI):
combo.set_active(0) combo.set_active(0)
@staticmethod @staticmethod
def build_disk_bus_combo(vm, combo, no_default=False): def build_disk_bus_combo(vm, combo):
ignore = vm ignore = vm
model = Gtk.ListStore(str, str) model = Gtk.ListStore(str, str)
combo.set_model(model) combo.set_model(model)
uiutil.set_combo_text_column(combo, 1) uiutil.set_combo_text_column(combo, 1)
model.set_sort_column_id(1, Gtk.SortType.ASCENDING) model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
if not no_default:
model.append([None, _("Hypervisor default")])
combo.set_active(-1) combo.set_active(-1)
@staticmethod
def populate_disk_bus_combo(vm, devtype, model):
rows = []
if vm.is_hvm():
if not vm.get_xmlobj().os.is_q35():
rows.append(["ide", "IDE"])
rows.append(["sata", "SATA"])
rows.append(["fdc", "Floppy"])
if not vm.stable_defaults():
rows.append(["scsi", "SCSI"])
rows.append(["usb", "USB"])
if vm.get_hv_type() in ["qemu", "kvm", "test"]:
rows.append(["sd", "SD"])
rows.append(["virtio", "VirtIO"])
rows.append(["virtio-scsi", "VirtIO SCSI"])
if vm.get_machtype() == "pseries":
rows.append(["spapr-vscsi", "sPAPR-vSCSI"])
if vm.conn.is_xen() or vm.conn.is_test_conn():
rows.append(["xen", "Xen"])
model.clear()
bus_map = {
"disk": ["ide", "sata", "scsi", "sd", "spapr-vscsi",
"usb", "virtio", "virtio-scsi", "xen"],
"floppy": ["fdc"],
"cdrom": ["ide", "sata", "scsi"],
"lun": ["virtio-scsi"],
}
for row in rows:
if row[0] in bus_map[devtype]:
model.append(row)
@staticmethod @staticmethod
def populate_disk_format_combo(vm, combo, create): def populate_disk_format_combo(vm, combo, create):
model = Gtk.ListStore(str) model = Gtk.ListStore(str)
@ -765,33 +806,15 @@ class vmmAddHardware(vmmGObjectUI):
# UI population methods # # UI population methods #
######################### #########################
def populate_disk_bus(self): def refresh_disk_bus(self, devtype):
widget = self.widget("config-storage-bustype") widget = self.widget("config-storage-bustype")
model = widget.get_model() model = widget.get_model()
model.clear() self.populate_disk_bus_combo(self.vm, devtype, model)
if self.vm.is_hvm():
if not self.vm.get_xmlobj().os.is_q35():
model.append(["ide", "IDE"])
model.append(["sata", "SATA"])
model.append(["fdc", "Floppy"])
if not self.vm.stable_defaults():
model.append(["scsi", "SCSI"])
model.append(["usb", "USB"])
if self.vm.get_hv_type() in ["qemu", "kvm", "test"]:
model.append(["sd", "SD"])
model.append(["virtio", "VirtIO"])
model.append(["virtio-scsi", "VirtIO SCSI"])
if self.conn.is_xen() or self.conn.is_test_conn():
model.append(["xen", "Xen"])
# By default, select bus of the first disk assigned to the VM # By default, select bus of the first disk assigned to the VM
default_bus = None default_bus = None
for i in self.vm.get_disk_devices(): for i in self.vm.get_disk_devices():
if i.is_disk(): if i.device == devtype:
default_bus = i.bus default_bus = i.bus
break break
@ -800,36 +823,6 @@ class vmmAddHardware(vmmGObjectUI):
elif len(model) > 0: elif len(model) > 0:
widget.set_active(0) widget.set_active(0)
def populate_disk_device(self, src):
ignore = src
bus = self.get_config_disk_bus()
devlist = self.widget("config-storage-devtype")
model = devlist.get_model()
model.clear()
disk_buses = ["ide", "sata", "scsi", "sd",
"usb", "virtio", "virtio-scsi", "xen"]
floppy_buses = ["fdc"]
cdrom_buses = ["ide", "sata", "scsi"]
lun_buses = ["virtio-scsi"]
if bus in disk_buses:
model.append([virtinst.VirtualDisk.DEVICE_DISK,
"drive-harddisk", _("Disk device")])
if bus in floppy_buses:
model.append([virtinst.VirtualDisk.DEVICE_FLOPPY,
"media-floppy", _("Floppy device")])
if bus in cdrom_buses:
model.append([virtinst.VirtualDisk.DEVICE_CDROM,
"media-cdrom", _("CDROM device")])
if bus in lun_buses:
model.append([virtinst.VirtualDisk.DEVICE_LUN,
"drive-harddisk", _("LUN device")])
if len(model) > 0:
devlist.set_active(0)
def populate_input_model(self, model): def populate_input_model(self, model):
model.clear() model.clear()
model.append([_("EvTouch USB Graphics Tablet"), "tablet", "usb"]) model.append([_("EvTouch USB Graphics Tablet"), "tablet", "usb"])
@ -1190,6 +1183,8 @@ class vmmAddHardware(vmmGObjectUI):
def change_storage_devtype(self, ignore): def change_storage_devtype(self, ignore):
devtype = self.get_config_disk_device() devtype = self.get_config_disk_device()
self.refresh_disk_bus(devtype)
allow_create = devtype not in ["cdrom", "floppy"] allow_create = devtype not in ["cdrom", "floppy"]
self.addstorage.widget("config-storage-create-box").set_sensitive( self.addstorage.widget("config-storage-create-box").set_sensitive(
allow_create) allow_create)

View File

@ -2734,9 +2734,8 @@ class vmmDetails(vmmGObjectUI):
self.widget("disk-format").get_child().set_text(driver_type) self.widget("disk-format").get_child().set_text(driver_type)
self.widget("disk-format-warn").hide() self.widget("disk-format-warn").hide()
no_default = not self.is_customize_dialog vmmAddHardware.populate_disk_bus_combo(self.vm, devtype,
self.widget("disk-bus").get_model())
self.populate_disk_bus_combo(devtype, no_default)
uiutil.set_combo_entry(self.widget("disk-bus"), bus) uiutil.set_combo_entry(self.widget("disk-bus"), bus)
self.widget("disk-serial").set_text(serial or "") self.widget("disk-serial").set_text(serial or "")
@ -3179,38 +3178,6 @@ class vmmDetails(vmmGObjectUI):
# Hardware list population # # Hardware list population #
############################ ############################
def populate_disk_bus_combo(self, devtype, no_default):
buslist = self.widget("disk-bus")
busmodel = buslist.get_model()
busmodel.clear()
buses = []
if devtype == virtinst.VirtualDisk.DEVICE_FLOPPY:
buses.append(["fdc", "Floppy"])
elif devtype == virtinst.VirtualDisk.DEVICE_CDROM:
buses.append(["ide", "IDE"])
if not self.vm.stable_defaults():
buses.append(["scsi", "SCSI"])
else:
if self.vm.is_hvm():
buses.append(["ide", "IDE"])
if not self.vm.stable_defaults():
buses.append(["scsi", "SCSI"])
buses.append(["usb", "USB"])
if self.vm.get_hv_type() in ["kvm", "test"]:
buses.append(["sata", "SATA"])
buses.append(["virtio", "VirtIO"])
if (self.vm.get_hv_type() == "kvm" and
self.vm.get_machtype() == "pseries"):
buses.append(["spapr-vscsi", "sPAPR-vSCSI"])
if self.vm.conn.is_xen() or self.vm.get_hv_type() == "test":
buses.append(["xen", "Xen"])
for row in buses:
busmodel.append(row)
if not no_default:
busmodel.append([None, _("Hypervisor default")])
def populate_hw_list(self): def populate_hw_list(self):
hw_list_model = self.widget("hw-list").get_model() hw_list_model = self.widget("hw-list").get_model()
hw_list_model.clear() hw_list_model.clear()