diff options
author | Not Zed <NotZed@Ximian.com> | 2004-01-29 14:26:30 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-01-29 14:26:30 +0800 |
commit | a59ee4cd30692aa5d653ad9f3deccb306c583a7d (patch) | |
tree | 68137535a21f81ab5724a42dea0a097aa452b9a3 /mail | |
parent | 3629f67f594ac7d21a777f01317cf2cb95774588 (diff) | |
download | gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.tar gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.tar.gz gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.tar.bz2 gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.tar.lz gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.tar.xz gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.tar.zst gsoc2013-evolution-a59ee4cd30692aa5d653ad9f3deccb306c583a7d.zip |
** See bug #53320 and probably others
2004-01-29 Not Zed <NotZed@Ximian.com>
** See bug #53320 and probably others
* message-list.c (message_list_set_folder): NULL out
message_list->folder when we clear it so it isn't left for another
free when we switch again.
2004-01-29 Not Zed <NotZed@Ximian.com>
** See bug #52190.
* message-list.c: Added folder/folder uri to the data stored for
primary/secondary selection, uses a struct to store the data now.
This is needed so when you cut/copy messages, and paste them, it
doesn't end up 'pasting' the messages from the current folder, but
from the one where the copy/cut took place.
(clear_selection): helper to free data inside selection struct.
2004-01-29 Not Zed <NotZed@Ximian.com>
** See bug #53506.
* mail-tools.c (mail_tools_folder_to_url): use a camelurl to do
this properly, and handle fragment folder-paths.
* em-composer-utils.c (em_utils_composer_send_cb): removed
outbox_folder local, not necessary.
svn path=/trunk/; revision=24511
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 29 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 3 | ||||
-rw-r--r-- | mail/mail-tools.c | 36 | ||||
-rw-r--r-- | mail/message-list.c | 80 |
4 files changed, 94 insertions, 54 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 31173327ba..1151a322d7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,32 @@ +2004-01-29 Not Zed <NotZed@Ximian.com> + + ** See bug #53320 and probably others + + * message-list.c (message_list_set_folder): NULL out + message_list->folder when we clear it so it isn't left for another + free when we switch again. + +2004-01-29 Not Zed <NotZed@Ximian.com> + + ** See bug #52190. + + * message-list.c: Added folder/folder uri to the data stored for + primary/secondary selection, uses a struct to store the data now. + This is needed so when you cut/copy messages, and paste them, it + doesn't end up 'pasting' the messages from the current folder, but + from the one where the copy/cut took place. + (clear_selection): helper to free data inside selection struct. + +2004-01-29 Not Zed <NotZed@Ximian.com> + + ** See bug #53506. + + * mail-tools.c (mail_tools_folder_to_url): use a camelurl to do + this properly, and handle fragment folder-paths. + + * em-composer-utils.c (em_utils_composer_send_cb): removed + outbox_folder local, not necessary. + 2004-01-28 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree-model.c (em_folder_tree_model_add_store): If the diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index b31ee4f9ee..6694b77403 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -390,7 +390,6 @@ got_post_folder (char *uri, CamelFolder *folder, void *data) void em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data) { - CamelFolder *outbox_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX); CamelMimeMessage *message; CamelMessageInfo *info; struct _send_data *send; @@ -408,7 +407,7 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data) postlist = g_list_next (postlist); } - mail_folder = outbox_folder; + mail_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX); camel_object_ref (mail_folder); if (!post_folders && !mail_folder) diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 0a16a27e0f..2e797f2ee5 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -363,7 +363,6 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) return folder; } - /** * mail_tools_x_evolution_message_parse: * @in: GtkSelectionData->data @@ -405,25 +404,26 @@ mail_tools_x_evolution_message_parse (char *in, unsigned int inlen, GPtrArray ** return folder; } - char * mail_tools_folder_to_url (CamelFolder *folder) { - char *service_url, *url; - const char *full_name; - CamelService *service; - + CamelURL *url; + char *out; + g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL); - - full_name = folder->full_name; - while (*full_name == '/') - full_name++; - - service = (CamelService *) folder->parent_store; - service_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL); - url = g_strdup_printf ("%s%s%s", service_url, service_url[strlen (service_url)-1] != '/' ? "/" : "", - full_name); - g_free (service_url); - - return url; + + url = camel_url_copy(((CamelService *)folder->parent_store)->url); + if (((CamelService *)folder->parent_store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) { + camel_url_set_fragment(url, folder->full_name); + } else { + char *name = g_alloca(strlen(folder->full_name)+2); + + sprintf(name, "/%s", folder->full_name); + camel_url_set_path(url, name); + } + + out = camel_url_to_string(url, CAMEL_URL_HIDE_ALL); + camel_url_free(url); + + return out; } diff --git a/mail/message-list.c b/mail/message-list.c index 745b637fd8..fe3147f70e 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -88,11 +88,17 @@ #define d(x) #define t(x) +struct _MLSelection { + GPtrArray *uids; + CamelFolder *folder; + char *folder_uri; +}; + struct _MessageListPrivate { GtkWidget *invisible; /* 4 selection */ - GPtrArray *primary_uids; /* uids in primary selection */ - GPtrArray *clipboard_uids; /* uids in clipboard selection */ + struct _MLSelection primary; + struct _MLSelection clipboard; }; /* @@ -462,6 +468,20 @@ search_func (ETreeModel *model, ETreePath path, struct search_func_data *data) return FALSE; } +static void +clear_selection(MessageList *ml, struct _MLSelection *selection) +{ + if (selection->uids) { + message_list_free_uids(ml, selection->uids); + selection->uids = NULL; + } + if (selection->folder) { + camel_object_unref(selection->folder); + selection->folder = NULL; + } + g_free(selection->folder_uri); + selection->folder_uri = NULL; +} /** * message_list_select: @@ -686,10 +706,7 @@ message_list_copy(MessageList *ml, gboolean cut) struct _MessageListPrivate *p = ml->priv; GPtrArray *uids; - if (p->clipboard_uids) { - message_list_free_uids(ml, p->clipboard_uids); - p->clipboard_uids = NULL; - } + clear_selection(ml, &p->clipboard); uids = message_list_get_selected(ml); @@ -706,7 +723,10 @@ message_list_copy(MessageList *ml, gboolean cut) camel_folder_thaw(ml->folder); } - p->clipboard_uids = uids; + p->clipboard.uids = uids; + p->clipboard.folder = ml->folder; + camel_object_ref(p->clipboard.folder); + p->clipboard.folder_uri = g_strdup(ml->folder_uri); gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); } else { message_list_free_uids(ml, uids); @@ -717,7 +737,7 @@ message_list_copy(MessageList *ml, gboolean cut) gboolean message_list_has_primary_selection(MessageList *ml) { - return ml->priv->primary_uids != NULL; + return ml->priv->primary.uids != NULL; } void @@ -1426,24 +1446,24 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) static void ml_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, MessageList *ml) { - GPtrArray *uids; + struct _MLSelection *selection; if (info & 1) - uids = ml->priv->primary_uids; + selection = &ml->priv->primary; else - uids = ml->priv->clipboard_uids; + selection = &ml->priv->clipboard; - if (uids == NULL) + if (selection->uids == NULL) return; if (info & 2) { /* text/plain */ printf("setting text/plain selection for uids\n"); - em_utils_selection_set_mailbox(data, ml->folder, uids); + em_utils_selection_set_mailbox(data, selection->folder, selection->uids); } else { /* x-uid-list */ printf("setting x-uid-list selection for uids\n"); - em_utils_selection_set_uidlist(data, ml->folder_uri, uids); + em_utils_selection_set_uidlist(data, selection->folder_uri, selection->uids); } } @@ -1452,17 +1472,10 @@ ml_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, MessageLis { struct _MessageListPrivate *p = ml->priv; - if (event->selection == GDK_SELECTION_PRIMARY) { - if (p->primary_uids) { - message_list_free_uids(ml, p->primary_uids); - p->primary_uids = NULL; - } - } else if (event->selection == GDK_SELECTION_CLIPBOARD) { - if (p->clipboard_uids) { - message_list_free_uids(ml, p->clipboard_uids); - p->clipboard_uids = NULL; - } - } + if (event->selection == GDK_SELECTION_PRIMARY) + clear_selection(ml, &p->primary); + else if (event->selection == GDK_SELECTION_CLIPBOARD) + clear_selection(ml, &p->clipboard); } static void @@ -1690,10 +1703,8 @@ message_list_finalise (GObject *object) g_free(message_list->folder_uri); message_list->folder_uri = NULL; - if (p->primary_uids) - message_list_free_uids(message_list, p->primary_uids); - if (p->clipboard_uids) - message_list_free_uids(message_list, p->clipboard_uids); + clear_selection(message_list, &p->primary); + clear_selection(message_list, &p->clipboard); g_free(p); @@ -2553,6 +2564,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c camel_object_unhook_event((CamelObject *)message_list->folder, "message_changed", message_changed, message_list); camel_object_unref (message_list->folder); + message_list->folder = NULL; } if (message_list->thread_tree) { @@ -2675,13 +2687,13 @@ on_selection_changed_cmd(ETree *tree, MessageList *ml) if (!ml->idle_id) ml->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, ml, NULL); - if (ml->priv->primary_uids) { - message_list_free_uids(ml, ml->priv->primary_uids); - ml->priv->primary_uids = NULL; - } + clear_selection(ml, &ml->priv->primary); if (uids->len > 0) { - ml->priv->primary_uids = uids; + ml->priv->primary.uids = uids; + ml->priv->primary.folder = ml->folder; + camel_object_ref(ml->priv->primary.folder); + ml->priv->primary.folder_uri = g_strdup(ml->folder_uri); gtk_selection_owner_set(ml->priv->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time()); } else { message_list_free_uids(ml, uids); |