delete: Make it look like other UI wizards

And fix a couple UI issues:
- Hide storage list when not deleting
- Have confirmation dialog explicitly list paths we will delete (bz 967927)
This commit is contained in:
Cole Robinson 2013-09-27 10:14:53 -04:00
parent 60b7365ae9
commit 9e73d6e4f0
2 changed files with 146 additions and 144 deletions

View File

@ -1,35 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.15.4 on Fri Sep 27 10:46:11 2013 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="vmm-delete">
<property name="width_request">500</property>
<property name="height_request">300</property>
<object class="GtkWindow" id="vmm-delete">
<property name="width_request">450</property>
<property name="height_request">350</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Delete Confirmation</property>
<property name="title" translatable="yes">Delete Virtual Machine</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_vmm_delete_delete_event" swapped="no"/>
<child internal-child="vbox">
<child>
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="spacing">6</property>
<child>
<object class="GtkViewport" id="header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<property name="resize_mode">queue</property>
<child>
<object class="GtkButton" id="delete-cancel">
<property name="label">gtk-cancel</property>
<object class="GtkHBox" id="hbox77">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_delete_cancel_clicked" swapped="no"/>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="spacing">10</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">vm_delete_wizard</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
@ -38,25 +42,25 @@
</packing>
</child>
<child>
<object class="GtkButton" id="delete-ok">
<property name="label">gtk-delete</property>
<object class="GtkLabel" id="header-label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_delete_ok_clicked" swapped="no"/>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">&lt;span size='large' color='white'&gt;Placeholder&lt;/span&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
@ -64,61 +68,14 @@
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">18</property>
<child>
<object class="GtkAlignment" id="alignment1">
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">6</property>
<property name="right_padding">6</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<object class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">vm_delete_wizard</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="delete-main-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label">&lt;span size='x-large'&gt;Delete 'foo'&lt;/span&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="delete-warn-running-vm-align">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">6</property>
<property name="orientation">vertical</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkHBox" id="delete-warn-running-vm-box">
<property name="visible">True</property>
@ -150,12 +107,11 @@
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<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>
@ -165,44 +121,88 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_delete_remove_storage_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<object class="GtkScrolledWindow" id="delete-storage-scroll">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="delete-storage-list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</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">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="delete-cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_delete_cancel_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete-ok">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_delete_ok_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -215,9 +215,5 @@
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">delete-cancel</action-widget>
<action-widget response="0">delete-ok</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -59,13 +59,14 @@ class vmmDeleteDialog(vmmGObjectUI):
})
self.bind_escape_key_close()
self._init_state()
def _init_state(self):
blue = Gdk.Color.parse("#0072A8")[1]
self.widget("header").modify_bg(Gtk.StateType.NORMAL, blue)
prepare_storage_list(self.widget("delete-storage-list"))
def toggle_remove_storage(self, src):
dodel = src.get_active()
self.widget("delete-storage-list").set_sensitive(dodel)
def show(self, vm, parent):
logging.debug("Showing delete wizard")
self.vm = vm
@ -87,17 +88,17 @@ class vmmDeleteDialog(vmmGObjectUI):
self.conn = None
def reset_state(self):
# Set VM name in title'
title_str = ("<span size='x-large'>%s '%s'</span>" %
title_str = ("<span size='large' color='white'>%s '%s'</span>" %
(_("Delete"), util.xml_escape(self.vm.get_name())))
self.widget("delete-main-label").set_markup(title_str)
self.widget("header-label").set_markup(title_str)
self.widget("delete-cancel").grab_focus()
# Show warning message if VM is running
vm_active = self.vm.is_active()
self.widget("delete-warn-running-vm-box").set_visible(vm_active)
uihelpers.set_grid_row_visible(
self.widget("delete-warn-running-vm-box"), vm_active)
# Disable storage removal by default
self.widget("delete-remove-storage").set_active(True)
@ -106,6 +107,11 @@ class vmmDeleteDialog(vmmGObjectUI):
populate_storage_list(self.widget("delete-storage-list"),
self.vm, self.conn)
def toggle_remove_storage(self, src):
dodel = src.get_active()
uihelpers.set_grid_row_visible(
self.widget("delete-storage-scroll"), dodel)
def get_config_format(self):
format_combo = self.widget("vol-format")
model = format_combo.get_model()
@ -141,13 +147,13 @@ class vmmDeleteDialog(vmmGObjectUI):
devs = self.get_paths_to_delete()
if devs:
title = _("Are you sure you want to delete the storage?")
message = (_("The following paths will be deleted:\n\n%s") %
"\n".join(devs))
ret = uihelpers.chkbox_helper(self,
self.config.get_confirm_delstorage,
self.config.set_confirm_delstorage,
text1=_("Are you sure you want to delete "
"the storage?"),
text2=_("All selected storage will "
"be deleted."))
text1=title, text2=message)
if not ret:
return