aboutsummaryrefslogtreecommitdiffstats
path: root/mail/component-factory.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-19 06:28:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-19 06:28:57 +0800
commit26e2b46cf03b396eab403c740c81646811ccb5d9 (patch)
tree472b60f7677e9eb5543c8650ea38b1218b99f053 /mail/component-factory.c
parent9fd21cb07d037e290d783edb77cf6395806c2ef4 (diff)
downloadgsoc2013-evolution-26e2b46cf03b396eab403c740c81646811ccb5d9.tar.gz
gsoc2013-evolution-26e2b46cf03b396eab403c740c81646811ccb5d9.tar.zst
gsoc2013-evolution-26e2b46cf03b396eab403c740c81646811ccb5d9.zip
Use a nice switch statement and use the new enum values.
2001-06-18 Jeffrey Stedfast <fejj@ximian.com> * component-factory.c (destination_folder_handle_drop): Use a nice switch statement and use the new enum values. * mail-callbacks.c (list_add_addresses): Now takes a hash table of already-used-recipients so that we don't get duplicates. (mail_generate_reply): Pass in a rcpt_hash argument to list_add_addresses(). These changes fix bug #1639. svn path=/trunk/; revision=10282
Diffstat (limited to 'mail/component-factory.c')
-rw-r--r--mail/component-factory.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/mail/component-factory.c b/mail/component-factory.c
index fc9c3649e7..303b29f443 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -66,14 +66,28 @@ char *evolution_dir;
static BonoboGenericFactory *component_factory = NULL;
static GHashTable *storages_hash;
+enum {
+ ACCEPTED_DND_TYPE_MESSAGE_RFC822,
+ ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE,
+};
+
static char *accepted_dnd_types[] = {
"message/rfc822", /* if we drag from nautilus or something... */
"x-evolution-message", /* if we drag from an evolution message list... */
NULL
};
+enum {
+ EXPORTED_DND_TYPE_TEXT_PLAIN,
+};
+
+static char *exported_dnd_types[] = {
+ "text/plain", /* we have to export to nautilus as text/plain or a uri-list */
+ NULL
+};
+
static const EvolutionShellComponentFolderType folder_types[] = {
- { "mail", "evolution-inbox.png", accepted_dnd_types, NULL },
+ { "mail", "evolution-inbox.png", accepted_dnd_types, exported_dnd_types },
{ "mailstorage", "evolution-inbox.png", NULL, NULL },
{ "vtrash", "evolution-trash.png", NULL, NULL },
{ NULL, NULL, NULL, NULL }
@@ -256,6 +270,7 @@ get_dnd_selection (EvolutionShellComponent *shell_component,
void *closure)
{
g_print ("should get dnd selection for %s\n", physical_uri);
+
return NULL;
}
@@ -320,20 +335,21 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
const GNOME_Evolution_ShellComponentDnd_Data *data,
gpointer user_data)
{
+ char *url, *name, *in, *inptr, *inend;
gboolean retval = FALSE;
+ CamelFolder *source;
+ CamelStream *stream;
+ GPtrArray *uids;
if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK)
return FALSE; /* we can't create links */
g_print ("in destination_folder_handle_drop (%s)\n", physical_uri);
- if (data->format == 0) {
- /* message/rfc822 */
- CamelFolder *folder;
- CamelStream *stream;
-
- folder = mail_tool_uri_to_folder (physical_uri, NULL);
- if (!folder)
+ switch (data->format) {
+ case ACCEPTED_DND_TYPE_MESSAGE_RFC822:
+ source = mail_tool_uri_to_folder (physical_uri, NULL);
+ if (!source)
return FALSE;
/* write the message(s) out to a CamelStream so we can use it */
@@ -341,14 +357,11 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
camel_stream_write (stream, data->bytes._buffer, data->bytes._length);
camel_stream_reset (stream);
- retval = message_rfc822_dnd (folder, stream);
+ retval = message_rfc822_dnd (source, stream);
camel_object_unref (CAMEL_OBJECT (stream));
- } else {
- /* x-evolution-message */
- char *url, *name, *in, *inptr, *inend;
- CamelFolder *source;
- GPtrArray *uids;
-
+ camel_object_unref (CAMEL_OBJECT (source));
+ break;
+ case ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE:
/* format: "url folder_name uid1\0uid2\0uid3\0...\0uidn" */
in = data->bytes._buffer;
@@ -384,10 +397,13 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
mail_do_transfer_messages (source, uids,
action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE,
physical_uri);
+
+ camel_object_unref (CAMEL_OBJECT (source));
+ break;
+ default:
+ break;
}
- camel_object_unref (CAMEL_OBJECT (folder));
-
return retval;
}