|
clipboard_copy_uris wrapped its URI text as a generic G_TYPE_STRING
provider, so targets could not request text/uri-list and file-manager
paste failed. Extracted clipboard_build_uri_provider builds a union of
two byte providers: text/uri-list (RFC 2483 CRLF-terminated URI lines,
trailing CRLF) and text/plain (newline-joined local paths, URI fallback
for non-local files). clipboard_copy_uris sets the union on the
GdkClipboard with correct refcounting (new_union steals the sub-provider
refs; clipboard takes its own ref).
Empty list returns NULL and leaves the clipboard untouched.
New integration test tests/test_clipboard.c: serializes the provider's
content per MIME type via gdk_content_provider_write_mime_type_async
into a GMemoryOutputStream and memcmps the bytes. Covers formats
(both MIME advertised, bogus type absent), single + multiple files
(exact CRLF/newline-joined bytes), empty list (no crash), and a
negative (unknown MIME rejected with GError).
|