From d652232d8564a74960b212b6a66e97d017592624 Mon Sep 17 00:00:00 2001 From: Charles Zhang Date: Tue, 23 Sep 2003 08:18:40 +0000 Subject: Add some assertion. Send Close response signal to the properties dialog 2003-09-13 Charles Zhang * e-msg-composer-attachment-bar.c (remove_attachment): Add some assertion. Send Close response signal to the properties dialog while removeing an attachment. * e-msg-composer-attachment-bar.c (remove_selected): Fix a re- remove-attachment bug. [#48466] svn path=/trunk/; revision=22656 --- composer/ChangeLog | 8 ++++++++ composer/e-msg-composer-attachment-bar.c | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index da59d41828..e66876fe19 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,11 @@ +2003-09-13 Charles Zhang + + * e-msg-composer-attachment-bar.c (remove_attachment): Add some + assertion. Send Close response signal to the properties dialog + while removeing an attachment. + * e-msg-composer-attachment-bar.c (remove_selected): Fix a re- + remove-attachment bug. [#48466] + 2003-09-18 Jeffrey Stedfast * e-msg-composer-attachment-bar.c: updated for diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c index 223c1e5fd9..1d5407bdcd 100644 --- a/composer/e-msg-composer-attachment-bar.c +++ b/composer/e-msg-composer-attachment-bar.c @@ -192,9 +192,16 @@ static void remove_attachment (EMsgComposerAttachmentBar *bar, EMsgComposerAttachment *attachment) { + g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar)); + g_return_if_fail (g_list_find (bar->priv->attachments, attachment) != NULL); + bar->priv->attachments = g_list_remove (bar->priv->attachments, attachment); bar->priv->num_attachments--; + if (attachment->editor_gui != NULL) { + GtkWidget *dialog = glade_xml_get_widget (attachment->editor_gui, "dialog"); + g_signal_emit_by_name (dialog, "response", GTK_RESPONSE_CLOSE); + } g_object_unref(attachment); @@ -336,8 +343,15 @@ remove_selected (EMsgComposerAttachmentBar *bar) p = gnome_icon_list_get_selection (icon_list); for ( ; p != NULL; p = p->next) { num = GPOINTER_TO_INT (p->data); - attachment = E_MSG_COMPOSER_ATTACHMENT (g_list_nth (bar->priv->attachments, num)->data); - attachment_list = g_list_prepend (attachment_list, attachment); + attachment = E_MSG_COMPOSER_ATTACHMENT (g_list_nth_data (bar->priv->attachments, num)); + + /* We need to check if there are duplicated index in the return list of + gnome_icon_list_get_selection() because of gnome bugzilla bug #122356. + FIXME in the future. */ + + if (g_list_find (attachment_list, attachment) == NULL) { + attachment_list = g_list_prepend (attachment_list, attachment); + } } for (p = attachment_list; p != NULL; p = p->next) -- cgit