Blame SOURCES/virt-manager-addhw-Fix-FS-UI-for-non-qemu.patch

343f27
From cc1814213ea3cf19208b950b857ba698e3ce15b1 Mon Sep 17 00:00:00 2001
343f27
From: Cole Robinson <crobinso@redhat.com>
343f27
Date: Tue, 10 Dec 2013 17:37:27 +0100
343f27
Subject: [RHEL-7.0 virt-manager PATCH] addhw: Fix FS UI for non-qemu
343f27
343f27
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1039829
343f27
343f27
(cherry picked from commit 1ce02cc7d954069ce87bc5b330dfddf8491a1121)
343f27
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
343f27
---
343f27
 ui/vmm-add-hardware.ui     | 259 +++++++++++++++++++++++----------------------
343f27
 virtManager/addhardware.py |  29 ++---
343f27
 2 files changed, 143 insertions(+), 145 deletions(-)
343f27
343f27
diff --git a/ui/vmm-add-hardware.ui b/ui/vmm-add-hardware.ui
343f27
index 875b4d7..1f1a92a 100644
343f27
--- a/ui/vmm-add-hardware.ui
343f27
+++ b/ui/vmm-add-hardware.ui
343f27
@@ -2337,29 +2337,13 @@ access in the guest.</property>
343f27
                                 <property name="can_focus">False</property>
343f27
                                 <property name="left_padding">24</property>
343f27
                                 <child>
343f27
-                                  <object class="GtkTable" id="table9">
343f27
+                                  <object class="GtkGrid" id="table9">
343f27
                                     <property name="visible">True</property>
343f27
                                     <property name="can_focus">False</property>
343f27
-                                    <property name="n_rows">4</property>
343f27
-                                    <property name="n_columns">2</property>
343f27
-                                    <property name="column_spacing">12</property>
343f27
                                     <property name="row_spacing">6</property>
343f27
+                                    <property name="column_spacing">12</property>
343f27
                                     <child>
343f27
-                                      <object class="GtkLabel" id="label18">
343f27
-                                        <property name="visible">True</property>
343f27
-                                        <property name="can_focus">False</property>
343f27
-                                        <property name="xalign">0</property>
343f27
-                                        <property name="label" translatable="yes">_Type:</property>
343f27
-                                        <property name="use_underline">True</property>
343f27
-                                        <property name="mnemonic_widget">fs-type-combo</property>
343f27
-                                      </object>
343f27
-                                      <packing>
343f27
-                                        <property name="x_options">GTK_FILL</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
-                                      </packing>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
-                                      <object class="GtkHBox" id="hbox11">
343f27
+                                      <object class="GtkHBox" id="fs-type-box">
343f27
                                         <property name="visible">True</property>
343f27
                                         <property name="can_focus">False</property>
343f27
                                         <child>
343f27
@@ -2390,28 +2374,13 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
-                                      </packing>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
-                                      <object class="GtkLabel" id="fs-mode-title">
343f27
-                                        <property name="visible">True</property>
343f27
-                                        <property name="can_focus">False</property>
343f27
-                                        <property name="xalign">0</property>
343f27
-                                        <property name="label" translatable="yes">_Mode:</property>
343f27
-                                        <property name="use_underline">True</property>
343f27
-                                        <property name="mnemonic_widget">fs-mode-combo</property>
343f27
-                                      </object>
343f27
-                                      <packing>
343f27
-                                        <property name="top_attach">1</property>
343f27
-                                        <property name="bottom_attach">2</property>
343f27
-                                        <property name="x_options">GTK_FILL</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="top_attach">0</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                     <child>
343f27
-                                      <object class="GtkHBox" id="hbox12">
343f27
+                                      <object class="GtkHBox" id="fs-mode-box">
343f27
                                         <property name="visible">True</property>
343f27
                                         <property name="can_focus">False</property>
343f27
                                         <child>
343f27
@@ -2441,30 +2410,13 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
-                                        <property name="top_attach">1</property>
343f27
-                                        <property name="bottom_attach">2</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
-                                      </packing>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
-                                      <object class="GtkLabel" id="fs-driver-title">
343f27
-                                        <property name="visible">True</property>
343f27
-                                        <property name="can_focus">False</property>
343f27
-                                        <property name="xalign">0</property>
343f27
-                                        <property name="label" translatable="yes">_Driver:</property>
343f27
-                                        <property name="use_underline">True</property>
343f27
-                                        <property name="mnemonic_widget">fs-driver-combo</property>
343f27
-                                      </object>
343f27
-                                      <packing>
343f27
                                         <property name="top_attach">2</property>
343f27
-                                        <property name="bottom_attach">3</property>
343f27
-                                        <property name="x_options">GTK_FILL</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                     <child>
343f27
-                                      <object class="GtkHBox" id="hbox15">
343f27
+                                      <object class="GtkHBox" id="fs-driver-box">
343f27
                                         <property name="visible">True</property>
343f27
                                         <property name="can_focus">False</property>
343f27
                                         <child>
343f27
@@ -2495,30 +2447,13 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
-                                        <property name="top_attach">2</property>
343f27
-                                        <property name="bottom_attach">3</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
-                                      </packing>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
-                                      <object class="GtkLabel" id="fs-wrpolicy-title">
343f27
-                                        <property name="visible">True</property>
343f27
-                                        <property name="can_focus">False</property>
343f27
-                                        <property name="xalign">0</property>
343f27
-                                        <property name="label" translatable="yes">_Write Policy:</property>
343f27
-                                        <property name="use_underline">True</property>
343f27
-                                        <property name="mnemonic_widget">fs-wrpolicy-combo</property>
343f27
-                                      </object>
343f27
-                                      <packing>
343f27
-                                        <property name="top_attach">3</property>
343f27
-                                        <property name="bottom_attach">4</property>
343f27
-                                        <property name="x_options">GTK_FILL</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="top_attach">1</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                     <child>
343f27
-                                      <object class="GtkHBox" id="hbox13">
343f27
+                                      <object class="GtkHBox" id="fs-wrpolicy-box">
343f27
                                         <property name="visible">True</property>
343f27
                                         <property name="can_focus">False</property>
343f27
                                         <child>
343f27
@@ -2548,42 +2483,9 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
                                         <property name="top_attach">3</property>
343f27
-                                        <property name="bottom_attach">4</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
-                                      </packing>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
-                                      <object class="GtkLabel" id="fs-source-title">
343f27
-                                        <property name="visible">True</property>
343f27
-                                        <property name="can_focus">False</property>
343f27
-                                        <property name="xalign">0</property>
343f27
-                                        <property name="label">src labelll:</property>
343f27
-                                        <property name="use_underline">True</property>
343f27
-                                        <property name="mnemonic_widget">fs-source</property>
343f27
-                                      </object>
343f27
-                                      <packing>
343f27
-                                        <property name="top_attach">4</property>
343f27
-                                        <property name="bottom_attach">5</property>
343f27
-                                        <property name="x_options">GTK_FILL</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
-                                      </packing>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
-                                      <object class="GtkLabel" id="label33">
343f27
-                                        <property name="visible">True</property>
343f27
-                                        <property name="can_focus">False</property>
343f27
-                                        <property name="xalign">0</property>
343f27
-                                        <property name="label" translatable="yes">Ta_rget path:</property>
343f27
-                                        <property name="use_underline">True</property>
343f27
-                                        <property name="mnemonic_widget">fs-target</property>
343f27
-                                      </object>
343f27
-                                      <packing>
343f27
-                                        <property name="top_attach">5</property>
343f27
-                                        <property name="bottom_attach">6</property>
343f27
-                                        <property name="x_options">GTK_FILL</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                     <child>
343f27
@@ -2594,10 +2496,9 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
                                         <property name="top_attach">5</property>
343f27
-                                        <property name="bottom_attach">6</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                     <child>
343f27
@@ -2612,16 +2513,12 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
                                         <property name="top_attach">6</property>
343f27
-                                        <property name="bottom_attach">7</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                     <child>
343f27
-                                      <placeholder/>
343f27
-                                    </child>
343f27
-                                    <child>
343f27
                                       <object class="GtkHBox" id="hbox16">
343f27
                                         <property name="visible">True</property>
343f27
                                         <property name="can_focus">False</property>
343f27
@@ -2656,10 +2553,120 @@ access in the guest.</property>
343f27
                                       </object>
343f27
                                       <packing>
343f27
                                         <property name="left_attach">1</property>
343f27
-                                        <property name="right_attach">2</property>
343f27
                                         <property name="top_attach">4</property>
343f27
-                                        <property name="bottom_attach">5</property>
343f27
-                                        <property name="y_options">GTK_FILL</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkLabel" id="label18">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <property name="xalign">0</property>
343f27
+                                        <property name="label" translatable="yes">_Type:</property>
343f27
+                                        <property name="use_underline">True</property>
343f27
+                                        <property name="mnemonic_widget">fs-type-combo</property>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">0</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkLabel" id="fs-mode-title">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <property name="xalign">0</property>
343f27
+                                        <property name="label" translatable="yes">_Mode:</property>
343f27
+                                        <property name="use_underline">True</property>
343f27
+                                        <property name="mnemonic_widget">fs-mode-combo</property>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">2</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkLabel" id="fs-driver-title">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <property name="xalign">0</property>
343f27
+                                        <property name="label" translatable="yes">_Driver:</property>
343f27
+                                        <property name="use_underline">True</property>
343f27
+                                        <property name="mnemonic_widget">fs-driver-combo</property>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">1</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkLabel" id="fs-wrpolicy-title">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <property name="xalign">0</property>
343f27
+                                        <property name="label" translatable="yes">_Write Policy:</property>
343f27
+                                        <property name="use_underline">True</property>
343f27
+                                        <property name="mnemonic_widget">fs-wrpolicy-combo</property>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">3</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkLabel" id="fs-source-title">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <property name="xalign">0</property>
343f27
+                                        <property name="label">src labelll:</property>
343f27
+                                        <property name="use_underline">True</property>
343f27
+                                        <property name="mnemonic_widget">fs-source</property>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">4</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkLabel" id="label33">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <property name="xalign">0</property>
343f27
+                                        <property name="label" translatable="yes">Ta_rget path:</property>
343f27
+                                        <property name="use_underline">True</property>
343f27
+                                        <property name="mnemonic_widget">fs-target</property>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">5</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
+                                      </packing>
343f27
+                                    </child>
343f27
+                                    <child>
343f27
+                                      <object class="GtkAlignment" id="alignment20">
343f27
+                                        <property name="visible">True</property>
343f27
+                                        <property name="can_focus">False</property>
343f27
+                                        <child>
343f27
+                                          <placeholder/>
343f27
+                                        </child>
343f27
+                                      </object>
343f27
+                                      <packing>
343f27
+                                        <property name="left_attach">0</property>
343f27
+                                        <property name="top_attach">6</property>
343f27
+                                        <property name="width">1</property>
343f27
+                                        <property name="height">1</property>
343f27
                                       </packing>
343f27
                                     </child>
343f27
                                   </object>
343f27
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
343f27
index f66e493..6851238 100644
343f27
--- a/virtManager/addhardware.py
343f27
+++ b/virtManager/addhardware.py
343f27
@@ -1250,30 +1250,21 @@ class vmmAddHardware(vmmGObjectUI):
343f27
         self.show_pair_combo("fs-wrpolicy", show_wrpolicy_combo)
343f27
343f27
     def change_fs_driver(self, src):
343f27
-        idx = src.get_active()
343f27
         fsdriver = None
343f27
-        modecombo = self.widget("fs-mode-combo")
343f27
-        modelabel1 = self.widget("fs-mode-title")
343f27
-        wrpcombo = self.widget("fs-wrpolicy-combo")
343f27
-        wrplabel1 = self.widget("fs-wrpolicy-title")
343f27
-
343f27
+        idx = src.get_active()
343f27
         if idx >= 0 and src.get_property("visible"):
343f27
             fsdriver = src.get_model()[idx][0]
343f27
343f27
-        if (fsdriver == virtinst.VirtualFilesystem.DRIVER_PATH or
343f27
-            fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT):
343f27
-            modecombo.set_property("visible", True)
343f27
-            modelabel1.set_property("visible", True)
343f27
-        else:
343f27
-            modecombo.set_property("visible", False)
343f27
-            modelabel1.set_property("visible", False)
343f27
+        show_mode = bool(
343f27
+            fsdriver == virtinst.VirtualFilesystem.DRIVER_PATH or
343f27
+            fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT)
343f27
+        self.widget("fs-mode-title").set_visible(show_mode)
343f27
+        self.widget("fs-mode-box").set_visible(show_mode)
343f27
343f27
-        if (fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT):
343f27
-            wrpcombo.set_property("visible", False)
343f27
-            wrplabel1.set_property("visible", False)
343f27
-        else:
343f27
-            wrpcombo.set_property("visible", True)
343f27
-            wrplabel1.set_property("visible", True)
343f27
+        show_wrpol = bool(
343f27
+            fsdriver and fsdriver != virtinst.VirtualFilesystem.DRIVER_DEFAULT)
343f27
+        self.widget("fs-wrpolicy-title").set_visible(show_wrpol)
343f27
+        self.widget("fs-wrpolicy-box").set_visible(show_wrpol)
343f27
343f27
343f27
343f27
-- 
343f27
1.8.5.2
343f27