[virt-tools-list] [PATCHv3 virt-viewer 05/10] spice: enable/disable share folder

Fabiano Fidêncio fabiano at fidencio.org
Thu Mar 5 20:19:49 UTC 2015


On Thu, Mar 5, 2015 at 8:12 PM, Marc-André Lureau
<marcandre.lureau at gmail.com> wrote:
> Connect/disconnect webdav channel to enable or disable sharing folder
> ---
>  src/virt-viewer-session-spice.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index 4414212..8d60335 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -961,6 +961,30 @@ name_changed(GObject *gobject G_GNUC_UNUSED,
>      g_free(name);
>  }
>
> +static void
> +update_share_folder(VirtViewerSessionSpice *self)
> +{
> +    gboolean share;
> +    SpiceSession *session = self->priv->session;
> +
> +    g_object_get(self, "share-folder", &share, NULL);
> +
> +    GList *l, *channels = spice_session_get_channels(session);

Hmm. As you took the suggestions about moving the declarations to be
beginning of the function, please, move this one as well.
(Yeah, yeah, I know about c99 :-p)

> +    for (l = channels; l != NULL; l = l->next) {
> +        SpiceChannel *channel = l->data;
> +
> +        if (!SPICE_IS_WEBDAV_CHANNEL(channel))
> +            continue;
> +
> +        if (share)
> +            spice_channel_connect(channel);
> +        else
> +            spice_channel_disconnect(channel, SPICE_CHANNEL_NONE);
> +    }
> +
> +    g_list_free(channels);
> +}
> +
>  VirtViewerSession *
>  virt_viewer_session_spice_new(VirtViewerApp *app, GtkWindow *main_window)
>  {
> @@ -980,6 +1004,9 @@ virt_viewer_session_spice_new(VirtViewerApp *app, GtkWindow *main_window)
>                                        G_CALLBACK(uuid_changed), self, 0);
>      virt_viewer_signal_connect_object(self->priv->session, "notify::name",
>                                        G_CALLBACK(name_changed), self, 0);
> +    virt_viewer_signal_connect_object(self, "notify::share-folder",
> +                                      G_CALLBACK(update_share_folder), self,
> +                                      G_CONNECT_SWAPPED);
>
>      g_object_bind_property(self->priv->session, "shared-dir",
>                             self, "shared-folder",
> --
> 2.1.0
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list



-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list