addhw: chardev: Hide unsupported params for the selected type

This commit is contained in:
Cole Robinson 2011-04-05 16:41:48 -04:00
parent cb56316cf3
commit 185876fd9a
2 changed files with 23 additions and 7 deletions

View File

@ -872,9 +872,19 @@ class vmmAddHardware(vmmGObjectUI):
chartype,
devtype)
show_something = False
for param_name, widget_name in char_widget_mappings.items():
make_visible = self._dev.supports_property(param_name)
self.window.get_widget(widget_name).set_sensitive(make_visible)
if make_visible:
show_something = True
self.window.get_widget(widget_name).set_property("visible",
make_visible)
self.window.get_widget(widget_name + "-label").set_property(
"visible", make_visible)
self.window.get_widget("char-param-box").set_property("visible",
show_something)
has_mode = self._dev.supports_property("source_mode")
if has_mode and self.window.get_widget("char-mode").get_active() == -1:

View File

@ -1492,7 +1492,7 @@ to connect to the virtual machine.</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame8">
<widget class="GtkFrame" id="char-param-box">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
@ -1507,7 +1507,6 @@ to connect to the virtual machine.</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">8</property>
<property name="row_spacing">8</property>
<child>
<widget class="GtkEntry" id="char-path">
<property name="visible">True</property>
@ -1533,9 +1532,10 @@ to connect to the virtual machine.</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="target-name-label">
<widget class="GtkLabel" id="char-target-name-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">6</property>
<property name="label" translatable="yes">Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">char-use-telnet</property>
@ -1544,7 +1544,7 @@ to connect to the virtual machine.</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
@ -1560,12 +1560,14 @@ to connect to the virtual machine.</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="char-use-telnet-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">6</property>
<property name="label" translatable="yes">Use Te_lnet:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">char-use-telnet</property>
@ -1574,7 +1576,7 @@ to connect to the virtual machine.</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
@ -1588,12 +1590,14 @@ to connect to the virtual machine.</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="char-bind-host-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">8</property>
<property name="label" translatable="yes">_Bind Host:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">char-host</property>
@ -1608,6 +1612,7 @@ to connect to the virtual machine.</property>
<widget class="GtkLabel" id="char-path-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">8</property>
<property name="label" translatable="yes">_Path:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">char-path</property>
@ -1620,6 +1625,7 @@ to connect to the virtual machine.</property>
<widget class="GtkLabel" id="char-host-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">8</property>
<property name="label" translatable="yes">H_ost:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">char-host</property>
@ -1728,6 +1734,7 @@ to connect to the virtual machine.</property>
<widget class="GtkLabel" id="char-mode-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">8</property>
<property name="label" translatable="yes">_Mode:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">char-mode</property>
@ -1793,7 +1800,6 @@ to connect to the virtual machine.</property>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>