[Spice-devel] How to drag a folder from client to guest?

Cody Chan int64ago at gmail.com
Tue Feb 25 03:04:41 PST 2014


On Tue, Feb 25, 2014 at 6:15 PM, Marc-André Lureau <mlureau at redhat.com> wrote:
>
>
> ----- Original Message -----
>> On Tue, Feb 25, 2014 at 6:03 AM, Marc-André Lureau <mlureau at redhat.com>
>> wrote:
>> > Hi
>> >
>> > ----- Original Message -----
>> >> Probably the function of copying has three defects:
>> >>
>> >> i)For some languages,there is a mis-encoding of file name
>> >> I have solved by myself...(under some circumstance)
>> >>
>> >
>> > Yeah, I remember your patch, but you didn't follow up, right? Are you still
>> > working on this?
>> Aha:) I have followed your advices, but the effect is the same with I
>> have patched
>> I don't have good environment to do more test...So I still need to
>> read source code deeply!
>>
>> >> ii)Can't drag multi-files
>> >> I'm glad to see the following in source code:
>> >>  /* At the moment, the copy() method is limited to a single file,
>> >>        support for copying multi-files will be implemented later. */
>> >>     g_return_if_fail(sources[1] == NULL);
>> >>
>> >> iii)But, it doesn't support for drag folder
>> >> Is there TODO I don't find? Or any ideas about solution?
>> >
>> >
>> > Imho, dragging files/folder shouldn't be done via a Spice "copy" protocol.
>> > Instead, Spice should learn to implement drag and drop. Afaik this should
>> > be doable, but nobody worked on it.
>>
>> Actually, I'm always curious if copying muti-files/folder can be done
>> by compressing to a zip/... before transfering ......of course, it's not a
>> cool solution...
>
> Compression can be handled by a remote filesystem protocol. Imho, we shouldn't reimplement something like scp/rsync in Spice.

yeah, BTW, in spice-gtk-0.23/gtk/channel-main.c, if I change it like
the following, then muti-files copying works!

---g_return_if_fail(sources[1] == NULL);

    if (!c->agent_connected) {
        g_simple_async_report_error_in_idle(G_OBJECT(channel),
                                            callback,
                                            user_data,
                                            SPICE_CLIENT_ERROR,
                                            SPICE_CLIENT_ERROR_FAILED,
                                            "The agent is not connected");
        return;
    }
+++ int cnt = 0;
+++ while(NULL != sources[cnt]){
    file_xfer_send_start_msg_async(channel,
 ---                              sources[0],
+++                            sources[cnt],
                                   flags,
                                   cancellable,
                                   progress_callback,
                                   progress_callback_data,
                                   callback,
                                   user_data);
+++   ++cnt;
+++}

I think it over, and don't the reason RedHat doesn't support
muti-files copying...
Further, if g_file_get_path(sources[cnt]) is a folder, I can copy all
files by DFS/BFS, then  folder copying also can be supported
Any idea?

>> > Otoh, you might be interested in the sharing folder functionality. It
>> > allows you to have a folder on the client mounted/visible directly in the
>> > guest. From there copy will work like a regular guest operation, with
>> > guest UI etc.
>>
>> Here's a  particular requirement that files can ONLY be draged from
>> local to guest......
>
> You mean currently? Yes, it's a known limitation. However, with the shared folder, you can copy to and from the client folder.
I mean this's my requirement, so the shared folder is not adaptable for me
>
>>
>> >This function is mostly ready, and I will submit a new patch this week (I'll
>> >add you in CC).
>>
>> I'm really appreciate to hear that, thx a lot:)
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>>


More information about the Spice-devel mailing list