From 3df2a75e721ef567b873e60f40b19ee9982e211b Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 22 Oct 2003 21:35:24 +0000 Subject: Removed, use em_utils_selection_get_uidlist() instead. (drop_uid_list): 2003-10-22 Jeffrey Stedfast * mail-component.c (parse_uid_list): Removed, use em_utils_selection_get_uidlist() instead. (drop_uid_list): Use em_utils_selection_get_uidlist() to parse the x-uid-list selection data and use mail_tool_uri_to_folder() directly since we have the uri (originally we expected the first component of the selection data to be the e-storage-set-view folder path rather than the uri). (folder_receive_drop_cb): Call gtk_drag_finish() here. * message-list.c: s/x-evolution-message/x-uid-list/ * em-utils.c: Same. svn path=/trunk/; revision=23004 --- mail/mail-component.c | 44 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) (limited to 'mail/mail-component.c') diff --git a/mail/mail-component.c b/mail/mail-component.c index 908403f824..b278ecd46e 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -578,55 +578,27 @@ folder_dragged_cb (EStorageSetView *view, const char *path, GdkDragContext *cont } } -static gboolean -parse_uid_list (const char *in, int inlen, char **path, GPtrArray **uids) -{ - const char *inptr, *inend; - - inend = in + inlen; - - *path = g_strdup (in); - - *uids = g_ptr_array_new (); - - inptr = in + inlen + 1; - while (inptr < inend) { - g_ptr_array_add (*uids, g_strdup (inptr)); - inptr += strlen (inptr) + 1; - } - - if ((*uids)->len == 0) { - g_ptr_array_free (*uids, TRUE); - g_free (*path); - - return FALSE; - } - - return TRUE; -} - static void drop_uid_list (EStorageSetView *view, const char *path, gboolean move, GtkSelectionData *selection, gpointer user_data) { CamelFolder *src, *dest; CamelException ex; GPtrArray *uids; - char *src_path; + char *src_uri; - if (!parse_uid_list (selection->data, selection->length, &src_path, &uids)) - return; + em_utils_selection_get_uidlist (selection, &src_uri, &uids); camel_exception_init (&ex); - if (!(src = foo_get_folder (view, src_path, &ex))) { + if (!(src = mail_tool_uri_to_folder (src_uri, 0, &ex))) { /* FIXME: report error to user? */ camel_exception_clear (&ex); em_utils_uids_free (uids); - g_free (src_path); + g_free (src_uri); return; } - g_free (src_path); + g_free (src_uri); if (!(dest = foo_get_folder (view, path, &ex))) { /* FIXME: report error to user? */ @@ -846,22 +818,28 @@ folder_receive_drop_cb (EStorageSetView *view, const char *path, GdkDragContext case DND_DROP_TYPE_UID_LIST: /* import a list of uids from another evo folder */ drop_uid_list (view, path, move, selection, user_data); + printf ("* dropped a x-uid-list\n"); break; case DND_DROP_TYPE_FOLDER: /* rename a folder */ drop_folder (view, path, move, selection, user_data); + printf ("* dropped a x-folder\n"); break; case DND_DROP_TYPE_MESSAGE_RFC822: /* import a message/rfc822 stream */ drop_message_rfc822 (view, path, selection, user_data); + printf ("* dropped a message/rfc822\n"); break; case DND_DROP_TYPE_TEXT_URI_LIST: /* import an mbox, maildir, or mh folder? */ drop_text_uri_list (view, path, selection, user_data); + printf ("* dropped a text/uri-list\n"); break; default: g_assert_not_reached (); } + + gtk_drag_finish (context, TRUE, TRUE, time); } -- cgit