aboutsummaryrefslogtreecommitdiffstats
path: root/mail/component-factory.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-27 00:44:08 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-27 00:44:08 +0800
commit0601af063526e0b862ba15bfb55f16932b238648 (patch)
tree6f6789559f6b3f23449bfadd5a8b557ff01168de /mail/component-factory.c
parent48d1ac7ba498c7027da09a44caf003a90bf4c7b2 (diff)
downloadgsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.tar
gsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.tar.gz
gsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.tar.bz2
gsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.tar.lz
gsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.tar.xz
gsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.tar.zst
gsoc2013-evolution-0601af063526e0b862ba15bfb55f16932b238648.zip
No longer returns a gboolean and also takes a CamelException.
2001-06-26 Jeffrey Stedfast <fejj@ximian.com> * component-factory.c (message_rfc822_dnd): No longer returns a gboolean and also takes a CamelException. (destination_folder_handle_drop): Do better error checking. * folder-browser.c (my_folder_browser_init): Connect to the tree-drag-data-recieved signal. (message_list_drag_data_recieved): New function that handles the recieving end of the DnD event. (x_evolution_message_parse): New convenience function to parse the x-evolution-message type so that the cut/paste and DnD code can share it. (selection_received): Use x_evolution_message_parse(). svn path=/trunk/; revision=10502
Diffstat (limited to 'mail/component-factory.c')
-rw-r--r--mail/component-factory.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 9c375786b7..6865f829b9 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -291,19 +291,15 @@ destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *f
return TRUE;
}
-static gboolean
-message_rfc822_dnd (CamelFolder *dest, CamelStream *stream)
+static void
+message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex)
{
- gboolean retval = FALSE;
CamelMimeParser *mp;
- CamelException *ex;
mp = camel_mime_parser_new ();
camel_mime_parser_scan_from (mp, TRUE);
camel_mime_parser_init_with_stream (mp, stream);
- ex = camel_exception_new ();
-
while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) {
CamelMessageInfo *info;
CamelMimeMessage *msg;
@@ -312,25 +308,21 @@ message_rfc822_dnd (CamelFolder *dest, CamelStream *stream)
if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) {
camel_object_unref (CAMEL_OBJECT (msg));
break;
- } else {
- /* we got at least 1 message so we will return TRUE */
- retval = TRUE;
}
/* append the message to the folder... */
info = g_new0 (CamelMessageInfo, 1);
camel_folder_append_message (dest, msg, info, ex);
- camel_exception_clear (ex);
camel_object_unref (CAMEL_OBJECT (msg));
+ if (camel_exception_is_set (ex))
+ break;
+
/* skip over the FROM_END state */
camel_mime_parser_step (mp, 0, 0);
}
camel_object_unref (CAMEL_OBJECT (mp));
- camel_exception_free (ex);
-
- return retval;
}
static CORBA_boolean
@@ -345,6 +337,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
gboolean retval = FALSE;
CamelFolder *source;
CamelStream *stream;
+ CamelException ex;
GPtrArray *uids;
CamelURL *uri;
int type, fd;
@@ -358,6 +351,8 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
if (!strcmp (destination_context->dndType, accepted_dnd_types[type]))
break;
+ camel_exception_init (&ex);
+
switch (type) {
case ACCEPTED_DND_TYPE_TEXT_URI_LIST:
source = mail_tool_uri_to_folder (physical_uri, NULL);
@@ -384,11 +379,13 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
}
stream = camel_stream_fs_new_with_fd (fd);
- retval = message_rfc822_dnd (source, stream);
+ message_rfc822_dnd (source, stream, &ex);
camel_object_unref (CAMEL_OBJECT (stream));
camel_object_unref (CAMEL_OBJECT (source));
- if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE)
+ retval = !camel_exception_is_set (&ex);
+
+ if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE && retval)
unlink (url);
g_free (url);
@@ -403,7 +400,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
camel_stream_write (stream, data->bytes._buffer, data->bytes._length);
camel_stream_reset (stream);
- retval = message_rfc822_dnd (source, stream);
+ message_rfc822_dnd (source, stream, &ex);
camel_object_unref (CAMEL_OBJECT (stream));
camel_object_unref (CAMEL_OBJECT (source));
break;
@@ -450,6 +447,8 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
break;
}
+ camel_exception_clear (&ex);
+
return retval;
}