[virt-tools-list] [PATCH virt-viewer] spice: add proxy configuration to connection file

Marc-André Lureau marcandre.lureau at gmail.com
Mon Jan 28 20:21:05 UTC 2013


---
 configure.ac                    |  2 +-
 src/virt-viewer-file.c          | 26 +++++++++++++++++++++++++-
 src/virt-viewer-session-spice.c |  6 ++++++
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 251b134..55f6ea0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ GTK2_REQUIRED="2.18.0"
 GTK3_REQUIRED="3.0"
 GTK_VNC1_REQUIRED="0.3.8"
 GTK_VNC2_REQUIRED="0.4.0"
-SPICE_GTK_REQUIRED="0.12.101"
+SPICE_GTK_REQUIRED="0.16.24"
 SPICE_PROTOCOL_REQUIRED="0.10.1"
 
 AC_MSG_CHECKING([for native Win32])
diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
index caac50f..7271156 100644
--- a/src/virt-viewer-file.c
+++ b/src/virt-viewer-file.c
@@ -92,7 +92,8 @@ enum  {
     PROP_COLOR_DEPTH,
     PROP_DISABLE_EFFECTS,
     PROP_ENABLE_USB_AUTOSHARE,
-    PROP_USB_FILTER
+    PROP_USB_FILTER,
+    PROP_PROXY,
 };
 
 VirtViewerFile*
@@ -509,6 +510,19 @@ virt_viewer_file_set_usb_filter(VirtViewerFile* self, const gchar* value)
     g_object_notify(G_OBJECT(self), "usb-filter");
 }
 
+gchar*
+virt_viewer_file_get_proxy(VirtViewerFile* self)
+{
+    return virt_viewer_file_get_string(self, "proxy");
+}
+
+void
+virt_viewer_file_set_proxy(VirtViewerFile* self, const gchar* value)
+{
+    virt_viewer_file_set_string(self, "proxy", value);
+    g_object_notify(G_OBJECT(self), "proxy");
+}
+
 static void
 spice_hotkey_set_accel(VirtViewerApp *app, const gchar *accel_path, const gchar *key)
 {
@@ -633,6 +647,9 @@ virt_viewer_file_set_property(GObject* object, guint property_id,
     case PROP_USB_FILTER:
         virt_viewer_file_set_usb_filter(self, g_value_get_string(value));
         break;
+    case PROP_PROXY:
+        virt_viewer_file_set_proxy(self, g_value_get_string(value));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
         break;
@@ -706,6 +723,9 @@ virt_viewer_file_get_property(GObject* object, guint property_id,
     case PROP_USB_FILTER:
         g_value_take_string(value, virt_viewer_file_get_usb_filter(self));
         break;
+    case PROP_PROXY:
+        g_value_take_string(value, virt_viewer_file_get_proxy(self));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
         break;
@@ -820,4 +840,8 @@ virt_viewer_file_class_init(VirtViewerFileClass* klass)
     g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_DISABLE_EFFECTS,
         g_param_spec_boxed("disable-effects", "disable-effects", "disable-effects", G_TYPE_STRV,
                            G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
+
+    g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_PROXY,
+        g_param_spec_string("proxy", "proxy", "proxy", NULL,
+                            G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
 }
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 468b8a7..80a3f34 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -302,6 +302,12 @@ fill_session(VirtViewerFile *file, SpiceSession *session)
         g_free(val);
     }
 
+    if (virt_viewer_file_is_set(file, "proxy")) {
+        gchar *val = virt_viewer_file_get_proxy(file);
+        g_object_set(G_OBJECT(session), "proxy", val, NULL);
+        g_free(val);
+    }
+
     if (virt_viewer_file_is_set(file, "enable-smartcard")) {
         g_object_set(G_OBJECT(session),
                      "enable-smartcard", virt_viewer_file_get_enable_smartcard(file), NULL);
-- 
1.8.1.1.439.g50a6b54




More information about the virt-tools-list mailing list