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_actions.h"
64 #include "prefs_filtering.h"
65 #include "prefs_scoring.h"
66 #include "prefs_account.h"
67 #include "prefs_folder_item.h"
68 #include "prefs_summary_column.h"
69 #include "prefs_template.h"
70 #include "prefs_toolbar.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"
85 #include "ssl_manager.h"
86 #include "sslcertwindow.h"
88 #define AC_LABEL_WIDTH 240
90 /* list of all instantiated MainWindow */
91 static GList *mainwin_list = NULL;
93 static GdkCursor *watch_cursor;
95 static void main_window_menu_callback_block (MainWindow *mainwin);
96 static void main_window_menu_callback_unblock (MainWindow *mainwin);
98 static void main_window_show_cur_account (MainWindow *mainwin);
100 static void main_window_set_widgets (MainWindow *mainwin,
104 static void toolbar_account_button_pressed (GtkWidget *widget,
105 GdkEventButton *event,
108 static void ac_label_button_pressed (GtkWidget *widget,
109 GdkEventButton *event,
111 static void ac_menu_popup_closed (GtkMenuShell *menu_shell,
114 static gint main_window_close_cb (GtkWidget *widget,
117 static gint folder_window_close_cb (GtkWidget *widget,
120 static gint message_window_close_cb (GtkWidget *widget,
124 static void add_mailbox_cb (MainWindow *mainwin,
127 static void add_mbox_cb (MainWindow *mainwin,
130 static void update_folderview_cb (MainWindow *mainwin,
133 static void new_folder_cb (MainWindow *mainwin,
136 static void rename_folder_cb (MainWindow *mainwin,
139 static void delete_folder_cb (MainWindow *mainwin,
142 static void import_mbox_cb (MainWindow *mainwin,
145 static void export_mbox_cb (MainWindow *mainwin,
148 static void empty_trash_cb (MainWindow *mainwin,
152 static void save_as_cb (MainWindow *mainwin,
155 static void print_cb (MainWindow *mainwin,
158 static void app_exit_cb (MainWindow *mainwin,
162 static void search_cb (MainWindow *mainwin,
166 static void toggle_folder_cb (MainWindow *mainwin,
169 static void toggle_message_cb (MainWindow *mainwin,
172 static void toggle_toolbar_cb (MainWindow *mainwin,
175 static void toggle_statusbar_cb (MainWindow *mainwin,
178 static void separate_widget_cb (MainWindow *mainwin,
182 static void addressbook_open_cb (MainWindow *mainwin,
185 static void log_window_show_cb (MainWindow *mainwin,
188 static void sel_download_cb (MainWindow *mainwin,
191 static void prefs_toolbar_cb (MainWindow *mainwin,
196 static void inc_cancel_cb (MainWindow *mainwin,
200 static void open_msg_cb (MainWindow *mainwin,
204 static void view_source_cb (MainWindow *mainwin,
208 static void show_all_header_cb (MainWindow *mainwin,
212 static void reedit_cb (MainWindow *mainwin,
216 static void move_to_cb (MainWindow *mainwin,
219 static void copy_to_cb (MainWindow *mainwin,
222 static void delete_cb (MainWindow *mainwin,
226 static void cancel_cb (MainWindow *mainwin,
230 static void mark_cb (MainWindow *mainwin,
233 static void unmark_cb (MainWindow *mainwin,
237 static void mark_as_unread_cb (MainWindow *mainwin,
240 static void mark_as_read_cb (MainWindow *mainwin,
243 static void mark_all_read_cb (MainWindow *mainwin,
246 static void add_address_cb (MainWindow *mainwin,
250 static void set_charset_cb (MainWindow *mainwin,
254 static void hide_read_messages (MainWindow *mainwin,
258 static void thread_cb (MainWindow *mainwin,
261 static void expand_threads_cb (MainWindow *mainwin,
264 static void collapse_threads_cb (MainWindow *mainwin,
268 static void set_display_item_cb (MainWindow *mainwin,
271 static void sort_summary_cb (MainWindow *mainwin,
274 static void sort_summary_type_cb (MainWindow *mainwin,
277 static void attract_by_subject_cb(MainWindow *mainwin,
281 static void delete_duplicated_cb (MainWindow *mainwin,
284 static void filter_cb (MainWindow *mainwin,
287 static void execute_summary_cb (MainWindow *mainwin,
290 static void update_summary_cb (MainWindow *mainwin,
294 static void prev_cb (MainWindow *mainwin,
297 static void next_cb (MainWindow *mainwin,
300 static void next_unread_cb (MainWindow *mainwin,
303 static void prev_unread_cb (MainWindow *mainwin,
307 static void prev_new_cb (MainWindow *mainwin,
310 static void next_new_cb (MainWindow *mainwin,
313 static void prev_marked_cb (MainWindow *mainwin,
316 static void next_marked_cb (MainWindow *mainwin,
319 static void prev_labeled_cb (MainWindow *mainwin,
322 static void next_labeled_cb (MainWindow *mainwin,
326 static void goto_folder_cb (MainWindow *mainwin,
330 static void copy_cb (MainWindow *mainwin,
333 static void allsel_cb (MainWindow *mainwin,
336 static void select_thread_cb (MainWindow *mainwin,
340 static void create_filter_cb (MainWindow *mainwin,
344 static void prefs_common_open_cb (MainWindow *mainwin,
347 static void prefs_template_open_cb (MainWindow *mainwin,
350 static void prefs_actions_open_cb (MainWindow *mainwin,
353 static void prefs_account_open_cb (MainWindow *mainwin,
356 static void prefs_scoring_open_cb (MainWindow *mainwin,
359 static void prefs_filtering_open_cb (MainWindow *mainwin,
363 static void ssl_manager_open_cb (MainWindow *mainwin,
367 static void new_account_cb (MainWindow *mainwin,
371 static void account_menu_cb (GtkMenuItem *menuitem,
374 static void online_switch_clicked(GtkButton *btn,
377 static void manual_open_cb (MainWindow *mainwin,
381 static void scan_tree_func (Folder *folder,
385 static void toggle_work_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget);
387 static void addr_harvest_cb ( MainWindow *mainwin,
391 static void addr_harvest_msg_cb ( MainWindow *mainwin,
395 #define SEPARATE_ACTION 500
397 static GtkItemFactoryEntry mainwin_entries[] =
399 {N_("/_File"), NULL, NULL, 0, "<Branch>"},
400 {N_("/_File/_Add mailbox..."), NULL, add_mailbox_cb, 0, NULL},
401 {N_("/_File/_Add mbox mailbox..."), NULL, add_mbox_cb, 0, NULL},
402 {N_("/_File/_Check for new messages in all folders"),
403 NULL, update_folderview_cb, 0, NULL},
404 {N_("/_File/_Folder"), NULL, NULL, 0, "<Branch>"},
405 {N_("/_File/_Folder/Create _new folder..."),
406 NULL, new_folder_cb, 0, NULL},
407 {N_("/_File/_Folder/_Rename folder..."),NULL, rename_folder_cb, 0, NULL},
408 {N_("/_File/_Folder/_Delete folder"), NULL, delete_folder_cb, 0, NULL},
409 {N_("/_File/_Import mbox file..."), NULL, import_mbox_cb, 0, NULL},
410 {N_("/_File/_Export to mbox file..."), NULL, export_mbox_cb, 0, NULL},
411 {N_("/_File/Empty _trash"), "<shift>D", empty_trash_cb, 0, NULL},
412 {N_("/_File/_Work offline"), "<control>W", toggle_work_offline_cb, 0, "<ToggleItem>"},
413 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
414 {N_("/_File/_Save as..."), "<control>S", save_as_cb, 0, NULL},
415 {N_("/_File/_Print..."), NULL, print_cb, 0, NULL},
416 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
417 /* {N_("/_File/_Close"), "<alt>W", app_exit_cb, 0, NULL}, */
418 {N_("/_File/E_xit"), "<control>Q", app_exit_cb, 0, NULL},
420 {N_("/_Edit"), NULL, NULL, 0, "<Branch>"},
421 {N_("/_Edit/_Copy"), "<control>C", copy_cb, 0, NULL},
422 {N_("/_Edit/Select _all"), "<control>A", allsel_cb, 0, NULL},
423 {N_("/_Edit/Select _thread"), NULL, select_thread_cb, 0, NULL},
424 {N_("/_Edit/---"), NULL, NULL, 0, "<Separator>"},
425 {N_("/_Edit/_Find in current message..."),
426 "<control>F", search_cb, 0, NULL},
427 {N_("/_Edit/_Search folder..."), "<shift><control>F", search_cb, 1, NULL},
428 {N_("/_View"), NULL, NULL, 0, "<Branch>"},
429 {N_("/_View/Show or hi_de"), NULL, NULL, 0, "<Branch>"},
430 {N_("/_View/Show or hi_de/_Folder tree"),
431 NULL, toggle_folder_cb, 0, "<ToggleItem>"},
432 {N_("/_View/Show or hi_de/_Message view"),
433 "V", toggle_message_cb, 0, "<ToggleItem>"},
434 {N_("/_View/Show or hi_de/_Toolbar"),
435 NULL, NULL, 0, "<Branch>"},
436 {N_("/_View/Show or hi_de/_Toolbar/Icon _and text"),
437 NULL, toggle_toolbar_cb, TOOLBAR_BOTH, "<RadioItem>"},
438 {N_("/_View/Show or hi_de/_Toolbar/_Icon"),
439 NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Icon and text"},
440 {N_("/_View/Show or hi_de/_Toolbar/_Text"),
441 NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Icon and text"},
442 {N_("/_View/Show or hi_de/_Toolbar/_None"),
443 NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Icon and text"},
444 {N_("/_View/Show or hi_de/Status _bar"),
445 NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
446 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
447 {N_("/_View/Separate f_older tree"), NULL, separate_widget_cb, SEPARATE_FOLDER, "<ToggleItem>"},
448 {N_("/_View/Separate m_essage view"), NULL, separate_widget_cb, SEPARATE_MESSAGE, "<ToggleItem>"},
449 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
450 {N_("/_View/_Sort"), NULL, NULL, 0, "<Branch>"},
451 {N_("/_View/_Sort/by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, "<RadioItem>"},
452 {N_("/_View/_Sort/by s_ize"), NULL, sort_summary_cb, SORT_BY_SIZE, "/View/Sort/by number"},
453 {N_("/_View/_Sort/by _date"), NULL, sort_summary_cb, SORT_BY_DATE, "/View/Sort/by number"},
454 {N_("/_View/_Sort/by _from"), NULL, sort_summary_cb, SORT_BY_FROM, "/View/Sort/by number"},
455 {N_("/_View/_Sort/by _recipient"), NULL, sort_summary_cb, SORT_BY_TO, "/View/Sort/by number"},
456 {N_("/_View/_Sort/by _subject"), NULL, sort_summary_cb, SORT_BY_SUBJECT, "/View/Sort/by number"},
457 {N_("/_View/_Sort/by _color label"),
458 NULL, sort_summary_cb, SORT_BY_LABEL, "/View/Sort/by number"},
459 {N_("/_View/_Sort/by _mark"), NULL, sort_summary_cb, SORT_BY_MARK, "/View/Sort/by number"},
460 {N_("/_View/_Sort/by _unread"), NULL, sort_summary_cb, SORT_BY_UNREAD, "/View/Sort/by number"},
461 {N_("/_View/_Sort/by a_ttachment"),
462 NULL, sort_summary_cb, SORT_BY_MIME, "/View/Sort/by number"},
463 {N_("/_View/_Sort/by score"), NULL, sort_summary_cb, SORT_BY_SCORE, "/View/Sort/by number"},
464 {N_("/_View/_Sort/by locked"), NULL, sort_summary_cb, SORT_BY_LOCKED, "/View/Sort/by number"},
465 {N_("/_View/_Sort/D_on't sort"), NULL, sort_summary_cb, SORT_BY_NONE, "/View/Sort/by number"},
466 {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
467 {N_("/_View/_Sort/Ascending"), NULL, sort_summary_type_cb, SORT_ASCENDING, "<RadioItem>"},
468 {N_("/_View/_Sort/Descending"), NULL, sort_summary_type_cb, SORT_DESCENDING, "/View/Sort/Ascending"},
469 {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
470 {N_("/_View/_Sort/_Attract by subject"),
471 NULL, attract_by_subject_cb, 0, NULL},
472 {N_("/_View/Th_read view"), "<control>T", thread_cb, 0, "<ToggleItem>"},
473 {N_("/_View/E_xpand all threads"), NULL, expand_threads_cb, 0, NULL},
474 {N_("/_View/Co_llapse all threads"), NULL, collapse_threads_cb, 0, NULL},
475 {N_("/_View/_Hide read messages"), NULL, hide_read_messages, 0, "<ToggleItem>"},
476 {N_("/_View/Set displayed _items..."), NULL, set_display_item_cb, 0, NULL},
478 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
479 {N_("/_View/_Go to"), NULL, NULL, 0, "<Branch>"},
480 {N_("/_View/_Go to/_Prev message"), "P", prev_cb, 0, NULL},
481 {N_("/_View/_Go to/_Next message"), "N", next_cb, 0, NULL},
482 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
483 {N_("/_View/_Go to/P_rev unread message"),
484 "<shift>P", prev_unread_cb, 0, NULL},
485 {N_("/_View/_Go to/N_ext unread message"),
486 "<shift>N", next_unread_cb, 0, NULL},
487 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
488 {N_("/_View/_Go to/Prev ne_w message"), NULL, prev_new_cb, 0, NULL},
489 {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL},
490 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
491 {N_("/_View/_Go to/Prev _marked message"),
492 NULL, prev_marked_cb, 0, NULL},
493 {N_("/_View/_Go to/Next m_arked message"),
494 NULL, next_marked_cb, 0, NULL},
495 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
496 {N_("/_View/_Go to/Prev _labeled message"),
497 NULL, prev_labeled_cb, 0, NULL},
498 {N_("/_View/_Go to/Next la_beled message"),
499 NULL, next_labeled_cb, 0, NULL},
500 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
501 {N_("/_View/_Go to/Other _folder..."), "G", goto_folder_cb, 0, NULL},
502 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
504 #define CODESET_SEPARATOR \
505 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"}
506 #define CODESET_ACTION(action) \
507 NULL, set_charset_cb, action, "/View/Code set/Auto detect"
509 {N_("/_View/_Code set"), NULL, NULL, 0, "<Branch>"},
510 {N_("/_View/_Code set/_Auto detect"),
511 NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
512 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"},
513 {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
514 CODESET_ACTION(C_US_ASCII)},
517 {N_("/_View/_Code set/Unicode (_UTF-8)"),
518 CODESET_ACTION(C_UTF_8)},
521 {N_("/_View/_Code set/Western European (ISO-8859-_1)"),
522 CODESET_ACTION(C_ISO_8859_1)},
523 {N_("/_View/_Code set/Western European (ISO-8859-15)"),
524 CODESET_ACTION(C_ISO_8859_15)},
527 {N_("/_View/_Code set/Central European (ISO-8859-_2)"),
528 CODESET_ACTION(C_ISO_8859_2)},
530 {N_("/_View/_Code set/_Baltic (ISO-8859-13)"),
531 CODESET_ACTION(C_ISO_8859_13)},
532 {N_("/_View/_Code set/Baltic (ISO-8859-_4)"),
533 CODESET_ACTION(C_ISO_8859_4)},
535 {N_("/_View/_Code set/Greek (ISO-8859-_7)"),
536 CODESET_ACTION(C_ISO_8859_7)},
538 {N_("/_View/_Code set/Turkish (ISO-8859-_9)"),
539 CODESET_ACTION(C_ISO_8859_9)},
541 {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"),
542 CODESET_ACTION(C_ISO_8859_5)},
543 {N_("/_View/_Code set/Cyrillic (KOI8-_R)"),
544 CODESET_ACTION(C_KOI8_R)},
545 {N_("/_View/_Code set/Cyrillic (Windows-1251)"),
546 CODESET_ACTION(C_WINDOWS_1251)},
549 {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
550 CODESET_ACTION(C_ISO_2022_JP)},
552 {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
553 CODESET_ACTION(C_ISO_2022_JP_2)},
555 {N_("/_View/_Code set/Japanese (_EUC-JP)"),
556 CODESET_ACTION(C_EUC_JP)},
557 {N_("/_View/_Code set/Japanese (_Shift__JIS)"),
558 CODESET_ACTION(C_SHIFT_JIS)},
561 {N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
562 CODESET_ACTION(C_GB2312)},
563 {N_("/_View/_Code set/Traditional Chinese (_Big5)"),
564 CODESET_ACTION(C_BIG5)},
565 {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"),
566 CODESET_ACTION(C_EUC_TW)},
567 {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"),
568 CODESET_ACTION(C_ISO_2022_CN)},
570 {N_("/_View/_Code set/Korean (EUC-_KR)"),
571 CODESET_ACTION(C_EUC_KR)},
572 {N_("/_View/_Code set/Korean (ISO-2022-KR)"),
573 CODESET_ACTION(C_ISO_2022_KR)},
575 {N_("/_View/_Code set/Thai (TIS-620)"),
576 CODESET_ACTION(C_TIS_620)},
577 {N_("/_View/_Code set/Thai (Windows-874)"),
578 CODESET_ACTION(C_WINDOWS_874)},
581 #undef CODESET_SEPARATOR
582 #undef CODESET_ACTION
584 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
585 {N_("/_View/Open in new _window"), "<control><alt>N", open_msg_cb, 0, NULL},
586 {N_("/_View/Mess_age source"), "<control>U", view_source_cb, 0, NULL},
587 {N_("/_View/Show all _headers"), "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
588 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
589 {N_("/_View/_Update summary"), "<control><alt>U", update_summary_cb, 0, NULL},
591 {N_("/_Message"), NULL, NULL, 0, "<Branch>"},
592 {N_("/_Message/Get new ma_il"), "<control>I", inc_mail_cb, 0, NULL},
593 {N_("/_Message/Get from _all accounts"),
594 "<shift><control>I", inc_all_account_mail_cb, 0, NULL},
595 {N_("/_Message/Cancel receivin_g"), NULL, inc_cancel_cb, 0, NULL},
596 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
597 {N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
598 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
599 {N_("/_Message/Compose a_n email message"), "<control>M", compose_mail_cb, 0, NULL},
600 {N_("/_Message/Compose a news message"), NULL, compose_news_cb, 0, NULL},
601 {N_("/_Message/_Reply"), "<control>R", reply_cb, COMPOSE_REPLY, NULL},
602 {N_("/_Message/Repl_y to"), NULL, NULL, 0, "<Branch>"},
603 {N_("/_Message/Repl_y to/_all"), "<shift><control>R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
604 {N_("/_Message/Repl_y to/_sender"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
605 {N_("/_Message/Repl_y to/mailing _list"),
606 "<control>L", reply_cb, COMPOSE_REPLY_TO_LIST, NULL},
607 {N_("/_Message/Follow-up and reply to"),NULL, reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
608 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
609 {N_("/_Message/_Forward"), "<control><alt>F", reply_cb, COMPOSE_FORWARD, NULL},
610 {N_("/_Message/Redirect"), NULL, reply_cb, COMPOSE_REDIRECT, NULL},
611 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
612 {N_("/_Message/Re-_edit"), NULL, reedit_cb, 0, NULL},
613 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
614 {N_("/_Message/M_ove..."), "<control>O", move_to_cb, 0, NULL},
615 {N_("/_Message/_Copy..."), "<shift><control>O", copy_to_cb, 0, NULL},
616 {N_("/_Message/_Delete"), "<control>D", delete_cb, 0, NULL},
617 {N_("/_Message/Cancel a news message"), "", cancel_cb, 0, NULL},
618 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
619 {N_("/_Message/_Mark"), NULL, NULL, 0, "<Branch>"},
620 {N_("/_Message/_Mark/_Mark"), "<shift>asterisk", mark_cb, 0, NULL},
621 {N_("/_Message/_Mark/_Unmark"), "U", unmark_cb, 0, NULL},
622 {N_("/_Message/_Mark/---"), NULL, NULL, 0, "<Separator>"},
623 {N_("/_Message/_Mark/Mark as unr_ead"), "<shift>exclam", mark_as_unread_cb, 0, NULL},
624 {N_("/_Message/_Mark/Mark as rea_d"),
625 NULL, mark_as_read_cb, 0, NULL},
626 {N_("/_Message/_Mark/Mark all _read"), NULL, mark_all_read_cb, 0, NULL},
628 {N_("/_Tools"), NULL, NULL, 0, "<Branch>"},
629 {N_("/_Tools/_Selective download..."), "<alt>S", sel_download_cb, 0, NULL},
630 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
631 {N_("/_Tools/_Address book..."), "<shift><control>A", addressbook_open_cb, 0, NULL},
632 {N_("/_Tools/Add sender to address boo_k"),
633 NULL, add_address_cb, 0, NULL},
634 {N_("/_Tools/_Harvest addresses"), NULL, NULL, 0, "<Branch>"},
635 {N_("/_Tools/_Harvest addresses/from _Folder..."),
636 NULL, addr_harvest_cb, 0, NULL},
637 {N_("/_Tools/_Harvest addresses/from _Messages..."),
638 NULL, addr_harvest_msg_cb, 0, NULL},
639 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
640 {N_("/_Tools/_Filter messages"), NULL, filter_cb, 0, NULL},
641 {N_("/_Tools/_Create filter rule"), NULL, NULL, 0, "<Branch>"},
642 {N_("/_Tools/_Create filter rule/_Automatically"),
643 NULL, create_filter_cb, FILTER_BY_AUTO, NULL},
644 {N_("/_Tools/_Create filter rule/by _From"),
645 NULL, create_filter_cb, FILTER_BY_FROM, NULL},
646 {N_("/_Tools/_Create filter rule/by _To"),
647 NULL, create_filter_cb, FILTER_BY_TO, NULL},
648 {N_("/_Tools/_Create filter rule/by _Subject"),
649 NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
650 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
651 {N_("/_Tools/Actio_ns"), NULL, NULL, 0, "<Branch>"},
652 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
653 {N_("/_Tools/Delete du_plicated messages"),
654 NULL, delete_duplicated_cb, 0, NULL},
655 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
656 {N_("/_Tools/E_xecute"), "X", execute_summary_cb, 0, NULL},
658 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
659 {N_("/_Tools/SSL certi_ficates..."),
660 NULL, ssl_manager_open_cb, 0, NULL},
662 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
663 {N_("/_Tools/_Log window"), "<shift><control>L", log_window_show_cb, 0, NULL},
665 {N_("/_Configuration"), NULL, NULL, 0, "<Branch>"},
666 {N_("/_Configuration/_Common preferences..."),
667 NULL, prefs_common_open_cb, 0, NULL},
668 {N_("/_Configuration/C_ustomize toolbars"),
669 NULL, NULL, 0, "<Branch>"},
670 {N_("/_Configuration/C_ustomize toolbars/_Main window..."),
671 NULL, prefs_toolbar_cb, TOOLBAR_MAIN, NULL},
672 {N_("/_Configuration/C_ustomize toolbars/_Compose window..."),
673 NULL, prefs_toolbar_cb, TOOLBAR_COMPOSE, NULL},
674 {N_("/_Configuration/C_ustomize toolbars/M_essage view..."),
675 NULL, prefs_toolbar_cb, TOOLBAR_MSGVIEW, NULL},
676 {N_("/_Configuration/_Scoring..."),
677 NULL, prefs_scoring_open_cb, 0, NULL},
678 {N_("/_Configuration/_Filtering..."),
679 NULL, prefs_filtering_open_cb, 0, NULL},
680 {N_("/_Configuration/_Templates..."), NULL, prefs_template_open_cb, 0, NULL},
681 {N_("/_Configuration/_Actions..."), NULL, prefs_actions_open_cb, 0, NULL},
682 {N_("/_Configuration/---"), NULL, NULL, 0, "<Separator>"},
683 {N_("/_Configuration/_Preferences for current account..."),
684 NULL, prefs_account_open_cb, 0, NULL},
685 {N_("/_Configuration/Create _new account..."),
686 NULL, new_account_cb, 0, NULL},
687 {N_("/_Configuration/_Edit accounts..."),
688 NULL, account_edit_open, 0, NULL},
689 {N_("/_Configuration/C_hange current account"),
690 NULL, NULL, 0, "<Branch>"},
692 {N_("/_Help"), NULL, NULL, 0, "<Branch>"},
693 {N_("/_Help/_Manual (Local)"), NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
694 {N_("/_Help/_Manual (Sylpheed Doc Homepage)"),
695 NULL, manual_open_cb, MANUAL_MANUAL_SYLDOC, NULL},
696 {N_("/_Help/_FAQ (Local)"), NULL, manual_open_cb, MANUAL_FAQ_LOCAL, NULL},
697 {N_("/_Help/_FAQ (Sylpheed Doc Homepage)"),
698 NULL, manual_open_cb, MANUAL_FAQ_SYLDOC, NULL},
699 {N_("/_Help/---"), NULL, NULL, 0, "<Separator>"},
700 {N_("/_Help/_About"), NULL, about_show, 0, NULL}
703 MainWindow *main_window_create(SeparateType type)
709 GtkWidget *handlebox;
710 GtkWidget *vbox_body;
711 GtkWidget *hbox_stat;
712 GtkWidget *statusbar;
713 GtkWidget *progressbar;
714 GtkWidget *statuslabel;
715 GtkWidget *ac_button;
717 GtkWidget *online_pixmap;
718 GtkWidget *offline_pixmap;
719 GtkWidget *online_switch;
720 GtkWidget *offline_switch;
722 FolderView *folderview;
723 SummaryView *summaryview;
724 MessageView *messageview;
725 GdkColormap *colormap;
728 GtkItemFactory *ifactory;
732 guint n_menu_entries;
734 static GdkGeometry geometry;
736 debug_print("Creating main window...\n");
737 mainwin = g_new0(MainWindow, 1);
740 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
741 gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
742 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
743 gtk_window_set_wmclass(GTK_WINDOW(window), "main_window", "Sylpheed");
745 if (!geometry.min_height) {
746 geometry.min_width = 320;
747 geometry.min_height = 200;
749 gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
752 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
753 GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
754 MANAGE_WINDOW_SIGNALS_CONNECT(window);
755 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
756 GTK_SIGNAL_FUNC(mainwindow_key_pressed), mainwin);
758 gtk_widget_realize(window);
759 gtk_widget_add_events(window, GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);
762 gtkut_widget_set_app_icon(window);
764 vbox = gtk_vbox_new(FALSE, 0);
765 gtk_widget_show(vbox);
766 gtk_container_add(GTK_CONTAINER(window), vbox);
769 n_menu_entries = sizeof(mainwin_entries) / sizeof(mainwin_entries[0]);
770 menubar = menubar_create(window, mainwin_entries,
771 n_menu_entries, "<Main>", mainwin);
772 gtk_widget_show(menubar);
773 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
774 ifactory = gtk_item_factory_from_widget(menubar);
776 menu_set_sensitive(ifactory, "/Help/Manual (Local)", manual_available(MANUAL_MANUAL_LOCAL));
777 menu_set_sensitive(ifactory, "/Help/FAQ (Local)", manual_available(MANUAL_FAQ_LOCAL));
779 handlebox = gtk_handle_box_new();
780 gtk_widget_show(handlebox);
781 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
783 /* link window to mainwin->window to avoid gdk warnings */
784 mainwin->window = window;
787 mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
791 /* vbox that contains body */
792 vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH);
793 gtk_widget_show(vbox_body);
794 gtk_container_set_border_width(GTK_CONTAINER(vbox_body), BORDER_WIDTH);
795 gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
797 hbox_stat = gtk_hbox_new(FALSE, 2);
798 gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
800 statusbar = statusbar_create();
801 gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
803 progressbar = gtk_progress_bar_new();
804 gtk_widget_set_usize(progressbar, 120, 1);
805 gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
807 online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_ONLINE);
808 offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_OFFLINE);
809 online_switch = gtk_button_new ();
810 offline_switch = gtk_button_new ();
811 gtk_container_add (GTK_CONTAINER(online_switch), online_pixmap);
812 gtk_button_set_relief (GTK_BUTTON(online_switch), GTK_RELIEF_NONE);
813 gtk_signal_connect (GTK_OBJECT(online_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
814 gtk_box_pack_start (GTK_BOX(hbox_stat), online_switch, FALSE, FALSE, 0);
815 gtk_container_add (GTK_CONTAINER(offline_switch), offline_pixmap);
816 gtk_button_set_relief (GTK_BUTTON(offline_switch), GTK_RELIEF_NONE);
817 gtk_signal_connect (GTK_OBJECT(offline_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
818 gtk_box_pack_start (GTK_BOX(hbox_stat), offline_switch, FALSE, FALSE, 0);
820 statuslabel = gtk_label_new("");
821 gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
823 ac_button = gtk_button_new();
824 gtk_button_set_relief(GTK_BUTTON(ac_button), GTK_RELIEF_NONE);
825 GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
826 gtk_widget_set_usize(ac_button, -1, 1);
827 gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
828 gtk_signal_connect(GTK_OBJECT(ac_button), "button_press_event",
829 GTK_SIGNAL_FUNC(ac_label_button_pressed), mainwin);
831 ac_label = gtk_label_new("");
832 gtk_container_add(GTK_CONTAINER(ac_button), ac_label);
834 gtk_widget_show_all(hbox_stat);
836 gtk_widget_hide(offline_switch);
838 mainwin->folderview = folderview = folderview_create();
839 mainwin->summaryview = summaryview = summary_create();
840 mainwin->messageview = messageview = messageview_create(mainwin);
841 mainwin->logwin = log_window_create();
843 folderview->mainwin = mainwin;
844 folderview->summaryview = summaryview;
846 summaryview->mainwin = mainwin;
847 summaryview->folderview = folderview;
848 summaryview->messageview = messageview;
849 summaryview->window = window;
851 mainwin->vbox = vbox;
852 mainwin->menubar = menubar;
853 mainwin->menu_factory = ifactory;
854 mainwin->handlebox = handlebox;
855 mainwin->vbox_body = vbox_body;
856 mainwin->hbox_stat = hbox_stat;
857 mainwin->statusbar = statusbar;
858 mainwin->progressbar = progressbar;
859 mainwin->statuslabel = statuslabel;
860 mainwin->ac_button = ac_button;
861 mainwin->ac_label = ac_label;
863 mainwin->online_switch = online_switch;
864 mainwin->offline_switch = offline_switch;
865 mainwin->online_pixmap = online_pixmap;
866 mainwin->offline_pixmap = offline_pixmap;
868 /* set context IDs for status bar */
869 mainwin->mainwin_cid = gtk_statusbar_get_context_id
870 (GTK_STATUSBAR(statusbar), "Main Window");
871 mainwin->folderview_cid = gtk_statusbar_get_context_id
872 (GTK_STATUSBAR(statusbar), "Folder View");
873 mainwin->summaryview_cid = gtk_statusbar_get_context_id
874 (GTK_STATUSBAR(statusbar), "Summary View");
876 /* allocate colors for summary view and folder view */
877 summaryview->color_marked.red = summaryview->color_marked.green = 0;
878 summaryview->color_marked.blue = (guint16)65535;
880 summaryview->color_dim.red = summaryview->color_dim.green =
881 summaryview->color_dim.blue = COLOR_DIM;
883 folderview->color_new.red = (guint16)55000;
884 folderview->color_new.green = folderview->color_new.blue = 15000;
886 gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
887 &folderview->color_op);
889 summaryview->color_important.red = 0;
890 summaryview->color_important.green = 0;
891 summaryview->color_important.blue = (guint16)65535;
893 color[0] = summaryview->color_marked;
894 color[1] = summaryview->color_dim;
895 color[2] = folderview->color_new;
896 color[3] = folderview->color_op;
898 colormap = gdk_window_get_colormap(window->window);
899 gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
900 for (i = 0; i < 4; i++) {
901 if (success[i] == FALSE)
902 g_warning("MainWindow: color allocation %d failed\n", i);
905 debug_print("done.\n");
907 messageview->visible = TRUE;
909 main_window_set_widgets(mainwin, type);
912 menuitem = gtk_item_factory_get_item
913 (ifactory, "/View/Code set/Auto detect");
914 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
916 switch (prefs_common.toolbar_style) {
918 menuitem = gtk_item_factory_get_item
919 (ifactory, "/View/Show or hide/Toolbar/None");
922 menuitem = gtk_item_factory_get_item
923 (ifactory, "/View/Show or hide/Toolbar/Icon");
926 menuitem = gtk_item_factory_get_item
927 (ifactory, "/View/Show or hide/Toolbar/Text");
930 menuitem = gtk_item_factory_get_item
931 (ifactory, "/View/Show or hide/Toolbar/Icon and text");
933 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
935 gtk_widget_hide(mainwin->hbox_stat);
936 menuitem = gtk_item_factory_get_item
937 (ifactory, "/View/Show or hide/Status bar");
938 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
939 prefs_common.show_statusbar);
941 gtk_widget_hide(GTK_WIDGET(mainwin->summaryview->hbox_search));
943 if (prefs_common.show_searchbar)
944 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainwin->summaryview->toggle_search), TRUE);
947 /* set account selection menu */
948 ac_menu = gtk_item_factory_get_widget
949 (ifactory, "/Configuration/Change current account");
950 gtk_signal_connect(GTK_OBJECT(ac_menu), "selection_done",
951 GTK_SIGNAL_FUNC(ac_menu_popup_closed), mainwin);
952 mainwin->ac_menu = ac_menu;
954 toolbar_main_set_sensitive(mainwin);
956 /* create actions menu */
957 update_mainwin_actions_menu(ifactory, mainwin);
959 /* show main window */
960 gtk_widget_set_uposition(mainwin->window,
961 prefs_common.mainwin_x,
962 prefs_common.mainwin_y);
963 gtk_widget_set_usize(window, prefs_common.mainwin_width,
964 prefs_common.mainwin_height);
965 gtk_widget_show(mainwin->window);
967 /* initialize views */
968 folderview_init(folderview);
969 summary_init(summaryview);
970 messageview_init(messageview);
971 log_window_init(mainwin->logwin);
973 sslcertwindow_register_hook();
975 mainwin->lock_count = 0;
976 mainwin->menu_lock_count = 0;
977 mainwin->cursor_count = 0;
980 watch_cursor = gdk_cursor_new(GDK_WATCH);
982 mainwin_list = g_list_append(mainwin_list, mainwin);
984 /* init work_offline */
985 if (prefs_common.work_offline)
986 online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
991 void main_window_cursor_wait(MainWindow *mainwin)
994 if (mainwin->cursor_count == 0)
995 gdk_window_set_cursor(mainwin->window->window, watch_cursor);
997 mainwin->cursor_count++;
1002 void main_window_cursor_normal(MainWindow *mainwin)
1004 if (mainwin->cursor_count)
1005 mainwin->cursor_count--;
1007 if (mainwin->cursor_count == 0)
1008 gdk_window_set_cursor(mainwin->window->window, NULL);
1013 /* lock / unlock the user-interface */
1014 void main_window_lock(MainWindow *mainwin)
1016 if (mainwin->lock_count == 0)
1017 gtk_widget_set_sensitive(mainwin->ac_button, FALSE);
1019 mainwin->lock_count++;
1021 main_window_set_menu_sensitive(mainwin);
1022 toolbar_main_set_sensitive(mainwin);
1025 void main_window_unlock(MainWindow *mainwin)
1027 if (mainwin->lock_count)
1028 mainwin->lock_count--;
1030 main_window_set_menu_sensitive(mainwin);
1031 toolbar_main_set_sensitive(mainwin);
1033 if (mainwin->lock_count == 0)
1034 gtk_widget_set_sensitive(mainwin->ac_button, TRUE);
1037 static void main_window_menu_callback_block(MainWindow *mainwin)
1039 mainwin->menu_lock_count++;
1042 static void main_window_menu_callback_unblock(MainWindow *mainwin)
1044 if (mainwin->menu_lock_count)
1045 mainwin->menu_lock_count--;
1048 void main_window_reflect_prefs_all(void)
1050 main_window_reflect_prefs_all_real(FALSE);
1053 void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
1056 MainWindow *mainwin;
1059 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1060 mainwin = (MainWindow *)cur->data;
1062 main_window_show_cur_account(mainwin);
1063 main_window_set_menu_sensitive(mainwin);
1064 toolbar_main_set_sensitive(mainwin);
1067 if (pixmap_theme_changed) {
1068 toolbar_update(TOOLBAR_MAIN, mainwin);
1069 messageview_reflect_prefs_pixmap_theme();
1070 compose_reflect_prefs_pixmap_theme();
1071 folderview_reflect_prefs_pixmap_theme(mainwin->folderview);
1072 summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
1074 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_WORK_ONLINE);
1075 gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
1076 mainwin->online_pixmap);
1077 gtk_container_add (GTK_CONTAINER(mainwin->online_switch), pixmap);
1078 gtk_widget_show(pixmap);
1079 mainwin->online_pixmap = pixmap;
1080 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_WORK_OFFLINE);
1081 gtk_container_remove(GTK_CONTAINER(mainwin->offline_switch),
1082 mainwin->offline_pixmap);
1083 gtk_container_add (GTK_CONTAINER(mainwin->offline_switch), pixmap);
1084 gtk_widget_show(pixmap);
1085 mainwin->offline_pixmap = pixmap;
1088 summary_redisplay_msg(mainwin->summaryview);
1089 headerview_set_visibility(mainwin->messageview->headerview,
1090 prefs_common.display_header_pane);
1094 void main_window_set_summary_column(void)
1097 MainWindow *mainwin;
1099 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1100 mainwin = (MainWindow *)cur->data;
1101 summary_set_column_order(mainwin->summaryview);
1105 void main_window_set_account_menu(GList *account_list)
1107 GList *cur, *cur_ac, *cur_item;
1108 GtkWidget *menuitem;
1109 MainWindow *mainwin;
1110 PrefsAccount *ac_prefs;
1112 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1113 mainwin = (MainWindow *)cur->data;
1115 /* destroy all previous menu item */
1116 cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children;
1117 while (cur_item != NULL) {
1118 GList *next = cur_item->next;
1119 gtk_widget_destroy(GTK_WIDGET(cur_item->data));
1123 for (cur_ac = account_list; cur_ac != NULL;
1124 cur_ac = cur_ac->next) {
1125 ac_prefs = (PrefsAccount *)cur_ac->data;
1127 menuitem = gtk_menu_item_new_with_label
1128 (ac_prefs->account_name
1129 ? ac_prefs->account_name : _("Untitled"));
1130 gtk_widget_show(menuitem);
1131 gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem);
1132 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
1133 GTK_SIGNAL_FUNC(account_menu_cb),
1139 static void main_window_show_cur_account(MainWindow *mainwin)
1144 ac_name = g_strdup(cur_account
1145 ? (cur_account->account_name
1146 ? cur_account->account_name : _("Untitled"))
1150 buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
1152 buf = g_strdup(PROG_VERSION);
1153 gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
1156 gtk_label_set_text(GTK_LABEL(mainwin->ac_label), ac_name);
1157 gtk_widget_queue_resize(mainwin->ac_button);
1162 void main_window_separation_change(MainWindow *mainwin, SeparateType type)
1164 GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview);
1165 GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview);
1166 //GtkWidget *message_wid = GTK_WIDGET_PTR(mainwin->messageview);
1167 GtkWidget *message_wid = mainwin->messageview->vbox;
1169 debug_print("Changing window separation type from %d to %d\n",
1170 mainwin->type, type);
1172 if (mainwin->type == type) return;
1174 /* remove widgets from those containers */
1175 gtk_widget_ref(folder_wid);
1176 gtk_widget_ref(summary_wid);
1177 gtk_widget_ref(message_wid);
1178 gtkut_container_remove
1179 (GTK_CONTAINER(folder_wid->parent), folder_wid);
1180 gtkut_container_remove
1181 (GTK_CONTAINER(summary_wid->parent), summary_wid);
1182 gtkut_container_remove
1183 (GTK_CONTAINER(message_wid->parent), message_wid);
1185 /* clean containers */
1186 switch (mainwin->type) {
1188 gtk_widget_destroy(mainwin->win.sep_none.hpaned);
1190 case SEPARATE_FOLDER:
1191 gtk_widget_destroy(mainwin->win.sep_folder.vpaned);
1192 gtk_widget_destroy(mainwin->win.sep_folder.folderwin);
1194 case SEPARATE_MESSAGE:
1195 gtk_widget_destroy(mainwin->win.sep_message.hpaned);
1196 gtk_widget_destroy(mainwin->win.sep_message.messagewin);
1199 gtk_widget_destroy(mainwin->win.sep_both.messagewin);
1200 gtk_widget_destroy(mainwin->win.sep_both.folderwin);
1204 gtk_widget_hide(mainwin->window);
1205 main_window_set_widgets(mainwin, type);
1206 gtk_widget_show(mainwin->window);
1208 gtk_widget_unref(folder_wid);
1209 gtk_widget_unref(summary_wid);
1210 gtk_widget_unref(message_wid);
1213 void main_window_toggle_message_view(MainWindow *mainwin)
1215 SummaryView *summaryview = mainwin->summaryview;
1216 union CompositeWin *cwin = &mainwin->win;
1217 GtkWidget *vpaned = NULL;
1218 GtkWidget *container = NULL;
1219 GtkWidget *msgwin = NULL;
1221 switch (mainwin->type) {
1223 vpaned = cwin->sep_none.vpaned;
1224 container = cwin->sep_none.hpaned;
1226 case SEPARATE_FOLDER:
1227 vpaned = cwin->sep_folder.vpaned;
1228 container = mainwin->vbox_body;
1230 case SEPARATE_MESSAGE:
1231 msgwin = mainwin->win.sep_message.messagewin;
1234 msgwin = mainwin->win.sep_both.messagewin;
1239 if (GTK_WIDGET_VISIBLE(msgwin)) {
1240 gtk_widget_hide(msgwin);
1241 mainwin->messageview->visible = FALSE;
1242 summaryview->displayed = NULL;
1244 gtk_widget_show(msgwin);
1245 mainwin->messageview->visible = TRUE;
1247 } else if (vpaned->parent != NULL) {
1248 mainwin->messageview->visible = FALSE;
1249 summaryview->displayed = NULL;
1250 gtk_widget_ref(vpaned);
1251 gtkut_container_remove(GTK_CONTAINER(container), vpaned);
1252 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container);
1253 gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
1254 GTK_ARROW_UP, GTK_SHADOW_OUT);
1256 mainwin->messageview->visible = TRUE;
1257 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), vpaned);
1258 gtk_container_add(GTK_CONTAINER(container), vpaned);
1259 gtk_widget_unref(vpaned);
1260 gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
1261 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
1264 main_window_set_menu_sensitive(mainwin);
1266 gtk_widget_grab_focus(summaryview->ctree);
1269 void main_window_get_size(MainWindow *mainwin)
1271 GtkAllocation *allocation;
1273 allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
1275 prefs_common.summaryview_width = allocation->width;
1277 if ((mainwin->type == SEPARATE_NONE ||
1278 mainwin->type == SEPARATE_FOLDER) &&
1279 messageview_is_visible(mainwin->messageview))
1280 prefs_common.summaryview_height = allocation->height;
1282 prefs_common.mainview_width = allocation->width;
1284 allocation = &mainwin->window->allocation;
1286 prefs_common.mainview_height = allocation->height;
1287 prefs_common.mainwin_width = allocation->width;
1288 prefs_common.mainwin_height = allocation->height;
1290 allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
1292 prefs_common.folderview_width = allocation->width;
1293 prefs_common.folderview_height = allocation->height;
1296 void main_window_get_position(MainWindow *mainwin)
1300 gtkut_widget_get_uposition(mainwin->window, &x, &y);
1302 prefs_common.mainview_x = x;
1303 prefs_common.mainview_y = y;
1304 prefs_common.mainwin_x = x;
1305 prefs_common.mainwin_y = y;
1307 debug_print("window position: x = %d, y = %d\n", x, y);
1310 void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
1316 for (has_trash = 0, list = folder_get_list(); list != NULL; list = list->next) {
1317 folder = FOLDER(list->data);
1318 if (folder && folder->trash && folder->trash->total > 0)
1322 if (!has_trash) return;
1325 if (alertpanel(_("Empty trash"),
1326 _("Empty all messages in trash?"),
1327 _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
1329 manage_window_focus_in(mainwin->window, NULL, NULL);
1332 procmsg_empty_trash();
1334 for (list = folder_get_list(); list != NULL; list = list->next) {
1335 folder = list->data;
1336 if (folder && folder->trash) {
1337 folder_update_item(folder->trash, TRUE);
1341 if (mainwin->summaryview->folder_item &&
1342 mainwin->summaryview->folder_item->stype == F_TRASH)
1343 gtk_widget_grab_focus(mainwin->folderview->ctree);
1346 void main_window_add_mailbox(MainWindow *mainwin)
1351 path = input_dialog(_("Add mailbox"),
1352 _("Input the location of mailbox.\n"
1353 "If the existing mailbox is specified, it will be\n"
1354 "scanned automatically."),
1357 if (folder_find_from_path(path)) {
1358 alertpanel_error(_("The mailbox `%s' already exists."), path);
1362 if (!strcmp(path, "Mail"))
1363 folder = folder_new(F_MH, _("Mailbox"), path);
1365 folder = folder_new(F_MH, g_basename(path), path);
1368 if (folder->create_tree(folder) < 0) {
1369 alertpanel_error(_("Creation of the mailbox failed.\n"
1370 "Maybe some files already exist, or you don't have the permission to write there."));
1371 folder_destroy(folder);
1376 folder_set_ui_func(folder, scan_tree_func, mainwin);
1377 folder_scan_tree(folder);
1378 folder_set_ui_func(folder, NULL, NULL);
1380 folderview_set(mainwin->folderview);
1383 void main_window_add_mbox(MainWindow *mainwin)
1389 path = input_dialog(_("Add mbox mailbox"),
1390 _("Input the location of mailbox."),
1395 if (folder_find_from_path(path)) {
1396 alertpanel_error(_("The mailbox `%s' already exists."), path);
1402 if (!strcmp(path, "Mail"))
1403 folder = folder_new(F_MBOX, _("Mailbox"), path);
1407 folder = folder_new(F_MBOX, g_basename(path), path);
1410 if (folder->create_tree(folder) < 0) {
1411 alertpanel_error(_("Creation of the mailbox failed."));
1412 folder_destroy(folder);
1418 item = folder_item_new(folder, folder->name, NULL);
1419 item->folder = folder;
1420 folder->node = g_node_new(item);
1422 folder_create_folder(item, "inbox");
1423 folder_create_folder(item, "outbox");
1424 folder_create_folder(item, "queue");
1425 folder_create_folder(item, "draft");
1426 folder_create_folder(item, "trash");
1428 folderview_set(mainwin->folderview);
1431 SensitiveCond main_window_get_current_state(MainWindow *mainwin)
1433 SensitiveCond state = 0;
1434 SummarySelection selection;
1435 FolderItem *item = mainwin->summaryview->folder_item;
1436 GList *account_list = account_get_list();
1438 selection = summary_get_selection_type(mainwin->summaryview);
1440 if (mainwin->lock_count == 0)
1441 state |= M_UNLOCKED;
1442 if (selection != SUMMARY_NONE)
1443 state |= M_MSG_EXIST;
1444 if (item && item->path && item->parent && !item->no_select) {
1446 /* if (item->folder->type != F_NEWS) */
1447 state |= M_ALLOW_DELETE;
1449 if (prefs_common.immediate_exec == 0
1450 && mainwin->lock_count == 0)
1451 state |= M_DELAY_EXEC;
1453 if ((selection == SUMMARY_NONE && item->hide_read_msgs)
1454 || selection != SUMMARY_NONE)
1455 state |= M_HIDE_READ_MSG;
1457 if (mainwin->summaryview->threaded)
1458 state |= M_THREADED;
1460 state |= M_UNTHREADED;
1461 if (selection == SUMMARY_SELECTED_SINGLE ||
1462 selection == SUMMARY_SELECTED_MULTIPLE)
1463 state |= M_TARGET_EXIST;
1464 if (selection == SUMMARY_SELECTED_SINGLE)
1465 state |= M_SINGLE_TARGET_EXIST;
1466 if (mainwin->summaryview->folder_item &&
1467 mainwin->summaryview->folder_item->folder->type == F_NEWS)
1470 state |= M_NOT_NEWS;
1471 if (selection == SUMMARY_SELECTED_SINGLE &&
1473 (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
1474 item->stype == F_QUEUE)))
1475 state |= M_ALLOW_REEDIT;
1477 state |= M_HAVE_ACCOUNT;
1479 for ( ; account_list != NULL; account_list = account_list->next) {
1480 if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
1481 state |= M_HAVE_NEWS_ACCOUNT;
1486 if (inc_is_active())
1487 state |= M_INC_ACTIVE;
1494 void main_window_set_menu_sensitive(MainWindow *mainwin)
1496 GtkItemFactory *ifactory = mainwin->menu_factory;
1497 SensitiveCond state;
1499 GtkWidget *menuitem;
1500 SummaryView *summaryview;
1504 static const struct {
1508 {"/File/Add mailbox..." , M_UNLOCKED},
1509 {"/File/Add mbox mailbox..." , M_UNLOCKED},
1510 {"/File/Check for new messages in all folders", M_UNLOCKED},
1511 {"/File/Folder" , M_UNLOCKED},
1512 {"/File/Import mbox file..." , M_UNLOCKED},
1513 {"/File/Export to mbox file..." , M_UNLOCKED},
1514 {"/File/Empty trash" , M_UNLOCKED},
1515 {"/File/Work offline" , M_UNLOCKED},
1517 {"/File/Save as...", M_SINGLE_TARGET_EXIST|M_UNLOCKED},
1518 {"/File/Print..." , M_TARGET_EXIST|M_UNLOCKED},
1519 /* {"/File/Close" , M_UNLOCKED}, */
1520 {"/File/Exit" , M_UNLOCKED},
1522 {"/Edit/Select thread" , M_SINGLE_TARGET_EXIST},
1524 {"/View/Sort" , M_EXEC},
1525 {"/View/Thread view" , M_EXEC},
1526 {"/View/Expand all threads" , M_MSG_EXIST},
1527 {"/View/Collapse all threads" , M_MSG_EXIST},
1528 {"/View/Hide read messages" , M_HIDE_READ_MSG},
1529 {"/View/Go to/Prev message" , M_MSG_EXIST},
1530 {"/View/Go to/Next message" , M_MSG_EXIST},
1531 {"/View/Go to/Prev unread message" , M_MSG_EXIST},
1532 {"/View/Go to/Next unread message" , M_MSG_EXIST},
1533 {"/View/Go to/Prev new message" , M_MSG_EXIST},
1534 {"/View/Go to/Next new message" , M_MSG_EXIST},
1535 {"/View/Go to/Prev marked message" , M_MSG_EXIST},
1536 {"/View/Go to/Next marked message" , M_MSG_EXIST},
1537 {"/View/Go to/Prev labeled message", M_MSG_EXIST},
1538 {"/View/Go to/Next labeled message", M_MSG_EXIST},
1539 {"/View/Open in new window" , M_SINGLE_TARGET_EXIST},
1540 {"/View/Show all headers" , M_SINGLE_TARGET_EXIST},
1541 {"/View/Message source" , M_SINGLE_TARGET_EXIST},
1543 {"/Message/Get new mail" , M_HAVE_ACCOUNT|M_UNLOCKED},
1544 {"/Message/Get from all accounts" , M_HAVE_ACCOUNT|M_UNLOCKED},
1545 {"/Message/Cancel receiving" , M_INC_ACTIVE},
1546 {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
1547 {"/Message/Reply" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1548 {"/Message/Reply to" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1549 {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS},
1550 {"/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST},
1551 {"/Message/Redirect" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1552 {"/Message/Re-edit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
1553 {"/Message/Move..." , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1554 {"/Message/Copy..." , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
1555 {"/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NOT_NEWS},
1556 {"/Message/Cancel a news message" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NEWS},
1557 {"/Message/Mark" , M_TARGET_EXIST},
1559 {"/Tools/Selective download..." , M_HAVE_ACCOUNT|M_UNLOCKED},
1560 {"/Tools/Add sender to address book", M_SINGLE_TARGET_EXIST},
1561 {"/Tools/Harvest addresses" , M_UNLOCKED},
1562 {"/Tools/Filter messages" , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
1563 {"/Tools/Create filter rule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
1564 {"/Tools/Actions" , M_TARGET_EXIST|M_UNLOCKED},
1565 {"/Tools/Execute" , M_DELAY_EXEC},
1566 {"/Tools/Delete duplicated messages", M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1568 {"/Configuration", M_UNLOCKED},
1573 state = main_window_get_current_state(mainwin);
1575 for (i = 0; entry[i].entry != NULL; i++) {
1576 sensitive = ((entry[i].cond & state) == entry[i].cond);
1577 menu_set_sensitive(ifactory, entry[i].entry, sensitive);
1580 main_window_menu_callback_block(mainwin);
1582 #define SET_CHECK_MENU_ACTIVE(path, active) \
1584 menuitem = gtk_item_factory_get_widget(ifactory, path); \
1585 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active); \
1588 SET_CHECK_MENU_ACTIVE("/View/Show or hide/Message view",
1589 messageview_is_visible(mainwin->messageview));
1591 summaryview = mainwin->summaryview;
1592 menu_path = "/View/Sort/Don't sort";
1594 switch (summaryview->sort_key) {
1595 case SORT_BY_NUMBER:
1596 menu_path = "/View/Sort/by number"; break;
1598 menu_path = "/View/Sort/by size"; break;
1600 menu_path = "/View/Sort/by date"; break;
1602 menu_path = "/View/Sort/by from"; break;
1604 menu_path = "/View/Sort/by recipient"; break;
1605 case SORT_BY_SUBJECT:
1606 menu_path = "/View/Sort/by subject"; break;
1608 menu_path = "/View/Sort/by color label"; break;
1610 menu_path = "/View/Sort/by mark"; break;
1611 case SORT_BY_UNREAD:
1612 menu_path = "/View/Sort/by unread"; break;
1614 menu_path = "/View/Sort/by attachment"; break;
1616 menu_path = "/View/Sort/by score"; break;
1617 case SORT_BY_LOCKED:
1618 menu_path = "/View/Sort/by locked"; break;
1621 menu_path = "/View/Sort/Don't sort"; break;
1623 SET_CHECK_MENU_ACTIVE(menu_path, TRUE);
1625 if (summaryview->sort_type == SORT_ASCENDING) {
1626 SET_CHECK_MENU_ACTIVE("/View/Sort/Ascending", TRUE);
1628 SET_CHECK_MENU_ACTIVE("/View/Sort/Descending", TRUE);
1631 if (summaryview->sort_key != SORT_BY_NONE) {
1632 menu_set_sensitive(ifactory, "/View/Sort/Ascending", TRUE);
1633 menu_set_sensitive(ifactory, "/View/Sort/Descending", TRUE);
1635 menu_set_sensitive(ifactory, "/View/Sort/Ascending", FALSE);
1636 menu_set_sensitive(ifactory, "/View/Sort/Descending", FALSE);
1639 SET_CHECK_MENU_ACTIVE("/View/Show all headers",
1640 mainwin->messageview->textview->show_all_headers);
1641 SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
1643 #undef SET_CHECK_MENU_ACTIVE
1645 main_window_menu_callback_unblock(mainwin);
1648 void main_window_popup(MainWindow *mainwin)
1650 gtkut_window_popup(mainwin->window);
1652 switch (mainwin->type) {
1653 case SEPARATE_FOLDER:
1654 gtkut_window_popup(mainwin->win.sep_folder.folderwin);
1656 case SEPARATE_MESSAGE:
1657 gtkut_window_popup(mainwin->win.sep_message.messagewin);
1660 gtkut_window_popup(mainwin->win.sep_both.folderwin);
1661 gtkut_window_popup(mainwin->win.sep_both.messagewin);
1668 static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
1670 GtkWidget *folderwin = NULL;
1671 GtkWidget *messagewin = NULL;
1674 GtkWidget *vbox_body = mainwin->vbox_body;
1675 GtkItemFactory *ifactory = mainwin->menu_factory;
1676 GtkWidget *menuitem;
1678 GtkItemFactory *msgview_ifactory;
1680 debug_print("Setting widgets...");
1682 /* create separated window(s) if needed */
1683 if (type & SEPARATE_FOLDER) {
1684 folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1685 gtk_window_set_title(GTK_WINDOW(folderwin),
1686 _("Sylpheed - Folder View"));
1687 gtk_window_set_wmclass(GTK_WINDOW(folderwin),
1688 "folder_view", "Sylpheed");
1689 gtk_window_set_policy(GTK_WINDOW(folderwin),
1691 gtk_widget_set_usize(folderwin, -1,
1692 prefs_common.mainview_height);
1693 gtk_container_set_border_width(GTK_CONTAINER(folderwin),
1695 gtk_signal_connect(GTK_OBJECT(folderwin), "delete_event",
1696 GTK_SIGNAL_FUNC(folder_window_close_cb),
1699 if (type & SEPARATE_MESSAGE) {
1700 messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1701 gtk_window_set_title(GTK_WINDOW(messagewin),
1702 _("Sylpheed - Message View"));
1703 gtk_window_set_wmclass(GTK_WINDOW(messagewin),
1704 "message_view", "Sylpheed");
1705 gtk_window_set_policy(GTK_WINDOW(messagewin),
1707 gtk_widget_set_usize
1708 (messagewin, prefs_common.mainview_width,
1709 prefs_common.mainview_height
1710 - prefs_common.summaryview_height
1711 + DEFAULT_HEADERVIEW_HEIGHT);
1712 gtk_container_set_border_width(GTK_CONTAINER(messagewin),
1714 gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
1715 GTK_SIGNAL_FUNC(message_window_close_cb),
1721 hpaned = gtk_hpaned_new();
1722 gtk_widget_show(hpaned);
1723 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1724 gtk_paned_add1(GTK_PANED(hpaned),
1725 GTK_WIDGET_PTR(mainwin->folderview));
1727 vpaned = gtk_vpaned_new();
1728 if (messageview_is_visible(mainwin->messageview)) {
1729 gtk_paned_add2(GTK_PANED(hpaned), vpaned);
1730 gtk_paned_add1(GTK_PANED(vpaned),
1731 GTK_WIDGET_PTR(mainwin->summaryview));
1733 gtk_paned_add2(GTK_PANED(hpaned),
1734 GTK_WIDGET_PTR(mainwin->summaryview));
1735 gtk_widget_ref(vpaned);
1737 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1738 prefs_common.summaryview_width,
1739 prefs_common.summaryview_height);
1740 gtk_paned_add2(GTK_PANED(vpaned),
1741 GTK_WIDGET_PTR(mainwin->messageview));
1742 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1743 prefs_common.mainview_width, -1);
1744 gtk_widget_set_usize(mainwin->window,
1745 prefs_common.folderview_width +
1746 prefs_common.mainview_width,
1747 prefs_common.mainwin_height);
1748 gtk_widget_show_all(vpaned);
1750 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1751 * lose track of its visibility state */
1752 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1753 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1755 mainwin->win.sep_none.hpaned = hpaned;
1756 mainwin->win.sep_none.vpaned = vpaned;
1758 /* remove headerview if not in prefs */
1759 headerview_set_visibility(mainwin->messageview->headerview,
1760 prefs_common.display_header_pane);
1762 case SEPARATE_FOLDER:
1763 vpaned = gtk_vpaned_new();
1764 if (messageview_is_visible(mainwin->messageview)) {
1765 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned,
1767 gtk_paned_add1(GTK_PANED(vpaned),
1768 GTK_WIDGET_PTR(mainwin->summaryview));
1770 gtk_box_pack_start(GTK_BOX(vbox_body),
1771 GTK_WIDGET_PTR(mainwin->summaryview),
1773 gtk_widget_ref(vpaned);
1775 gtk_paned_add2(GTK_PANED(vpaned),
1776 GTK_WIDGET_PTR(mainwin->messageview));
1777 gtk_widget_show_all(vpaned);
1778 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1779 prefs_common.summaryview_width,
1780 prefs_common.summaryview_height);
1781 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1782 prefs_common.mainview_width, -1);
1783 gtk_widget_set_usize(mainwin->window,
1784 prefs_common.mainview_width,
1785 prefs_common.mainview_height);
1787 gtk_container_add(GTK_CONTAINER(folderwin),
1788 GTK_WIDGET_PTR(mainwin->folderview));
1790 mainwin->win.sep_folder.folderwin = folderwin;
1791 mainwin->win.sep_folder.vpaned = vpaned;
1793 gtk_widget_show_all(folderwin);
1795 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1796 * lose track of its visibility state */
1797 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1798 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1800 /* remove headerview if not in prefs */
1801 headerview_set_visibility(mainwin->messageview->headerview,
1802 prefs_common.display_header_pane);
1805 case SEPARATE_MESSAGE:
1806 hpaned = gtk_hpaned_new();
1807 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1809 gtk_paned_add1(GTK_PANED(hpaned),
1810 GTK_WIDGET_PTR(mainwin->folderview));
1811 gtk_paned_add2(GTK_PANED(hpaned),
1812 GTK_WIDGET_PTR(mainwin->summaryview));
1813 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1814 prefs_common.summaryview_width,
1815 prefs_common.summaryview_height);
1816 gtk_widget_set_usize(mainwin->window,
1817 prefs_common.folderview_width +
1818 prefs_common.mainview_width,
1819 prefs_common.mainwin_height);
1820 gtk_widget_show_all(hpaned);
1822 messageview_add_toolbar(mainwin->messageview, messagewin);
1823 msgview_ifactory = gtk_item_factory_from_widget(mainwin->messageview->menubar);
1824 menu_set_sensitive(msgview_ifactory, "/File/Close", FALSE);
1826 mainwin->win.sep_message.messagewin = messagewin;
1827 mainwin->win.sep_message.hpaned = hpaned;
1829 gtk_widget_show_all(messagewin);
1831 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1832 * lose track of its visibility state */
1833 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1834 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1837 gtk_box_pack_start(GTK_BOX(vbox_body),
1838 GTK_WIDGET_PTR(mainwin->summaryview),
1840 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1841 prefs_common.summaryview_width,
1842 prefs_common.summaryview_height);
1843 gtk_widget_set_usize(mainwin->window,
1844 prefs_common.mainview_width,
1845 prefs_common.mainwin_height);
1846 gtk_container_add(GTK_CONTAINER(folderwin),
1847 GTK_WIDGET_PTR(mainwin->folderview));
1848 gtk_container_add(GTK_CONTAINER(messagewin),
1849 GTK_WIDGET_PTR(mainwin->messageview));
1851 mainwin->win.sep_both.folderwin = folderwin;
1852 mainwin->win.sep_both.messagewin = messagewin;
1854 gtk_widget_show_all(folderwin);
1855 gtk_widget_show_all(messagewin);
1857 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1858 * lose track of its visibility state */
1859 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1860 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1864 /* rehide quick search if necessary */
1865 if (!prefs_common.show_searchbar)
1866 gtk_widget_hide(mainwin->summaryview->hbox_search);
1868 mainwin->type = type;
1870 mainwin->messageview->visible = TRUE;
1872 /* toggle menu state */
1873 menuitem = gtk_item_factory_get_item
1874 (ifactory, "/View/Show or hide/Folder tree");
1875 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
1876 menuitem = gtk_item_factory_get_item
1877 (ifactory, "/View/Show or hide/Message view");
1878 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
1880 menuitem = gtk_item_factory_get_item
1881 (ifactory, "/View/Separate folder tree");
1882 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
1883 ((type & SEPARATE_FOLDER) != 0));
1884 menuitem = gtk_item_factory_get_item
1885 (ifactory, "/View/Separate message view");
1886 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
1887 ((type & SEPARATE_MESSAGE) != 0));
1889 debug_print("done.\n");
1892 void main_window_destroy_all(void)
1894 while (mainwin_list != NULL) {
1895 MainWindow *mainwin = (MainWindow*)mainwin_list->data;
1897 /* free toolbar stuff */
1898 toolbar_clear_list(TOOLBAR_MAIN);
1899 TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
1900 TOOLBAR_DESTROY_ITEMS(mainwin->toolbar->item_list);
1902 g_free(mainwin->toolbar);
1905 mainwin_list = g_list_remove(mainwin_list, mainwin);
1907 g_list_free(mainwin_list);
1911 static void toolbar_account_button_pressed(GtkWidget *widget,
1912 GdkEventButton *event,
1915 MainWindow *mainwin = (MainWindow *)data;
1918 if (event->button != 3) return;
1920 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
1921 gtk_object_set_data(GTK_OBJECT(mainwin->ac_menu), "menu_button",
1924 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
1925 menu_button_position, widget,
1926 event->button, event->time);
1930 static void ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
1933 MainWindow *mainwin = (MainWindow *)data;
1937 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
1938 gtk_object_set_data(GTK_OBJECT(mainwin->ac_menu), "menu_button",
1941 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
1942 menu_button_position, widget,
1943 event->button, event->time);
1946 static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
1948 MainWindow *mainwin = (MainWindow *)data;
1951 button = gtk_object_get_data(GTK_OBJECT(menu_shell), "menu_button");
1952 if (!button) return;
1953 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1954 gtk_object_remove_data(GTK_OBJECT(mainwin->ac_menu), "menu_button");
1955 manage_window_focus_in(mainwin->window, NULL, NULL);
1958 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1961 MainWindow *mainwin = (MainWindow *)data;
1963 if (mainwin->lock_count == 0)
1964 app_exit_cb(data, 0, widget);
1969 static gint folder_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1972 MainWindow *mainwin = (MainWindow *)data;
1973 GtkWidget *menuitem;
1975 menuitem = gtk_item_factory_get_item
1976 (mainwin->menu_factory, "/View/Show or hide/Folder tree");
1977 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
1982 static gint message_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1985 MainWindow *mainwin = (MainWindow *)data;
1986 GtkWidget *menuitem;
1988 menuitem = gtk_item_factory_get_item
1989 (mainwin->menu_factory, "/View/Show or hide/Message view");
1990 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
1995 static void add_mailbox_cb(MainWindow *mainwin, guint action,
1998 main_window_add_mailbox(mainwin);
2001 static void add_mbox_cb(MainWindow *mainwin, guint action,
2004 main_window_add_mbox(mainwin);
2007 static void update_folderview_cb(MainWindow *mainwin, guint action,
2010 summary_show(mainwin->summaryview, NULL);
2011 folderview_check_new_all();
2014 static void new_folder_cb(MainWindow *mainwin, guint action,
2017 folderview_new_folder(mainwin->folderview);
2020 static void rename_folder_cb(MainWindow *mainwin, guint action,
2023 folderview_rename_folder(mainwin->folderview);
2026 static void delete_folder_cb(MainWindow *mainwin, guint action,
2029 folderview_delete_folder(mainwin->folderview);
2032 static void import_mbox_cb(MainWindow *mainwin, guint action,
2035 import_mbox(mainwin->summaryview->folder_item);
2038 static void export_mbox_cb(MainWindow *mainwin, guint action,
2041 export_mbox(mainwin->summaryview->folder_item);
2044 static void empty_trash_cb(MainWindow *mainwin, guint action,
2047 main_window_empty_trash(mainwin, TRUE);
2050 static void save_as_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2052 summary_save_as(mainwin->summaryview);
2055 static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2057 summary_print(mainwin->summaryview);
2060 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2062 if (prefs_common.confirm_on_exit) {
2063 if (alertpanel(_("Exit"), _("Exit this program?"),
2064 _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
2066 manage_window_focus_in(mainwin->window, NULL, NULL);
2069 app_will_exit(widget, mainwin);
2072 static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2075 summary_search(mainwin->summaryview);
2077 message_search(mainwin->messageview);
2080 static void toggle_folder_cb(MainWindow *mainwin, guint action,
2085 active = GTK_CHECK_MENU_ITEM(widget)->active;
2087 switch (mainwin->type) {
2089 case SEPARATE_MESSAGE:
2092 gtk_widget_show(GTK_WIDGET_PTR(mainwin->folderview));
2094 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->folderview));
2097 case SEPARATE_FOLDER:
2098 debug_print("separate folder\n");
2100 gtk_widget_show(mainwin->win.sep_folder.folderwin);
2102 gtk_widget_hide(mainwin->win.sep_folder.folderwin);
2106 gtk_widget_show(mainwin->win.sep_both.folderwin);
2108 gtk_widget_hide(mainwin->win.sep_both.folderwin);
2113 static void toggle_message_cb(MainWindow *mainwin, guint action,
2118 active = GTK_CHECK_MENU_ITEM(widget)->active;
2120 if (active != messageview_is_visible(mainwin->messageview))
2121 summary_toggle_view(mainwin->summaryview);
2124 static void toggle_toolbar_cb(MainWindow *mainwin, guint action,
2127 toolbar_toggle(action, mainwin);
2130 /* END Toolbar Stuff */
2132 static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
2135 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2136 gtk_widget_show(mainwin->hbox_stat);
2137 prefs_common.show_statusbar = TRUE;
2139 gtk_widget_hide(mainwin->hbox_stat);
2140 prefs_common.show_statusbar = FALSE;
2144 static void separate_widget_cb(MainWindow *mainwin, guint action,
2149 if (GTK_CHECK_MENU_ITEM(widget)->active)
2150 type = mainwin->type | action;
2152 type = mainwin->type & ~action;
2154 main_window_separation_change(mainwin, type);
2156 prefs_common.sep_folder = (type & SEPARATE_FOLDER) != 0;
2157 prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
2160 void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline)
2163 online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
2165 online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
2168 static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget *widget)
2170 main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active);
2173 static void online_switch_clicked (GtkButton *btn, gpointer data)
2175 MainWindow *mainwin;
2176 GtkItemFactory *ifactory;
2177 GtkCheckMenuItem *menuitem;
2179 mainwin = (MainWindow *) data;
2181 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
2182 menuitem = GTK_CHECK_MENU_ITEM (gtk_item_factory_get_widget(ifactory, "/File/Work offline"));
2184 g_return_if_fail(mainwin != NULL);
2185 g_return_if_fail(menuitem != NULL);
2187 if (btn == GTK_BUTTON(mainwin->online_switch)) {
2189 gtk_widget_hide (mainwin->online_switch);
2190 gtk_widget_show (mainwin->offline_switch);
2191 menuitem->active = TRUE;
2192 prefs_common.work_offline = TRUE;
2193 inc_autocheck_timer_remove();
2196 gtk_widget_hide (mainwin->offline_switch);
2197 gtk_widget_show (mainwin->online_switch);
2198 menuitem->active = FALSE;
2199 prefs_common.work_offline = FALSE;
2200 inc_autocheck_timer_set();
2204 static void addressbook_open_cb(MainWindow *mainwin, guint action,
2207 addressbook_open(NULL);
2210 static void log_window_show_cb(MainWindow *mainwin, guint action,
2213 log_window_show(mainwin->logwin);
2216 static void sel_download_cb(MainWindow *mainwin, guint action,
2219 selective_download(mainwin);
2222 static void prefs_toolbar_cb(MainWindow *mainwin, guint action,
2225 prefs_toolbar_open((ToolbarType)action);
2228 static void inc_cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2233 static void move_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2235 summary_move_to(mainwin->summaryview);
2238 static void copy_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2240 summary_copy_to(mainwin->summaryview);
2243 static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2245 summary_delete(mainwin->summaryview);
2248 static void cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2250 summary_cancel(mainwin->summaryview);
2253 static void open_msg_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2255 summary_open_msg(mainwin->summaryview);
2258 static void view_source_cb(MainWindow *mainwin, guint action,
2261 summary_view_source(mainwin->summaryview);
2264 static void show_all_header_cb(MainWindow *mainwin, guint action,
2267 if (mainwin->menu_lock_count) return;
2268 summary_display_msg_selected(mainwin->summaryview,
2269 GTK_CHECK_MENU_ITEM(widget)->active);
2272 static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2274 summary_reedit(mainwin->summaryview);
2277 static void mark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2279 summary_mark(mainwin->summaryview);
2282 static void unmark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2284 summary_unmark(mainwin->summaryview);
2287 static void mark_as_unread_cb(MainWindow *mainwin, guint action,
2290 summary_mark_as_unread(mainwin->summaryview);
2293 static void mark_as_read_cb(MainWindow *mainwin, guint action,
2296 summary_mark_as_read(mainwin->summaryview);
2299 static void mark_all_read_cb(MainWindow *mainwin, guint action,
2302 summary_mark_all_read(mainwin->summaryview);
2305 static void add_address_cb(MainWindow *mainwin, guint action,
2308 summary_add_address(mainwin->summaryview);
2311 static void set_charset_cb(MainWindow *mainwin, guint action,
2316 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2317 str = conv_get_charset_str((CharSet)action);
2318 g_free(prefs_common.force_charset);
2319 prefs_common.force_charset = str ? g_strdup(str) : NULL;
2321 summary_redisplay_msg(mainwin->summaryview);
2323 debug_print("forced charset: %s\n", str ? str : "Auto-Detect");
2327 static void hide_read_messages (MainWindow *mainwin, guint action,
2330 if (!mainwin->summaryview->folder_item
2331 || gtk_object_get_data(GTK_OBJECT(widget), "dont_toggle"))
2333 summary_toggle_show_read_messages(mainwin->summaryview);
2336 static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2338 if (mainwin->menu_lock_count) return;
2339 if (!mainwin->summaryview->folder_item) return;
2341 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2342 summary_thread_build(mainwin->summaryview);
2343 /* mainwin->summaryview->folder_item->threaded = TRUE; */
2345 summary_unthread(mainwin->summaryview);
2346 /* mainwin->summaryview->folder_item->threaded = FALSE; */
2350 static void expand_threads_cb(MainWindow *mainwin, guint action,
2353 summary_expand_threads(mainwin->summaryview);
2356 static void collapse_threads_cb(MainWindow *mainwin, guint action,
2359 summary_collapse_threads(mainwin->summaryview);
2362 static void set_display_item_cb(MainWindow *mainwin, guint action,
2365 prefs_summary_column_open();
2368 static void sort_summary_cb(MainWindow *mainwin, guint action,
2371 FolderItem *item = mainwin->summaryview->folder_item;
2372 GtkWidget *menuitem;
2374 if (mainwin->menu_lock_count) return;
2376 if (GTK_CHECK_MENU_ITEM(widget)->active && item) {
2377 menuitem = gtk_item_factory_get_item
2378 (mainwin->menu_factory, "/View/Sort/Ascending");
2379 summary_sort(mainwin->summaryview, (FolderSortKey)action,
2380 GTK_CHECK_MENU_ITEM(menuitem)->active
2381 ? SORT_ASCENDING : SORT_DESCENDING);
2385 static void sort_summary_type_cb(MainWindow *mainwin, guint action,
2388 FolderItem *item = mainwin->summaryview->folder_item;
2390 if (mainwin->menu_lock_count) return;
2392 if (GTK_CHECK_MENU_ITEM(widget)->active && item)
2393 summary_sort(mainwin->summaryview,
2394 item->sort_key, (FolderSortType)action);
2397 static void attract_by_subject_cb(MainWindow *mainwin, guint action,
2400 summary_attract_by_subject(mainwin->summaryview);
2403 static void delete_duplicated_cb(MainWindow *mainwin, guint action,
2406 summary_delete_duplicated(mainwin->summaryview);
2409 static void filter_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2411 summary_filter(mainwin->summaryview);
2414 static void execute_summary_cb(MainWindow *mainwin, guint action,
2417 summary_execute(mainwin->summaryview);
2420 static void update_summary_cb(MainWindow *mainwin, guint action,
2424 FolderView *folderview = mainwin->folderview;
2426 if (!mainwin->summaryview->folder_item) return;
2427 if (!folderview->opened) return;
2429 folder_update_op_count();
2431 fitem = gtk_ctree_node_get_row_data(GTK_CTREE(folderview->ctree),
2432 folderview->opened);
2435 folder_item_scan(fitem);
2436 summary_show(mainwin->summaryview, fitem);
2439 static void prev_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2441 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
2444 static void next_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2446 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
2449 static void prev_unread_cb(MainWindow *mainwin, guint action,
2452 summary_select_prev_unread(mainwin->summaryview);
2455 static void next_unread_cb(MainWindow *mainwin, guint action,
2458 summary_select_next_unread(mainwin->summaryview);
2461 static void prev_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2463 summary_select_prev_new(mainwin->summaryview);
2466 static void next_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2468 summary_select_next_new(mainwin->summaryview);
2471 static void prev_marked_cb(MainWindow *mainwin, guint action,
2474 summary_select_prev_marked(mainwin->summaryview);
2477 static void next_marked_cb(MainWindow *mainwin, guint action,
2480 summary_select_next_marked(mainwin->summaryview);
2483 static void prev_labeled_cb(MainWindow *mainwin, guint action,
2486 summary_select_prev_labeled(mainwin->summaryview);
2489 static void next_labeled_cb(MainWindow *mainwin, guint action,
2492 summary_select_next_labeled(mainwin->summaryview);
2495 static void goto_folder_cb(MainWindow *mainwin, guint action,
2498 FolderItem *to_folder;
2500 to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL);
2503 folderview_select(mainwin->folderview, to_folder);
2506 static void copy_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2508 messageview_copy_clipboard(mainwin->messageview);
2511 static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2513 MessageView *msgview = mainwin->messageview;
2515 if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->ctree))
2516 summary_select_all(mainwin->summaryview);
2517 else if (messageview_is_visible(msgview) &&
2518 (GTK_WIDGET_HAS_FOCUS(msgview->textview->text) ||
2519 GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text)))
2520 messageview_select_all(mainwin->messageview);
2523 static void select_thread_cb(MainWindow *mainwin, guint action,
2526 summary_select_thread(mainwin->summaryview);
2529 static void create_filter_cb(MainWindow *mainwin, guint action,
2532 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action);
2535 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
2538 prefs_common_open();
2541 static void prefs_scoring_open_cb(MainWindow *mainwin, guint action,
2544 prefs_scoring_open(NULL);
2547 static void prefs_filtering_open_cb(MainWindow *mainwin, guint action,
2550 prefs_filtering_open(NULL, NULL, NULL);
2553 static void prefs_template_open_cb(MainWindow *mainwin, guint action,
2556 prefs_template_open();
2559 static void prefs_actions_open_cb(MainWindow *mainwin, guint action,
2562 prefs_actions_open(mainwin);
2565 static void ssl_manager_open_cb(MainWindow *mainwin, guint action,
2568 ssl_manager_open(mainwin);
2571 static void prefs_account_open_cb(MainWindow *mainwin, guint action,
2575 new_account_cb(mainwin, 0, widget);
2577 account_open(cur_account);
2581 static void new_account_cb(MainWindow *mainwin, guint action,
2584 account_edit_open();
2585 if (!compose_get_compose_list()) account_add();
2588 static void account_menu_cb(GtkMenuItem *menuitem, gpointer data)
2590 cur_account = (PrefsAccount *)data;
2591 main_window_reflect_prefs_all();
2594 static void manual_open_cb(MainWindow *mainwin, guint action,
2597 manual_open((ManualType)action);
2600 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
2602 MainWindow *mainwin = (MainWindow *)data;
2606 str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
2607 LOCAL_FOLDER(folder)->rootpath,
2611 str = g_strdup_printf(_("Scanning folder %s ..."),
2612 LOCAL_FOLDER(folder)->rootpath);
2614 STATUSBAR_PUSH(mainwin, str);
2615 STATUSBAR_POP(mainwin);
2619 #define BREAK_ON_MODIFIER_KEY() \
2620 if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
2622 void mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
2625 MainWindow *mainwin = (MainWindow*) data;
2627 if (!mainwin || !event) return;
2629 switch (event->keyval) {
2630 case GDK_Q: /* Quit */
2631 BREAK_ON_MODIFIER_KEY();
2633 app_exit_cb(mainwin, 0, NULL);
2636 if (mainwin->folderview && mainwin->summaryview
2637 && !mainwin->summaryview->displayed) {
2638 summary_lock(mainwin->summaryview);
2639 folderview_select_next_unread(mainwin->folderview);
2640 summary_unlock(mainwin->summaryview);
2648 #undef BREAK_ON_MODIFIER_KEY
2651 * Harvest addresses for selected folder.
2653 static void addr_harvest_cb( MainWindow *mainwin,
2657 addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
2661 * Harvest addresses for selected messages in summary view.
2663 static void addr_harvest_msg_cb( MainWindow *mainwin,
2667 summary_harvest_address( mainwin->summaryview );