aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-18 04:31:37 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-18 04:31:37 +0800
commitc1f19b88db7658700348d91b4e2310cb8502b5ea (patch)
treebf778bcfc99b506c2959662e00c8513e748eb170 /composer/e-msg-composer.c
parent9d61de761d94349b018d9ce559611c373dbbeb80 (diff)
downloadgsoc2013-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
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c49
1 files changed, 25 insertions, 24 deletions
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;