2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2002 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include <gdk/gdkkeysyms.h>
24 #include <gtk/gtkvbox.h>
25 #include <gtk/gtkcontainer.h>
26 #include <gtk/gtkeditable.h>
27 #include <gtk/gtkwindow.h>
28 #include <gtk/gtktext.h>
35 #include "messageview.h"
36 #include "headerview.h"
37 #include "summaryview.h"
39 #include "imageview.h"
42 #include "procheader.h"
44 #include "prefs_common.h"
50 #include "alertpanel.h"
54 #include "stock_pixmap.h"
56 static void messageview_change_view_type(MessageView *messageview,
58 static void messageview_destroy_cb (GtkWidget *widget,
59 MessageView *messageview);
60 static void messageview_size_allocate_cb(GtkWidget *widget,
61 GtkAllocation *allocation);
62 static void key_pressed (GtkWidget *widget,
64 MessageView *messageview);
65 static void focus_in (GtkWidget *widget,
69 static void return_receipt_show (NoticeView *noticeview,
71 static void return_receipt_send_clicked (NoticeView *noticeview,
74 static PrefsAccount *select_account_from_list
77 static void messageview_menubar_cb (gpointer data,
81 static void messageview_close_cb (gpointer data,
84 static GList *msgview_list = NULL;
86 MessageView *messageview_create(MainWindow *mainwin)
88 MessageView *messageview;
90 HeaderView *headerview;
94 NoticeView *noticeview;
96 debug_print("Creating message view...\n");
97 messageview = g_new0(MessageView, 1);
99 messageview->type = MVIEW_TEXT;
101 headerview = headerview_create();
103 noticeview = noticeview_create(mainwin);
105 textview = textview_create();
106 textview->messageview = messageview;
108 imageview = imageview_create();
109 imageview->messageview = messageview;
111 mimeview = mimeview_create();
112 mimeview->textview = textview_create();
113 mimeview->textview->messageview = messageview;
114 mimeview->imageview = imageview;
115 mimeview->messageview = messageview;
117 vbox = gtk_vbox_new(FALSE, 0);
118 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(headerview),
120 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(noticeview),
122 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(textview),
125 /* to remove without destroyed */
126 gtk_widget_ref(GTK_WIDGET_PTR(textview));
127 gtk_widget_ref(GTK_WIDGET_PTR(imageview));
128 gtk_widget_ref(GTK_WIDGET_PTR(mimeview));
129 gtk_widget_ref(GTK_WIDGET_PTR(mimeview->textview));
131 messageview->vbox = vbox;
132 messageview->new_window = FALSE;
133 messageview->window = NULL;
134 messageview->headerview = headerview;
135 messageview->textview = textview;
136 messageview->imageview = imageview;
137 messageview->mimeview = mimeview;
138 messageview->noticeview = noticeview;
139 messageview->mainwin = mainwin;
144 static GtkItemFactoryEntry messageview_entries[] =
146 {N_("/_File"), NULL, NULL, 0, "<Branch>"},
147 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
148 {N_("/_File/_Close"), "<control>W", messageview_close_cb, 0, NULL},
150 {N_("/_Message"), NULL, NULL, 0, "<Branch>"},
151 {N_("/_Message/_Reply"), "<control>R", messageview_menubar_cb, COMPOSE_REPLY, NULL},
152 {N_("/_Message/Repl_y to"), NULL, NULL, 0, "<Branch>"},
153 {N_("/_Message/Repl_y to/_all"), "<shift><control>R", messageview_menubar_cb, COMPOSE_REPLY_TO_ALL, NULL},
154 {N_("/_Message/Repl_y to/_sender"), NULL, messageview_menubar_cb, COMPOSE_REPLY_TO_SENDER, NULL},
155 {N_("/_Message/Repl_y to/mailing _list"),
156 "<control>L", messageview_menubar_cb, COMPOSE_REPLY_TO_LIST, NULL},
157 /* {N_("/_Message/Follow-up and reply to"),NULL, messageview_menubar_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL}, */
158 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
159 {N_("/_Message/_Forward"), "<control><alt>F", messageview_menubar_cb, COMPOSE_FORWARD, NULL},
160 {N_("/_Message/Redirect"), NULL, messageview_menubar_cb, COMPOSE_REDIRECT, NULL},
161 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
162 {N_("/_Message/_Delete"), "<control>D", delete_msgview_cb, 0, NULL},
164 {N_("/_Help"), NULL, NULL, 0, "<Branch>"},
165 {N_("/_Help/_About"), NULL, about_show, 0, NULL}
169 GList *messageview_get_msgview_list(void)
174 void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
176 GtkWidget *handlebox;
179 guint n_menu_entries;
181 vbox = gtk_vbox_new(FALSE, 0);
182 gtk_widget_show(vbox);
183 gtk_container_add(GTK_CONTAINER(window), vbox);
185 n_menu_entries = sizeof(messageview_entries) / sizeof(messageview_entries[0]);
186 menubar = menubar_create(window, messageview_entries,
187 n_menu_entries, "<MessageView>", msgview);
188 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
190 handlebox = gtk_handle_box_new();
191 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
192 msgview->toolbar = toolbar_create(TOOLBAR_MSGVIEW, handlebox,
194 msgview->handlebox = handlebox;
195 msgview->menubar = menubar;
197 gtk_container_add(GTK_CONTAINER(vbox),
198 GTK_WIDGET_PTR(msgview));
201 MessageView *messageview_create_with_new_window(MainWindow *mainwin)
204 MessageView *msgview;
206 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
207 gtk_window_set_title(GTK_WINDOW(window), _("Sylpheed - Message View"));
208 gtk_window_set_wmclass(GTK_WINDOW(window), "message_view", "Sylpheed");
209 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
210 gtk_widget_set_usize(window, prefs_common.msgwin_width,
211 prefs_common.msgwin_height);
213 msgview = messageview_create(mainwin);
215 gtk_signal_connect(GTK_OBJECT(window), "size_allocate",
216 GTK_SIGNAL_FUNC(messageview_size_allocate_cb),
218 gtk_signal_connect(GTK_OBJECT(window), "destroy",
219 GTK_SIGNAL_FUNC(messageview_destroy_cb), msgview);
220 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
221 GTK_SIGNAL_FUNC(key_pressed), msgview);
222 gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
223 GTK_SIGNAL_FUNC(focus_in), msgview);
225 messageview_add_toolbar(msgview, window);
227 gtk_widget_grab_focus(msgview->textview->text);
228 gtk_widget_show_all(window);
230 msgview->new_window = TRUE;
231 msgview->window = window;
232 msgview->visible = TRUE;
234 toolbar_set_style(msgview->toolbar->toolbar, msgview->handlebox,
235 prefs_common.toolbar_style);
236 messageview_init(msgview);
237 msgview_list = g_list_append(msgview_list, msgview);
242 void messageview_init(MessageView *messageview)
244 headerview_init(messageview->headerview);
245 textview_init(messageview->textview);
246 imageview_init(messageview->imageview);
247 mimeview_init(messageview->mimeview);
248 /*messageview_set_font(messageview);*/
250 noticeview_hide(messageview->noticeview);
253 static void notification_convert_header(gchar *dest, gint len,
259 g_return_if_fail(src_ != NULL);
260 g_return_if_fail(dest != NULL);
264 Xstrndup_a(src, src_, len, return);
268 if (is_ascii_str(src)) {
269 strncpy2(dest, src, len);
270 dest[len - 1] = '\0';
273 conv_encode_header(dest, len, src, header_len);
276 static gint disposition_notification_queue(PrefsAccount * account,
277 gchar * to, const gchar *file)
285 debug_print("queueing message...\n");
286 g_return_val_if_fail(account != NULL, -1);
288 tmp = g_strdup_printf("%s%cqueue.%d", g_get_tmp_dir(),
289 G_DIR_SEPARATOR, (gint)file);
290 if ((fp = fopen(tmp, "wb")) == NULL) {
291 FILE_OP_ERROR(tmp, "fopen");
295 if ((src_fp = fopen(file, "rb")) == NULL) {
296 FILE_OP_ERROR(file, "fopen");
302 if (change_file_mode_rw(fp, tmp) < 0) {
303 FILE_OP_ERROR(tmp, "chmod");
304 g_warning("can't change file mode\n");
307 /* queueing variables */
308 fprintf(fp, "AF:\n");
309 fprintf(fp, "NF:0\n");
310 fprintf(fp, "PS:10\n");
311 fprintf(fp, "SRH:1\n");
312 fprintf(fp, "SFN:\n");
313 fprintf(fp, "DSR:\n");
314 fprintf(fp, "MID:\n");
315 fprintf(fp, "CFG:\n");
316 fprintf(fp, "PT:0\n");
317 fprintf(fp, "S:%s\n", account->address);
318 fprintf(fp, "RQ:\n");
319 if (account->smtp_server)
320 fprintf(fp, "SSV:%s\n", account->smtp_server);
322 fprintf(fp, "SSV:\n");
323 if (account->nntp_server)
324 fprintf(fp, "NSV:%s\n", account->nntp_server);
326 fprintf(fp, "NSV:\n");
327 fprintf(fp, "SSH:\n");
328 fprintf(fp, "R:<%s>", to);
332 while (fgets(buf, sizeof(buf), src_fp) != NULL) {
333 if (fputs(buf, fp) == EOF) {
334 FILE_OP_ERROR(tmp, "fputs");
344 if (fclose(fp) == EOF) {
345 FILE_OP_ERROR(tmp, "fclose");
351 queue = folder_get_default_queue();
352 if ((num = folder_item_add_msg(queue, tmp, TRUE)) < 0) {
353 g_warning("can't queue the message\n");
363 static gint disposition_notification_send(MsgInfo *msginfo)
366 gchar tmp[MAXPATHLEN + 1];
370 PrefsAccount *account;
374 if ((!msginfo->returnreceiptto) &&
375 (!msginfo->dispositionnotificationto))
378 /* RFC2298: Test for Return-Path */
379 if (msginfo->dispositionnotificationto)
380 to = msginfo->dispositionnotificationto;
382 to = msginfo->returnreceiptto;
384 ok = get_header_from_msginfo(msginfo, buf, sizeof(buf),
387 gchar *to_addr = g_strdup(to);
388 extract_address(to_addr);
389 extract_address(buf);
390 ok = strcmp(to_addr, buf);
393 strncpy(buf, _("<No Return-Path found>"),
400 message = g_strdup_printf(
401 _("The notification address to which the "
402 "return receipt is to be sent\n"
403 "does not correspond to the return path:\n"
404 "Notification address: %s\n"
406 "It is advised to not to send the return "
407 "receipt."), to, buf);
408 val = alertpanel(_("Warning"), message, _("Send"),
409 _("+Don't Send"), NULL);
410 if (val != G_ALERTDEFAULT)
414 ac_list = account_find_all_from_address(NULL, msginfo->to);
415 ac_list = account_find_all_from_address(ac_list, msginfo->cc);
417 if (ac_list == NULL) {
418 alertpanel_error(_("This message is asking for a return "
419 "receipt notification\n"
420 "but according to its 'To:' and 'CC:' "
421 "headers it was not\nofficially addressed "
423 "Receipt notification cancelled."));
427 if (g_list_length(ac_list) > 1)
428 account = select_account_from_list(ac_list);
430 account = (PrefsAccount *) ac_list->data;
431 g_list_free(ac_list);
436 /* write to temporary file */
437 g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg%d",
438 get_rc_dir(), G_DIR_SEPARATOR, (gint)msginfo);
440 if ((fp = fopen(tmp, "wb")) == NULL) {
441 FILE_OP_ERROR(tmp, "fopen");
445 /* chmod for security */
446 if (change_file_mode_rw(fp, tmp) < 0) {
447 FILE_OP_ERROR(tmp, "chmod");
448 g_warning("can't change file mode\n");
452 get_rfc822_date(buf, sizeof(buf));
453 fprintf(fp, "Date: %s\n", buf);
456 if (account->name && *account->name) {
457 notification_convert_header
458 (buf, sizeof(buf), account->name,
460 fprintf(fp, "From: %s <%s>\n", buf, account->address);
462 fprintf(fp, "From: %s\n", account->address);
464 fprintf(fp, "To: %s\n", to);
467 notification_convert_header(buf, sizeof(buf), msginfo->subject,
468 strlen("Subject: "));
469 fprintf(fp, "Subject: Disposition notification: %s\n", buf);
471 if (fclose(fp) == EOF) {
472 FILE_OP_ERROR(tmp, "fclose");
477 to_list = address_list_append(NULL, to);
478 ok = send_message(tmp, account, to_list);
481 if (prefs_common.queue_msg) {
486 _("Error occurred while sending the notification.\n"
487 "Put this notification into queue folder?"),
488 _("OK"), _("Cancel"), NULL);
489 if (G_ALERTDEFAULT == val) {
490 ok = disposition_notification_queue(account, to, tmp);
492 alertpanel_error(_("Can't queue the notification."));
495 alertpanel_error_log(_("Error occurred while sending the notification."));
498 if (unlink(tmp) < 0) FILE_OP_ERROR(tmp, "unlink");
503 void messageview_show(MessageView *messageview, MsgInfo *msginfo,
504 gboolean all_headers)
511 g_return_if_fail(msginfo != NULL);
512 messageview->msginfo = msginfo;
515 if ((fp = procmsg_open_message_decrypted(msginfo, &mimeinfo)) == NULL)
517 #else /* !USE_GPGME */
518 if ((fp = procmsg_open_message(msginfo)) == NULL) return;
519 mimeinfo = procmime_scan_mime_header(fp);
520 #endif /* USE_GPGME */
522 if (!mimeinfo) return;
524 file = procmsg_get_message_file_path(msginfo);
526 g_warning("can't get message file path.\n");
527 procmime_mimeinfo_free_all(mimeinfo);
531 tmpmsginfo = procheader_parse_file(file, msginfo->flags, TRUE, TRUE);
533 headerview_show(messageview->headerview, tmpmsginfo);
534 procmsg_msginfo_free(tmpmsginfo);
536 messageview->all_headers = all_headers;
537 textview_set_all_headers(messageview->textview, all_headers);
538 textview_set_all_headers(messageview->mimeview->textview, all_headers);
540 if (mimeinfo->mime_type != MIME_TEXT &&
541 mimeinfo->mime_type != MIME_TEXT_HTML) {
542 messageview_change_view_type(messageview, MVIEW_MIME);
543 mimeview_show_message(messageview->mimeview, mimeinfo, file);
545 messageview_change_view_type(messageview, MVIEW_TEXT);
546 textview_show_message(messageview->textview, mimeinfo, file);
547 procmime_mimeinfo_free_all(mimeinfo);
550 if (MSG_IS_RETRCPT_PENDING(msginfo->flags))
551 return_receipt_show(messageview->noticeview, msginfo);
553 noticeview_hide(messageview->noticeview);
558 static void messageview_change_view_type(MessageView *messageview,
561 TextView *textview = messageview->textview;
562 MimeView *mimeview = messageview->mimeview;
564 if (messageview->type == type) return;
566 if (type == MVIEW_MIME) {
567 gtkut_container_remove
568 (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)),
569 GTK_WIDGET_PTR(textview));
570 gtk_box_pack_start(GTK_BOX(messageview->vbox),
571 GTK_WIDGET_PTR(mimeview), TRUE, TRUE, 0);
572 gtk_container_add(GTK_CONTAINER(mimeview->vbox),
573 GTK_WIDGET_PTR(textview));
574 } else if (type == MVIEW_TEXT) {
575 gtkut_container_remove
576 (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)),
577 GTK_WIDGET_PTR(mimeview));
579 if (mimeview->vbox == GTK_WIDGET_PTR(textview)->parent)
580 gtkut_container_remove(GTK_CONTAINER(mimeview->vbox),
581 GTK_WIDGET_PTR(textview));
583 gtk_box_pack_start(GTK_BOX(messageview->vbox),
584 GTK_WIDGET_PTR(textview), TRUE, TRUE, 0);
588 messageview->type = type;
591 void messageview_reflect_prefs_pixmap_theme(void)
594 MessageView *msgview;
596 for (cur = msgview_list; cur != NULL; cur = cur->next) {
597 msgview = (MessageView*)cur->data;
598 toolbar_update(TOOLBAR_MSGVIEW, msgview);
602 void messageview_clear(MessageView *messageview)
604 messageview_change_view_type(messageview, MVIEW_TEXT);
605 headerview_clear(messageview->headerview);
606 textview_clear(messageview->textview);
607 imageview_clear(messageview->imageview);
608 noticeview_hide(messageview->noticeview);
611 void messageview_destroy(MessageView *messageview)
613 GtkWidget *textview = GTK_WIDGET_PTR(messageview->textview);
614 GtkWidget *imageview = GTK_WIDGET_PTR(messageview->imageview);
615 GtkWidget *mimeview = GTK_WIDGET_PTR(messageview->mimeview);
617 debug_print("destroy messageview\n");
618 headerview_destroy(messageview->headerview);
619 textview_destroy(messageview->textview);
620 imageview_destroy(messageview->imageview);
621 mimeview_destroy(messageview->mimeview);
622 noticeview_destroy(messageview->noticeview);
624 toolbar_clear_list(TOOLBAR_MSGVIEW);
625 if (messageview->toolbar) {
626 toolbar_destroy(messageview->toolbar);
627 g_free(messageview->toolbar);
630 msgview_list = g_list_remove(msgview_list, messageview);
634 gtk_widget_unref(textview);
635 gtk_widget_unref(imageview);
636 gtk_widget_unref(mimeview);
639 void messageview_quote_color_set(void)
643 void messageview_set_font(MessageView *messageview)
645 textview_set_font(messageview->textview, NULL);
648 TextView *messageview_get_current_textview(MessageView *messageview)
650 TextView *text = NULL;
652 if (messageview->type == MVIEW_TEXT)
653 text = messageview->textview;
654 else if (messageview->type == MVIEW_MIME) {
655 if (gtk_notebook_get_current_page
656 (GTK_NOTEBOOK(messageview->mimeview->notebook)) == 0)
657 text = messageview->textview;
658 else if (messageview->mimeview->type == MIMEVIEW_TEXT)
659 text = messageview->mimeview->textview;
665 void messageview_copy_clipboard(MessageView *messageview)
669 text = messageview_get_current_textview(messageview);
671 gtk_editable_copy_clipboard(GTK_EDITABLE(text->text));
674 void messageview_select_all(MessageView *messageview)
678 text = messageview_get_current_textview(messageview);
680 gtk_editable_select_region(GTK_EDITABLE(text->text), 0, -1);
683 void messageview_set_position(MessageView *messageview, gint pos)
685 textview_set_position(messageview->textview, pos);
688 gboolean messageview_search_string(MessageView *messageview, const gchar *str,
691 return textview_search_string(messageview->textview, str, case_sens);
695 gboolean messageview_search_string_backward(MessageView *messageview,
699 return textview_search_string_backward(messageview->textview,
704 gboolean messageview_is_visible(MessageView *messageview)
706 return messageview->visible;
709 static void messageview_destroy_cb(GtkWidget *widget, MessageView *messageview)
711 messageview_destroy(messageview);
714 static void messageview_size_allocate_cb(GtkWidget *widget,
715 GtkAllocation *allocation)
717 g_return_if_fail(allocation != NULL);
719 prefs_common.msgwin_width = allocation->width;
720 prefs_common.msgwin_height = allocation->height;
723 static void key_pressed(GtkWidget *widget, GdkEventKey *event,
724 MessageView *messageview)
726 if (event && event->keyval == GDK_Escape && messageview->window)
727 gtk_widget_destroy(messageview->window);
730 static void focus_in(GtkWidget *widget, GdkEventFocus *event,
733 MessageView *msgview = (MessageView*)data;
735 summary_select_by_msgnum(msgview->mainwin->summaryview,
736 msgview->msginfo->msgnum);
739 void messageview_toggle_view_real(MessageView *messageview)
741 MainWindow *mainwin = messageview->mainwin;
742 union CompositeWin *cwin = &mainwin->win;
743 GtkWidget *vpaned = NULL;
744 GtkWidget *container = NULL;
745 GtkItemFactory *ifactory = gtk_item_factory_from_widget(mainwin->menubar);
747 switch (mainwin->type) {
749 vpaned = cwin->sep_none.vpaned;
750 container = cwin->sep_none.hpaned;
752 case SEPARATE_FOLDER:
753 vpaned = cwin->sep_folder.vpaned;
754 container = mainwin->vbox_body;
756 case SEPARATE_MESSAGE:
761 if (vpaned->parent != NULL) {
762 gtk_widget_ref(vpaned);
763 gtkut_container_remove(GTK_CONTAINER(container), vpaned);
764 gtk_widget_reparent(GTK_WIDGET_PTR(messageview), container);
765 menu_set_sensitive(ifactory, "/View/Expand Summary View", FALSE);
766 gtk_widget_grab_focus(GTK_WIDGET(messageview->textview->text));
768 gtk_widget_reparent(GTK_WIDGET_PTR(messageview), vpaned);
769 gtk_container_add(GTK_CONTAINER(container), vpaned);
770 gtk_widget_unref(vpaned);
771 menu_set_sensitive(ifactory, "/View/Expand Summary View", TRUE);
772 gtk_widget_grab_focus(GTK_WIDGET(mainwin->summaryview->ctree));
776 static void return_receipt_show(NoticeView *noticeview, MsgInfo *msginfo)
778 noticeview_set_text(noticeview, _("This messages asks for a return receipt."));
779 noticeview_set_button_text(noticeview, _("Send receipt"));
780 noticeview_set_button_press_callback(noticeview,
781 GTK_SIGNAL_FUNC(return_receipt_send_clicked),
783 noticeview_show(noticeview);
786 static void return_receipt_send_clicked(NoticeView *noticeview, MsgInfo *msginfo)
791 file = procmsg_get_message_file_path(msginfo);
793 g_warning("can't get message file path.\n");
797 tmpmsginfo = procheader_parse_file(file, msginfo->flags, TRUE, TRUE);
798 tmpmsginfo->folder = msginfo->folder;
799 tmpmsginfo->msgnum = msginfo->msgnum;
801 if (disposition_notification_send(tmpmsginfo) >= 0) {
802 procmsg_msginfo_unset_flags(msginfo, MSG_RETRCPT_PENDING, 0);
803 noticeview_hide(noticeview);
806 procmsg_msginfo_free(tmpmsginfo);
810 static void select_account_cb(GtkWidget *w, gpointer data)
812 *(gint*)data = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(w)));
815 static PrefsAccount *select_account_from_list(GList *ac_list)
821 g_return_val_if_fail(ac_list != NULL, NULL);
822 g_return_val_if_fail(ac_list->data != NULL, NULL);
824 optmenu = gtk_option_menu_new();
825 menu = gtkut_account_menu_new(ac_list, select_account_cb, &account_id);
828 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
829 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
830 account_id = ((PrefsAccount *) ac_list->data)->account_id;
831 if (alertpanel_with_widget(
832 _("Return Receipt Notification"),
833 _("The message was sent to several of your "
835 "Please choose which account do you want to "
836 "use for sending the receipt notification:"),
837 _("Send Notification"), _("+Cancel"), NULL,
838 optmenu) != G_ALERTDEFAULT)
840 return account_find_from_id(account_id);
843 static void messageview_menubar_cb(gpointer data, guint action, GtkWidget *widget)
845 MessageView *msgview = (MessageView*)data;
846 MainWindow *mainwin = (MainWindow*)msgview->mainwin;
848 g_return_if_fail(mainwin != NULL);
849 reply_cb(mainwin, action, widget);
852 static void messageview_close_cb(gpointer data, guint action, GtkWidget *widget)
854 MessageView *messageview = (MessageView *)data;
856 gtk_widget_destroy(messageview->window);