details: Don't claim that security can be disabled.

After some discussion with upstream libvirt, it was decided that security
should not be disableable for individual VMs. Refactor the UI to
reflect this (it never worked anyways)
This commit is contained in:
Cole Robinson 2011-01-13 11:57:26 -05:00
parent 4b84a00876
commit 6be5fe0872
2 changed files with 20 additions and 60 deletions

View File

@ -341,7 +341,6 @@ class vmmDetails(vmmGObjectUI):
"on_overview_clock_changed": self.config_enable_apply,
"on_security_label_changed": self.security_label_changed,
"on_security_type_changed": self.security_type_changed,
"on_security_model_changed": self.security_model_changed,
"on_config_vcpus_changed": self.config_vcpus_changed,
"on_config_vcpupin_changed": self.config_vcpus_changed,
@ -1287,17 +1286,6 @@ class vmmDetails(vmmGObjectUI):
self.window.get_widget("config-apply").set_sensitive(True)
# Overview -> Security
def security_model_changed(self, combo):
model = combo.get_model()
idx = combo.get_active()
if idx < 0:
return
self.window.get_widget("config-apply").set_sensitive(True)
val = model[idx][0]
show_type = (val.lower() != "none")
self.window.get_widget("security-type-box").set_sensitive(show_type)
def security_label_changed(self, label_ignore):
self.window.get_widget("config-apply").set_sensitive(True)
@ -1531,19 +1519,15 @@ class vmmDetails(vmmGObjectUI):
clock = self.window.get_widget("overview-clock-label").get_text()
# Security
combo = self.window.get_widget("security-model")
model = combo.get_model()
semodel = model[combo.get_active()][0]
if not semodel or str(semodel).lower() == "none":
semodel = None
if self.window.get_widget("security-dynamic").get_active():
setype = "dynamic"
else:
setype = "static"
selabel = self.window.get_widget("security-label").get_text()
semodel = None
if self.window.get_widget("security-type-box").get_sensitive():
semodel = self.window.get_widget("security-model").get_text()
# Description
desc_widget = self.window.get_widget("overview-description")
@ -1919,22 +1903,13 @@ class vmmDetails(vmmGObjectUI):
self.set_combo_label("overview-clock", 0, clock)
# Security details
vmmodel, ignore, vmlabel = self.vm.get_seclabel()
semodel_combo = self.window.get_widget("security-model")
semodel_model = semodel_combo.get_model()
semodel, ignore, vmlabel = self.vm.get_seclabel()
caps = self.vm.get_connection().get_capabilities()
semodel_model.clear()
semodel_model.append(["None"])
if caps.host.secmodel and caps.host.secmodel.model:
semodel_model.append([caps.host.secmodel.model])
active = 0
for i in range(0, len(semodel_model)):
if vmmodel and vmmodel == semodel_model[i][0]:
active = i
break
semodel_combo.set_active(active)
semodel = caps.host.secmodel.model
self.window.get_widget("security-type-box").set_sensitive(bool(semodel))
self.window.get_widget("security-model").set_text(semodel or _("None"))
if self.vm.get_seclabel()[1] == "static":
self.window.get_widget("security-static").set_active(True)
@ -1942,7 +1917,6 @@ class vmmDetails(vmmGObjectUI):
self.window.get_widget("security-dynamic").set_active(True)
self.window.get_widget("security-label").set_text(vmlabel)
semodel_combo.emit("changed")
def refresh_stats_page(self):
def _dsk_rx_tx_text(rx, tx, unit):

View File

@ -1426,33 +1426,6 @@
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<widget class="GtkComboBox" id="security-model">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<signal name="changed" handler="on_security_model_changed"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkTable" id="security-type-box">
<property name="visible">True</property>
@ -1486,6 +1459,7 @@
<child>
<widget class="GtkEntry" id="security-label">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_security_label_changed"/>
@ -1598,6 +1572,18 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="security-model">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label">label</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>