virt-manager: add UI elements for domain title in the details window

Commit b79ba8382e2205c416d7c4836ac9ee08c72e2c56 in libvirt adds a
<title> attribute to the domain XML, that is used by the user to
identify more easily the VM. This feature is not supported by all
HVs. This patch allows to see and modify the title from the details
window.

Something similar was requested here:
https://bugzilla.redhat.com/show_bug.cgi?id=798949

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2013-09-24 13:02:27 +02:00
parent 4b52133e53
commit ade0c16015
2 changed files with 69 additions and 30 deletions

View File

@ -631,7 +631,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="n_rows">5</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
@ -733,6 +733,33 @@
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="overview-name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_overview_name_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label24">
<property name="visible">True</property>
@ -741,10 +768,38 @@
<property name="yalign">0</property>
<property name="label" translatable="yes">Description:</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="title-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Title:</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkEntry" id="overview-title">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_overview_title_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -765,35 +820,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">5</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="overview-name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_overview_name_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="bottom_attach">6</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>

View File

@ -43,6 +43,7 @@ from virtinst import util
# Parameters that can be editted in the details window
(EDIT_NAME,
EDIT_TITLE,
EDIT_ACPI,
EDIT_APIC,
EDIT_CLOCK,
@ -93,7 +94,7 @@ EDIT_WATCHDOG_ACTION,
EDIT_CONTROLLER_MODEL,
EDIT_TPM_TYPE,
) = range(1, 40)
) = range(1, 41)
# Columns in hw list model
@ -438,6 +439,7 @@ class vmmDetails(vmmGObjectUI):
"on_details_pages_switch_page": self.switch_page,
"on_overview_name_changed": lambda *x: self.enable_apply(x, EDIT_NAME),
"on_overview_title_changed": lambda *x: self.enable_apply(x, EDIT_TITLE),
"on_overview_acpi_changed": self.config_acpi_changed,
"on_overview_apic_changed": self.config_apic_changed,
"on_overview_clock_changed": lambda *x: self.enable_apply(x, EDIT_CLOCK),
@ -1979,6 +1981,11 @@ class vmmDetails(vmmGObjectUI):
name = self.widget("overview-name").get_text()
add_define(self.vm.define_name, name)
if self.edited(EDIT_TITLE):
title = self.widget("overview-title").get_text()
add_define(self.vm.define_title, title)
add_hotplug(self.vm.hotplug_title, title)
if self.edited(EDIT_ACPI):
enable_acpi = self.widget("overview-acpi").get_active()
if self.widget("overview-acpi").get_inconsistent():
@ -2543,6 +2550,10 @@ class vmmDetails(vmmGObjectUI):
desc_widget = self.widget("overview-description")
desc_widget.get_buffer().set_text(desc)
title = self.vm.get_title()
self.widget("overview-title").set_sensitive(self.vm.title_supported)
self.widget("overview-title").set_text(title or "")
# Hypervisor Details
self.widget("overview-hv").set_text(self.vm.get_pretty_hv_type())
arch = self.vm.get_arch() or _("Unknown")