[virt-tools-list] [PATCH virt-viewer 1/6] spice: forward secure-channels

Hans de Goede hdegoede at redhat.com
Sat Apr 13 13:39:48 UTC 2013


Looks good, ACK series.

On 04/12/2013 07:23 PM, Marc-André Lureau wrote:
> This needs spice-gtk >= 0.19.7 and will warn with lower version
> ---
>   src/remote-viewer.c             |  1 +
>   src/virt-viewer-file.c          | 26 ++++++++++++++++++++++++++
>   src/virt-viewer-file.h          |  2 ++
>   src/virt-viewer-session-spice.c |  6 ++++++
>   4 files changed, 35 insertions(+)
>
> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> index 216d0d8..32336a4 100644
> --- a/src/remote-viewer.c
> +++ b/src/remote-viewer.c
> @@ -482,6 +482,7 @@ spice_ctrl_notified(SpiceCtrlController *ctrl,
>           g_str_equal(pspec->name, "color-depth") ||
>           g_str_equal(pspec->name, "disable-effects") ||
>           g_str_equal(pspec->name, "enable-usbredir") ||
> +        g_str_equal(pspec->name, "secure-channels") ||
>           g_str_equal(pspec->name, "proxy")) {
>           g_object_set_property(G_OBJECT(session), pspec->name, &value);
>       } else if (g_str_equal(pspec->name, "sport")) {
> diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
> index a1815d3..12b8c31 100644
> --- a/src/virt-viewer-file.c
> +++ b/src/virt-viewer-file.c
> @@ -60,6 +60,7 @@
>    * - disable-effects: string list
>    * - enable-usb-autoshare: int
>    * - usb-filter: string
> + * - secure-channels: string list
>    *
>    * (the file can be extended with extra groups or keys, which should
>    * be prefixed with x- to avoid later conflicts)
> @@ -99,6 +100,7 @@ enum  {
>       PROP_USB_FILTER,
>       PROP_PROXY,
>       PROP_VERSION,
> +    PROP_SECURE_CHANNELS,
>   };
>
>   VirtViewerFile*
> @@ -541,6 +543,19 @@ virt_viewer_file_set_version(VirtViewerFile* self, const gchar* value)
>       g_object_notify(G_OBJECT(self), "version");
>   }
>
> +gchar**
> +virt_viewer_file_get_secure_channels(VirtViewerFile* self, gsize* length)
> +{
> +    return virt_viewer_file_get_string_list(self, "secure-channels", length);
> +}
> +
> +void
> +virt_viewer_file_set_secure_channels(VirtViewerFile* self, const gchar* const* value, gsize length)
> +{
> +    virt_viewer_file_set_string_list(self, "secure-channels", value, length);
> +    g_object_notify(G_OBJECT(self), "secure-channels");
> +}
> +
>   static void
>   spice_hotkey_set_accel(VirtViewerApp *app, const gchar *accel_path, const gchar *key)
>   {
> @@ -690,6 +705,10 @@ virt_viewer_file_set_property(GObject* object, guint property_id,
>       case PROP_VERSION:
>           virt_viewer_file_set_version(self, g_value_get_string(value));
>           break;
> +    case PROP_SECURE_CHANNELS:
> +        strv = g_value_get_boxed(value);
> +        virt_viewer_file_set_secure_channels(self, (const gchar* const*)strv, g_strv_length(strv));
> +        break;
>       default:
>           G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
>           break;
> @@ -769,6 +788,9 @@ virt_viewer_file_get_property(GObject* object, guint property_id,
>       case PROP_VERSION:
>           g_value_take_string(value, virt_viewer_file_get_version(self));
>           break;
> +    case PROP_SECURE_CHANNELS:
> +        g_value_take_boxed(value, virt_viewer_file_get_secure_channels(self, NULL));
> +        break;
>       default:
>           G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
>           break;
> @@ -891,4 +913,8 @@ virt_viewer_file_class_init(VirtViewerFileClass* klass)
>       g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_VERSION,
>           g_param_spec_string("version", "version", "version", NULL,
>                               G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
> +
> +    g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_SECURE_CHANNELS,
> +        g_param_spec_boxed("secure-channels", "secure-channels", "secure-channels", G_TYPE_STRV,
> +                           G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
>   }
> diff --git a/src/virt-viewer-file.h b/src/virt-viewer-file.h
> index 7e26b71..7c48856 100644
> --- a/src/virt-viewer-file.h
> +++ b/src/virt-viewer-file.h
> @@ -102,6 +102,8 @@ gchar* virt_viewer_file_get_proxy(VirtViewerFile* self);
>   void virt_viewer_file_set_proxy(VirtViewerFile* self, const gchar* value);
>   gchar* virt_viewer_file_get_version(VirtViewerFile* self);
>   void virt_viewer_file_set_version(VirtViewerFile* self, const gchar* value);
> +gchar** virt_viewer_file_get_secure_channels(VirtViewerFile* self, gsize* length);
> +void virt_viewer_file_set_secure_channels(VirtViewerFile* self, const gchar* const* value, gsize length);
>
>   G_END_DECLS
>
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index 8bdf0bd..73af8ce 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -335,6 +335,12 @@ fill_session(VirtViewerFile *file, SpiceSession *session)
>           g_object_set(G_OBJECT(gtk), "auto-usbredir", enabled, NULL);
>       }
>
> +    if (virt_viewer_file_is_set(file, "secure-channels")) {
> +        gchar **channels = virt_viewer_file_get_secure_channels(file, NULL);
> +        g_object_set(G_OBJECT(session), "secure-channels", channels, NULL);
> +        g_strfreev(channels);
> +    }
> +
>       if (virt_viewer_file_is_set(file, "disable-channels")) {
>           DEBUG_LOG("FIXME: disable-channels is not supported atm");
>       }
>




More information about the virt-tools-list mailing list