diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-10-23 05:35:24 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-10-23 05:35:24 +0800 |
commit | 3df2a75e721ef567b873e60f40b19ee9982e211b (patch) | |
tree | 67c6314033b003ce74792b4282a763a5a68960a9 /mail | |
parent | 17dacd6a97b0a2e1548aef137a58f7281e928cfd (diff) | |
download | gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.tar gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.tar.gz gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.tar.bz2 gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.tar.lz gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.tar.xz gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.tar.zst gsoc2013-evolution-3df2a75e721ef567b873e60f40b19ee9982e211b.zip |
Removed, use em_utils_selection_get_uidlist() instead. (drop_uid_list):
2003-10-22 Jeffrey Stedfast <fejj@ximian.com>
* 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
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 15 | ||||
-rw-r--r-- | mail/em-utils.c | 7 | ||||
-rw-r--r-- | mail/mail-component.c | 44 | ||||
-rw-r--r-- | mail/message-list.c | 16 |
4 files changed, 37 insertions, 45 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index fe29a71caf..24ee52a6b0 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2003-10-22 Jeffrey Stedfast <fejj@ximian.com> + + * 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. + 2003-10-22 Ettore Perazzoli <ettore@ximian.com> * mail-component.c (impl_createControls): Use diff --git a/mail/em-utils.c b/mail/em-utils.c index 5b16d0cd7b..8df8499031 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1790,7 +1790,7 @@ em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder) * @uri: * @uids: * - * Sets a "x-evolution-message" format selection data. + * Sets a "x-uid-list" format selection data. * * FIXME: be nice if this could take a folder argument rather than uri **/ @@ -1801,8 +1801,7 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const char *uri, GPtrArra int i; /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn\0" */ - /* NB: original form missed trailing \0 */ - + g_byte_array_append(array, uri, strlen(uri)+1); for (i=0; i<uids->len; i++) @@ -1818,7 +1817,7 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const char *uri, GPtrArra * @urip: Pointer to uri string, to be free'd by caller * @uidsp: Pointer to an array of uid's. * - * Convert an x-evolution-message type to a uri and a uid list. + * Convert an x-uid-list type to a uri and a uid list. * * Return value: The number of uid's found. If 0, then @urip and * @uidsp will be empty. 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); } diff --git a/mail/message-list.c b/mail/message-list.c index 8398518810..e58ae5acfc 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -717,7 +717,7 @@ void message_list_paste(MessageList *ml) { gtk_selection_convert(ml->priv->invisible, GDK_SELECTION_CLIPBOARD, - gdk_atom_intern("x-evolution-message", FALSE), + gdk_atom_intern ("x-uid-list", FALSE), GDK_CURRENT_TIME); } @@ -1425,12 +1425,12 @@ ml_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint ti return; if (info & 2) { - /* text_plain */ + /* text/plain */ printf("setting text/plain selection for uids\n"); em_utils_selection_set_mailbox(data, ml->folder, uids); } else { - /* x-evolution-message */ - printf("setting x-evolution-message selection for uids\n"); + /* x-uid-list */ + printf("setting x-uid-list selection for uids\n"); em_utils_selection_set_uidlist(data, ml->folder_uri, uids); } } @@ -1479,7 +1479,7 @@ ml_selection_received_uidlist(MessageList *ml, GtkSelectionData *data) static void ml_selection_received(GtkWidget *widget, GtkSelectionData *data, guint time, MessageList *ml) { - if (data->target != gdk_atom_intern("x-evolution-message", FALSE)) { + if (data->target != gdk_atom_intern ("x-uid-list", FALSE)) { printf("Unknown selection received by message-list\n"); return; @@ -1489,7 +1489,7 @@ ml_selection_received(GtkWidget *widget, GtkSelectionData *data, guint time, Mes } static GtkTargetEntry ml_drag_types[] = { - { "x-evolution-message", 0, 0 }, + { "x-uid-list", 0, 0 }, { "message/rfc822", 0, 1 }, /* not included in dest types */ { "text/uri-list", 0, 2 }, @@ -1506,7 +1506,7 @@ ml_tree_drag_data_get (ETree *tree, int row, ETreePath path, int col, if (uids->len > 0) { switch (info) { - case 0 /*DND_TARGET_TYPE_X_EVOLUTION_MESSAGE*/: + case 0 /*DND_TARGET_TYPE_X_UID_LIST */: em_utils_selection_set_uidlist(data, ml->folder_uri, uids); break; case 1 /*DND_TARGET_TYPE_MESSAGE_RFC822*/: @@ -1578,7 +1578,7 @@ message_list_init (GtkObject *object) g_object_ref(p->invisible); gtk_object_sink((GtkObject *)p->invisible); - matom = gdk_atom_intern("x-evolution-message", FALSE); + matom = gdk_atom_intern ("x-uid-list", FALSE); gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, matom, 0); gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, matom, 1); gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 2); |