mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
details: Add a cancel button for undo-ing hw edits
Next we introduce a dialog warning the user they have unapplied HW edits. This gives them a way to undo edits without having to force encounter the dialog.
This commit is contained in:
parent
297afef5f5
commit
b14a44bf62
@ -431,6 +431,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
EDIT_SMARTCARD_MODE),
|
||||
|
||||
"on_config_apply_clicked": self.config_apply,
|
||||
"on_config_cancel_clicked": self.config_cancel,
|
||||
|
||||
"on_details_help_activate": self.show_help,
|
||||
|
||||
@ -1539,10 +1540,12 @@ class vmmDetails(vmmGObjectUI):
|
||||
def disable_apply(self):
|
||||
self.active_edits = []
|
||||
self.widget("config-apply").set_sensitive(False)
|
||||
self.widget("config-cancel").set_sensitive(False)
|
||||
|
||||
def enable_apply(self, *arglist):
|
||||
edittype = arglist[-1]
|
||||
self.widget("config-apply").set_sensitive(True)
|
||||
self.widget("config-cancel").set_sensitive(True)
|
||||
if edittype not in self.active_edits:
|
||||
self.active_edits.append(edittype)
|
||||
|
||||
@ -1729,6 +1732,10 @@ class vmmDetails(vmmGObjectUI):
|
||||
# Details/Hardware config changes (apply button) #
|
||||
##################################################
|
||||
|
||||
def config_cancel(self, ignore):
|
||||
# Remove current changes and deactive 'apply' button
|
||||
self.hw_selected()
|
||||
|
||||
def config_apply(self, ignore):
|
||||
pagetype = self.get_hw_selection(HW_LIST_COL_TYPE)
|
||||
devobj = self.get_hw_selection(HW_LIST_COL_DEVICE)
|
||||
|
@ -5817,6 +5817,21 @@ I/O:</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="config-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_config_cancel_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="config-apply">
|
||||
<property name="label">gtk-apply</property>
|
||||
@ -5831,7 +5846,7 @@ I/O:</property>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user