[virt-tools-list] [virt-manager PATCH] snapshot: start snapshot when double-click the item of snapshot list

Chen Hanxiao chen_han_xiao at 126.com
Fri Jul 29 09:44:46 UTC 2016


From: Chen Hanxiao <chenhanxiao at gmail.com>

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 ui/snapshots.ui          | 37 +++++++++++++++++++------------------
 virtManager/snapshots.py |  3 ++-
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/ui/snapshots.ui b/ui/snapshots.ui
index 0598251..673754b 100644
--- a/ui/snapshots.ui
+++ b/ui/snapshots.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.19.0 -->
 <interface>
   <requires lib="gtk+" version="3.14"/>
   <object class="GtkImage" id="image3">
@@ -51,9 +51,9 @@
                       <object class="GtkLabel" id="label2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes"><span size='large' color='white'>Create snapshot</span></property>
                         <property name="use_markup">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="expand">True</property>
@@ -94,10 +94,10 @@
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">_Name:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">snapshot-new-name</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -121,11 +121,11 @@
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
                     <property name="label" translatable="yes">_Description:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">snapshot-new-description</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -155,8 +155,8 @@
                   <object class="GtkLabel" id="label4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">Status:</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -184,8 +184,8 @@
                       <object class="GtkLabel" id="snapshot-new-status-text">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label">Shut down</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -203,9 +203,9 @@
                   <object class="GtkLabel" id="label6">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Screenshot:</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
-                    <property name="label" translatable="yes">Screenshot:</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -316,6 +316,7 @@
                     <property name="can_focus">True</property>
                     <property name="headers_visible">False</property>
                     <signal name="button-press-event" handler="on_snapshot_list_button_press_event" swapped="no"/>
+                    <signal name="row-activated" handler="on_snapshot_list_row_activated" swapped="no"/>
                     <child internal-child="selection">
                       <object class="GtkTreeSelection" id="treeview-selection">
                         <signal name="changed" handler="on_snapshot_list_changed" swapped="no"/>
@@ -355,9 +356,9 @@
                               <object class="GtkLabel" id="slabel94">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Description:</property>
                                 <property name="xalign">0</property>
                                 <property name="yalign">0</property>
-                                <property name="label" translatable="yes">Description:</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -389,8 +390,8 @@
                               <object class="GtkLabel" id="label92">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
                                 <property name="label" translatable="yes">VM State:</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -418,8 +419,8 @@
                                   <object class="GtkLabel" id="snapshot-status-text">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
                                     <property name="label">Shut down</property>
+                                    <property name="xalign">0</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
@@ -437,8 +438,8 @@
                               <object class="GtkLabel" id="label93">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Timestamp:</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -449,8 +450,8 @@
                               <object class="GtkLabel" id="snapshot-timestamp">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
                                 <property name="label">label</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -461,9 +462,9 @@
                               <object class="GtkLabel" id="snapshot-title">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
                                 <property name="label"><b>snapshot 'foo'</b></property>
                                 <property name="use_markup">True</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -475,8 +476,8 @@
                               <object class="GtkLabel" id="label5">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Snapshot Mode:</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -487,8 +488,8 @@
                               <object class="GtkLabel" id="snapshot-mode">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
                                 <property name="label" translatable="yes">label</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -499,9 +500,9 @@
                               <object class="GtkLabel" id="label7">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Screenshot:</property>
                                 <property name="xalign">0</property>
                                 <property name="yalign">0</property>
-                                <property name="label" translatable="yes">Screenshot:</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -564,9 +565,9 @@
                                   <object class="GtkLabel" id="label652">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
                                     <property name="label" translatable="yes"><small><i>This was the most recently applied snapshot.</i></small></property>
                                     <property name="use_markup">True</property>
+                                    <property name="xalign">0</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
diff --git a/virtManager/snapshots.py b/virtManager/snapshots.py
index 825ee59..ac80c5c 100644
--- a/virtManager/snapshots.py
+++ b/virtManager/snapshots.py
@@ -80,6 +80,7 @@ class vmmSnapshotPage(vmmGObjectUI):
             "on_snapshot_list_changed": self._snapshot_selected,
             "on_snapshot_list_button_press_event": self._popup_snapshot_menu,
             "on_snapshot_refresh_clicked": self._refresh_snapshots,
+            "on_snapshot_list_row_activated": self._on_start_clicked,
 
             # 'Create' dialog
             "on_snapshot_new_delete_event": self._snapshot_new_close,
@@ -606,7 +607,7 @@ class vmmSnapshotPage(vmmGObjectUI):
         self._snapshot_new.show()
         self.widget("snapshot-new-name").grab_focus()
 
-    def _on_start_clicked(self, ignore):
+    def _on_start_clicked(self, ignore, ignore2=None, ignore3=None):
         snaps = self._get_selected_snapshots()
         if not snaps or len(snaps) > 1:
             return
-- 
1.8.3.1





More information about the virt-tools-list mailing list