details: show warning when guest inspection fails

If libguestfs fails to inspect the guest then show a warning.

Now the "Operating System" and "Applications" frames are visible
only when the guest inspection is available.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=755869

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2013-11-25 16:10:03 +01:00
parent b3131e828e
commit 0abbb6d122
2 changed files with 937 additions and 868 deletions

View File

@ -437,7 +437,6 @@
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
@ -610,6 +609,13 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_border">False</property>
<child>
<object class="GtkBox" id="box11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="resize_mode">immediate</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
@ -750,7 +756,6 @@
<object class="GtkAlignment" id="alignment14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<child>
<placeholder/>
</child>
@ -976,7 +981,7 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="frame17">
<object class="GtkFrame" id="details-inspection-os">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
@ -1073,7 +1078,7 @@
</packing>
</child>
<child>
<object class="GtkExpander" id="expander7">
<object class="GtkExpander" id="details-inspection-apps">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@ -1233,8 +1238,8 @@
<property name="has_entry">True</property>
<signal name="changed" handler="on_overview_clock_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry18">
<property name="can_focus">True</property>
<object class="GtkEntry" id="combobox-entry2">
<property name="can_focus">False</property>
</object>
</child>
</object>
@ -1507,6 +1512,60 @@
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="details-overview-error-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">end</property>
<property name="orientation">vertical</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-warning</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="details-overview-error">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Error message bar</property>
<property name="max_width_chars">80</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label10">
@ -2057,7 +2116,7 @@
<property name="has_entry">True</property>
<signal name="changed" handler="on_cpu_model_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry2">
<object class="GtkEntry" id="combobox-entry33">
<property name="can_focus">False</property>
</object>
</child>

View File

@ -2503,7 +2503,16 @@ class vmmDetails(vmmGObjectUI):
self.widget("overview-arch").set_text(arch)
self.widget("overview-emulator").set_text(emu)
inspection_supported = self.config.support_inspection
uihelpers.set_grid_row_visible(self.widget("details-overview-error"),
self.vm.inspection.error)
if self.vm.inspection.error:
msg = _("Error while inspecting the guest configuration")
self.widget("details-overview-error").set_text(msg)
# Operating System (ie. inspection data)
self.widget("details-inspection-os").set_visible(inspection_supported)
if inspection_supported:
hostname = self.vm.inspection.hostname
if not hostname:
hostname = _("unknown")
@ -2514,8 +2523,9 @@ class vmmDetails(vmmGObjectUI):
self.widget("inspection-product-name").set_text(product_name)
# Applications (also inspection data)
self.widget("details-inspection-apps").set_visible(inspection_supported)
if inspection_supported:
apps = self.vm.inspection.applications or []
apps_list = self.widget("inspection-apps")
apps_model = apps_list.get_model()
apps_model.clear()