diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-07-18 04:45:57 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-07-18 04:45:57 +0800 |
commit | bbfb9268af8e5d8c5a0ac346ba13efc00783d46c (patch) | |
tree | 5a1dbb6d08fb030995efa38c13edd985046dc1cb /mail/folder-browser.c | |
parent | c1f19b88db7658700348d91b4e2310cb8502b5ea (diff) | |
download | gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.gz gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.tar.zst gsoc2013-evolution-bbfb9268af8e5d8c5a0ac346ba13efc00783d46c.zip |
Fix to correctly handle text/uri-lists that contain more than a single
2001-07-17 Jeffrey Stedfast <fejj@ximian.com>
* folder-browser.c (message_list_drag_data_recieved): Fix to
correctly handle text/uri-lists that contain more than a single
url.
* component-factory.c (destination_folder_handle_drop): Fix to
correctly handle text/uri-lists that contain more than a single
url.
svn path=/trunk/; revision=11174
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index d0662b0266..12af53f9e2 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -427,44 +427,49 @@ message_list_drag_data_recieved (ETree *tree, int row, ETreePath path, int col, { FolderBrowser *fb = FOLDER_BROWSER (user_data); CamelFolder *folder = NULL; + char *tmp, *url, **urls; GPtrArray *uids = NULL; CamelStream *stream; CamelException ex; - char *inend, *url; CamelURL *uri; - int fd; + int i, fd; camel_exception_init (&ex); switch (info) { case DND_TARGET_TYPE_TEXT_URI_LIST: - url = g_strndup (selection_data->data, selection_data->length); - inend = strchr (url, '\n'); - if (inend) - *inend = '\0'; + tmp = g_strndup (selection_data->data, selection_data->length); + urls = g_strsplit (tmp, "\n", 0); + g_free (tmp); - /* get the path component */ - g_strstrip (url); - uri = camel_url_new (url, NULL); - g_free (url); - url = uri->path; - uri->path = NULL; - camel_url_free (uri); - - fd = open (url, O_RDONLY); - if (fd == -1) { + for (i = 0; urls[i] != NULL; i++) { + /* get the path component */ + url = g_strstrip (urls[i]); + + uri = camel_url_new (url, NULL); + g_free (url); + url = uri->path; + uri->path = NULL; + camel_url_free (uri); + + fd = open (url, O_RDONLY); + if (fd == -1) { + g_free (url); + /* FIXME: okay, what do we do in this case? */ + continue; + } + + stream = camel_stream_fs_new_with_fd (fd); + message_rfc822_dnd (fb->folder, stream, &ex); + camel_object_unref (CAMEL_OBJECT (stream)); + + if (context->action == GDK_ACTION_MOVE && !camel_exception_is_set (&ex)) + unlink (url); + g_free (url); - goto fail; } - stream = camel_stream_fs_new_with_fd (fd); - message_rfc822_dnd (fb->folder, stream, &ex); - camel_object_unref (CAMEL_OBJECT (stream)); - - if (context->action == GDK_ACTION_MOVE && !camel_exception_is_set (&ex)) - unlink (url); - - g_free (url); + g_free (urls); break; case DND_TARGET_TYPE_MESSAGE_RFC822: /* write the message(s) out to a CamelStream so we can use it */ |