[virt-tools-list] [PATCH 1/4] addhardware: allow setting the char device target name

Marc-André Lureau marcandre.lureau at redhat.com
Mon Apr 4 23:35:31 UTC 2011


---
 src/virtManager/addhardware.py |    5 +++++
 src/vmm-add-hardware.glade     |   30 +++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py
index a8ceb78..91ece33 100644
--- a/src/virtManager/addhardware.py
+++ b/src/virtManager/addhardware.py
@@ -54,6 +54,7 @@ char_widget_mappings = {
     "bind_port" : "char-bind-port",
     "bind_host" : "char-bind-host",
     "protocol"  : "char-use-telnet",
+    "target_name" : "char-target-name",
 }
 
 def get_list_selection(widget):
@@ -117,6 +118,7 @@ class vmmAddHardware(vmmGObjectUI):
             "char_host_focus_in": (self.update_doc, "source_host"),
             "char_bind_host_focus_in": (self.update_doc, "bind_host"),
             "char_telnet_focus_in": (self.update_doc, "protocol"),
+            "char_name_focus_in": (self.update_doc, "target_name"),
             })
         util.bind_escape_key_close(self)
 
@@ -443,6 +445,7 @@ class vmmAddHardware(vmmGObjectUI):
         self.window.get_widget("char-bind-host").set_text("127.0.0.1")
         self.window.get_widget("char-bind-port").get_adjustment().value = 4556
         self.window.get_widget("char-use-telnet").set_active(False)
+        self.window.get_widget("char-target-name").set_text("com.redhat.spice.0")
 
         # Hide all notebook pages, so the wizard isn't as big as the largest
         # page
@@ -1143,6 +1146,7 @@ class vmmAddHardware(vmmGObjectUI):
         bind_host = self.window.get_widget("char-bind-host").get_text()
         source_port = self.window.get_widget("char-port").get_adjustment().value
         bind_port = self.window.get_widget("char-bind-port").get_adjustment().value
+        target_name = self.window.get_widget("char-target-name").get_text()
 
         if self.window.get_widget("char-use-telnet").get_active():
             protocol = VirtualCharDevice.CHAR_PROTOCOL_TELNET
@@ -1156,6 +1160,7 @@ class vmmAddHardware(vmmGObjectUI):
             "bind_port": bind_port,
             "bind_host": bind_host,
             "protocol": protocol,
+            "target_name": target_name,
         }
 
         try:
diff --git a/src/vmm-add-hardware.glade b/src/vmm-add-hardware.glade
index bbd3a42..c5087a1 100644
--- a/src/vmm-add-hardware.glade
+++ b/src/vmm-add-hardware.glade
@@ -1504,7 +1504,7 @@ to connect to the virtual machine.</property>
                                                 <child>
                                                   <widget class="GtkTable" id="char-param-table">
                                                     <property name="visible">True</property>
-                                                    <property name="n_rows">5</property>
+                                                    <property name="n_rows">6</property>
                                                     <property name="n_columns">2</property>
                                                     <property name="column_spacing">8</property>
                                                     <property name="row_spacing">8</property>
@@ -1520,6 +1520,34 @@ to connect to the virtual machine.</property>
                                                       </packing>
                                                     </child>
                                                     <child>
+                                                      <widget class="GtkEntry" id="char-target-name">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">True</property>
+                                                        <signal name="focus_in_event" handler="char_name_focus_in"/>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="left_attach">1</property>
+                                                        <property name="right_attach">2</property>
+                                                        <property name="top_attach">5</property>
+                                                        <property name="bottom_attach">6</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="target-name-label">
+                                                        <property name="visible">True</property>
+                                                        <property name="xalign">0</property>
+                                                        <property name="label" translatable="yes">Name:</property>
+                                                        <property name="use_underline">True</property>
+                                                        <property name="mnemonic_widget">char-use-telnet</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="top_attach">5</property>
+                                                        <property name="bottom_attach">6</property>
+                                                        <property name="x_options">GTK_FILL</property>
+                                                        <property name="y_options"></property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
                                                       <widget class="GtkCheckButton" id="char-use-telnet">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">True</property>
-- 
1.7.4




More information about the virt-tools-list mailing list