diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-07-18 04:31:37 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-07-18 04:31:37 +0800 |
commit | c1f19b88db7658700348d91b4e2310cb8502b5ea (patch) | |
tree | bf778bcfc99b506c2959662e00c8513e748eb170 | |
parent | 9d61de761d94349b018d9ce559611c373dbbeb80 (diff) | |
download | gsoc2013-evolution-c1f19b88db7658700348d91b4e2310cb8502b5ea.tar.gz gsoc2013-evolution-c1f19b88db7658700348d91b4e2310cb8502b5ea.tar.zst gsoc2013-evolution-c1f19b88db7658700348d91b4e2310cb8502b5ea.zip |
Correctly handle text/uri-list's that contain more than a single file
2001-07-17 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (drag_data_received): Correctly handle
text/uri-list's that contain more than a single file reference.
svn path=/trunk/; revision=11173
-rw-r--r-- | composer/ChangeLog | 5 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 49 |
2 files changed, 30 insertions, 24 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index a9f13303b8..4a2cf3b2a4 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,8 @@ +2001-07-17 Jeffrey Stedfast <fejj@ximian.com> + + * e-msg-composer.c (drag_data_received): Correctly handle + text/uri-list's that contain more than a single file reference. + 2001-07-12 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (menu_changed_charset_cb): Removed a warning diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 767e166144..4ae4256881 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -2010,17 +2010,14 @@ message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream) } static void -drag_data_received (EMsgComposer *composer, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection, - guint info, - guint time) -{ - gchar *temp, *filename; +drag_data_received (EMsgComposer *composer, GdkDragContext *context, + gint x, gint y, GtkSelectionData *selection, + guint info, guint time) +{ + gchar *tmp, *filename, **filenames; CamelStream *stream; CamelURL *url; + int i; switch (info) { case DND_TYPE_MESSAGE_RFC822: @@ -2033,23 +2030,27 @@ drag_data_received (EMsgComposer *composer, camel_object_unref (CAMEL_OBJECT (stream)); break; case DND_TYPE_TEXT_URI_LIST: - filename = g_strndup (selection->data, selection->length); - temp = strchr (filename, '\n'); - if (temp) - *temp = '\0'; - g_strstrip (filename); + tmp = g_strndup (selection->data, selection->length); + filenames = g_strsplit (tmp, "\n", 0); + g_free (tmp); - url = camel_url_new (filename, NULL); - g_free (filename); - filename = url->path; - url->path = NULL; - camel_url_free (url); - - e_msg_composer_attachment_bar_attach - (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), - filename); + for (i = 0; filenames[i] != NULL; i++) { + filename = g_strstrip (filenames[i]); + + url = camel_url_new (filename, NULL); + g_free (filename); + filename = url->path; + url->path = NULL; + camel_url_free (url); + + e_msg_composer_attachment_bar_attach + (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), + filename); + + g_free (filename); + } - g_free (filename); + g_free (filenames); break; default: break; |