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/gtkmain.h>
25 #include <gtk/gtkwindow.h>
26 #include <gtk/gtkwidget.h>
27 #include <gtk/gtksignal.h>
28 #include <gtk/gtkvbox.h>
29 #include <gtk/gtkcontainer.h>
30 #include <gtk/gtkstatusbar.h>
31 #include <gtk/gtkprogressbar.h>
32 #include <gtk/gtkhpaned.h>
33 #include <gtk/gtkvpaned.h>
34 #include <gtk/gtkcheckmenuitem.h>
35 #include <gtk/gtkitemfactory.h>
36 #include <gtk/gtkeditable.h>
37 #include <gtk/gtkmenu.h>
38 #include <gtk/gtkmenuitem.h>
39 #include <gtk/gtkhandlebox.h>
40 #include <gtk/gtktoolbar.h>
41 #include <gtk/gtkbutton.h>
46 #include "mainwindow.h"
47 #include "folderview.h"
48 #include "foldersel.h"
49 #include "summaryview.h"
50 #include "summary_search.h"
51 #include "messageview.h"
52 #include "message_search.h"
53 #include "headerview.h"
55 #include "stock_pixmap.h"
62 #include "prefs_common.h"
63 #include "prefs_filter.h"
64 #include "prefs_actions.h"
65 #include "prefs_filtering.h"
66 #include "prefs_scoring.h"
67 #include "prefs_account.h"
68 #include "prefs_folder_item.h"
69 #include "prefs_summary_column.h"
70 #include "prefs_template.h"
72 #include "addressbook.h"
73 #include "logwindow.h"
74 #include "manage_window.h"
75 #include "alertpanel.h"
76 #include "statusbar.h"
77 #include "inputdialog.h"
84 #include "selective_download.h"
86 #define AC_LABEL_WIDTH 240
88 #define STATUSBAR_PUSH(mainwin, str) \
90 gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar), \
91 mainwin->mainwin_cid, str); \
92 gtkut_widget_wait_for_draw(mainwin->hbox_stat); \
95 #define STATUSBAR_POP(mainwin) \
97 gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar), \
98 mainwin->mainwin_cid); \
101 /* list of all instantiated MainWindow */
102 static GList *mainwin_list = NULL;
104 static GdkCursor *watch_cursor;
106 static void main_window_menu_callback_block (MainWindow *mainwin);
107 static void main_window_menu_callback_unblock (MainWindow *mainwin);
109 static void main_window_show_cur_account (MainWindow *mainwin);
111 static void main_window_set_widgets (MainWindow *mainwin,
113 static void main_window_toolbar_create (MainWindow *mainwin,
114 GtkWidget *container);
116 /* callback functions */
117 static void toolbar_inc_cb (GtkWidget *widget,
119 static void toolbar_inc_all_cb (GtkWidget *widget,
121 static void toolbar_send_cb (GtkWidget *widget,
124 static void toolbar_compose_cb (GtkWidget *widget,
126 static void toolbar_compose_news_cb (GtkWidget *widget,
128 static void toolbar_compose_mail_cb (GtkWidget *widget,
130 static void toolbar_reply_cb (GtkWidget *widget,
132 static void toolbar_reply_popup_cb (GtkWidget *widget,
133 GdkEventButton *event,
135 static void toolbar_reply_popup_closed_cb(GtkMenuShell *menu_shell,
137 static void toolbar_reply_to_all_cb (GtkWidget *widget,
139 static void toolbar_reply_to_all_popup_cb(GtkWidget *widget,
140 GdkEventButton *event,
142 static void toolbar_reply_to_all_popup_closed_cb(GtkMenuShell *menu_shell,
144 static void toolbar_reply_to_sender_cb (GtkWidget *widget,
146 static void toolbar_reply_to_sender_popup_cb(GtkWidget *widget,
147 GdkEventButton *event,
149 static void toolbar_reply_to_sender_popup_closed_cb(GtkMenuShell *menu_shell,
151 static void toolbar_forward_cb (GtkWidget *widget,
153 static void toolbar_forward_popup_cb (GtkWidget *widget,
154 GdkEventButton *event,
156 static void toolbar_forward_popup_closed_cb(GtkMenuShell *menu_shell,
159 static void toolbar_delete_cb (GtkWidget *widget,
161 static void toolbar_exec_cb (GtkWidget *widget,
164 static void toolbar_next_unread_cb (GtkWidget *widget,
167 static void toolbar_prefs_cb (GtkWidget *widget,
169 static void toolbar_account_cb (GtkWidget *widget,
173 static void toolbar_account_button_pressed (GtkWidget *widget,
174 GdkEventButton *event,
177 static void ac_label_button_pressed (GtkWidget *widget,
178 GdkEventButton *event,
180 static void ac_menu_popup_closed (GtkMenuShell *menu_shell,
183 static gint main_window_close_cb (GtkWidget *widget,
186 static gint folder_window_close_cb (GtkWidget *widget,
189 static gint message_window_close_cb (GtkWidget *widget,
193 static void add_mailbox_cb (MainWindow *mainwin,
196 static void add_mbox_cb (MainWindow *mainwin,
199 static void update_folderview_cb (MainWindow *mainwin,
202 static void new_folder_cb (MainWindow *mainwin,
205 static void rename_folder_cb (MainWindow *mainwin,
208 static void delete_folder_cb (MainWindow *mainwin,
211 static void import_mbox_cb (MainWindow *mainwin,
214 static void export_mbox_cb (MainWindow *mainwin,
217 static void empty_trash_cb (MainWindow *mainwin,
221 static void save_as_cb (MainWindow *mainwin,
224 static void print_cb (MainWindow *mainwin,
227 static void app_exit_cb (MainWindow *mainwin,
231 static void search_cb (MainWindow *mainwin,
235 static void toggle_folder_cb (MainWindow *mainwin,
238 static void toggle_message_cb (MainWindow *mainwin,
241 static void toggle_toolbar_cb (MainWindow *mainwin,
244 static void toggle_statusbar_cb (MainWindow *mainwin,
247 static void separate_widget_cb (MainWindow *mainwin,
251 static void addressbook_open_cb (MainWindow *mainwin,
254 static void log_window_show_cb (MainWindow *mainwin,
257 static void sel_download_cb (MainWindow *mainwin,
261 static void inc_mail_cb (MainWindow *mainwin,
264 static void inc_all_account_mail_cb (MainWindow *mainwin,
267 static void inc_cancel_cb (MainWindow *mainwin,
271 static void send_queue_cb (MainWindow *mainwin,
275 static void compose_cb (MainWindow *mainwin,
278 static void compose_mail_cb(MainWindow *mainwin, guint action,
280 static void compose_news_cb(MainWindow *mainwin, guint action,
282 static void reply_cb (MainWindow *mainwin,
286 static void open_msg_cb (MainWindow *mainwin,
290 static void view_source_cb (MainWindow *mainwin,
294 static void show_all_header_cb (MainWindow *mainwin,
298 static void reedit_cb (MainWindow *mainwin,
302 static void move_to_cb (MainWindow *mainwin,
305 static void copy_to_cb (MainWindow *mainwin,
308 static void delete_cb (MainWindow *mainwin,
312 static void mark_cb (MainWindow *mainwin,
315 static void unmark_cb (MainWindow *mainwin,
319 static void mark_as_unread_cb (MainWindow *mainwin,
322 static void mark_as_read_cb (MainWindow *mainwin,
325 static void mark_all_read_cb (MainWindow *mainwin,
328 static void add_address_cb (MainWindow *mainwin,
332 static void set_charset_cb (MainWindow *mainwin,
336 static void hide_read_messages (MainWindow *mainwin,
340 static void thread_cb (MainWindow *mainwin,
343 static void expand_threads_cb (MainWindow *mainwin,
346 static void collapse_threads_cb (MainWindow *mainwin,
350 static void set_display_item_cb (MainWindow *mainwin,
353 static void sort_summary_cb (MainWindow *mainwin,
356 static void sort_summary_type_cb (MainWindow *mainwin,
359 static void attract_by_subject_cb(MainWindow *mainwin,
363 static void delete_duplicated_cb (MainWindow *mainwin,
366 static void filter_cb (MainWindow *mainwin,
369 static void execute_summary_cb (MainWindow *mainwin,
372 static void update_summary_cb (MainWindow *mainwin,
376 static void prev_cb (MainWindow *mainwin,
379 static void next_cb (MainWindow *mainwin,
383 static void prev_unread_cb (MainWindow *mainwin,
386 static void next_unread_cb (MainWindow *mainwin,
389 static void prev_marked_cb (MainWindow *mainwin,
392 static void next_marked_cb (MainWindow *mainwin,
395 static void prev_labeled_cb (MainWindow *mainwin,
398 static void next_labeled_cb (MainWindow *mainwin,
402 static void goto_folder_cb (MainWindow *mainwin,
406 static void copy_cb (MainWindow *mainwin,
409 static void allsel_cb (MainWindow *mainwin,
412 static void selthread_cb (MainWindow *mainwin,
415 static void create_filter_cb (MainWindow *mainwin,
419 static void prefs_common_open_cb (MainWindow *mainwin,
422 static void prefs_filter_open_cb (MainWindow *mainwin,
425 static void prefs_scoring_open_cb (MainWindow *mainwin,
428 static void prefs_filtering_open_cb (MainWindow *mainwin,
431 static void prefs_account_open_cb(MainWindow *mainwin,
434 static void prefs_template_open_cb (MainWindow *mainwin,
437 static void prefs_actions_open_cb (MainWindow *mainwin,
441 static void new_account_cb (MainWindow *mainwin,
445 static void account_menu_cb (GtkMenuItem *menuitem,
448 static void online_switch_clicked(GtkButton *btn,
451 static void manual_open_cb (MainWindow *mainwin,
454 static void faq_open_cb (MainWindow *mainwin,
458 static void scan_tree_func (Folder *folder,
462 static void activate_compose_button (MainWindow *mainwin,
464 ComposeButtonType type);
466 static void key_pressed (GtkWidget *widget,
470 static void set_toolbar_style(MainWindow *mainwin);
472 static void toggle_work_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget);
474 static void addr_harvest_cb ( MainWindow *mainwin,
478 static void addr_harvest_msg_cb ( MainWindow *mainwin,
482 #define SEPARATE_ACTION 500
484 static GtkItemFactoryEntry mainwin_entries[] =
486 {N_("/_File"), NULL, NULL, 0, "<Branch>"},
487 {N_("/_File/_Add mailbox..."), NULL, add_mailbox_cb, 0, NULL},
488 {N_("/_File/_Add mbox mailbox..."), NULL, add_mbox_cb, 0, NULL},
489 {N_("/_File/_Rescan folder tree"), NULL, update_folderview_cb, 0, NULL},
490 {N_("/_File/_Folder"), NULL, NULL, 0, "<Branch>"},
491 {N_("/_File/_Folder/Create _new folder..."),
492 NULL, new_folder_cb, 0, NULL},
493 {N_("/_File/_Folder/_Rename folder..."),NULL, rename_folder_cb, 0, NULL},
494 {N_("/_File/_Folder/_Delete folder"), NULL, delete_folder_cb, 0, NULL},
495 {N_("/_File/_Import mbox file..."), NULL, import_mbox_cb, 0, NULL},
496 {N_("/_File/_Export to mbox file..."), NULL, export_mbox_cb, 0, NULL},
497 {N_("/_File/Empty _trash"), "<shift>D", empty_trash_cb, 0, NULL},
498 {N_("/_File/_Work offline"), "<control>W", toggle_work_offline_cb, 0, "<ToggleItem>"},
499 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
500 {N_("/_File/_Save as..."), "<control>S", save_as_cb, 0, NULL},
501 {N_("/_File/_Print..."), NULL, print_cb, 0, NULL},
502 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
503 /* {N_("/_File/_Close"), "<alt>W", app_exit_cb, 0, NULL}, */
504 {N_("/_File/E_xit"), "<control>Q", app_exit_cb, 0, NULL},
506 {N_("/_Edit"), NULL, NULL, 0, "<Branch>"},
507 {N_("/_Edit/_Copy"), "<control>C", copy_cb, 0, NULL},
508 {N_("/_Edit/Select _all"), "<control>A", allsel_cb, 0, NULL},
509 {N_("/_Edit/Select thread"), "<control>Z", selthread_cb, 0, NULL},
510 {N_("/_Edit/---"), NULL, NULL, 0, "<Separator>"},
511 {N_("/_Edit/_Find in current message..."),
512 "<control>F", search_cb, 0, NULL},
513 {N_("/_Edit/_Search folder..."), "<shift><control>F", search_cb, 1, NULL},
514 {N_("/_View"), NULL, NULL, 0, "<Branch>"},
515 {N_("/_View/Show or hi_de"), NULL, NULL, 0, "<Branch>"},
516 {N_("/_View/Show or hi_de/_Folder tree"),
517 NULL, toggle_folder_cb, 0, "<ToggleItem>"},
518 {N_("/_View/Show or hi_de/_Message view"),
519 "V", toggle_message_cb, 0, "<ToggleItem>"},
520 {N_("/_View/Show or hi_de/_Toolbar"),
521 NULL, NULL, 0, "<Branch>"},
522 {N_("/_View/Show or hi_de/_Toolbar/Icon _and text"),
523 NULL, toggle_toolbar_cb, TOOLBAR_BOTH, "<RadioItem>"},
524 {N_("/_View/Show or hi_de/_Toolbar/_Icon"),
525 NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Icon and text"},
526 {N_("/_View/Show or hi_de/_Toolbar/_Text"),
527 NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Icon and text"},
528 {N_("/_View/Show or hi_de/_Toolbar/_None"),
529 NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Icon and text"},
530 {N_("/_View/Show or hi_de/Status _bar"),
531 NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
532 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
533 {N_("/_View/Separate f_older tree"), NULL, separate_widget_cb, SEPARATE_FOLDER, "<ToggleItem>"},
534 {N_("/_View/Separate m_essage view"), NULL, separate_widget_cb, SEPARATE_MESSAGE, "<ToggleItem>"},
535 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
536 {N_("/_View/_Sort"), NULL, NULL, 0, "<Branch>"},
537 {N_("/_View/_Sort/by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, "<RadioItem>"},
538 {N_("/_View/_Sort/by s_ize"), NULL, sort_summary_cb, SORT_BY_SIZE, "/View/Sort/by number"},
539 {N_("/_View/_Sort/by _date"), NULL, sort_summary_cb, SORT_BY_DATE, "/View/Sort/by number"},
540 {N_("/_View/_Sort/by _from"), NULL, sort_summary_cb, SORT_BY_FROM, "/View/Sort/by number"},
541 {N_("/_View/_Sort/by _subject"), NULL, sort_summary_cb, SORT_BY_SUBJECT, "/View/Sort/by number"},
542 {N_("/_View/_Sort/by _color label"),
543 NULL, sort_summary_cb, SORT_BY_LABEL, "/View/Sort/by number"},
544 {N_("/_View/_Sort/by _mark"), NULL, sort_summary_cb, SORT_BY_MARK, "/View/Sort/by number"},
545 {N_("/_View/_Sort/by _unread"), NULL, sort_summary_cb, SORT_BY_UNREAD, "/View/Sort/by number"},
546 {N_("/_View/_Sort/by a_ttachment"),
547 NULL, sort_summary_cb, SORT_BY_MIME, "/View/Sort/by number"},
548 {N_("/_View/_Sort/by score"), NULL, sort_summary_cb, SORT_BY_SCORE, "/View/Sort/by number"},
549 {N_("/_View/_Sort/by locked"), NULL, sort_summary_cb, SORT_BY_LOCKED, "/View/Sort/by number"},
550 {N_("/_View/_Sort/D_on't sort"), NULL, sort_summary_cb, SORT_BY_NONE, "/View/Sort/by number"},
551 {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
552 {N_("/_View/_Sort/Ascending"), NULL, sort_summary_type_cb, SORT_ASCENDING, "<RadioItem>"},
553 {N_("/_View/_Sort/Descending"), NULL, sort_summary_type_cb, SORT_DESCENDING, "/View/Sort/Ascending"},
554 {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
555 {N_("/_View/_Sort/_Attract by subject"),
556 NULL, attract_by_subject_cb, 0, NULL},
557 {N_("/_View/Th_read view"), "<control>T", thread_cb, 0, "<ToggleItem>"},
558 {N_("/_View/E_xpand all threads"), NULL, expand_threads_cb, 0, NULL},
559 {N_("/_View/Co_llapse all threads"), NULL, collapse_threads_cb, 0, NULL},
560 {N_("/_View/_Hide read messages"), NULL, hide_read_messages, 0, "<ToggleItem>"},
561 {N_("/_View/Set display _item..."), NULL, set_display_item_cb, 0, NULL},
563 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
564 {N_("/_View/_Go to"), NULL, NULL, 0, "<Branch>"},
565 {N_("/_View/_Go to/_Prev message"), "P", prev_cb, 0, NULL},
566 {N_("/_View/_Go to/_Next message"), "N", next_cb, 0, NULL},
567 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
568 {N_("/_View/_Go to/P_rev unread message"),
569 "<shift>P", prev_unread_cb, 0, NULL},
570 {N_("/_View/_Go to/N_ext unread message"),
571 "<shift>N", next_unread_cb, 0, NULL},
572 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
573 {N_("/_View/_Go to/Prev _marked message"),
574 NULL, prev_marked_cb, 0, NULL},
575 {N_("/_View/_Go to/Next m_arked message"),
576 NULL, next_marked_cb, 0, NULL},
577 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
578 {N_("/_View/_Go to/Prev _labeled message"),
579 NULL, prev_labeled_cb, 0, NULL},
580 {N_("/_View/_Go to/Next la_beled message"),
581 NULL, next_labeled_cb, 0, NULL},
582 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
583 {N_("/_View/_Go to/Other _folder..."), "G", goto_folder_cb, 0, NULL},
584 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
586 #define CODESET_SEPARATOR \
587 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"}
588 #define CODESET_ACTION(action) \
589 NULL, set_charset_cb, action, "/View/Code set/Auto detect"
591 {N_("/_View/_Code set"), NULL, NULL, 0, "<Branch>"},
592 {N_("/_View/_Code set/_Auto detect"),
593 NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
594 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"},
595 {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
596 CODESET_ACTION(C_US_ASCII)},
599 {N_("/_View/_Code set/Unicode (_UTF-8)"),
600 CODESET_ACTION(C_UTF_8)},
603 {N_("/_View/_Code set/Western European (ISO-8859-_1)"),
604 CODESET_ACTION(C_ISO_8859_1)},
605 {N_("/_View/_Code set/Western European (ISO-8859-15)"),
606 CODESET_ACTION(C_ISO_8859_15)},
609 {N_("/_View/_Code set/Central European (ISO-8859-_2)"),
610 CODESET_ACTION(C_ISO_8859_2)},
612 {N_("/_View/_Code set/_Baltic (ISO-8859-13)"),
613 CODESET_ACTION(C_ISO_8859_13)},
614 {N_("/_View/_Code set/Baltic (ISO-8859-_4)"),
615 CODESET_ACTION(C_ISO_8859_4)},
617 {N_("/_View/_Code set/Greek (ISO-8859-_7)"),
618 CODESET_ACTION(C_ISO_8859_7)},
620 {N_("/_View/_Code set/Turkish (ISO-8859-_9)"),
621 CODESET_ACTION(C_ISO_8859_9)},
623 {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"),
624 CODESET_ACTION(C_ISO_8859_5)},
625 {N_("/_View/_Code set/Cyrillic (KOI8-_R)"),
626 CODESET_ACTION(C_KOI8_R)},
627 {N_("/_View/_Code set/Cyrillic (Windows-1251)"),
628 CODESET_ACTION(C_WINDOWS_1251)},
631 {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
632 CODESET_ACTION(C_ISO_2022_JP)},
634 {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
635 CODESET_ACTION(C_ISO_2022_JP_2)},
637 {N_("/_View/_Code set/Japanese (_EUC-JP)"),
638 CODESET_ACTION(C_EUC_JP)},
639 {N_("/_View/_Code set/Japanese (_Shift__JIS)"),
640 CODESET_ACTION(C_SHIFT_JIS)},
643 {N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
644 CODESET_ACTION(C_GB2312)},
645 {N_("/_View/_Code set/Traditional Chinese (_Big5)"),
646 CODESET_ACTION(C_BIG5)},
647 {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"),
648 CODESET_ACTION(C_EUC_TW)},
649 {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"),
650 CODESET_ACTION(C_ISO_2022_CN)},
652 {N_("/_View/_Code set/Korean (EUC-_KR)"),
653 CODESET_ACTION(C_EUC_KR)},
654 {N_("/_View/_Code set/Korean (ISO-2022-KR)"),
655 CODESET_ACTION(C_ISO_2022_KR)},
657 {N_("/_View/_Code set/Thai (TIS-620)"),
658 CODESET_ACTION(C_TIS_620)},
659 {N_("/_View/_Code set/Thai (Windows-874)"),
660 CODESET_ACTION(C_WINDOWS_874)},
663 #undef CODESET_SEPARATOR
664 #undef CODESET_ACTION
666 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
667 {N_("/_View/Open in new _window"), "<control><alt>N", open_msg_cb, 0, NULL},
668 {N_("/_View/Mess_age source"), "<control>U", view_source_cb, 0, NULL},
669 {N_("/_View/Show all _header"), "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
670 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
671 {N_("/_View/_Update summary"), "<control><alt>U", update_summary_cb, 0, NULL},
673 {N_("/_Message"), NULL, NULL, 0, "<Branch>"},
674 {N_("/_Message/Get new ma_il"), "<control>I", inc_mail_cb, 0, NULL},
675 {N_("/_Message/Get from _all accounts"),
676 "<shift><control>I", inc_all_account_mail_cb, 0, NULL},
677 {N_("/_Message/Cancel receivin_g"), NULL, inc_cancel_cb, 0, NULL},
678 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
679 {N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
680 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
681 {N_("/_Message/Compose a_n email message"), "<control>M", compose_mail_cb, 0, NULL},
682 {N_("/_Message/Compose a news message"), NULL, compose_news_cb, 0, NULL},
683 {N_("/_Message/_Reply"), "<control>R", reply_cb, COMPOSE_REPLY, NULL},
684 {N_("/_Message/Repl_y to sender"), "<control><alt>R", reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
685 {N_("/_Message/Follow-up and reply to"), NULL, reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
686 {N_("/_Message/Reply to a_ll"), "<shift><control>R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
687 {N_("/_Message/_Forward"), "<control><alt>F", reply_cb, COMPOSE_FORWARD, NULL},
688 {N_("/_Message/Redirect"), NULL, reply_cb, COMPOSE_REDIRECT, NULL},
689 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
690 {N_("/_Message/Re-_edit"), NULL, reedit_cb, 0, NULL},
691 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
692 {N_("/_Message/M_ove..."), "<control>O", move_to_cb, 0, NULL},
693 {N_("/_Message/_Copy..."), "<shift><control>O", copy_to_cb, 0, NULL},
694 {N_("/_Message/_Delete"), "<control>D", delete_cb, 0, NULL},
695 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
696 {N_("/_Message/_Mark"), NULL, NULL, 0, "<Branch>"},
697 {N_("/_Message/_Mark/_Mark"), "<shift>asterisk", mark_cb, 0, NULL},
698 {N_("/_Message/_Mark/_Unmark"), "U", unmark_cb, 0, NULL},
699 {N_("/_Message/_Mark/---"), NULL, NULL, 0, "<Separator>"},
700 {N_("/_Message/_Mark/Mark as unr_ead"), "<shift>exclam", mark_as_unread_cb, 0, NULL},
701 {N_("/_Message/_Mark/Mark as rea_d"),
702 NULL, mark_as_read_cb, 0, NULL},
703 {N_("/_Message/_Mark/Mark all _read"), NULL, mark_all_read_cb, 0, NULL},
705 {N_("/_Tools"), NULL, NULL, 0, "<Branch>"},
706 {N_("/_Tools/_Selective download..."), "<alt>S", sel_download_cb, 0, NULL},
707 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
708 {N_("/_Tools/_Address book..."), "<shift><control>A", addressbook_open_cb, 0, NULL},
709 {N_("/_Tools/Add sender to address boo_k"),
710 NULL, add_address_cb, 0, NULL},
711 {N_("/_Tools/_Harvest addresses"), NULL, NULL, 0, "<Branch>"},
712 {N_("/_Tools/_Harvest addresses/from _Folder..."),
713 NULL, addr_harvest_cb, 0, NULL},
714 {N_("/_Tools/_Harvest addresses/from _Messages..."),
715 NULL, addr_harvest_msg_cb, 0, NULL},
716 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
717 {N_("/_Tools/_Filter messages"), NULL, filter_cb, 0, NULL},
718 {N_("/_Tools/_Create filter rule"), NULL, NULL, 0, "<Branch>"},
719 {N_("/_Tools/_Create filter rule/_Automatically"),
720 NULL, create_filter_cb, FILTER_BY_AUTO, NULL},
721 {N_("/_Tools/_Create filter rule/by _From"),
722 NULL, create_filter_cb, FILTER_BY_FROM, NULL},
723 {N_("/_Tools/_Create filter rule/by _To"),
724 NULL, create_filter_cb, FILTER_BY_TO, NULL},
725 {N_("/_Tools/_Create filter rule/by _Subject"),
726 NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
727 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
728 {N_("/_Tools/Actio_ns"), NULL, NULL, 0, "<Branch>"},
729 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
730 {N_("/_Tools/E_xecute"), "X", execute_summary_cb, 0, NULL},
731 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
732 {N_("/_Tools/Delete du_plicated messages"),
733 NULL, delete_duplicated_cb, 0, NULL},
734 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
735 {N_("/_Tools/_Log window"), "<control>L", log_window_show_cb, 0, NULL},
737 {N_("/_Configuration"), NULL, NULL, 0, "<Branch>"},
738 {N_("/_Configuration/_Common preferences..."),
739 NULL, prefs_common_open_cb, 0, NULL},
740 {N_("/_Configuration/_Filter setting..."),
741 NULL, prefs_filter_open_cb, 0, NULL},
742 {N_("/_Configuration/_Scoring..."),
743 NULL, prefs_scoring_open_cb, 0, NULL},
744 {N_("/_Configuration/_Filtering..."),
745 NULL, prefs_filtering_open_cb, 0, NULL},
746 {N_("/_Configuration/_Template..."), NULL, prefs_template_open_cb, 0, NULL},
747 {N_("/_Configuration/_Actions..."), NULL, prefs_actions_open_cb, 0, NULL},
748 {N_("/_Configuration/---"), NULL, NULL, 0, "<Separator>"},
749 {N_("/_Configuration/_Preferences for current account..."),
750 NULL, prefs_account_open_cb, 0, NULL},
751 {N_("/_Configuration/Create _new account..."),
752 NULL, new_account_cb, 0, NULL},
753 {N_("/_Configuration/_Edit accounts..."),
754 NULL, account_edit_open, 0, NULL},
755 {N_("/_Configuration/C_hange current account"),
756 NULL, NULL, 0, "<Branch>"},
758 {N_("/_Help"), NULL, NULL, 0, "<Branch>"},
759 {N_("/_Help/_Manual"), NULL, NULL, 0, "<Branch>"},
760 {N_("/_Help/_Manual/_English"), NULL, manual_open_cb, MANUAL_LANG_EN, NULL},
761 {N_("/_Help/_Manual/_German"), NULL, manual_open_cb, MANUAL_LANG_DE, NULL},
762 {N_("/_Help/_Manual/_Spanish"), NULL, manual_open_cb, MANUAL_LANG_ES, NULL},
763 {N_("/_Help/_Manual/_French"), NULL, manual_open_cb, MANUAL_LANG_FR, NULL},
764 {N_("/_Help/_Manual/_Japanese"), NULL, manual_open_cb, MANUAL_LANG_JA, NULL},
765 {N_("/_Help/_FAQ"), NULL, NULL, 0, "<Branch>"},
766 {N_("/_Help/_FAQ/_English"), NULL, faq_open_cb, MANUAL_LANG_EN, NULL},
767 {N_("/_Help/_FAQ/_German"), NULL, faq_open_cb, MANUAL_LANG_DE, NULL},
768 {N_("/_Help/_FAQ/_Spanish"), NULL, faq_open_cb, MANUAL_LANG_ES, NULL},
769 {N_("/_Help/_FAQ/_French"), NULL, faq_open_cb, MANUAL_LANG_FR, NULL},
770 {N_("/_Help/_FAQ/_Italian"), NULL, faq_open_cb, MANUAL_LANG_IT, NULL},
771 {N_("/_Help/---"), NULL, NULL, 0, "<Separator>"},
772 {N_("/_Help/_About"), NULL, about_show, 0, NULL}
774 static GtkItemFactoryEntry reply_popup_entries[] =
776 {N_("/Reply with _quote"), NULL, reply_cb, COMPOSE_REPLY_WITH_QUOTE, NULL},
777 {N_("/_Reply without quote"), NULL, reply_cb, COMPOSE_REPLY_WITHOUT_QUOTE, NULL}
779 static GtkItemFactoryEntry replyall_popup_entries[] =
781 {N_("/Reply to all with _quote"), "<shift>A", reply_cb, COMPOSE_REPLY_TO_ALL_WITH_QUOTE, NULL},
782 {N_("/_Reply to all without quote"), "a", reply_cb, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, NULL}
784 static GtkItemFactoryEntry replysender_popup_entries[] =
786 {N_("/Reply to sender with _quote"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, NULL},
787 {N_("/_Reply to sender without quote"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, NULL}
789 static GtkItemFactoryEntry fwd_popup_entries[] =
791 {N_("/_Forward message (inline style)"), "f", reply_cb, COMPOSE_FORWARD_INLINE, NULL},
792 {N_("/Forward message as _attachment"), "<shift>F", reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}
795 MainWindow *main_window_create(SeparateType type)
801 GtkWidget *handlebox;
802 GtkWidget *vbox_body;
803 GtkWidget *hbox_stat;
804 GtkWidget *statusbar;
805 GtkWidget *progressbar;
806 GtkWidget *statuslabel;
807 GtkWidget *ac_button;
809 GtkWidget *online_status;
810 GtkWidget *offline_status;
811 GtkWidget *online_switch;
812 GtkWidget *offline_switch;
814 FolderView *folderview;
815 SummaryView *summaryview;
816 MessageView *messageview;
817 GdkColormap *colormap;
820 guint n_menu_entries;
821 GtkItemFactory *ifactory;
824 GtkWidget *compose_popup;
825 GtkWidget *reply_popup;
826 GtkWidget *replyall_popup;
827 GtkWidget *replysender_popup;
828 GtkWidget *fwd_popup;
831 static GdkGeometry geometry;
833 debug_print(_("Creating main window...\n"));
834 mainwin = g_new0(MainWindow, 1);
837 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
838 gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
839 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
840 gtk_window_set_wmclass(GTK_WINDOW(window), "main_window", "Sylpheed");
842 if (!geometry.min_height) {
843 geometry.min_width = 320;
844 geometry.min_height = 200;
846 gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
849 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
850 GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
851 MANAGE_WINDOW_SIGNALS_CONNECT(window);
852 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
853 GTK_SIGNAL_FUNC(key_pressed), mainwin);
855 gtk_widget_realize(window);
856 gtk_widget_add_events(window, GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);
859 gtkut_widget_set_app_icon(window);
861 vbox = gtk_vbox_new(FALSE, 0);
862 gtk_widget_show(vbox);
863 gtk_container_add(GTK_CONTAINER(window), vbox);
866 n_menu_entries = sizeof(mainwin_entries) / sizeof(mainwin_entries[0]);
867 menubar = menubar_create(window, mainwin_entries,
868 n_menu_entries, "<Main>", mainwin);
869 gtk_widget_show(menubar);
870 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
871 ifactory = gtk_item_factory_from_widget(menubar);
873 handlebox = gtk_handle_box_new();
874 gtk_widget_show(handlebox);
875 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
877 /* create the popup menus for the reply buttons specials */
878 n_menu_entries = sizeof(reply_popup_entries) /
879 sizeof(reply_popup_entries[0]);
880 reply_popup = popupmenu_create(window, reply_popup_entries, n_menu_entries,
881 "<ReplyPopup>", mainwin);
882 gtk_signal_connect(GTK_OBJECT(reply_popup), "selection_done",
883 GTK_SIGNAL_FUNC(toolbar_reply_popup_closed_cb), mainwin);
884 n_menu_entries = sizeof(replyall_popup_entries) /
885 sizeof(replyall_popup_entries[0]);
886 replyall_popup = popupmenu_create(window, replyall_popup_entries, n_menu_entries,
887 "<ReplyAllPopup>", mainwin);
888 gtk_signal_connect(GTK_OBJECT(replyall_popup), "selection_done",
889 GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_closed_cb), mainwin);
890 n_menu_entries = sizeof(replysender_popup_entries) /
891 sizeof(replysender_popup_entries[0]);
892 replysender_popup = popupmenu_create(window, replysender_popup_entries, n_menu_entries,
893 "<ReplySenderPopup>", mainwin);
894 gtk_signal_connect(GTK_OBJECT(replysender_popup), "selection_done",
895 GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_closed_cb), mainwin);
896 /* create the popup menu for the forward button */
897 n_menu_entries = sizeof(fwd_popup_entries) /
898 sizeof(fwd_popup_entries[0]);
899 fwd_popup = popupmenu_create(window, fwd_popup_entries, n_menu_entries,
900 "<ForwardPopup>", mainwin);
901 gtk_signal_connect(GTK_OBJECT(fwd_popup), "selection_done",
902 GTK_SIGNAL_FUNC(toolbar_forward_popup_closed_cb), mainwin);
904 main_window_toolbar_create(mainwin, handlebox);
906 /* vbox that contains body */
907 vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH);
908 gtk_widget_show(vbox_body);
909 gtk_container_set_border_width(GTK_CONTAINER(vbox_body), BORDER_WIDTH);
910 gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
912 hbox_stat = gtk_hbox_new(FALSE, 2);
913 gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
915 statusbar = statusbar_create();
916 gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
918 progressbar = gtk_progress_bar_new();
919 gtk_widget_set_usize(progressbar, 120, 1);
920 gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
922 online_status = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_ONLINE);
923 offline_status = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_OFFLINE);
924 online_switch = gtk_button_new ();
925 offline_switch = gtk_button_new ();
926 gtk_container_add (GTK_CONTAINER(online_switch), online_status);
927 gtk_button_set_relief (GTK_BUTTON(online_switch), GTK_RELIEF_NONE);
928 gtk_signal_connect (GTK_OBJECT(online_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
929 gtk_box_pack_start (GTK_BOX(hbox_stat), online_switch, FALSE, FALSE, 0);
930 gtk_container_add (GTK_CONTAINER(offline_switch), offline_status);
931 gtk_button_set_relief (GTK_BUTTON(offline_switch), GTK_RELIEF_NONE);
932 gtk_signal_connect (GTK_OBJECT(offline_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
933 gtk_box_pack_start (GTK_BOX(hbox_stat), offline_switch, FALSE, FALSE, 0);
935 statuslabel = gtk_label_new("");
936 gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
938 ac_button = gtk_button_new();
939 gtk_button_set_relief(GTK_BUTTON(ac_button), GTK_RELIEF_NONE);
940 GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
941 gtk_widget_set_usize(ac_button, -1, 1);
942 gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
943 gtk_signal_connect(GTK_OBJECT(ac_button), "button_press_event",
944 GTK_SIGNAL_FUNC(ac_label_button_pressed), mainwin);
946 ac_label = gtk_label_new("");
947 gtk_container_add(GTK_CONTAINER(ac_button), ac_label);
949 gtk_widget_show_all(hbox_stat);
951 gtk_widget_hide(offline_switch);
953 mainwin->folderview = folderview = folderview_create();
954 mainwin->summaryview = summaryview = summary_create();
955 mainwin->messageview = messageview = messageview_create();
956 mainwin->logwin = log_window_create();
958 folderview->mainwin = mainwin;
959 folderview->summaryview = summaryview;
961 summaryview->mainwin = mainwin;
962 summaryview->folderview = folderview;
963 summaryview->messageview = messageview;
964 summaryview->window = window;
966 messageview->mainwin = mainwin;
968 mainwin->window = window;
969 mainwin->vbox = vbox;
970 mainwin->menubar = menubar;
971 mainwin->menu_factory = ifactory;
972 mainwin->handlebox = handlebox;
973 mainwin->vbox_body = vbox_body;
974 mainwin->hbox_stat = hbox_stat;
975 mainwin->statusbar = statusbar;
976 mainwin->progressbar = progressbar;
977 mainwin->statuslabel = statuslabel;
978 mainwin->ac_button = ac_button;
979 mainwin->ac_label = ac_label;
981 mainwin->reply_popup = reply_popup;
982 mainwin->replyall_popup = replyall_popup;
983 mainwin->replysender_popup = replysender_popup;
984 mainwin->fwd_popup = fwd_popup;
985 mainwin->online_switch = online_switch;
986 mainwin->offline_switch = offline_switch;
988 /* set context IDs for status bar */
989 mainwin->mainwin_cid = gtk_statusbar_get_context_id
990 (GTK_STATUSBAR(statusbar), "Main Window");
991 mainwin->folderview_cid = gtk_statusbar_get_context_id
992 (GTK_STATUSBAR(statusbar), "Folder View");
993 mainwin->summaryview_cid = gtk_statusbar_get_context_id
994 (GTK_STATUSBAR(statusbar), "Summary View");
996 /* allocate colors for summary view and folder view */
997 summaryview->color_marked.red = summaryview->color_marked.green = 0;
998 summaryview->color_marked.blue = (guint16)65535;
1000 summaryview->color_dim.red = summaryview->color_dim.green =
1001 summaryview->color_dim.blue = COLOR_DIM;
1003 folderview->color_new.red = (guint16)55000;
1004 folderview->color_new.green = folderview->color_new.blue = 15000;
1006 gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
1007 &folderview->color_op);
1009 summaryview->color_important.red = 0;
1010 summaryview->color_important.green = 0;
1011 summaryview->color_important.blue = (guint16)65535;
1013 color[0] = summaryview->color_marked;
1014 color[1] = summaryview->color_dim;
1015 color[2] = folderview->color_new;
1016 color[3] = folderview->color_op;
1018 colormap = gdk_window_get_colormap(window->window);
1019 gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
1020 for (i = 0; i < 4; i++) {
1021 if (success[i] == FALSE)
1022 g_warning(_("MainWindow: color allocation %d failed\n"), i);
1025 debug_print(_("done.\n"));
1027 messageview->visible = TRUE;
1029 main_window_set_widgets(mainwin, type);
1031 /* set menu items */
1032 menuitem = gtk_item_factory_get_item
1033 (ifactory, "/View/Code set/Auto detect");
1034 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
1036 switch (prefs_common.toolbar_style) {
1038 menuitem = gtk_item_factory_get_item
1039 (ifactory, "/View/Show or hide/Toolbar/None");
1042 menuitem = gtk_item_factory_get_item
1043 (ifactory, "/View/Show or hide/Toolbar/Icon");
1046 menuitem = gtk_item_factory_get_item
1047 (ifactory, "/View/Show or hide/Toolbar/Text");
1050 menuitem = gtk_item_factory_get_item
1051 (ifactory, "/View/Show or hide/Toolbar/Icon and text");
1053 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
1055 gtk_widget_hide(mainwin->hbox_stat);
1056 menuitem = gtk_item_factory_get_item
1057 (ifactory, "/View/Show or hide/Status bar");
1058 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
1059 prefs_common.show_statusbar);
1061 /* set account selection menu */
1062 ac_menu = gtk_item_factory_get_widget
1063 (ifactory, "/Configuration/Change current account");
1064 gtk_signal_connect(GTK_OBJECT(ac_menu), "selection_done",
1065 GTK_SIGNAL_FUNC(ac_menu_popup_closed), mainwin);
1066 mainwin->ac_menu = ac_menu;
1068 main_window_set_toolbar_sensitive(mainwin);
1070 /* Create actions menu */
1071 update_mainwin_actions_menu(ifactory, mainwin);
1073 /* show main window */
1074 gtk_widget_set_uposition(mainwin->window,
1075 prefs_common.mainwin_x,
1076 prefs_common.mainwin_y);
1077 gtk_widget_set_usize(window, prefs_common.mainwin_width,
1078 prefs_common.mainwin_height);
1079 gtk_widget_show(mainwin->window);
1081 /* initialize views */
1082 folderview_init(folderview);
1083 summary_init(summaryview);
1084 messageview_init(messageview);
1085 log_window_init(mainwin->logwin);
1087 mainwin->lock_count = 0;
1088 mainwin->menu_lock_count = 0;
1089 mainwin->cursor_count = 0;
1092 watch_cursor = gdk_cursor_new(GDK_WATCH);
1094 mainwin_list = g_list_append(mainwin_list, mainwin);
1096 /* init work_offline */
1097 if (prefs_common.work_offline)
1098 online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
1103 void main_window_cursor_wait(MainWindow *mainwin)
1106 if (mainwin->cursor_count == 0)
1107 gdk_window_set_cursor(mainwin->window->window, watch_cursor);
1109 mainwin->cursor_count++;
1114 void main_window_cursor_normal(MainWindow *mainwin)
1116 if (mainwin->cursor_count)
1117 mainwin->cursor_count--;
1119 if (mainwin->cursor_count == 0)
1120 gdk_window_set_cursor(mainwin->window->window, NULL);
1125 /* lock / unlock the user-interface */
1126 void main_window_lock(MainWindow *mainwin)
1128 if (mainwin->lock_count == 0)
1129 gtk_widget_set_sensitive(mainwin->ac_button, FALSE);
1131 mainwin->lock_count++;
1133 main_window_set_menu_sensitive(mainwin);
1134 main_window_set_toolbar_sensitive(mainwin);
1137 void main_window_unlock(MainWindow *mainwin)
1139 if (mainwin->lock_count)
1140 mainwin->lock_count--;
1142 main_window_set_menu_sensitive(mainwin);
1143 main_window_set_toolbar_sensitive(mainwin);
1145 if (mainwin->lock_count == 0)
1146 gtk_widget_set_sensitive(mainwin->ac_button, TRUE);
1149 static void main_window_menu_callback_block(MainWindow *mainwin)
1151 mainwin->menu_lock_count++;
1154 static void main_window_menu_callback_unblock(MainWindow *mainwin)
1156 if (mainwin->menu_lock_count)
1157 mainwin->menu_lock_count--;
1160 void main_window_reflect_prefs_all(void)
1162 main_window_reflect_prefs_all_real(FALSE);
1165 void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
1168 MainWindow *mainwin;
1170 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1171 mainwin = (MainWindow *)cur->data;
1173 main_window_show_cur_account(mainwin);
1174 main_window_set_menu_sensitive(mainwin);
1175 main_window_set_toolbar_sensitive(mainwin);
1178 if (pixmap_theme_changed) {
1179 gtk_container_remove(GTK_CONTAINER(mainwin->handlebox), GTK_WIDGET(mainwin->toolbar));
1180 mainwin->toolbar = NULL;
1181 main_window_toolbar_create(mainwin, mainwin->handlebox);
1182 set_toolbar_style(mainwin);
1183 activate_compose_button(mainwin, prefs_common.toolbar_style, mainwin->compose_btn_type);
1184 folderview_reflect_prefs_pixmap_theme(mainwin->folderview);
1185 summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
1188 if (prefs_common.immediate_exec)
1189 gtk_widget_hide(mainwin->exec_btn);
1191 gtk_widget_show(mainwin->exec_btn);
1193 summary_redisplay_msg(mainwin->summaryview);
1194 headerview_set_visibility(mainwin->messageview->headerview,
1195 prefs_common.display_header_pane);
1199 void main_window_set_summary_column(void)
1202 MainWindow *mainwin;
1204 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1205 mainwin = (MainWindow *)cur->data;
1206 summary_set_column_order(mainwin->summaryview);
1210 void main_window_set_account_menu(GList *account_list)
1212 GList *cur, *cur_ac, *cur_item;
1213 GtkWidget *menuitem;
1214 MainWindow *mainwin;
1215 PrefsAccount *ac_prefs;
1217 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1218 mainwin = (MainWindow *)cur->data;
1220 /* destroy all previous menu item */
1221 cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children;
1222 while (cur_item != NULL) {
1223 GList *next = cur_item->next;
1224 gtk_widget_destroy(GTK_WIDGET(cur_item->data));
1228 for (cur_ac = account_list; cur_ac != NULL;
1229 cur_ac = cur_ac->next) {
1230 ac_prefs = (PrefsAccount *)cur_ac->data;
1232 menuitem = gtk_menu_item_new_with_label
1233 (ac_prefs->account_name
1234 ? ac_prefs->account_name : _("Untitled"));
1235 gtk_widget_show(menuitem);
1236 gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem);
1237 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
1238 GTK_SIGNAL_FUNC(account_menu_cb),
1244 static void main_window_show_cur_account(MainWindow *mainwin)
1249 ac_name = g_strdup(cur_account
1250 ? (cur_account->account_name
1251 ? cur_account->account_name : _("Untitled"))
1255 buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
1257 buf = g_strdup(PROG_VERSION);
1258 gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
1261 gtk_label_set_text(GTK_LABEL(mainwin->ac_label), ac_name);
1262 gtk_widget_queue_resize(mainwin->ac_button);
1267 void main_window_separation_change(MainWindow *mainwin, SeparateType type)
1269 GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview);
1270 GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview);
1271 GtkWidget *message_wid = GTK_WIDGET_PTR(mainwin->messageview);
1273 debug_print(_("Changing window separation type from %d to %d\n"),
1274 mainwin->type, type);
1276 if (mainwin->type == type) return;
1278 /* remove widgets from those containers */
1279 gtk_widget_ref(folder_wid);
1280 gtk_widget_ref(summary_wid);
1281 gtk_widget_ref(message_wid);
1282 gtkut_container_remove
1283 (GTK_CONTAINER(folder_wid->parent), folder_wid);
1284 gtkut_container_remove
1285 (GTK_CONTAINER(summary_wid->parent), summary_wid);
1286 gtkut_container_remove
1287 (GTK_CONTAINER(message_wid->parent), message_wid);
1289 /* clean containers */
1290 switch (mainwin->type) {
1292 gtk_widget_destroy(mainwin->win.sep_none.hpaned);
1294 case SEPARATE_FOLDER:
1295 gtk_widget_destroy(mainwin->win.sep_folder.vpaned);
1296 gtk_widget_destroy(mainwin->win.sep_folder.folderwin);
1298 case SEPARATE_MESSAGE:
1299 gtk_widget_destroy(mainwin->win.sep_message.hpaned);
1300 gtk_widget_destroy(mainwin->win.sep_message.messagewin);
1303 gtk_widget_destroy(mainwin->win.sep_both.messagewin);
1304 gtk_widget_destroy(mainwin->win.sep_both.folderwin);
1308 gtk_widget_hide(mainwin->window);
1309 main_window_set_widgets(mainwin, type);
1310 gtk_widget_show(mainwin->window);
1312 gtk_widget_unref(folder_wid);
1313 gtk_widget_unref(summary_wid);
1314 gtk_widget_unref(message_wid);
1317 void main_window_toggle_message_view(MainWindow *mainwin)
1319 SummaryView *summaryview = mainwin->summaryview;
1320 union CompositeWin *cwin = &mainwin->win;
1321 GtkWidget *vpaned = NULL;
1322 GtkWidget *container = NULL;
1323 GtkWidget *msgwin = NULL;
1325 switch (mainwin->type) {
1327 vpaned = cwin->sep_none.vpaned;
1328 container = cwin->sep_none.hpaned;
1330 case SEPARATE_FOLDER:
1331 vpaned = cwin->sep_folder.vpaned;
1332 container = mainwin->vbox_body;
1334 case SEPARATE_MESSAGE:
1335 msgwin = mainwin->win.sep_message.messagewin;
1338 msgwin = mainwin->win.sep_both.messagewin;
1343 if (GTK_WIDGET_VISIBLE(msgwin)) {
1344 gtk_widget_hide(msgwin);
1345 mainwin->messageview->visible = FALSE;
1346 summaryview->displayed = NULL;
1348 gtk_widget_show(msgwin);
1349 mainwin->messageview->visible = TRUE;
1351 } else if (vpaned->parent != NULL) {
1352 mainwin->messageview->visible = FALSE;
1353 summaryview->displayed = NULL;
1354 gtk_widget_ref(vpaned);
1355 gtkut_container_remove(GTK_CONTAINER(container), vpaned);
1356 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container);
1357 gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
1358 GTK_ARROW_UP, GTK_SHADOW_OUT);
1360 mainwin->messageview->visible = TRUE;
1361 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), vpaned);
1362 gtk_container_add(GTK_CONTAINER(container), vpaned);
1363 gtk_widget_unref(vpaned);
1364 gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
1365 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
1368 main_window_set_menu_sensitive(mainwin);
1370 gtk_widget_grab_focus(summaryview->ctree);
1373 void main_window_get_size(MainWindow *mainwin)
1375 GtkAllocation *allocation;
1377 allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
1379 prefs_common.summaryview_width = allocation->width;
1381 if ((mainwin->type == SEPARATE_NONE ||
1382 mainwin->type == SEPARATE_FOLDER) &&
1383 messageview_is_visible(mainwin->messageview))
1384 prefs_common.summaryview_height = allocation->height;
1386 prefs_common.mainview_width = allocation->width;
1388 allocation = &mainwin->window->allocation;
1390 prefs_common.mainview_height = allocation->height;
1391 prefs_common.mainwin_width = allocation->width;
1392 prefs_common.mainwin_height = allocation->height;
1394 allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
1396 prefs_common.folderview_width = allocation->width;
1397 prefs_common.folderview_height = allocation->height;
1400 void main_window_get_position(MainWindow *mainwin)
1404 gtkut_widget_get_uposition(mainwin->window, &x, &y);
1406 prefs_common.mainview_x = x;
1407 prefs_common.mainview_y = y;
1408 prefs_common.mainwin_x = x;
1409 prefs_common.mainwin_y = y;
1411 debug_print(_("window position: x = %d, y = %d\n"), x, y);
1414 void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
1420 for (has_trash = 0, list = folder_get_list(); list != NULL; list = list->next) {
1421 folder = FOLDER(list->data);
1422 if (folder && folder->trash && folder->trash->total > 0)
1426 if (!has_trash) return;
1429 if (alertpanel(_("Empty trash"),
1430 _("Empty all messages in trash?"),
1431 _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
1433 manage_window_focus_in(mainwin->window, NULL, NULL);
1436 procmsg_empty_trash();
1438 for (list = folder_get_list(); list != NULL; list = list->next) {
1439 folder = list->data;
1440 if (folder && folder->trash && folder->trash->total != 0) {
1441 folder_item_scan(folder->trash);
1442 folderview_update_item(folder->trash, TRUE);
1446 if (mainwin->summaryview->folder_item &&
1447 mainwin->summaryview->folder_item->stype == F_TRASH)
1448 gtk_widget_grab_focus(mainwin->folderview->ctree);
1451 void main_window_add_mailbox(MainWindow *mainwin)
1456 path = input_dialog(_("Add mailbox"),
1457 _("Input the location of mailbox.\n"
1458 "If the existing mailbox is specified, it will be\n"
1459 "scanned automatically."),
1462 if (folder_find_from_path(path)) {
1463 alertpanel_error(_("The mailbox `%s' already exists."), path);
1467 if (!strcmp(path, "Mail"))
1468 folder = folder_new(F_MH, _("Mailbox"), path);
1470 folder = folder_new(F_MH, g_basename(path), path);
1473 if (folder->create_tree(folder) < 0) {
1474 alertpanel_error(_("Creation of the mailbox failed.\n"
1475 "Maybe some files already exist, or you don't have the permission to write there."));
1476 folder_destroy(folder);
1481 folder_set_ui_func(folder, scan_tree_func, mainwin);
1482 folder->scan_tree(folder);
1483 folder_set_ui_func(folder, NULL, NULL);
1485 folderview_set(mainwin->folderview);
1488 void main_window_add_mbox(MainWindow *mainwin)
1494 path = input_dialog(_("Add mbox mailbox"),
1495 _("Input the location of mailbox."),
1500 if (folder_find_from_path(path)) {
1501 alertpanel_error(_("The mailbox `%s' already exists."), path);
1507 if (!strcmp(path, "Mail"))
1508 folder = folder_new(F_MBOX, _("Mailbox"), path);
1512 folder = folder_new(F_MBOX, g_basename(path), path);
1515 if (folder->create_tree(folder) < 0) {
1516 alertpanel_error(_("Creation of the mailbox failed."));
1517 folder_destroy(folder);
1523 item = folder_item_new(folder->name, NULL);
1524 item->folder = folder;
1525 folder->node = g_node_new(item);
1527 folder->create_folder(folder, item, "inbox");
1528 folder->create_folder(folder, item, "outbox");
1529 folder->create_folder(folder, item, "queue");
1530 folder->create_folder(folder, item, "draft");
1531 folder->create_folder(folder, item, "trash");
1533 folderview_set(mainwin->folderview);
1538 M_UNLOCKED = 1 << 0,
1539 M_MSG_EXIST = 1 << 1,
1540 M_TARGET_EXIST = 1 << 2,
1541 M_SINGLE_TARGET_EXIST = 1 << 3,
1543 M_ALLOW_REEDIT = 1 << 5,
1544 M_HAVE_ACCOUNT = 1 << 6,
1545 M_THREADED = 1 << 7,
1546 M_UNTHREADED = 1 << 8,
1547 M_ALLOW_DELETE = 1 << 9,
1548 M_INC_ACTIVE = 1 << 10,
1550 M_HAVE_NEWS_ACCOUNT = 1 << 12,
1551 M_HIDE_READ_MSG = 1 << 13
1554 static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
1556 SensitiveCond state = 0;
1557 SummarySelection selection;
1558 FolderItem *item = mainwin->summaryview->folder_item;
1559 GList *account_list = account_get_list();
1561 selection = summary_get_selection_type(mainwin->summaryview);
1563 if (mainwin->lock_count == 0)
1564 state |= M_UNLOCKED;
1565 if (selection != SUMMARY_NONE)
1566 state |= M_MSG_EXIST;
1567 if (item && item->path && item->parent && !item->no_select) {
1570 state |= M_THREADED;
1572 state |= M_UNTHREADED;
1573 /* if (item->folder->type != F_NEWS) */
1574 state |= M_ALLOW_DELETE;
1576 if (selection == SUMMARY_NONE && item->hide_read_msgs
1577 || selection != SUMMARY_NONE)
1578 state |= M_HIDE_READ_MSG;
1580 if (selection == SUMMARY_SELECTED_SINGLE ||
1581 selection == SUMMARY_SELECTED_MULTIPLE)
1582 state |= M_TARGET_EXIST;
1583 if (selection == SUMMARY_SELECTED_SINGLE)
1584 state |= M_SINGLE_TARGET_EXIST;
1585 if (mainwin->summaryview->folder_item &&
1586 mainwin->summaryview->folder_item->folder->type == F_NEWS)
1588 if (selection == SUMMARY_SELECTED_SINGLE &&
1590 (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
1591 item->stype == F_QUEUE)))
1592 state |= M_ALLOW_REEDIT;
1594 state |= M_HAVE_ACCOUNT;
1596 for ( ; account_list != NULL; account_list = account_list->next) {
1597 if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
1598 state |= M_HAVE_NEWS_ACCOUNT;
1603 if (inc_is_active())
1604 state |= M_INC_ACTIVE;
1609 void main_window_set_toolbar_sensitive(MainWindow *mainwin)
1611 SensitiveCond state;
1620 #define SET_WIDGET_COND(w, c) \
1622 entry[i].widget = w; \
1623 entry[i].cond = c; \
1627 SET_WIDGET_COND(mainwin->get_btn, M_HAVE_ACCOUNT|M_UNLOCKED);
1628 SET_WIDGET_COND(mainwin->getall_btn, M_HAVE_ACCOUNT|M_UNLOCKED);
1629 SET_WIDGET_COND(mainwin->compose_news_btn, M_HAVE_ACCOUNT);
1630 SET_WIDGET_COND(mainwin->reply_btn,
1631 M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
1632 SET_WIDGET_COND(mainwin->replyall_btn,
1633 M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
1634 SET_WIDGET_COND(mainwin->replysender_btn,
1635 M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
1636 SET_WIDGET_COND(mainwin->fwd_btn, M_HAVE_ACCOUNT|M_TARGET_EXIST);
1638 SET_WIDGET_COND(mainwin->prefs_btn, M_UNLOCKED);
1639 SET_WIDGET_COND(mainwin->account_btn, M_UNLOCKED);
1641 SET_WIDGET_COND(mainwin->next_btn, M_MSG_EXIST);
1642 SET_WIDGET_COND(mainwin->delete_btn,
1643 M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED);
1644 SET_WIDGET_COND(mainwin->exec_btn, M_MSG_EXIST|M_EXEC|M_UNLOCKED);
1645 SET_WIDGET_COND(NULL, 0);
1647 #undef SET_WIDGET_COND
1649 state = main_window_get_current_state(mainwin);
1651 for (i = 0; entry[i].widget != NULL; i++) {
1652 sensitive = ((entry[i].cond & state) == entry[i].cond);
1653 gtk_widget_set_sensitive(entry[i].widget, sensitive);
1656 activate_compose_button(mainwin,
1657 prefs_common.toolbar_style,
1658 mainwin->compose_btn_type);
1661 void main_window_set_menu_sensitive(MainWindow *mainwin)
1663 GtkItemFactory *ifactory = mainwin->menu_factory;
1664 SensitiveCond state;
1666 GtkWidget *menuitem;
1671 static const struct {
1675 {"/File/Add mailbox..." , M_UNLOCKED},
1676 {"/File/Add mbox mailbox..." , M_UNLOCKED},
1677 {"/File/Rescan folder tree" , M_UNLOCKED},
1678 {"/File/Folder" , M_UNLOCKED},
1679 {"/File/Import mbox file..." , M_UNLOCKED},
1680 {"/File/Export to mbox file...", M_UNLOCKED},
1681 {"/File/Empty trash" , M_UNLOCKED},
1682 {"/File/Work offline" , M_UNLOCKED},
1683 {"/File/Save as...", M_SINGLE_TARGET_EXIST|M_UNLOCKED},
1684 {"/File/Print..." , M_TARGET_EXIST|M_UNLOCKED},
1685 /* {"/File/Close", M_UNLOCKED}, */
1686 {"/File/Exit" , M_UNLOCKED},
1688 {"/Edit/Select thread" , M_SINGLE_TARGET_EXIST},
1689 {"/View/Sort" , M_EXEC},
1690 {"/View/Thread view" , M_EXEC},
1691 {"/View/Expand all threads" , M_MSG_EXIST},
1692 {"/View/Collapse all threads" , M_MSG_EXIST},
1693 {"/View/Hide read messages" , M_HIDE_READ_MSG},
1694 {"/View/Go to/Prev message" , M_MSG_EXIST},
1695 {"/View/Go to/Next message" , M_MSG_EXIST},
1696 {"/View/Go to/Prev unread message" , M_MSG_EXIST},
1697 {"/View/Go to/Next unread message" , M_MSG_EXIST},
1698 {"/View/Go to/Prev marked message" , M_MSG_EXIST},
1699 {"/View/Go to/Next marked message" , M_MSG_EXIST},
1700 {"/View/Go to/Prev labeled message", M_MSG_EXIST},
1701 {"/View/Go to/Next labeled message", M_MSG_EXIST},
1702 {"/View/Open in new window" , M_SINGLE_TARGET_EXIST},
1703 {"/View/Show all header" , M_SINGLE_TARGET_EXIST},
1704 {"/View/Message source" , M_SINGLE_TARGET_EXIST},
1706 {"/Message/Get new mail" , M_HAVE_ACCOUNT|M_UNLOCKED},
1707 {"/Message/Get from all accounts" , M_HAVE_ACCOUNT|M_UNLOCKED},
1708 {"/Message/Cancel receiving" , M_INC_ACTIVE},
1709 {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
1710 {"/Message/Reply" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1711 {"/Message/Reply to sender" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1712 {"/Message/Reply to all" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1713 {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS},
1714 {"/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST},
1715 {"/Message/Redirect" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1716 {"/Message/Re-edit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
1717 {"/Message/Move..." , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1718 {"/Message/Copy..." , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
1719 {"/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1720 {"/Message/Mark" , M_TARGET_EXIST},
1722 {"/Tools/Selective download..." , M_HAVE_ACCOUNT|M_UNLOCKED},
1723 {"/Tools/Add sender to address book", M_SINGLE_TARGET_EXIST},
1724 {"/Tools/Harvest addresses" , M_UNLOCKED},
1725 {"/Tools/Filter messages" , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
1726 {"/Tools/Create filter rule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
1727 {"/Tools/Execute" , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
1728 {"/Tools/Actions" , M_MSG_EXIST},
1729 {"/Tools/Delete duplicated messages", M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1731 {"/Configuration", M_UNLOCKED},
1736 state = main_window_get_current_state(mainwin);
1738 for (i = 0; entry[i].entry != NULL; i++) {
1739 sensitive = ((entry[i].cond & state) == entry[i].cond);
1740 menu_set_sensitive(ifactory, entry[i].entry, sensitive);
1743 main_window_menu_callback_block(mainwin);
1745 #define SET_CHECK_MENU_ACTIVE(path, active) \
1747 menuitem = gtk_item_factory_get_widget(ifactory, path); \
1748 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active); \
1751 SET_CHECK_MENU_ACTIVE("/View/Show or hide/Message view",
1752 messageview_is_visible(mainwin->messageview));
1754 item = mainwin->summaryview->folder_item;
1755 menu_path = "/View/Sort/Don't sort";
1757 switch (item->sort_key) {
1758 case SORT_BY_NUMBER:
1759 menu_path = "/View/Sort/by number"; break;
1761 menu_path = "/View/Sort/by size"; break;
1763 menu_path = "/View/Sort/by date"; break;
1765 menu_path = "/View/Sort/by from"; break;
1766 case SORT_BY_SUBJECT:
1767 menu_path = "/View/Sort/by subject"; break;
1769 menu_path = "/View/Sort/by color label"; break;
1771 menu_path = "/View/Sort/by mark"; break;
1772 case SORT_BY_UNREAD:
1773 menu_path = "/View/Sort/by unread"; break;
1775 menu_path = "/View/Sort/by attachment"; break;
1777 menu_path = "/View/Sort/by score"; break;
1778 case SORT_BY_LOCKED:
1779 menu_path = "/View/Sort/by locked"; break;
1782 menu_path = "/View/Sort/Don't sort"; break;
1785 SET_CHECK_MENU_ACTIVE(menu_path, TRUE);
1787 if (!item || item->sort_type == SORT_ASCENDING) {
1788 SET_CHECK_MENU_ACTIVE("/View/Sort/Ascending", TRUE);
1790 SET_CHECK_MENU_ACTIVE("/View/Sort/Descending", TRUE);
1793 if (item && item->sort_key != SORT_BY_NONE) {
1794 menu_set_sensitive(ifactory, "/View/Sort/Ascending", TRUE);
1795 menu_set_sensitive(ifactory, "/View/Sort/Descending", TRUE);
1797 menu_set_sensitive(ifactory, "/View/Sort/Ascending", FALSE);
1798 menu_set_sensitive(ifactory, "/View/Sort/Descending", FALSE);
1801 SET_CHECK_MENU_ACTIVE("/View/Show all header",
1802 mainwin->messageview->textview->show_all_headers);
1803 SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
1805 #undef SET_CHECK_MENU_ACTIVE
1807 main_window_menu_callback_unblock(mainwin);
1810 void main_window_popup(MainWindow *mainwin)
1816 gdk_window_get_origin(mainwin->window->window, &x, &y);
1817 sx = gdk_screen_width();
1818 sy = gdk_screen_height();
1819 x %= sx; if (x < 0) x = 0;
1820 y %= sy; if (y < 0) y = 0;
1821 gdk_window_move(mainwin->window->window, x, y);
1822 gdk_window_raise(mainwin->window->window);
1823 gdk_window_show(mainwin->window->window);
1825 debug_print("window position: x = %d, y = %d\n", x, y);
1827 switch (mainwin->type) {
1828 case SEPARATE_FOLDER:
1829 widget = mainwin->win.sep_folder.folderwin;
1830 gdk_window_get_origin(widget->window, &x, &y);
1831 x %= sx; if (x < 0) x = 0;
1832 y %= sy; if (y < 0) y = 0;
1833 gdk_window_move(widget->window, x, y);
1834 gdk_window_raise(widget->window);
1836 case SEPARATE_MESSAGE:
1837 widget = mainwin->win.sep_message.messagewin;
1838 gdk_window_get_origin(widget->window, &x, &y);
1839 x %= sx; if (x < 0) x = 0;
1840 y %= sy; if (y < 0) y = 0;
1841 gdk_window_move(widget->window, x, y);
1842 gdk_window_raise(widget->window);
1845 widget = mainwin->win.sep_both.folderwin;
1846 gdk_window_get_origin(widget->window, &x, &y);
1847 x %= sx; if (x < 0) x = 0;
1848 y %= sy; if (y < 0) y = 0;
1849 gdk_window_move(widget->window, x, y);
1850 gdk_window_raise(widget->window);
1851 widget = mainwin->win.sep_both.messagewin;
1852 gdk_window_get_origin(widget->window, &x, &y);
1853 x %= sx; if (x < 0) x = 0;
1854 y %= sy; if (y < 0) y = 0;
1855 gdk_window_move(widget->window, x, y);
1856 gdk_window_raise(widget->window);
1863 static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
1865 GtkWidget *folderwin = NULL;
1866 GtkWidget *messagewin = NULL;
1869 GtkWidget *vbox_body = mainwin->vbox_body;
1870 GtkItemFactory *ifactory = mainwin->menu_factory;
1871 GtkWidget *menuitem;
1873 debug_print(_("Setting widgets..."));
1875 /* create separated window(s) if needed */
1876 if (type & SEPARATE_FOLDER) {
1877 folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1878 gtk_window_set_title(GTK_WINDOW(folderwin),
1879 _("Sylpheed - Folder View"));
1880 gtk_window_set_wmclass(GTK_WINDOW(folderwin),
1881 "folder_view", "Sylpheed");
1882 gtk_window_set_policy(GTK_WINDOW(folderwin),
1884 gtk_widget_set_usize(folderwin, -1,
1885 prefs_common.mainview_height);
1886 gtk_container_set_border_width(GTK_CONTAINER(folderwin),
1888 gtk_signal_connect(GTK_OBJECT(folderwin), "delete_event",
1889 GTK_SIGNAL_FUNC(folder_window_close_cb),
1892 if (type & SEPARATE_MESSAGE) {
1893 messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1894 gtk_window_set_title(GTK_WINDOW(messagewin),
1895 _("Sylpheed - Message View"));
1896 gtk_window_set_wmclass(GTK_WINDOW(messagewin),
1897 "message_view", "Sylpheed");
1898 gtk_window_set_policy(GTK_WINDOW(messagewin),
1900 gtk_widget_set_usize
1901 (messagewin, prefs_common.mainview_width,
1902 prefs_common.mainview_height
1903 - prefs_common.summaryview_height
1904 + DEFAULT_HEADERVIEW_HEIGHT);
1905 gtk_container_set_border_width(GTK_CONTAINER(messagewin),
1907 gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
1908 GTK_SIGNAL_FUNC(message_window_close_cb),
1914 hpaned = gtk_hpaned_new();
1915 gtk_widget_show(hpaned);
1916 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1917 gtk_paned_add1(GTK_PANED(hpaned),
1918 GTK_WIDGET_PTR(mainwin->folderview));
1920 vpaned = gtk_vpaned_new();
1921 if (messageview_is_visible(mainwin->messageview)) {
1922 gtk_paned_add2(GTK_PANED(hpaned), vpaned);
1923 gtk_paned_add1(GTK_PANED(vpaned),
1924 GTK_WIDGET_PTR(mainwin->summaryview));
1926 gtk_paned_add2(GTK_PANED(hpaned),
1927 GTK_WIDGET_PTR(mainwin->summaryview));
1928 gtk_widget_ref(vpaned);
1930 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1931 prefs_common.summaryview_width,
1932 prefs_common.summaryview_height);
1933 gtk_paned_add2(GTK_PANED(vpaned),
1934 GTK_WIDGET_PTR(mainwin->messageview));
1935 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1936 prefs_common.mainview_width, -1);
1937 gtk_widget_set_usize(mainwin->window,
1938 prefs_common.folderview_width +
1939 prefs_common.mainview_width,
1940 prefs_common.mainwin_height);
1941 gtk_widget_show_all(vpaned);
1943 mainwin->win.sep_none.hpaned = hpaned;
1944 mainwin->win.sep_none.vpaned = vpaned;
1946 case SEPARATE_FOLDER:
1947 vpaned = gtk_vpaned_new();
1948 if (messageview_is_visible(mainwin->messageview)) {
1949 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned,
1951 gtk_paned_add1(GTK_PANED(vpaned),
1952 GTK_WIDGET_PTR(mainwin->summaryview));
1954 gtk_box_pack_start(GTK_BOX(vbox_body),
1955 GTK_WIDGET_PTR(mainwin->summaryview),
1957 gtk_widget_ref(vpaned);
1959 gtk_paned_add2(GTK_PANED(vpaned),
1960 GTK_WIDGET_PTR(mainwin->messageview));
1961 gtk_widget_show_all(vpaned);
1962 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1963 prefs_common.summaryview_width,
1964 prefs_common.summaryview_height);
1965 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1966 prefs_common.mainview_width, -1);
1967 gtk_widget_set_usize(mainwin->window,
1968 prefs_common.mainview_width,
1969 prefs_common.mainview_height);
1971 gtk_container_add(GTK_CONTAINER(folderwin),
1972 GTK_WIDGET_PTR(mainwin->folderview));
1974 mainwin->win.sep_folder.folderwin = folderwin;
1975 mainwin->win.sep_folder.vpaned = vpaned;
1977 gtk_widget_show_all(folderwin);
1979 case SEPARATE_MESSAGE:
1980 hpaned = gtk_hpaned_new();
1981 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1983 gtk_paned_add1(GTK_PANED(hpaned),
1984 GTK_WIDGET_PTR(mainwin->folderview));
1985 gtk_paned_add2(GTK_PANED(hpaned),
1986 GTK_WIDGET_PTR(mainwin->summaryview));
1987 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1988 prefs_common.summaryview_width,
1989 prefs_common.summaryview_height);
1990 gtk_widget_set_usize(mainwin->window,
1991 prefs_common.folderview_width +
1992 prefs_common.mainview_width,
1993 prefs_common.mainwin_height);
1994 gtk_widget_show_all(hpaned);
1995 gtk_container_add(GTK_CONTAINER(messagewin),
1996 GTK_WIDGET_PTR(mainwin->messageview));
1998 mainwin->win.sep_message.messagewin = messagewin;
1999 mainwin->win.sep_message.hpaned = hpaned;
2001 gtk_widget_show_all(messagewin);
2004 gtk_box_pack_start(GTK_BOX(vbox_body),
2005 GTK_WIDGET_PTR(mainwin->summaryview),
2007 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
2008 prefs_common.summaryview_width,
2009 prefs_common.summaryview_height);
2010 gtk_widget_set_usize(mainwin->window,
2011 prefs_common.mainview_width,
2012 prefs_common.mainwin_height);
2013 gtk_container_add(GTK_CONTAINER(folderwin),
2014 GTK_WIDGET_PTR(mainwin->folderview));
2015 gtk_container_add(GTK_CONTAINER(messagewin),
2016 GTK_WIDGET_PTR(mainwin->messageview));
2018 mainwin->win.sep_both.folderwin = folderwin;
2019 mainwin->win.sep_both.messagewin = messagewin;
2021 gtk_widget_show_all(folderwin);
2022 gtk_widget_show_all(messagewin);
2026 mainwin->type = type;
2028 mainwin->messageview->visible = TRUE;
2030 /* toggle menu state */
2031 menuitem = gtk_item_factory_get_item
2032 (ifactory, "/View/Show or hide/Folder tree");
2033 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
2034 menuitem = gtk_item_factory_get_item
2035 (ifactory, "/View/Show or hide/Message view");
2036 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
2038 menuitem = gtk_item_factory_get_item
2039 (ifactory, "/View/Separate folder tree");
2040 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
2041 ((type & SEPARATE_FOLDER) != 0));
2042 menuitem = gtk_item_factory_get_item
2043 (ifactory, "/View/Separate message view");
2044 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
2045 ((type & SEPARATE_MESSAGE) != 0));
2047 debug_print(_("done.\n"));
2050 static void main_window_toolbar_create(MainWindow *mainwin,
2051 GtkWidget *container)
2054 GtkWidget *icon_wid;
2056 GtkWidget *getall_btn;
2057 GtkWidget *compose_mail_btn;
2058 GtkWidget *compose_news_btn;
2059 GtkWidget *reply_btn;
2060 GtkWidget *replyall_btn;
2061 GtkWidget *replysender_btn;
2063 GtkWidget *send_btn;
2065 GtkWidget *prefs_btn;
2066 GtkWidget *account_btn;
2068 GtkWidget *next_btn;
2069 GtkWidget *delete_btn;
2070 GtkWidget *exec_btn;
2072 GtkTooltips *tooltips;
2074 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
2076 gtk_container_add(GTK_CONTAINER(container), toolbar);
2077 gtk_container_set_border_width(GTK_CONTAINER(container), 2);
2078 gtk_toolbar_set_button_relief(GTK_TOOLBAR(toolbar), GTK_RELIEF_NONE);
2079 gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar),
2080 GTK_TOOLBAR_SPACE_LINE);
2082 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_RECEIVE);
2083 get_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2085 _("Get new mail from current account"),
2087 icon_wid, toolbar_inc_cb, mainwin);
2088 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_RECEIVE_ALL);
2089 getall_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2091 _("Get new mail from all accounts"),
2097 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
2099 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_SEND);
2100 send_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2102 _("Send queued message(s)"),
2108 /* insert compose mail button widget */
2109 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_COMPOSE);
2110 compose_mail_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2112 _("Compose an email message"),
2115 toolbar_compose_mail_cb,
2118 /* insert compose news button widget */
2119 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_NEWS_COMPOSE);
2120 compose_news_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2122 _("Compose a news message"),
2125 toolbar_compose_news_cb,
2128 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
2132 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_REPLY);
2133 reply_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2135 _("Reply to the message - Right button: more options"),
2141 /* replyall button */
2143 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_REPLY_TO_ALL);
2144 replyall_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2146 _("Reply to all - Right button: more options"),
2149 toolbar_reply_to_all_cb,
2152 /* reply to sender button */
2153 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR);
2154 replysender_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2156 _("Reply to sender - Right button: more options"),
2159 toolbar_reply_to_sender_cb,
2162 /* forward button */
2163 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_FORWARD);
2164 fwd_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2166 _("Forward the message - Right button: more options"),
2172 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
2174 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_CLOSE);
2175 delete_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2177 _("Delete the message"),
2183 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_EXEC);
2184 exec_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2186 _("Execute marked process"),
2192 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_DOWN_ARROW);
2193 next_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2195 _("Next unread message"),
2198 toolbar_next_unread_cb,
2202 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
2204 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_PREFERENCES);
2205 prefs_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2207 _("Common preferences"),
2212 icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_PROPERTIES);
2213 account_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
2215 _("Account setting"),
2220 gtk_signal_connect(GTK_OBJECT(account_btn), "button_press_event",
2221 GTK_SIGNAL_FUNC(toolbar_account_button_pressed),
2225 gtk_signal_connect(GTK_OBJECT(reply_btn), "button_press_event",
2226 GTK_SIGNAL_FUNC(toolbar_reply_popup_cb),
2229 gtk_signal_connect(GTK_OBJECT(replyall_btn), "button_press_event",
2230 GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_cb),
2233 gtk_signal_connect(GTK_OBJECT(replysender_btn), "button_press_event",
2234 GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_cb),
2237 gtk_signal_connect(GTK_OBJECT(fwd_btn), "button_press_event",
2238 GTK_SIGNAL_FUNC(toolbar_forward_popup_cb),
2242 mainwin->toolbar = toolbar;
2243 mainwin->get_btn = get_btn;
2244 mainwin->getall_btn = getall_btn;
2245 mainwin->compose_mail_btn = compose_mail_btn;
2246 mainwin->compose_news_btn = compose_news_btn;
2247 mainwin->reply_btn = reply_btn;
2248 mainwin->replyall_btn = replyall_btn;
2249 mainwin->replysender_btn = replysender_btn;
2250 mainwin->fwd_btn = fwd_btn;
2251 mainwin->send_btn = send_btn;
2253 mainwin->prefs_btn = prefs_btn;
2254 mainwin->account_btn = account_btn;
2256 mainwin->next_btn = next_btn;
2257 mainwin->delete_btn = delete_btn;
2258 mainwin->exec_btn = exec_btn;
2260 gtk_widget_show_all(toolbar);
2263 /* callback functions */
2264 static void toolbar_reply_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
2266 MainWindow *mainwindow = (MainWindow *) data;
2270 if (event->button == 3) {
2271 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
2272 gtk_menu_popup(GTK_MENU(mainwindow->reply_popup), NULL, NULL,
2273 menu_button_position, widget,
2274 event->button, event->time);
2278 static void toolbar_reply_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
2280 MainWindow *mainwin = (MainWindow *)data;
2282 gtk_button_set_relief(GTK_BUTTON(mainwin->reply_btn), GTK_RELIEF_NONE);
2283 manage_window_focus_in(mainwin->window, NULL, NULL);
2286 static void toolbar_reply_to_all_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
2288 MainWindow *mainwindow = (MainWindow *) data;
2292 if (event->button == 3) {
2293 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
2294 gtk_menu_popup(GTK_MENU(mainwindow->replyall_popup), NULL, NULL,
2295 menu_button_position, widget,
2296 event->button, event->time);
2300 static void toolbar_reply_to_all_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
2302 MainWindow *mainwin = (MainWindow *)data;
2304 gtk_button_set_relief(GTK_BUTTON(mainwin->replyall_btn), GTK_RELIEF_NONE);
2305 manage_window_focus_in(mainwin->window, NULL, NULL);
2308 static void toolbar_reply_to_sender_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
2310 MainWindow *mainwindow = (MainWindow *) data;
2311 GtkWidget *replysender_menu, *replysender_item;
2315 if (event->button == 3) {
2316 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
2317 gtk_menu_popup(GTK_MENU(mainwindow->replysender_popup), NULL, NULL,
2318 menu_button_position, widget,
2319 event->button, event->time);
2323 static void toolbar_reply_to_sender_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
2325 MainWindow *mainwin = (MainWindow *)data;
2327 gtk_button_set_relief(GTK_BUTTON(mainwin->replysender_btn), GTK_RELIEF_NONE);
2328 manage_window_focus_in(mainwin->window, NULL, NULL);
2331 static void toolbar_forward_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
2333 MainWindow *mainwindow = (MainWindow *) data;
2337 if (event->button == 3) {
2338 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
2339 gtk_menu_popup(GTK_MENU(mainwindow->fwd_popup), NULL, NULL,
2340 menu_button_position, widget,
2341 event->button, event->time);
2345 static void toolbar_forward_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
2347 MainWindow *mainwin = (MainWindow *)data;
2349 gtk_button_set_relief(GTK_BUTTON(mainwin->fwd_btn), GTK_RELIEF_NONE);
2350 manage_window_focus_in(mainwin->window, NULL, NULL);
2353 static void toolbar_inc_cb (GtkWidget *widget,
2356 MainWindow *mainwin = (MainWindow *)data;
2358 inc_mail_cb(mainwin, 0, NULL);
2361 static void toolbar_inc_all_cb (GtkWidget *widget,
2364 MainWindow *mainwin = (MainWindow *)data;
2366 inc_all_account_mail_cb(mainwin, 0, NULL);
2369 static void toolbar_send_cb (GtkWidget *widget,
2372 MainWindow *mainwin = (MainWindow *)data;
2374 send_queue_cb(mainwin, 0, NULL);
2377 static void toolbar_compose_cb (GtkWidget *widget,
2380 MainWindow *mainwin = (MainWindow *)data;
2382 if (mainwin->compose_btn_type == COMPOSEBUTTON_MAIL)
2383 compose_cb(mainwin, 0, NULL);
2385 compose_news_cb(mainwin, 0, NULL);
2388 static void toolbar_compose_news_cb (GtkWidget *widget,
2391 MainWindow *mainwin = (MainWindow *)data;
2393 compose_news_cb(mainwin, 0, NULL);
2396 static void toolbar_compose_mail_cb (GtkWidget *widget,
2399 MainWindow *mainwin = (MainWindow *)data;
2401 compose_mail_cb(mainwin, 0, NULL);
2404 static void toolbar_reply_cb(GtkWidget *widget, gpointer data)
2406 MainWindow *mainwin = (MainWindow *)data;
2409 prefs_common.reply_with_quote ? COMPOSE_REPLY_WITH_QUOTE
2410 : COMPOSE_REPLY_WITHOUT_QUOTE,
2414 static void toolbar_reply_to_all_cb(GtkWidget *widget, gpointer data)
2416 MainWindow *mainwin = (MainWindow *)data;
2419 prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
2420 : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
2425 static void toolbar_reply_to_sender_cb(GtkWidget *widget, gpointer data)
2427 MainWindow *mainwin = (MainWindow *)data;
2430 prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
2431 : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
2435 static void toolbar_forward_cb (GtkWidget *widget,
2438 MainWindow *mainwin = (MainWindow *)data;
2440 if (prefs_common.forward_as_attachment)
2441 reply_cb(mainwin, COMPOSE_FORWARD_AS_ATTACH, NULL);
2443 reply_cb(mainwin, COMPOSE_FORWARD, NULL);
2446 static void toolbar_delete_cb (GtkWidget *widget,
2449 MainWindow *mainwin = (MainWindow *)data;
2451 summary_delete(mainwin->summaryview);
2454 static void toolbar_exec_cb (GtkWidget *widget,
2457 MainWindow *mainwin = (MainWindow *)data;
2459 summary_execute(mainwin->summaryview);
2462 static void toolbar_next_unread_cb (GtkWidget *widget,
2465 MainWindow *mainwin = (MainWindow *)data;
2467 next_unread_cb(mainwin, 0, NULL);
2470 static void toolbar_prefs_cb (GtkWidget *widget,
2473 prefs_common_open();
2476 static void toolbar_account_cb (GtkWidget *widget,
2479 MainWindow *mainwin = (MainWindow *)data;
2481 prefs_account_open_cb(mainwin, 0, NULL);
2485 static void toolbar_account_button_pressed(GtkWidget *widget,
2486 GdkEventButton *event,
2489 MainWindow *mainwin = (MainWindow *)data;
2492 if (event->button != 3) return;
2494 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
2495 gtk_object_set_data(GTK_OBJECT(mainwin->ac_menu), "menu_button",
2498 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
2499 menu_button_position, widget,
2500 event->button, event->time);
2504 static void ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
2507 MainWindow *mainwin = (MainWindow *)data;
2511 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
2512 gtk_object_set_data(GTK_OBJECT(mainwin->ac_menu), "menu_button",
2515 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
2516 menu_button_position, widget,
2517 event->button, event->time);
2520 static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
2522 MainWindow *mainwin = (MainWindow *)data;
2525 button = gtk_object_get_data(GTK_OBJECT(menu_shell), "menu_button");
2526 if (!button) return;
2527 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
2528 gtk_object_remove_data(GTK_OBJECT(mainwin->ac_menu), "menu_button");
2529 manage_window_focus_in(mainwin->window, NULL, NULL);
2532 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
2535 MainWindow *mainwin = (MainWindow *)data;
2537 if (mainwin->lock_count == 0)
2538 app_exit_cb(data, 0, widget);
2543 static gint folder_window_close_cb(GtkWidget *widget, GdkEventAny *event,
2546 MainWindow *mainwin = (MainWindow *)data;
2547 GtkWidget *menuitem;
2549 menuitem = gtk_item_factory_get_item
2550 (mainwin->menu_factory, "/View/Show or hide/Folder tree");
2551 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
2556 static gint message_window_close_cb(GtkWidget *widget, GdkEventAny *event,
2559 MainWindow *mainwin = (MainWindow *)data;
2560 GtkWidget *menuitem;
2562 menuitem = gtk_item_factory_get_item
2563 (mainwin->menu_factory, "/View/Show or hide/Message view");
2564 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
2569 static void add_mailbox_cb(MainWindow *mainwin, guint action,
2572 main_window_add_mailbox(mainwin);
2575 static void add_mbox_cb(MainWindow *mainwin, guint action,
2578 main_window_add_mbox(mainwin);
2581 static void update_folderview_cb(MainWindow *mainwin, guint action,
2584 summary_show(mainwin->summaryview, NULL, FALSE);
2585 folderview_rescan_all();
2588 static void new_folder_cb(MainWindow *mainwin, guint action,
2591 folderview_new_folder(mainwin->folderview);
2594 static void rename_folder_cb(MainWindow *mainwin, guint action,
2597 folderview_rename_folder(mainwin->folderview);
2600 static void delete_folder_cb(MainWindow *mainwin, guint action,
2603 folderview_delete_folder(mainwin->folderview);
2606 static void import_mbox_cb(MainWindow *mainwin, guint action,
2609 import_mbox(mainwin->summaryview->folder_item);
2612 static void export_mbox_cb(MainWindow *mainwin, guint action,
2615 export_mbox(mainwin->summaryview->folder_item);
2618 static void empty_trash_cb(MainWindow *mainwin, guint action,
2621 main_window_empty_trash(mainwin, TRUE);
2624 static void save_as_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2626 summary_save_as(mainwin->summaryview);
2629 static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2631 summary_print(mainwin->summaryview);
2634 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2636 if (prefs_common.confirm_on_exit) {
2637 if (alertpanel(_("Exit"), _("Exit this program?"),
2638 _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
2640 manage_window_focus_in(mainwin->window, NULL, NULL);
2643 app_will_exit(widget, mainwin);
2646 static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2649 summary_search(mainwin->summaryview);
2651 message_search(mainwin->messageview);
2654 static void toggle_folder_cb(MainWindow *mainwin, guint action,
2659 active = GTK_CHECK_MENU_ITEM(widget)->active;
2661 switch (mainwin->type) {
2663 case SEPARATE_MESSAGE:
2666 gtk_widget_show(GTK_WIDGET_PTR(mainwin->folderview));
2668 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->folderview));
2671 case SEPARATE_FOLDER:
2672 debug_print("separate folder\n");
2674 gtk_widget_show(mainwin->win.sep_folder.folderwin);
2676 gtk_widget_hide(mainwin->win.sep_folder.folderwin);
2680 gtk_widget_show(mainwin->win.sep_both.folderwin);
2682 gtk_widget_hide(mainwin->win.sep_both.folderwin);
2687 static void toggle_message_cb(MainWindow *mainwin, guint action,
2692 active = GTK_CHECK_MENU_ITEM(widget)->active;
2694 if (active != messageview_is_visible(mainwin->messageview))
2695 summary_toggle_view(mainwin->summaryview);
2698 static void toggle_toolbar_cb(MainWindow *mainwin, guint action,
2701 switch ((ToolbarStyle)action) {
2703 gtk_widget_hide(mainwin->handlebox);
2705 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
2709 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
2713 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
2718 if (action != TOOLBAR_NONE) {
2719 gtk_widget_show(mainwin->handlebox);
2720 gtk_widget_queue_resize(mainwin->handlebox);
2723 mainwin->toolbar_style = (ToolbarStyle)action;
2724 prefs_common.toolbar_style = (ToolbarStyle)action;
2727 static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
2730 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2731 gtk_widget_show(mainwin->hbox_stat);
2732 prefs_common.show_statusbar = TRUE;
2734 gtk_widget_hide(mainwin->hbox_stat);
2735 prefs_common.show_statusbar = FALSE;
2739 static void separate_widget_cb(MainWindow *mainwin, guint action,
2744 if (GTK_CHECK_MENU_ITEM(widget)->active)
2745 type = mainwin->type | action;
2747 type = mainwin->type & ~action;
2749 main_window_separation_change(mainwin, type);
2751 prefs_common.sep_folder = (type & SEPARATE_FOLDER) != 0;
2752 prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
2755 static void toggle_work_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2757 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2758 online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
2760 online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
2764 static void online_switch_clicked (GtkButton *btn, gpointer data)
2766 MainWindow *mainwin;
2767 GtkItemFactory *ifactory;
2768 GtkCheckMenuItem *menuitem;
2770 mainwin = (MainWindow *) data;
2772 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
2773 menuitem = GTK_CHECK_MENU_ITEM (gtk_item_factory_get_widget(ifactory, "/File/Work offline"));
2775 g_return_if_fail(mainwin != NULL);
2776 g_return_if_fail(menuitem != NULL);
2778 if (btn == GTK_BUTTON(mainwin->online_switch)) {
2780 gtk_widget_hide (mainwin->online_switch);
2781 gtk_widget_show (mainwin->offline_switch);
2782 menuitem->active = TRUE;
2783 prefs_common.work_offline = TRUE;
2784 inc_autocheck_timer_remove();
2787 gtk_widget_hide (mainwin->offline_switch);
2788 gtk_widget_show (mainwin->online_switch);
2789 menuitem->active = FALSE;
2790 prefs_common.work_offline = FALSE;
2791 inc_autocheck_timer_set();
2795 static void addressbook_open_cb(MainWindow *mainwin, guint action,
2798 addressbook_open(NULL);
2801 static void log_window_show_cb(MainWindow *mainwin, guint action,
2804 log_window_show(mainwin->logwin);
2807 static void sel_download_cb(MainWindow *mainwin, guint action,
2810 selective_download(mainwin);
2813 static void inc_mail_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2815 inc_mail(mainwin, prefs_common.newmail_notify_manu);
2818 static void inc_all_account_mail_cb(MainWindow *mainwin, guint action,
2821 inc_all_account_mail(mainwin, prefs_common.newmail_notify_manu);
2824 static void inc_cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2829 static void send_queue_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2833 if (prefs_common.work_offline)
2834 if (alertpanel(_("Offline warning"),
2835 _("You're working offline. Override?"),
2836 _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
2839 for (list = folder_get_list(); list != NULL; list = list->next) {
2840 Folder *folder = list->data;
2842 if (folder->queue) {
2843 if (procmsg_send_queue
2844 (folder->queue, prefs_common.savemsg) < 0)
2845 alertpanel_error(_("Some errors occurred while sending queued messages."));
2846 statusbar_pop_all();
2847 folder_item_scan(folder->queue);
2848 folderview_update_item(folder->queue, TRUE);
2853 static void compose_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2855 if (mainwin->summaryview->folder_item) {
2856 if (mainwin->summaryview->folder_item->folder->account != NULL
2857 && mainwin->summaryview->folder_item->folder->account->protocol == A_NNTP)
2858 compose_new_with_recipient(mainwin->summaryview->folder_item->folder->account, mainwin->summaryview->folder_item->path);
2860 compose_new_with_folderitem(mainwin->summaryview->folder_item->folder->account, mainwin->summaryview->folder_item);
2866 static void compose_mail_cb(MainWindow *mainwin, guint action,
2873 if (mainwin->summaryview->folder_item) {
2874 ac = mainwin->summaryview->folder_item->folder->account;
2875 if (ac && ac->protocol != A_NNTP) {
2876 compose_new_with_folderitem(ac, mainwin->summaryview->folder_item);
2881 if(cur_account && (cur_account->protocol != A_NNTP)) {
2882 compose_new_with_folderitem(cur_account, mainwin->summaryview->folder_item);
2886 list = account_get_list();
2887 for(cur = list ; cur != NULL ; cur = g_list_next(cur)) {
2888 ac = (PrefsAccount *) cur->data;
2889 if (ac->protocol != A_NNTP) {
2890 compose_new_with_folderitem(ac, mainwin->summaryview->folder_item);
2896 static void compose_news_cb(MainWindow *mainwin, guint action,
2899 PrefsAccount * ac = NULL;
2903 if (mainwin->summaryview->folder_item) {
2904 ac = mainwin->summaryview->folder_item->folder->account;
2905 if (ac && ac->protocol == A_NNTP) {
2906 compose_new_with_recipient
2907 (ac, mainwin->summaryview->folder_item->path);
2912 list = account_get_list();
2913 for(cur = list ; cur != NULL ; cur = g_list_next(cur)) {
2914 ac = (PrefsAccount *) cur->data;
2915 if (ac->protocol == A_NNTP) {
2922 static void reply_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2924 summary_reply(mainwin->summaryview, (ComposeMode)action);
2927 static void move_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2929 summary_move_to(mainwin->summaryview);
2932 static void copy_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2934 summary_copy_to(mainwin->summaryview);
2937 static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2939 summary_delete(mainwin->summaryview);
2942 static void open_msg_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2944 summary_open_msg(mainwin->summaryview);
2947 static void view_source_cb(MainWindow *mainwin, guint action,
2950 summary_view_source(mainwin->summaryview);
2953 static void show_all_header_cb(MainWindow *mainwin, guint action,
2956 if (mainwin->menu_lock_count) return;
2957 summary_display_msg_selected(mainwin->summaryview,
2958 GTK_CHECK_MENU_ITEM(widget)->active);
2961 static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2963 summary_reedit(mainwin->summaryview);
2966 static void mark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2968 summary_mark(mainwin->summaryview);
2971 static void unmark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2973 summary_unmark(mainwin->summaryview);
2976 static void mark_as_unread_cb(MainWindow *mainwin, guint action,
2979 summary_mark_as_unread(mainwin->summaryview);
2982 static void mark_as_read_cb(MainWindow *mainwin, guint action,
2985 summary_mark_as_read(mainwin->summaryview);
2988 static void mark_all_read_cb(MainWindow *mainwin, guint action,
2991 summary_mark_all_read(mainwin->summaryview);
2994 static void add_address_cb(MainWindow *mainwin, guint action,
2997 summary_add_address(mainwin->summaryview);
3000 static void set_charset_cb(MainWindow *mainwin, guint action,
3005 str = conv_get_charset_str((CharSet)action);
3006 g_free(prefs_common.force_charset);
3007 prefs_common.force_charset = str ? g_strdup(str) : NULL;
3009 summary_redisplay_msg(mainwin->summaryview);
3011 debug_print(_("forced charset: %s\n"), str ? str : "Auto-Detect");
3014 static void hide_read_messages (MainWindow *mainwin, guint action,
3017 if (!mainwin->summaryview->folder_item
3018 || gtk_object_get_data(GTK_OBJECT(widget), "dont_toggle"))
3020 summary_toggle_show_read_messages(mainwin->summaryview);
3023 static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3025 if (mainwin->menu_lock_count) return;
3026 if (!mainwin->summaryview->folder_item) return;
3028 if (GTK_CHECK_MENU_ITEM(widget)->active) {
3029 summary_thread_build(mainwin->summaryview);
3030 mainwin->summaryview->folder_item->threaded = TRUE;
3032 summary_unthread(mainwin->summaryview);
3033 mainwin->summaryview->folder_item->threaded = FALSE;
3037 static void expand_threads_cb(MainWindow *mainwin, guint action,
3040 summary_expand_threads(mainwin->summaryview);
3043 static void collapse_threads_cb(MainWindow *mainwin, guint action,
3046 summary_collapse_threads(mainwin->summaryview);
3049 static void set_display_item_cb(MainWindow *mainwin, guint action,
3052 prefs_summary_column_open();
3055 static void sort_summary_cb(MainWindow *mainwin, guint action,
3058 FolderItem *item = mainwin->summaryview->folder_item;
3059 GtkWidget *menuitem;
3061 if (mainwin->menu_lock_count) return;
3063 menuitem = gtk_item_factory_get_item
3064 (mainwin->menu_factory, "/View/Sort/Ascending");
3065 summary_sort(mainwin->summaryview, (FolderSortKey)action,
3066 GTK_CHECK_MENU_ITEM(menuitem)->active
3067 ? SORT_ASCENDING : SORT_DESCENDING);
3071 static void sort_summary_type_cb(MainWindow *mainwin, guint action,
3074 FolderItem *item = mainwin->summaryview->folder_item;
3076 if (mainwin->menu_lock_count) return;
3078 summary_sort(mainwin->summaryview,
3079 item->sort_key, (FolderSortType)action);
3082 static void attract_by_subject_cb(MainWindow *mainwin, guint action,
3085 summary_attract_by_subject(mainwin->summaryview);
3088 static void delete_duplicated_cb(MainWindow *mainwin, guint action,
3091 summary_delete_duplicated(mainwin->summaryview);
3094 static void filter_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3096 summary_filter(mainwin->summaryview);
3099 static void execute_summary_cb(MainWindow *mainwin, guint action,
3102 summary_execute(mainwin->summaryview);
3105 static void update_summary_cb(MainWindow *mainwin, guint action,
3109 FolderView *folderview = mainwin->folderview;
3111 if (!mainwin->summaryview->folder_item) return;
3112 if (!folderview->opened) return;
3114 folder_update_op_count();
3116 fitem = gtk_ctree_node_get_row_data(GTK_CTREE(folderview->ctree),
3117 folderview->opened);
3120 summary_show(mainwin->summaryview, fitem, TRUE);
3123 static void prev_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3125 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
3128 static void next_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3130 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
3133 static void prev_unread_cb(MainWindow *mainwin, guint action,
3136 summary_select_prev_unread(mainwin->summaryview);
3139 static void next_unread_cb(MainWindow *mainwin, guint action,
3142 summary_select_next_unread(mainwin->summaryview);
3145 static void prev_marked_cb(MainWindow *mainwin, guint action,
3148 summary_select_prev_marked(mainwin->summaryview);
3151 static void next_marked_cb(MainWindow *mainwin, guint action,
3154 summary_select_next_marked(mainwin->summaryview);
3157 static void prev_labeled_cb(MainWindow *mainwin, guint action,
3160 summary_select_prev_labeled(mainwin->summaryview);
3163 static void next_labeled_cb(MainWindow *mainwin, guint action,
3166 summary_select_next_labeled(mainwin->summaryview);
3169 static void goto_folder_cb(MainWindow *mainwin, guint action,
3172 FolderItem *to_folder;
3174 to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL);
3177 folderview_select(mainwin->folderview, to_folder);
3180 static void copy_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3182 messageview_copy_clipboard(mainwin->messageview);
3185 static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3187 MessageView *msgview = mainwin->messageview;
3189 if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->ctree))
3190 summary_select_all(mainwin->summaryview);
3191 else if (messageview_is_visible(msgview) &&
3192 (GTK_WIDGET_HAS_FOCUS(msgview->textview->text) ||
3193 GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text)))
3194 messageview_select_all(mainwin->messageview);
3197 static void selthread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3199 if (messageview_is_visible(mainwin->summaryview->messageview))
3200 summary_select_thread(mainwin->summaryview);
3203 static void create_filter_cb(MainWindow *mainwin, guint action,
3206 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action);
3209 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
3212 prefs_common_open();
3215 static void prefs_filter_open_cb(MainWindow *mainwin, guint action,
3218 prefs_filter_open(NULL, NULL);
3221 static void prefs_scoring_open_cb(MainWindow *mainwin, guint action,
3224 prefs_scoring_open(NULL);
3227 static void prefs_filtering_open_cb(MainWindow *mainwin, guint action,
3230 prefs_filtering_open(NULL, NULL, NULL);
3233 static void prefs_template_open_cb(MainWindow *mainwin, guint action,
3236 prefs_template_open();
3239 static void prefs_actions_open_cb(MainWindow *mainwin, guint action,
3242 prefs_actions_open(mainwin);
3245 static void prefs_account_open_cb(MainWindow *mainwin, guint action,
3249 new_account_cb(mainwin, 0, widget);
3251 gboolean prev_default = cur_account->is_default;
3253 prefs_account_open(cur_account);
3254 if (!prev_default && cur_account->is_default)
3255 account_set_as_default(cur_account);
3256 account_save_config_all();
3258 main_window_reflect_prefs_all();
3262 static void new_account_cb(MainWindow *mainwin, guint action,
3265 account_edit_open();
3266 if (!compose_get_compose_list()) account_add();
3269 static void account_menu_cb(GtkMenuItem *menuitem, gpointer data)
3271 cur_account = (PrefsAccount *)data;
3272 main_window_reflect_prefs_all();
3275 static void manual_open_cb(MainWindow *mainwin, guint action,
3278 manual_open((ManualLang)action);
3281 static void faq_open_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
3283 faq_open((ManualLang)action);
3286 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
3288 MainWindow *mainwin = (MainWindow *)data;
3292 str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
3293 LOCAL_FOLDER(folder)->rootpath,
3297 str = g_strdup_printf(_("Scanning folder %s ..."),
3298 LOCAL_FOLDER(folder)->rootpath);
3300 STATUSBAR_PUSH(mainwin, str);
3301 STATUSBAR_POP(mainwin);
3305 static void activate_compose_button (MainWindow *mainwin,
3307 ComposeButtonType type)
3309 SensitiveCond state = main_window_get_current_state(mainwin);
3311 if (style == TOOLBAR_NONE)
3314 gtk_widget_hide(type == COMPOSEBUTTON_NEWS ? mainwin->compose_mail_btn
3315 : mainwin->compose_news_btn);
3316 gtk_widget_show(type == COMPOSEBUTTON_NEWS ? mainwin->compose_news_btn
3317 : mainwin->compose_mail_btn);
3318 mainwin->compose_btn_type = type;
3321 void main_window_toolbar_set_compose_button(MainWindow *mainwin, ComposeButtonType compose_btn_type)
3323 if (mainwin->compose_btn_type != compose_btn_type)
3324 activate_compose_button(mainwin,
3325 prefs_common.toolbar_style,
3329 #define BREAK_ON_MODIFIER_KEY() \
3330 if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
3332 static void key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer data)
3334 MainWindow *mainwin = (MainWindow*) data;
3336 if (!mainwin || !event) return;
3338 switch (event->keyval) {
3339 case GDK_Q: /* Quit */
3340 BREAK_ON_MODIFIER_KEY();
3342 app_exit_cb(mainwin, 0, NULL);
3349 #undef BREAK_ON_MODIFIER_KEY
3351 static void set_toolbar_style(MainWindow *mainwin)
3353 switch (prefs_common.toolbar_style) {
3355 gtk_widget_hide(mainwin->handlebox);
3358 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
3362 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
3366 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
3371 if (prefs_common.toolbar_style != TOOLBAR_NONE) {
3372 gtk_widget_show(mainwin->handlebox);
3373 gtk_widget_queue_resize(mainwin->handlebox);
3378 * Harvest addresses for selected folder.
3380 static void addr_harvest_cb( MainWindow *mainwin,
3384 addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
3388 * Harvest addresses for selected messages in summary view.
3390 static void addr_harvest_msg_cb( MainWindow *mainwin,
3394 summary_harvest_address( mainwin->summaryview );