mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
fsdetails: Remove the combo vs label dynamic
If something would normally be shown only in a label, just hide the row entirely. This was interesting for viewer XML properties before we had the XML editor, but now it doesn't add much Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
374ea52be0
commit
2b864a9294
191
ui/fsdetails.ui
191
ui/fsdetails.ui
@ -7,117 +7,12 @@
|
||||
<property name="step-increment">100</property>
|
||||
<property name="page-increment">1000</property>
|
||||
</object>
|
||||
<!-- n-columns=3 n-rows=8 -->
|
||||
<!-- n-columns=2 n-rows=8 -->
|
||||
<object class="GtkGrid" id="vmm-fs-details">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="fs-type-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="fs-type-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="on_fs_type_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fs-type-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label">Passthrough</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="fs-mode-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="fs-mode-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="on_fs_mode_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fs-mode-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Default</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="fs-driver-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="fs-driver-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="on_fs_driver_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fs-driver-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Default</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="fs-target">
|
||||
<property name="visible">True</property>
|
||||
@ -335,40 +230,16 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="fs-format-box">
|
||||
<object class="GtkComboBox" id="fs-format-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="fs-format-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="has-entry">True</property>
|
||||
<signal name="changed" handler="on_fs_format_combo_changed" swapped="no"/>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="has-entry">True</property>
|
||||
<signal name="changed" handler="on_fs_format_combo_changed" swapped="no"/>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry" id="fs-format-entry">
|
||||
<property name="can-focus">True</property>
|
||||
<property name="width-chars">10</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fs-format-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Default</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
@ -377,28 +248,40 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkComboBox" id="fs-mode-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<signal name="changed" handler="on_fs_mode_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkComboBox" id="fs-driver-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<signal name="changed" handler="on_fs_driver_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkComboBox" id="fs-type-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<signal name="changed" handler="on_fs_type_combo_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
@ -95,7 +95,6 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
DeviceFilesystem.TYPE_RAM], sort=False)
|
||||
else:
|
||||
simple_store_set("fs-type-combo", [DeviceFilesystem.TYPE_MOUNT])
|
||||
self.widget("fs-type-label").set_text(DeviceFilesystem.TYPE_MOUNT)
|
||||
|
||||
simple_store_set("fs-mode-combo", DeviceFilesystem.MODES + [None])
|
||||
|
||||
@ -109,8 +108,7 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
simple_store_set("fs-driver-combo", drivers + [None])
|
||||
|
||||
simple_store_set("fs-format-combo", ["raw", "qcow2"], capitalize=False)
|
||||
self.show_pair_combo("fs-type", self.conn.is_container_only())
|
||||
self.show_check_button("fs-readonly",
|
||||
self.widget("fs-readonly").set_visible(
|
||||
self.conn.is_qemu() or
|
||||
self.conn.is_test() or
|
||||
self.conn.is_lxc())
|
||||
@ -130,8 +128,6 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
check_visible=True)
|
||||
|
||||
def get_config_fs_type(self):
|
||||
if self.widget("fs-type-label").is_visible():
|
||||
return self.widget("fs-type-label").get_text()
|
||||
return uiutil.get_list_selection(self.widget("fs-type-combo"),
|
||||
check_visible=True)
|
||||
|
||||
@ -150,10 +146,15 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
def set_dev(self, dev):
|
||||
self._dev = dev
|
||||
|
||||
self.set_config_value("fs-type", dev.type)
|
||||
self.set_config_value("fs-mode", dev.accessmode)
|
||||
self.set_config_value("fs-driver", dev.driver_type)
|
||||
self.set_config_value("fs-format", dev.driver_format)
|
||||
uiutil.set_list_selection(
|
||||
self.widget("fs-type-combo"), dev.type)
|
||||
uiutil.set_list_selection(
|
||||
self.widget("fs-mode-combo"), dev.accessmode)
|
||||
uiutil.set_list_selection(
|
||||
self.widget("fs-driver-combo"), dev.driver_type)
|
||||
uiutil.set_list_selection(
|
||||
self.widget("fs-format-combo"), dev.driver_format)
|
||||
|
||||
if dev.type != DeviceFilesystem.TYPE_RAM:
|
||||
self.widget("fs-source").set_text(dev.source)
|
||||
else:
|
||||
@ -161,15 +162,9 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
self.widget("fs-target").set_text(dev.target or "")
|
||||
self.widget("fs-readonly").set_active(dev.readonly)
|
||||
|
||||
self.show_pair_combo("fs-type", self.conn.is_container_only())
|
||||
uiutil.set_grid_row_visible(
|
||||
self.widget("fs-type-combo"), self.conn.is_container_only())
|
||||
|
||||
def set_config_value(self, name, value):
|
||||
combo = self.widget("%s-combo" % name)
|
||||
label = self.widget("%s-label" % name)
|
||||
|
||||
uiutil.set_list_selection(combo, value)
|
||||
if label:
|
||||
label.set_text(value or "default")
|
||||
|
||||
# listeners
|
||||
def notify_change(self, ignore):
|
||||
@ -188,7 +183,7 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
show_mode = bool(ismount and
|
||||
(fsdriver == DeviceFilesystem.DRIVER_PATH or
|
||||
fsdriver is None))
|
||||
uiutil.set_grid_row_visible(self.widget("fs-mode-box"), show_mode)
|
||||
uiutil.set_grid_row_visible(self.widget("fs-mode-combo"), show_mode)
|
||||
|
||||
show_ram_source = fstype == DeviceFilesystem.TYPE_RAM
|
||||
uiutil.set_grid_row_visible(
|
||||
@ -198,8 +193,8 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
|
||||
show_format = bool(
|
||||
fsdriver == DeviceFilesystem.DRIVER_NBD)
|
||||
uiutil.set_grid_row_visible(self.widget("fs-format-box"), show_format)
|
||||
self.show_pair_combo("fs-format", True)
|
||||
uiutil.set_grid_row_visible(
|
||||
self.widget("fs-format-combo"), show_format)
|
||||
|
||||
show_mode_combo = False
|
||||
show_driver_combo = False
|
||||
@ -214,8 +209,10 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
|
||||
self.widget("fs-source-title").set_text(source_text)
|
||||
self.widget("fs-source-title").set_use_underline(True)
|
||||
self.show_pair_combo("fs-mode", show_mode_combo)
|
||||
self.show_pair_combo("fs-driver", show_driver_combo)
|
||||
uiutil.set_grid_row_visible(
|
||||
self.widget("fs-mode-combo"), show_mode_combo)
|
||||
uiutil.set_grid_row_visible(
|
||||
self.widget("fs-driver-combo"), show_driver_combo)
|
||||
|
||||
def change_field(self, src):
|
||||
self.update_fs_rows()
|
||||
|
Loading…
Reference in New Issue
Block a user