[virt-tools-list] [PATCH v2 4/6] ui: details: Add ui for showing attached controller devices in the future

Lin Ma lma at suse.com
Thu Nov 23 09:32:48 UTC 2017


Signed-off-by: Lin Ma <lma at suse.com>
---
 ui/details.ui          | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 virtManager/details.py | 13 +++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/ui/details.ui b/ui/details.ui
index f307f340..e6687c49 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -4990,6 +4990,54 @@ if you know what you are doing.</small></property>
                                         <property name="top_attach">1</property>
                                       </packing>
                                     </child>
+                                    <child>
+                                      <object class="GtkLabel" id="device-list-label">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="halign">start</property>
+                                        <property name="label" translatable="yes">Devices:</property>
+                                        <property name="use_markup">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">0</property>
+                                        <property name="top_attach">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkBox" id="controller-device-box">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="orientation">vertical</property>
+                                        <property name="spacing">3</property>
+                                        <child>
+                                          <object class="GtkScrolledWindow" id="controller-device-scroll">
+                                            <property name="width_request">270</property>
+                                            <property name="height_request">100</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="shadow_type">in</property>
+                                            <child>
+                                              <object class="GtkTreeView" id="controller-device-list">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <child internal-child="selection">
+                                                  <object class="GtkTreeSelection" id="controller-device-selection"/>
+                                                </child>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">True</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="top_attach">2</property>
+                                      </packing>
+                                    </child>
                                   </object>
                                 </child>
                               </object>
diff --git a/virtManager/details.py b/virtManager/details.py
index e77fa859..d67361d2 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1042,6 +1042,16 @@ class vmmDetails(vmmGObjectUI):
         uiutil.init_combo_text_column(combo, 1)
         combo.set_active(-1)
 
+        combo = self.widget("controller-device-list")
+        model = Gtk.ListStore(str)
+        combo.set_model(model)
+        combo.set_headers_visible(False)
+        col = Gtk.TreeViewColumn()
+        text = Gtk.CellRendererText()
+        col.pack_start(text, True)
+        col.add_attribute(text, 'text', 0)
+        combo.append_column(col)
+
 
     ##########################
     # Window state listeners #
@@ -2995,6 +3005,9 @@ class vmmDetails(vmmGObjectUI):
         if not controller:
             return
 
+        uiutil.set_grid_row_visible(self.widget("device-list-label"), False)
+        uiutil.set_grid_row_visible(self.widget("controller-device-box"), False)
+
         can_remove = True
         if self.vm.get_xmlobj().os.is_x86() and controller.type == "usb":
             can_remove = False
-- 
2.14.0




More information about the virt-tools-list mailing list