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 _subject"), NULL, sort_summary_cb, SORT_BY_SUBJECT, "/View/Sort/by number"},
456 {N_("/_View/_Sort/by _color label"),
457 NULL, sort_summary_cb, SORT_BY_LABEL, "/View/Sort/by number"},
458 {N_("/_View/_Sort/by _mark"), NULL, sort_summary_cb, SORT_BY_MARK, "/View/Sort/by number"},
459 {N_("/_View/_Sort/by _unread"), NULL, sort_summary_cb, SORT_BY_UNREAD, "/View/Sort/by number"},
460 {N_("/_View/_Sort/by a_ttachment"),
461 NULL, sort_summary_cb, SORT_BY_MIME, "/View/Sort/by number"},
462 {N_("/_View/_Sort/by score"), NULL, sort_summary_cb, SORT_BY_SCORE, "/View/Sort/by number"},
463 {N_("/_View/_Sort/by locked"), NULL, sort_summary_cb, SORT_BY_LOCKED, "/View/Sort/by number"},
464 {N_("/_View/_Sort/D_on't sort"), NULL, sort_summary_cb, SORT_BY_NONE, "/View/Sort/by number"},
465 {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
466 {N_("/_View/_Sort/Ascending"), NULL, sort_summary_type_cb, SORT_ASCENDING, "<RadioItem>"},
467 {N_("/_View/_Sort/Descending"), NULL, sort_summary_type_cb, SORT_DESCENDING, "/View/Sort/Ascending"},
468 {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
469 {N_("/_View/_Sort/_Attract by subject"),
470 NULL, attract_by_subject_cb, 0, NULL},
471 {N_("/_View/Th_read view"), "<control>T", thread_cb, 0, "<ToggleItem>"},
472 {N_("/_View/E_xpand all threads"), NULL, expand_threads_cb, 0, NULL},
473 {N_("/_View/Co_llapse all threads"), NULL, collapse_threads_cb, 0, NULL},
474 {N_("/_View/_Hide read messages"), NULL, hide_read_messages, 0, "<ToggleItem>"},
475 {N_("/_View/Set displayed _items..."), NULL, set_display_item_cb, 0, NULL},
477 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
478 {N_("/_View/_Go to"), NULL, NULL, 0, "<Branch>"},
479 {N_("/_View/_Go to/_Prev message"), "P", prev_cb, 0, NULL},
480 {N_("/_View/_Go to/_Next message"), "N", next_cb, 0, NULL},
481 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
482 {N_("/_View/_Go to/P_rev unread message"),
483 "<shift>P", prev_unread_cb, 0, NULL},
484 {N_("/_View/_Go to/N_ext unread message"),
485 "<shift>N", next_unread_cb, 0, NULL},
486 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
487 {N_("/_View/_Go to/Prev ne_w message"), NULL, prev_new_cb, 0, NULL},
488 {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL},
489 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
490 {N_("/_View/_Go to/Prev _marked message"),
491 NULL, prev_marked_cb, 0, NULL},
492 {N_("/_View/_Go to/Next m_arked message"),
493 NULL, next_marked_cb, 0, NULL},
494 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
495 {N_("/_View/_Go to/Prev _labeled message"),
496 NULL, prev_labeled_cb, 0, NULL},
497 {N_("/_View/_Go to/Next la_beled message"),
498 NULL, next_labeled_cb, 0, NULL},
499 {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
500 {N_("/_View/_Go to/Other _folder..."), "G", goto_folder_cb, 0, NULL},
501 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
503 #define CODESET_SEPARATOR \
504 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"}
505 #define CODESET_ACTION(action) \
506 NULL, set_charset_cb, action, "/View/Code set/Auto detect"
508 {N_("/_View/_Code set"), NULL, NULL, 0, "<Branch>"},
509 {N_("/_View/_Code set/_Auto detect"),
510 NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
511 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"},
512 {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
513 CODESET_ACTION(C_US_ASCII)},
516 {N_("/_View/_Code set/Unicode (_UTF-8)"),
517 CODESET_ACTION(C_UTF_8)},
520 {N_("/_View/_Code set/Western European (ISO-8859-_1)"),
521 CODESET_ACTION(C_ISO_8859_1)},
522 {N_("/_View/_Code set/Western European (ISO-8859-15)"),
523 CODESET_ACTION(C_ISO_8859_15)},
526 {N_("/_View/_Code set/Central European (ISO-8859-_2)"),
527 CODESET_ACTION(C_ISO_8859_2)},
529 {N_("/_View/_Code set/_Baltic (ISO-8859-13)"),
530 CODESET_ACTION(C_ISO_8859_13)},
531 {N_("/_View/_Code set/Baltic (ISO-8859-_4)"),
532 CODESET_ACTION(C_ISO_8859_4)},
534 {N_("/_View/_Code set/Greek (ISO-8859-_7)"),
535 CODESET_ACTION(C_ISO_8859_7)},
537 {N_("/_View/_Code set/Turkish (ISO-8859-_9)"),
538 CODESET_ACTION(C_ISO_8859_9)},
540 {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"),
541 CODESET_ACTION(C_ISO_8859_5)},
542 {N_("/_View/_Code set/Cyrillic (KOI8-_R)"),
543 CODESET_ACTION(C_KOI8_R)},
544 {N_("/_View/_Code set/Cyrillic (Windows-1251)"),
545 CODESET_ACTION(C_WINDOWS_1251)},
548 {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
549 CODESET_ACTION(C_ISO_2022_JP)},
551 {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
552 CODESET_ACTION(C_ISO_2022_JP_2)},
554 {N_("/_View/_Code set/Japanese (_EUC-JP)"),
555 CODESET_ACTION(C_EUC_JP)},
556 {N_("/_View/_Code set/Japanese (_Shift__JIS)"),
557 CODESET_ACTION(C_SHIFT_JIS)},
560 {N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
561 CODESET_ACTION(C_GB2312)},
562 {N_("/_View/_Code set/Traditional Chinese (_Big5)"),
563 CODESET_ACTION(C_BIG5)},
564 {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"),
565 CODESET_ACTION(C_EUC_TW)},
566 {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"),
567 CODESET_ACTION(C_ISO_2022_CN)},
569 {N_("/_View/_Code set/Korean (EUC-_KR)"),
570 CODESET_ACTION(C_EUC_KR)},
571 {N_("/_View/_Code set/Korean (ISO-2022-KR)"),
572 CODESET_ACTION(C_ISO_2022_KR)},
574 {N_("/_View/_Code set/Thai (TIS-620)"),
575 CODESET_ACTION(C_TIS_620)},
576 {N_("/_View/_Code set/Thai (Windows-874)"),
577 CODESET_ACTION(C_WINDOWS_874)},
580 #undef CODESET_SEPARATOR
581 #undef CODESET_ACTION
583 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
584 {N_("/_View/Open in new _window"), "<control><alt>N", open_msg_cb, 0, NULL},
585 {N_("/_View/Mess_age source"), "<control>U", view_source_cb, 0, NULL},
586 {N_("/_View/Show all _headers"), "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
587 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
588 {N_("/_View/_Update summary"), "<control><alt>U", update_summary_cb, 0, NULL},
590 {N_("/_Message"), NULL, NULL, 0, "<Branch>"},
591 {N_("/_Message/Get new ma_il"), "<control>I", inc_mail_cb, 0, NULL},
592 {N_("/_Message/Get from _all accounts"),
593 "<shift><control>I", inc_all_account_mail_cb, 0, NULL},
594 {N_("/_Message/Cancel receivin_g"), NULL, inc_cancel_cb, 0, NULL},
595 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
596 {N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
597 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
598 {N_("/_Message/Compose a_n email message"), "<control>M", compose_mail_cb, 0, NULL},
599 {N_("/_Message/Compose a news message"), NULL, compose_news_cb, 0, NULL},
600 {N_("/_Message/_Reply"), "<control>R", reply_cb, COMPOSE_REPLY, NULL},
601 {N_("/_Message/Repl_y to"), NULL, NULL, 0, "<Branch>"},
602 {N_("/_Message/Repl_y to/_all"), "<shift><control>R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
603 {N_("/_Message/Repl_y to/_sender"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
604 {N_("/_Message/Repl_y to/mailing _list"),
605 "<control>L", reply_cb, COMPOSE_REPLY_TO_LIST, NULL},
606 {N_("/_Message/Follow-up and reply to"),NULL, reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
607 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
608 {N_("/_Message/_Forward"), "<control><alt>F", reply_cb, COMPOSE_FORWARD, NULL},
609 {N_("/_Message/Redirect"), NULL, reply_cb, COMPOSE_REDIRECT, NULL},
610 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
611 {N_("/_Message/Re-_edit"), NULL, reedit_cb, 0, NULL},
612 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
613 {N_("/_Message/M_ove..."), "<control>O", move_to_cb, 0, NULL},
614 {N_("/_Message/_Copy..."), "<shift><control>O", copy_to_cb, 0, NULL},
615 {N_("/_Message/_Delete"), "<control>D", delete_cb, 0, NULL},
616 {N_("/_Message/Cancel a news message"), "", cancel_cb, 0, NULL},
617 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
618 {N_("/_Message/_Mark"), NULL, NULL, 0, "<Branch>"},
619 {N_("/_Message/_Mark/_Mark"), "<shift>asterisk", mark_cb, 0, NULL},
620 {N_("/_Message/_Mark/_Unmark"), "U", unmark_cb, 0, NULL},
621 {N_("/_Message/_Mark/---"), NULL, NULL, 0, "<Separator>"},
622 {N_("/_Message/_Mark/Mark as unr_ead"), "<shift>exclam", mark_as_unread_cb, 0, NULL},
623 {N_("/_Message/_Mark/Mark as rea_d"),
624 NULL, mark_as_read_cb, 0, NULL},
625 {N_("/_Message/_Mark/Mark all _read"), NULL, mark_all_read_cb, 0, NULL},
627 {N_("/_Tools"), NULL, NULL, 0, "<Branch>"},
628 {N_("/_Tools/_Selective download..."), "<alt>S", sel_download_cb, 0, NULL},
629 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
630 {N_("/_Tools/_Address book..."), "<shift><control>A", addressbook_open_cb, 0, NULL},
631 {N_("/_Tools/Add sender to address boo_k"),
632 NULL, add_address_cb, 0, NULL},
633 {N_("/_Tools/_Harvest addresses"), NULL, NULL, 0, "<Branch>"},
634 {N_("/_Tools/_Harvest addresses/from _Folder..."),
635 NULL, addr_harvest_cb, 0, NULL},
636 {N_("/_Tools/_Harvest addresses/from _Messages..."),
637 NULL, addr_harvest_msg_cb, 0, NULL},
638 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
639 {N_("/_Tools/_Filter messages"), NULL, filter_cb, 0, NULL},
640 {N_("/_Tools/_Create filter rule"), NULL, NULL, 0, "<Branch>"},
641 {N_("/_Tools/_Create filter rule/_Automatically"),
642 NULL, create_filter_cb, FILTER_BY_AUTO, NULL},
643 {N_("/_Tools/_Create filter rule/by _From"),
644 NULL, create_filter_cb, FILTER_BY_FROM, NULL},
645 {N_("/_Tools/_Create filter rule/by _To"),
646 NULL, create_filter_cb, FILTER_BY_TO, NULL},
647 {N_("/_Tools/_Create filter rule/by _Subject"),
648 NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
649 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
650 {N_("/_Tools/Actio_ns"), NULL, NULL, 0, "<Branch>"},
651 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
652 {N_("/_Tools/Delete du_plicated messages"),
653 NULL, delete_duplicated_cb, 0, NULL},
654 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
655 {N_("/_Tools/E_xecute"), "X", execute_summary_cb, 0, NULL},
657 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
658 {N_("/_Tools/SSL certi_ficates..."),
659 NULL, ssl_manager_open_cb, 0, NULL},
661 {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
662 {N_("/_Tools/_Log window"), "<shift><control>L", log_window_show_cb, 0, NULL},
664 {N_("/_Configuration"), NULL, NULL, 0, "<Branch>"},
665 {N_("/_Configuration/_Common preferences..."),
666 NULL, prefs_common_open_cb, 0, NULL},
667 {N_("/_Configuration/C_ustomize toolbars"),
668 NULL, NULL, 0, "<Branch>"},
669 {N_("/_Configuration/C_ustomize toolbars/_Main window..."),
670 NULL, prefs_toolbar_cb, TOOLBAR_MAIN, NULL},
671 {N_("/_Configuration/C_ustomize toolbars/_Compose window..."),
672 NULL, prefs_toolbar_cb, TOOLBAR_COMPOSE, NULL},
673 {N_("/_Configuration/C_ustomize toolbars/M_essage view..."),
674 NULL, prefs_toolbar_cb, TOOLBAR_MSGVIEW, NULL},
675 {N_("/_Configuration/_Scoring..."),
676 NULL, prefs_scoring_open_cb, 0, NULL},
677 {N_("/_Configuration/_Filtering..."),
678 NULL, prefs_filtering_open_cb, 0, NULL},
679 {N_("/_Configuration/_Templates..."), NULL, prefs_template_open_cb, 0, NULL},
680 {N_("/_Configuration/_Actions..."), NULL, prefs_actions_open_cb, 0, NULL},
681 {N_("/_Configuration/---"), NULL, NULL, 0, "<Separator>"},
682 {N_("/_Configuration/_Preferences for current account..."),
683 NULL, prefs_account_open_cb, 0, NULL},
684 {N_("/_Configuration/Create _new account..."),
685 NULL, new_account_cb, 0, NULL},
686 {N_("/_Configuration/_Edit accounts..."),
687 NULL, account_edit_open, 0, NULL},
688 {N_("/_Configuration/C_hange current account"),
689 NULL, NULL, 0, "<Branch>"},
691 {N_("/_Help"), NULL, NULL, 0, "<Branch>"},
692 {N_("/_Help/_Manual (Local)"), NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
693 {N_("/_Help/_Manual (Sylpheed Doc Homepage)"),
694 NULL, manual_open_cb, MANUAL_MANUAL_SYLDOC, NULL},
695 {N_("/_Help/_FAQ (Local)"), NULL, manual_open_cb, MANUAL_FAQ_LOCAL, NULL},
696 {N_("/_Help/_FAQ (Sylpheed Doc Homepage)"),
697 NULL, manual_open_cb, MANUAL_FAQ_SYLDOC, NULL},
698 {N_("/_Help/---"), NULL, NULL, 0, "<Separator>"},
699 {N_("/_Help/_About"), NULL, about_show, 0, NULL}
702 MainWindow *main_window_create(SeparateType type)
708 GtkWidget *handlebox;
709 GtkWidget *vbox_body;
710 GtkWidget *hbox_stat;
711 GtkWidget *statusbar;
712 GtkWidget *progressbar;
713 GtkWidget *statuslabel;
714 GtkWidget *ac_button;
716 GtkWidget *online_pixmap;
717 GtkWidget *offline_pixmap;
718 GtkWidget *online_switch;
719 GtkWidget *offline_switch;
721 FolderView *folderview;
722 SummaryView *summaryview;
723 MessageView *messageview;
724 GdkColormap *colormap;
727 GtkItemFactory *ifactory;
731 guint n_menu_entries;
733 static GdkGeometry geometry;
735 debug_print("Creating main window...\n");
736 mainwin = g_new0(MainWindow, 1);
739 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
740 gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
741 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
742 gtk_window_set_wmclass(GTK_WINDOW(window), "main_window", "Sylpheed");
744 if (!geometry.min_height) {
745 geometry.min_width = 320;
746 geometry.min_height = 200;
748 gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
751 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
752 GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
753 MANAGE_WINDOW_SIGNALS_CONNECT(window);
754 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
755 GTK_SIGNAL_FUNC(mainwindow_key_pressed), mainwin);
757 gtk_widget_realize(window);
758 gtk_widget_add_events(window, GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);
761 gtkut_widget_set_app_icon(window);
763 vbox = gtk_vbox_new(FALSE, 0);
764 gtk_widget_show(vbox);
765 gtk_container_add(GTK_CONTAINER(window), vbox);
768 n_menu_entries = sizeof(mainwin_entries) / sizeof(mainwin_entries[0]);
769 menubar = menubar_create(window, mainwin_entries,
770 n_menu_entries, "<Main>", mainwin);
771 gtk_widget_show(menubar);
772 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
773 ifactory = gtk_item_factory_from_widget(menubar);
775 menu_set_sensitive(ifactory, "/Help/Manual (Local)", manual_available(MANUAL_MANUAL_LOCAL));
776 menu_set_sensitive(ifactory, "/Help/FAQ (Local)", manual_available(MANUAL_FAQ_LOCAL));
778 handlebox = gtk_handle_box_new();
779 gtk_widget_show(handlebox);
780 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
782 /* link window to mainwin->window to avoid gdk warnings */
783 mainwin->window = window;
786 mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
790 /* vbox that contains body */
791 vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH);
792 gtk_widget_show(vbox_body);
793 gtk_container_set_border_width(GTK_CONTAINER(vbox_body), BORDER_WIDTH);
794 gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
796 hbox_stat = gtk_hbox_new(FALSE, 2);
797 gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
799 statusbar = statusbar_create();
800 gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
802 progressbar = gtk_progress_bar_new();
803 gtk_widget_set_usize(progressbar, 120, 1);
804 gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
806 online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_ONLINE);
807 offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_OFFLINE);
808 online_switch = gtk_button_new ();
809 offline_switch = gtk_button_new ();
810 gtk_container_add (GTK_CONTAINER(online_switch), online_pixmap);
811 gtk_button_set_relief (GTK_BUTTON(online_switch), GTK_RELIEF_NONE);
812 gtk_signal_connect (GTK_OBJECT(online_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
813 gtk_box_pack_start (GTK_BOX(hbox_stat), online_switch, FALSE, FALSE, 0);
814 gtk_container_add (GTK_CONTAINER(offline_switch), offline_pixmap);
815 gtk_button_set_relief (GTK_BUTTON(offline_switch), GTK_RELIEF_NONE);
816 gtk_signal_connect (GTK_OBJECT(offline_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
817 gtk_box_pack_start (GTK_BOX(hbox_stat), offline_switch, FALSE, FALSE, 0);
819 statuslabel = gtk_label_new("");
820 gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
822 ac_button = gtk_button_new();
823 gtk_button_set_relief(GTK_BUTTON(ac_button), GTK_RELIEF_NONE);
824 GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
825 gtk_widget_set_usize(ac_button, -1, 1);
826 gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
827 gtk_signal_connect(GTK_OBJECT(ac_button), "button_press_event",
828 GTK_SIGNAL_FUNC(ac_label_button_pressed), mainwin);
830 ac_label = gtk_label_new("");
831 gtk_container_add(GTK_CONTAINER(ac_button), ac_label);
833 gtk_widget_show_all(hbox_stat);
835 gtk_widget_hide(offline_switch);
837 mainwin->folderview = folderview = folderview_create();
838 mainwin->summaryview = summaryview = summary_create();
839 mainwin->messageview = messageview = messageview_create(mainwin);
840 mainwin->logwin = log_window_create();
842 folderview->mainwin = mainwin;
843 folderview->summaryview = summaryview;
845 summaryview->mainwin = mainwin;
846 summaryview->folderview = folderview;
847 summaryview->messageview = messageview;
848 summaryview->window = window;
850 mainwin->vbox = vbox;
851 mainwin->menubar = menubar;
852 mainwin->menu_factory = ifactory;
853 mainwin->handlebox = handlebox;
854 mainwin->vbox_body = vbox_body;
855 mainwin->hbox_stat = hbox_stat;
856 mainwin->statusbar = statusbar;
857 mainwin->progressbar = progressbar;
858 mainwin->statuslabel = statuslabel;
859 mainwin->ac_button = ac_button;
860 mainwin->ac_label = ac_label;
862 mainwin->online_switch = online_switch;
863 mainwin->offline_switch = offline_switch;
864 mainwin->online_pixmap = online_pixmap;
865 mainwin->offline_pixmap = offline_pixmap;
867 /* set context IDs for status bar */
868 mainwin->mainwin_cid = gtk_statusbar_get_context_id
869 (GTK_STATUSBAR(statusbar), "Main Window");
870 mainwin->folderview_cid = gtk_statusbar_get_context_id
871 (GTK_STATUSBAR(statusbar), "Folder View");
872 mainwin->summaryview_cid = gtk_statusbar_get_context_id
873 (GTK_STATUSBAR(statusbar), "Summary View");
875 /* allocate colors for summary view and folder view */
876 summaryview->color_marked.red = summaryview->color_marked.green = 0;
877 summaryview->color_marked.blue = (guint16)65535;
879 summaryview->color_dim.red = summaryview->color_dim.green =
880 summaryview->color_dim.blue = COLOR_DIM;
882 folderview->color_new.red = (guint16)55000;
883 folderview->color_new.green = folderview->color_new.blue = 15000;
885 gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
886 &folderview->color_op);
888 summaryview->color_important.red = 0;
889 summaryview->color_important.green = 0;
890 summaryview->color_important.blue = (guint16)65535;
892 color[0] = summaryview->color_marked;
893 color[1] = summaryview->color_dim;
894 color[2] = folderview->color_new;
895 color[3] = folderview->color_op;
897 colormap = gdk_window_get_colormap(window->window);
898 gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
899 for (i = 0; i < 4; i++) {
900 if (success[i] == FALSE)
901 g_warning("MainWindow: color allocation %d failed\n", i);
904 debug_print("done.\n");
906 messageview->visible = TRUE;
908 main_window_set_widgets(mainwin, type);
911 menuitem = gtk_item_factory_get_item
912 (ifactory, "/View/Code set/Auto detect");
913 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
915 switch (prefs_common.toolbar_style) {
917 menuitem = gtk_item_factory_get_item
918 (ifactory, "/View/Show or hide/Toolbar/None");
921 menuitem = gtk_item_factory_get_item
922 (ifactory, "/View/Show or hide/Toolbar/Icon");
925 menuitem = gtk_item_factory_get_item
926 (ifactory, "/View/Show or hide/Toolbar/Text");
929 menuitem = gtk_item_factory_get_item
930 (ifactory, "/View/Show or hide/Toolbar/Icon and text");
932 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
934 gtk_widget_hide(mainwin->hbox_stat);
935 menuitem = gtk_item_factory_get_item
936 (ifactory, "/View/Show or hide/Status bar");
937 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
938 prefs_common.show_statusbar);
940 gtk_widget_hide(GTK_WIDGET(mainwin->summaryview->hbox_search));
942 if (prefs_common.show_searchbar)
943 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainwin->summaryview->toggle_search), TRUE);
946 /* set account selection menu */
947 ac_menu = gtk_item_factory_get_widget
948 (ifactory, "/Configuration/Change current account");
949 gtk_signal_connect(GTK_OBJECT(ac_menu), "selection_done",
950 GTK_SIGNAL_FUNC(ac_menu_popup_closed), mainwin);
951 mainwin->ac_menu = ac_menu;
953 toolbar_main_set_sensitive(mainwin);
955 /* create actions menu */
956 update_mainwin_actions_menu(ifactory, mainwin);
958 /* show main window */
959 gtk_widget_set_uposition(mainwin->window,
960 prefs_common.mainwin_x,
961 prefs_common.mainwin_y);
962 gtk_widget_set_usize(window, prefs_common.mainwin_width,
963 prefs_common.mainwin_height);
964 gtk_widget_show(mainwin->window);
966 /* initialize views */
967 folderview_init(folderview);
968 summary_init(summaryview);
969 messageview_init(messageview);
970 log_window_init(mainwin->logwin);
972 sslcertwindow_register_hook();
974 mainwin->lock_count = 0;
975 mainwin->menu_lock_count = 0;
976 mainwin->cursor_count = 0;
979 watch_cursor = gdk_cursor_new(GDK_WATCH);
981 mainwin_list = g_list_append(mainwin_list, mainwin);
983 /* init work_offline */
984 if (prefs_common.work_offline)
985 online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
990 void main_window_cursor_wait(MainWindow *mainwin)
993 if (mainwin->cursor_count == 0)
994 gdk_window_set_cursor(mainwin->window->window, watch_cursor);
996 mainwin->cursor_count++;
1001 void main_window_cursor_normal(MainWindow *mainwin)
1003 if (mainwin->cursor_count)
1004 mainwin->cursor_count--;
1006 if (mainwin->cursor_count == 0)
1007 gdk_window_set_cursor(mainwin->window->window, NULL);
1012 /* lock / unlock the user-interface */
1013 void main_window_lock(MainWindow *mainwin)
1015 if (mainwin->lock_count == 0)
1016 gtk_widget_set_sensitive(mainwin->ac_button, FALSE);
1018 mainwin->lock_count++;
1020 main_window_set_menu_sensitive(mainwin);
1021 toolbar_main_set_sensitive(mainwin);
1024 void main_window_unlock(MainWindow *mainwin)
1026 if (mainwin->lock_count)
1027 mainwin->lock_count--;
1029 main_window_set_menu_sensitive(mainwin);
1030 toolbar_main_set_sensitive(mainwin);
1032 if (mainwin->lock_count == 0)
1033 gtk_widget_set_sensitive(mainwin->ac_button, TRUE);
1036 static void main_window_menu_callback_block(MainWindow *mainwin)
1038 mainwin->menu_lock_count++;
1041 static void main_window_menu_callback_unblock(MainWindow *mainwin)
1043 if (mainwin->menu_lock_count)
1044 mainwin->menu_lock_count--;
1047 void main_window_reflect_prefs_all(void)
1049 main_window_reflect_prefs_all_real(FALSE);
1052 void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
1055 MainWindow *mainwin;
1058 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1059 mainwin = (MainWindow *)cur->data;
1061 main_window_show_cur_account(mainwin);
1062 main_window_set_menu_sensitive(mainwin);
1063 toolbar_main_set_sensitive(mainwin);
1066 if (pixmap_theme_changed) {
1067 toolbar_update(TOOLBAR_MAIN, mainwin);
1068 messageview_reflect_prefs_pixmap_theme();
1069 compose_reflect_prefs_pixmap_theme();
1070 folderview_reflect_prefs_pixmap_theme(mainwin->folderview);
1071 summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
1073 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_WORK_ONLINE);
1074 gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
1075 mainwin->online_pixmap);
1076 gtk_container_add (GTK_CONTAINER(mainwin->online_switch), pixmap);
1077 gtk_widget_show(pixmap);
1078 mainwin->online_pixmap = pixmap;
1079 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_WORK_OFFLINE);
1080 gtk_container_remove(GTK_CONTAINER(mainwin->offline_switch),
1081 mainwin->offline_pixmap);
1082 gtk_container_add (GTK_CONTAINER(mainwin->offline_switch), pixmap);
1083 gtk_widget_show(pixmap);
1084 mainwin->offline_pixmap = pixmap;
1087 summary_redisplay_msg(mainwin->summaryview);
1088 headerview_set_visibility(mainwin->messageview->headerview,
1089 prefs_common.display_header_pane);
1093 void main_window_set_summary_column(void)
1096 MainWindow *mainwin;
1098 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1099 mainwin = (MainWindow *)cur->data;
1100 summary_set_column_order(mainwin->summaryview);
1104 void main_window_set_account_menu(GList *account_list)
1106 GList *cur, *cur_ac, *cur_item;
1107 GtkWidget *menuitem;
1108 MainWindow *mainwin;
1109 PrefsAccount *ac_prefs;
1111 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
1112 mainwin = (MainWindow *)cur->data;
1114 /* destroy all previous menu item */
1115 cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children;
1116 while (cur_item != NULL) {
1117 GList *next = cur_item->next;
1118 gtk_widget_destroy(GTK_WIDGET(cur_item->data));
1122 for (cur_ac = account_list; cur_ac != NULL;
1123 cur_ac = cur_ac->next) {
1124 ac_prefs = (PrefsAccount *)cur_ac->data;
1126 menuitem = gtk_menu_item_new_with_label
1127 (ac_prefs->account_name
1128 ? ac_prefs->account_name : _("Untitled"));
1129 gtk_widget_show(menuitem);
1130 gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem);
1131 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
1132 GTK_SIGNAL_FUNC(account_menu_cb),
1138 static void main_window_show_cur_account(MainWindow *mainwin)
1143 ac_name = g_strdup(cur_account
1144 ? (cur_account->account_name
1145 ? cur_account->account_name : _("Untitled"))
1149 buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
1151 buf = g_strdup(PROG_VERSION);
1152 gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
1155 gtk_label_set_text(GTK_LABEL(mainwin->ac_label), ac_name);
1156 gtk_widget_queue_resize(mainwin->ac_button);
1161 void main_window_separation_change(MainWindow *mainwin, SeparateType type)
1163 GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview);
1164 GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview);
1165 //GtkWidget *message_wid = GTK_WIDGET_PTR(mainwin->messageview);
1166 GtkWidget *message_wid = mainwin->messageview->vbox;
1168 debug_print("Changing window separation type from %d to %d\n",
1169 mainwin->type, type);
1171 if (mainwin->type == type) return;
1173 /* remove widgets from those containers */
1174 gtk_widget_ref(folder_wid);
1175 gtk_widget_ref(summary_wid);
1176 gtk_widget_ref(message_wid);
1177 gtkut_container_remove
1178 (GTK_CONTAINER(folder_wid->parent), folder_wid);
1179 gtkut_container_remove
1180 (GTK_CONTAINER(summary_wid->parent), summary_wid);
1181 gtkut_container_remove
1182 (GTK_CONTAINER(message_wid->parent), message_wid);
1184 /* clean containers */
1185 switch (mainwin->type) {
1187 gtk_widget_destroy(mainwin->win.sep_none.hpaned);
1189 case SEPARATE_FOLDER:
1190 gtk_widget_destroy(mainwin->win.sep_folder.vpaned);
1191 gtk_widget_destroy(mainwin->win.sep_folder.folderwin);
1193 case SEPARATE_MESSAGE:
1194 gtk_widget_destroy(mainwin->win.sep_message.hpaned);
1195 gtk_widget_destroy(mainwin->win.sep_message.messagewin);
1198 gtk_widget_destroy(mainwin->win.sep_both.messagewin);
1199 gtk_widget_destroy(mainwin->win.sep_both.folderwin);
1203 gtk_widget_hide(mainwin->window);
1204 main_window_set_widgets(mainwin, type);
1205 gtk_widget_show(mainwin->window);
1207 gtk_widget_unref(folder_wid);
1208 gtk_widget_unref(summary_wid);
1209 gtk_widget_unref(message_wid);
1212 void main_window_toggle_message_view(MainWindow *mainwin)
1214 SummaryView *summaryview = mainwin->summaryview;
1215 union CompositeWin *cwin = &mainwin->win;
1216 GtkWidget *vpaned = NULL;
1217 GtkWidget *container = NULL;
1218 GtkWidget *msgwin = NULL;
1220 switch (mainwin->type) {
1222 vpaned = cwin->sep_none.vpaned;
1223 container = cwin->sep_none.hpaned;
1225 case SEPARATE_FOLDER:
1226 vpaned = cwin->sep_folder.vpaned;
1227 container = mainwin->vbox_body;
1229 case SEPARATE_MESSAGE:
1230 msgwin = mainwin->win.sep_message.messagewin;
1233 msgwin = mainwin->win.sep_both.messagewin;
1238 if (GTK_WIDGET_VISIBLE(msgwin)) {
1239 gtk_widget_hide(msgwin);
1240 mainwin->messageview->visible = FALSE;
1241 summaryview->displayed = NULL;
1243 gtk_widget_show(msgwin);
1244 mainwin->messageview->visible = TRUE;
1246 } else if (vpaned->parent != NULL) {
1247 mainwin->messageview->visible = FALSE;
1248 summaryview->displayed = NULL;
1249 gtk_widget_ref(vpaned);
1250 gtkut_container_remove(GTK_CONTAINER(container), vpaned);
1251 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container);
1252 gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
1253 GTK_ARROW_UP, GTK_SHADOW_OUT);
1255 mainwin->messageview->visible = TRUE;
1256 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), vpaned);
1257 gtk_container_add(GTK_CONTAINER(container), vpaned);
1258 gtk_widget_unref(vpaned);
1259 gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
1260 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
1263 main_window_set_menu_sensitive(mainwin);
1265 gtk_widget_grab_focus(summaryview->ctree);
1268 void main_window_get_size(MainWindow *mainwin)
1270 GtkAllocation *allocation;
1272 allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
1274 prefs_common.summaryview_width = allocation->width;
1276 if ((mainwin->type == SEPARATE_NONE ||
1277 mainwin->type == SEPARATE_FOLDER) &&
1278 messageview_is_visible(mainwin->messageview))
1279 prefs_common.summaryview_height = allocation->height;
1281 prefs_common.mainview_width = allocation->width;
1283 allocation = &mainwin->window->allocation;
1285 prefs_common.mainview_height = allocation->height;
1286 prefs_common.mainwin_width = allocation->width;
1287 prefs_common.mainwin_height = allocation->height;
1289 allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
1291 prefs_common.folderview_width = allocation->width;
1292 prefs_common.folderview_height = allocation->height;
1295 void main_window_get_position(MainWindow *mainwin)
1299 gtkut_widget_get_uposition(mainwin->window, &x, &y);
1301 prefs_common.mainview_x = x;
1302 prefs_common.mainview_y = y;
1303 prefs_common.mainwin_x = x;
1304 prefs_common.mainwin_y = y;
1306 debug_print("window position: x = %d, y = %d\n", x, y);
1309 void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
1315 for (has_trash = 0, list = folder_get_list(); list != NULL; list = list->next) {
1316 folder = FOLDER(list->data);
1317 if (folder && folder->trash && folder->trash->total > 0)
1321 if (!has_trash) return;
1324 if (alertpanel(_("Empty trash"),
1325 _("Empty all messages in trash?"),
1326 _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
1328 manage_window_focus_in(mainwin->window, NULL, NULL);
1331 procmsg_empty_trash();
1333 for (list = folder_get_list(); list != NULL; list = list->next) {
1334 folder = list->data;
1335 if (folder && folder->trash) {
1336 folder_update_item(folder->trash, TRUE);
1340 if (mainwin->summaryview->folder_item &&
1341 mainwin->summaryview->folder_item->stype == F_TRASH)
1342 gtk_widget_grab_focus(mainwin->folderview->ctree);
1345 void main_window_add_mailbox(MainWindow *mainwin)
1350 path = input_dialog(_("Add mailbox"),
1351 _("Input the location of mailbox.\n"
1352 "If the existing mailbox is specified, it will be\n"
1353 "scanned automatically."),
1356 if (folder_find_from_path(path)) {
1357 alertpanel_error(_("The mailbox `%s' already exists."), path);
1361 if (!strcmp(path, "Mail"))
1362 folder = folder_new(F_MH, _("Mailbox"), path);
1364 folder = folder_new(F_MH, g_basename(path), path);
1367 if (folder->create_tree(folder) < 0) {
1368 alertpanel_error(_("Creation of the mailbox failed.\n"
1369 "Maybe some files already exist, or you don't have the permission to write there."));
1370 folder_destroy(folder);
1375 folder_set_ui_func(folder, scan_tree_func, mainwin);
1376 folder_scan_tree(folder);
1377 folder_set_ui_func(folder, NULL, NULL);
1379 folderview_set(mainwin->folderview);
1382 void main_window_add_mbox(MainWindow *mainwin)
1388 path = input_dialog(_("Add mbox mailbox"),
1389 _("Input the location of mailbox."),
1394 if (folder_find_from_path(path)) {
1395 alertpanel_error(_("The mailbox `%s' already exists."), path);
1401 if (!strcmp(path, "Mail"))
1402 folder = folder_new(F_MBOX, _("Mailbox"), path);
1406 folder = folder_new(F_MBOX, g_basename(path), path);
1409 if (folder->create_tree(folder) < 0) {
1410 alertpanel_error(_("Creation of the mailbox failed."));
1411 folder_destroy(folder);
1417 item = folder_item_new(folder, folder->name, NULL);
1418 item->folder = folder;
1419 folder->node = g_node_new(item);
1421 folder_create_folder(item, "inbox");
1422 folder_create_folder(item, "outbox");
1423 folder_create_folder(item, "queue");
1424 folder_create_folder(item, "draft");
1425 folder_create_folder(item, "trash");
1427 folderview_set(mainwin->folderview);
1430 SensitiveCond main_window_get_current_state(MainWindow *mainwin)
1432 SensitiveCond state = 0;
1433 SummarySelection selection;
1434 FolderItem *item = mainwin->summaryview->folder_item;
1435 GList *account_list = account_get_list();
1437 selection = summary_get_selection_type(mainwin->summaryview);
1439 if (mainwin->lock_count == 0)
1440 state |= M_UNLOCKED;
1441 if (selection != SUMMARY_NONE)
1442 state |= M_MSG_EXIST;
1443 if (item && item->path && item->parent && !item->no_select) {
1445 /* if (item->folder->type != F_NEWS) */
1446 state |= M_ALLOW_DELETE;
1448 if (prefs_common.immediate_exec == 0
1449 && mainwin->lock_count == 0)
1450 state |= M_DELAY_EXEC;
1452 if ((selection == SUMMARY_NONE && item->hide_read_msgs)
1453 || selection != SUMMARY_NONE)
1454 state |= M_HIDE_READ_MSG;
1456 if (mainwin->summaryview->threaded)
1457 state |= M_THREADED;
1459 state |= M_UNTHREADED;
1460 if (selection == SUMMARY_SELECTED_SINGLE ||
1461 selection == SUMMARY_SELECTED_MULTIPLE)
1462 state |= M_TARGET_EXIST;
1463 if (selection == SUMMARY_SELECTED_SINGLE)
1464 state |= M_SINGLE_TARGET_EXIST;
1465 if (mainwin->summaryview->folder_item &&
1466 mainwin->summaryview->folder_item->folder->type == F_NEWS)
1469 state |= M_NOT_NEWS;
1470 if (selection == SUMMARY_SELECTED_SINGLE &&
1472 (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
1473 item->stype == F_QUEUE)))
1474 state |= M_ALLOW_REEDIT;
1476 state |= M_HAVE_ACCOUNT;
1478 for ( ; account_list != NULL; account_list = account_list->next) {
1479 if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
1480 state |= M_HAVE_NEWS_ACCOUNT;
1485 if (inc_is_active())
1486 state |= M_INC_ACTIVE;
1493 void main_window_set_menu_sensitive(MainWindow *mainwin)
1495 GtkItemFactory *ifactory = mainwin->menu_factory;
1496 SensitiveCond state;
1498 GtkWidget *menuitem;
1499 SummaryView *summaryview;
1503 static const struct {
1507 {"/File/Add mailbox..." , M_UNLOCKED},
1508 {"/File/Add mbox mailbox..." , M_UNLOCKED},
1509 {"/File/Check for new messages in all folders", M_UNLOCKED},
1510 {"/File/Folder" , M_UNLOCKED},
1511 {"/File/Import mbox file..." , M_UNLOCKED},
1512 {"/File/Export to mbox file..." , M_UNLOCKED},
1513 {"/File/Empty trash" , M_UNLOCKED},
1514 {"/File/Work offline" , M_UNLOCKED},
1516 {"/File/Save as...", M_SINGLE_TARGET_EXIST|M_UNLOCKED},
1517 {"/File/Print..." , M_TARGET_EXIST|M_UNLOCKED},
1518 /* {"/File/Close" , M_UNLOCKED}, */
1519 {"/File/Exit" , M_UNLOCKED},
1521 {"/Edit/Select thread" , M_SINGLE_TARGET_EXIST},
1523 {"/View/Sort" , M_EXEC},
1524 {"/View/Thread view" , M_EXEC},
1525 {"/View/Expand all threads" , M_MSG_EXIST},
1526 {"/View/Collapse all threads" , M_MSG_EXIST},
1527 {"/View/Hide read messages" , M_HIDE_READ_MSG},
1528 {"/View/Go to/Prev message" , M_MSG_EXIST},
1529 {"/View/Go to/Next message" , M_MSG_EXIST},
1530 {"/View/Go to/Prev unread message" , M_MSG_EXIST},
1531 {"/View/Go to/Next unread message" , M_MSG_EXIST},
1532 {"/View/Go to/Prev new message" , M_MSG_EXIST},
1533 {"/View/Go to/Next new message" , M_MSG_EXIST},
1534 {"/View/Go to/Prev marked message" , M_MSG_EXIST},
1535 {"/View/Go to/Next marked message" , M_MSG_EXIST},
1536 {"/View/Go to/Prev labeled message", M_MSG_EXIST},
1537 {"/View/Go to/Next labeled message", M_MSG_EXIST},
1538 {"/View/Open in new window" , M_SINGLE_TARGET_EXIST},
1539 {"/View/Show all headers" , M_SINGLE_TARGET_EXIST},
1540 {"/View/Message source" , M_SINGLE_TARGET_EXIST},
1542 {"/Message/Get new mail" , M_HAVE_ACCOUNT|M_UNLOCKED},
1543 {"/Message/Get from all accounts" , M_HAVE_ACCOUNT|M_UNLOCKED},
1544 {"/Message/Cancel receiving" , M_INC_ACTIVE},
1545 {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
1546 {"/Message/Reply" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1547 {"/Message/Reply to" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1548 {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS},
1549 {"/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST},
1550 {"/Message/Redirect" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
1551 {"/Message/Re-edit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
1552 {"/Message/Move..." , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1553 {"/Message/Copy..." , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
1554 {"/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NOT_NEWS},
1555 {"/Message/Cancel a news message" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NEWS},
1556 {"/Message/Mark" , M_TARGET_EXIST},
1558 {"/Tools/Selective download..." , M_HAVE_ACCOUNT|M_UNLOCKED},
1559 {"/Tools/Add sender to address book", M_SINGLE_TARGET_EXIST},
1560 {"/Tools/Harvest addresses" , M_UNLOCKED},
1561 {"/Tools/Filter messages" , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
1562 {"/Tools/Create filter rule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
1563 {"/Tools/Actions" , M_TARGET_EXIST|M_UNLOCKED},
1564 {"/Tools/Execute" , M_DELAY_EXEC},
1565 {"/Tools/Delete duplicated messages", M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
1567 {"/Configuration", M_UNLOCKED},
1572 state = main_window_get_current_state(mainwin);
1574 for (i = 0; entry[i].entry != NULL; i++) {
1575 sensitive = ((entry[i].cond & state) == entry[i].cond);
1576 menu_set_sensitive(ifactory, entry[i].entry, sensitive);
1579 main_window_menu_callback_block(mainwin);
1581 #define SET_CHECK_MENU_ACTIVE(path, active) \
1583 menuitem = gtk_item_factory_get_widget(ifactory, path); \
1584 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active); \
1587 SET_CHECK_MENU_ACTIVE("/View/Show or hide/Message view",
1588 messageview_is_visible(mainwin->messageview));
1590 summaryview = mainwin->summaryview;
1591 menu_path = "/View/Sort/Don't sort";
1593 switch (summaryview->sort_key) {
1594 case SORT_BY_NUMBER:
1595 menu_path = "/View/Sort/by number"; break;
1597 menu_path = "/View/Sort/by size"; break;
1599 menu_path = "/View/Sort/by date"; break;
1601 menu_path = "/View/Sort/by from"; break;
1602 case SORT_BY_SUBJECT:
1603 menu_path = "/View/Sort/by subject"; break;
1605 menu_path = "/View/Sort/by color label"; break;
1607 menu_path = "/View/Sort/by mark"; break;
1608 case SORT_BY_UNREAD:
1609 menu_path = "/View/Sort/by unread"; break;
1611 menu_path = "/View/Sort/by attachment"; break;
1613 menu_path = "/View/Sort/by score"; break;
1614 case SORT_BY_LOCKED:
1615 menu_path = "/View/Sort/by locked"; break;
1618 menu_path = "/View/Sort/Don't sort"; break;
1620 SET_CHECK_MENU_ACTIVE(menu_path, TRUE);
1622 if (summaryview->sort_type == SORT_ASCENDING) {
1623 SET_CHECK_MENU_ACTIVE("/View/Sort/Ascending", TRUE);
1625 SET_CHECK_MENU_ACTIVE("/View/Sort/Descending", TRUE);
1628 if (summaryview->sort_key != SORT_BY_NONE) {
1629 menu_set_sensitive(ifactory, "/View/Sort/Ascending", TRUE);
1630 menu_set_sensitive(ifactory, "/View/Sort/Descending", TRUE);
1632 menu_set_sensitive(ifactory, "/View/Sort/Ascending", FALSE);
1633 menu_set_sensitive(ifactory, "/View/Sort/Descending", FALSE);
1636 SET_CHECK_MENU_ACTIVE("/View/Show all headers",
1637 mainwin->messageview->textview->show_all_headers);
1638 SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
1640 #undef SET_CHECK_MENU_ACTIVE
1642 main_window_menu_callback_unblock(mainwin);
1645 void main_window_popup(MainWindow *mainwin)
1647 gtkut_window_popup(mainwin->window);
1649 switch (mainwin->type) {
1650 case SEPARATE_FOLDER:
1651 gtkut_window_popup(mainwin->win.sep_folder.folderwin);
1653 case SEPARATE_MESSAGE:
1654 gtkut_window_popup(mainwin->win.sep_message.messagewin);
1657 gtkut_window_popup(mainwin->win.sep_both.folderwin);
1658 gtkut_window_popup(mainwin->win.sep_both.messagewin);
1665 static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
1667 GtkWidget *folderwin = NULL;
1668 GtkWidget *messagewin = NULL;
1671 GtkWidget *vbox_body = mainwin->vbox_body;
1672 GtkItemFactory *ifactory = mainwin->menu_factory;
1673 GtkWidget *menuitem;
1675 GtkItemFactory *msgview_ifactory;
1677 debug_print("Setting widgets...");
1679 /* create separated window(s) if needed */
1680 if (type & SEPARATE_FOLDER) {
1681 folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1682 gtk_window_set_title(GTK_WINDOW(folderwin),
1683 _("Sylpheed - Folder View"));
1684 gtk_window_set_wmclass(GTK_WINDOW(folderwin),
1685 "folder_view", "Sylpheed");
1686 gtk_window_set_policy(GTK_WINDOW(folderwin),
1688 gtk_widget_set_usize(folderwin, -1,
1689 prefs_common.mainview_height);
1690 gtk_container_set_border_width(GTK_CONTAINER(folderwin),
1692 gtk_signal_connect(GTK_OBJECT(folderwin), "delete_event",
1693 GTK_SIGNAL_FUNC(folder_window_close_cb),
1696 if (type & SEPARATE_MESSAGE) {
1697 messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1698 gtk_window_set_title(GTK_WINDOW(messagewin),
1699 _("Sylpheed - Message View"));
1700 gtk_window_set_wmclass(GTK_WINDOW(messagewin),
1701 "message_view", "Sylpheed");
1702 gtk_window_set_policy(GTK_WINDOW(messagewin),
1704 gtk_widget_set_usize
1705 (messagewin, prefs_common.mainview_width,
1706 prefs_common.mainview_height
1707 - prefs_common.summaryview_height
1708 + DEFAULT_HEADERVIEW_HEIGHT);
1709 gtk_container_set_border_width(GTK_CONTAINER(messagewin),
1711 gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
1712 GTK_SIGNAL_FUNC(message_window_close_cb),
1718 hpaned = gtk_hpaned_new();
1719 gtk_widget_show(hpaned);
1720 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1721 gtk_paned_add1(GTK_PANED(hpaned),
1722 GTK_WIDGET_PTR(mainwin->folderview));
1724 vpaned = gtk_vpaned_new();
1725 if (messageview_is_visible(mainwin->messageview)) {
1726 gtk_paned_add2(GTK_PANED(hpaned), vpaned);
1727 gtk_paned_add1(GTK_PANED(vpaned),
1728 GTK_WIDGET_PTR(mainwin->summaryview));
1730 gtk_paned_add2(GTK_PANED(hpaned),
1731 GTK_WIDGET_PTR(mainwin->summaryview));
1732 gtk_widget_ref(vpaned);
1734 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1735 prefs_common.summaryview_width,
1736 prefs_common.summaryview_height);
1737 gtk_paned_add2(GTK_PANED(vpaned),
1738 GTK_WIDGET_PTR(mainwin->messageview));
1739 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1740 prefs_common.mainview_width, -1);
1741 gtk_widget_set_usize(mainwin->window,
1742 prefs_common.folderview_width +
1743 prefs_common.mainview_width,
1744 prefs_common.mainwin_height);
1745 gtk_widget_show_all(vpaned);
1747 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1748 * lose track of its visibility state */
1749 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1750 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1752 mainwin->win.sep_none.hpaned = hpaned;
1753 mainwin->win.sep_none.vpaned = vpaned;
1755 /* remove headerview if not in prefs */
1756 headerview_set_visibility(mainwin->messageview->headerview,
1757 prefs_common.display_header_pane);
1759 case SEPARATE_FOLDER:
1760 vpaned = gtk_vpaned_new();
1761 if (messageview_is_visible(mainwin->messageview)) {
1762 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned,
1764 gtk_paned_add1(GTK_PANED(vpaned),
1765 GTK_WIDGET_PTR(mainwin->summaryview));
1767 gtk_box_pack_start(GTK_BOX(vbox_body),
1768 GTK_WIDGET_PTR(mainwin->summaryview),
1770 gtk_widget_ref(vpaned);
1772 gtk_paned_add2(GTK_PANED(vpaned),
1773 GTK_WIDGET_PTR(mainwin->messageview));
1774 gtk_widget_show_all(vpaned);
1775 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1776 prefs_common.summaryview_width,
1777 prefs_common.summaryview_height);
1778 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1779 prefs_common.mainview_width, -1);
1780 gtk_widget_set_usize(mainwin->window,
1781 prefs_common.mainview_width,
1782 prefs_common.mainview_height);
1784 gtk_container_add(GTK_CONTAINER(folderwin),
1785 GTK_WIDGET_PTR(mainwin->folderview));
1787 mainwin->win.sep_folder.folderwin = folderwin;
1788 mainwin->win.sep_folder.vpaned = vpaned;
1790 gtk_widget_show_all(folderwin);
1792 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1793 * lose track of its visibility state */
1794 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1795 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1797 /* remove headerview if not in prefs */
1798 headerview_set_visibility(mainwin->messageview->headerview,
1799 prefs_common.display_header_pane);
1802 case SEPARATE_MESSAGE:
1803 hpaned = gtk_hpaned_new();
1804 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1806 gtk_paned_add1(GTK_PANED(hpaned),
1807 GTK_WIDGET_PTR(mainwin->folderview));
1808 gtk_paned_add2(GTK_PANED(hpaned),
1809 GTK_WIDGET_PTR(mainwin->summaryview));
1810 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1811 prefs_common.summaryview_width,
1812 prefs_common.summaryview_height);
1813 gtk_widget_set_usize(mainwin->window,
1814 prefs_common.folderview_width +
1815 prefs_common.mainview_width,
1816 prefs_common.mainwin_height);
1817 gtk_widget_show_all(hpaned);
1819 messageview_add_toolbar(mainwin->messageview, messagewin);
1820 msgview_ifactory = gtk_item_factory_from_widget(mainwin->messageview->menubar);
1821 menu_set_sensitive(msgview_ifactory, "/File/Close", FALSE);
1823 mainwin->win.sep_message.messagewin = messagewin;
1824 mainwin->win.sep_message.hpaned = hpaned;
1826 gtk_widget_show_all(messagewin);
1828 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1829 * lose track of its visibility state */
1830 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1831 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1834 gtk_box_pack_start(GTK_BOX(vbox_body),
1835 GTK_WIDGET_PTR(mainwin->summaryview),
1837 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1838 prefs_common.summaryview_width,
1839 prefs_common.summaryview_height);
1840 gtk_widget_set_usize(mainwin->window,
1841 prefs_common.mainview_width,
1842 prefs_common.mainwin_height);
1843 gtk_container_add(GTK_CONTAINER(folderwin),
1844 GTK_WIDGET_PTR(mainwin->folderview));
1845 gtk_container_add(GTK_CONTAINER(messagewin),
1846 GTK_WIDGET_PTR(mainwin->messageview));
1848 mainwin->win.sep_both.folderwin = folderwin;
1849 mainwin->win.sep_both.messagewin = messagewin;
1851 gtk_widget_show_all(folderwin);
1852 gtk_widget_show_all(messagewin);
1854 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
1855 * lose track of its visibility state */
1856 if (!noticeview_is_visible(mainwin->messageview->noticeview))
1857 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
1861 /* rehide quick search if necessary */
1862 if (!prefs_common.show_searchbar)
1863 gtk_widget_hide(mainwin->summaryview->hbox_search);
1865 mainwin->type = type;
1867 mainwin->messageview->visible = TRUE;
1869 /* toggle menu state */
1870 menuitem = gtk_item_factory_get_item
1871 (ifactory, "/View/Show or hide/Folder tree");
1872 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
1873 menuitem = gtk_item_factory_get_item
1874 (ifactory, "/View/Show or hide/Message view");
1875 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
1877 menuitem = gtk_item_factory_get_item
1878 (ifactory, "/View/Separate folder tree");
1879 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
1880 ((type & SEPARATE_FOLDER) != 0));
1881 menuitem = gtk_item_factory_get_item
1882 (ifactory, "/View/Separate message view");
1883 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
1884 ((type & SEPARATE_MESSAGE) != 0));
1886 debug_print("done.\n");
1889 void main_window_destroy_all(void)
1891 while (mainwin_list != NULL) {
1892 MainWindow *mainwin = (MainWindow*)mainwin_list->data;
1894 /* free toolbar stuff */
1895 toolbar_clear_list(TOOLBAR_MAIN);
1896 TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
1897 TOOLBAR_DESTROY_ITEMS(mainwin->toolbar->item_list);
1899 g_free(mainwin->toolbar);
1902 mainwin_list = g_list_remove(mainwin_list, mainwin);
1904 g_list_free(mainwin_list);
1908 static void toolbar_account_button_pressed(GtkWidget *widget,
1909 GdkEventButton *event,
1912 MainWindow *mainwin = (MainWindow *)data;
1915 if (event->button != 3) return;
1917 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
1918 gtk_object_set_data(GTK_OBJECT(mainwin->ac_menu), "menu_button",
1921 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
1922 menu_button_position, widget,
1923 event->button, event->time);
1927 static void ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
1930 MainWindow *mainwin = (MainWindow *)data;
1934 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
1935 gtk_object_set_data(GTK_OBJECT(mainwin->ac_menu), "menu_button",
1938 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
1939 menu_button_position, widget,
1940 event->button, event->time);
1943 static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
1945 MainWindow *mainwin = (MainWindow *)data;
1948 button = gtk_object_get_data(GTK_OBJECT(menu_shell), "menu_button");
1949 if (!button) return;
1950 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1951 gtk_object_remove_data(GTK_OBJECT(mainwin->ac_menu), "menu_button");
1952 manage_window_focus_in(mainwin->window, NULL, NULL);
1955 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1958 MainWindow *mainwin = (MainWindow *)data;
1960 if (mainwin->lock_count == 0)
1961 app_exit_cb(data, 0, widget);
1966 static gint folder_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1969 MainWindow *mainwin = (MainWindow *)data;
1970 GtkWidget *menuitem;
1972 menuitem = gtk_item_factory_get_item
1973 (mainwin->menu_factory, "/View/Show or hide/Folder tree");
1974 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
1979 static gint message_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1982 MainWindow *mainwin = (MainWindow *)data;
1983 GtkWidget *menuitem;
1985 menuitem = gtk_item_factory_get_item
1986 (mainwin->menu_factory, "/View/Show or hide/Message view");
1987 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
1992 static void add_mailbox_cb(MainWindow *mainwin, guint action,
1995 main_window_add_mailbox(mainwin);
1998 static void add_mbox_cb(MainWindow *mainwin, guint action,
2001 main_window_add_mbox(mainwin);
2004 static void update_folderview_cb(MainWindow *mainwin, guint action,
2007 summary_show(mainwin->summaryview, NULL);
2008 folderview_check_new_all();
2011 static void new_folder_cb(MainWindow *mainwin, guint action,
2014 folderview_new_folder(mainwin->folderview);
2017 static void rename_folder_cb(MainWindow *mainwin, guint action,
2020 folderview_rename_folder(mainwin->folderview);
2023 static void delete_folder_cb(MainWindow *mainwin, guint action,
2026 folderview_delete_folder(mainwin->folderview);
2029 static void import_mbox_cb(MainWindow *mainwin, guint action,
2032 import_mbox(mainwin->summaryview->folder_item);
2035 static void export_mbox_cb(MainWindow *mainwin, guint action,
2038 export_mbox(mainwin->summaryview->folder_item);
2041 static void empty_trash_cb(MainWindow *mainwin, guint action,
2044 main_window_empty_trash(mainwin, TRUE);
2047 static void save_as_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2049 summary_save_as(mainwin->summaryview);
2052 static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2054 summary_print(mainwin->summaryview);
2057 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2059 if (prefs_common.confirm_on_exit) {
2060 if (alertpanel(_("Exit"), _("Exit this program?"),
2061 _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
2063 manage_window_focus_in(mainwin->window, NULL, NULL);
2066 app_will_exit(widget, mainwin);
2069 static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2072 summary_search(mainwin->summaryview);
2074 message_search(mainwin->messageview);
2077 static void toggle_folder_cb(MainWindow *mainwin, guint action,
2082 active = GTK_CHECK_MENU_ITEM(widget)->active;
2084 switch (mainwin->type) {
2086 case SEPARATE_MESSAGE:
2089 gtk_widget_show(GTK_WIDGET_PTR(mainwin->folderview));
2091 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->folderview));
2094 case SEPARATE_FOLDER:
2095 debug_print("separate folder\n");
2097 gtk_widget_show(mainwin->win.sep_folder.folderwin);
2099 gtk_widget_hide(mainwin->win.sep_folder.folderwin);
2103 gtk_widget_show(mainwin->win.sep_both.folderwin);
2105 gtk_widget_hide(mainwin->win.sep_both.folderwin);
2110 static void toggle_message_cb(MainWindow *mainwin, guint action,
2115 active = GTK_CHECK_MENU_ITEM(widget)->active;
2117 if (active != messageview_is_visible(mainwin->messageview))
2118 summary_toggle_view(mainwin->summaryview);
2121 static void toggle_toolbar_cb(MainWindow *mainwin, guint action,
2124 toolbar_toggle(action, mainwin);
2127 /* END Toolbar Stuff */
2129 static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
2132 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2133 gtk_widget_show(mainwin->hbox_stat);
2134 prefs_common.show_statusbar = TRUE;
2136 gtk_widget_hide(mainwin->hbox_stat);
2137 prefs_common.show_statusbar = FALSE;
2141 static void separate_widget_cb(MainWindow *mainwin, guint action,
2146 if (GTK_CHECK_MENU_ITEM(widget)->active)
2147 type = mainwin->type | action;
2149 type = mainwin->type & ~action;
2151 main_window_separation_change(mainwin, type);
2153 prefs_common.sep_folder = (type & SEPARATE_FOLDER) != 0;
2154 prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
2157 void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline)
2160 online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
2162 online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
2165 static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget *widget)
2167 main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active);
2170 static void online_switch_clicked (GtkButton *btn, gpointer data)
2172 MainWindow *mainwin;
2173 GtkItemFactory *ifactory;
2174 GtkCheckMenuItem *menuitem;
2176 mainwin = (MainWindow *) data;
2178 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
2179 menuitem = GTK_CHECK_MENU_ITEM (gtk_item_factory_get_widget(ifactory, "/File/Work offline"));
2181 g_return_if_fail(mainwin != NULL);
2182 g_return_if_fail(menuitem != NULL);
2184 if (btn == GTK_BUTTON(mainwin->online_switch)) {
2186 gtk_widget_hide (mainwin->online_switch);
2187 gtk_widget_show (mainwin->offline_switch);
2188 menuitem->active = TRUE;
2189 prefs_common.work_offline = TRUE;
2190 inc_autocheck_timer_remove();
2193 gtk_widget_hide (mainwin->offline_switch);
2194 gtk_widget_show (mainwin->online_switch);
2195 menuitem->active = FALSE;
2196 prefs_common.work_offline = FALSE;
2197 inc_autocheck_timer_set();
2201 static void addressbook_open_cb(MainWindow *mainwin, guint action,
2204 addressbook_open(NULL);
2207 static void log_window_show_cb(MainWindow *mainwin, guint action,
2210 log_window_show(mainwin->logwin);
2213 static void sel_download_cb(MainWindow *mainwin, guint action,
2216 selective_download(mainwin);
2219 static void prefs_toolbar_cb(MainWindow *mainwin, guint action,
2222 prefs_toolbar_open((ToolbarType)action);
2225 static void inc_cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2230 static void move_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2232 summary_move_to(mainwin->summaryview);
2235 static void copy_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2237 summary_copy_to(mainwin->summaryview);
2240 static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2242 summary_delete(mainwin->summaryview);
2245 static void cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2247 summary_cancel(mainwin->summaryview);
2250 static void open_msg_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2252 summary_open_msg(mainwin->summaryview);
2255 static void view_source_cb(MainWindow *mainwin, guint action,
2258 summary_view_source(mainwin->summaryview);
2261 static void show_all_header_cb(MainWindow *mainwin, guint action,
2264 if (mainwin->menu_lock_count) return;
2265 summary_display_msg_selected(mainwin->summaryview,
2266 GTK_CHECK_MENU_ITEM(widget)->active);
2269 static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2271 summary_reedit(mainwin->summaryview);
2274 static void mark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2276 summary_mark(mainwin->summaryview);
2279 static void unmark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2281 summary_unmark(mainwin->summaryview);
2284 static void mark_as_unread_cb(MainWindow *mainwin, guint action,
2287 summary_mark_as_unread(mainwin->summaryview);
2290 static void mark_as_read_cb(MainWindow *mainwin, guint action,
2293 summary_mark_as_read(mainwin->summaryview);
2296 static void mark_all_read_cb(MainWindow *mainwin, guint action,
2299 summary_mark_all_read(mainwin->summaryview);
2302 static void add_address_cb(MainWindow *mainwin, guint action,
2305 summary_add_address(mainwin->summaryview);
2308 static void set_charset_cb(MainWindow *mainwin, guint action,
2313 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2314 str = conv_get_charset_str((CharSet)action);
2315 g_free(prefs_common.force_charset);
2316 prefs_common.force_charset = str ? g_strdup(str) : NULL;
2318 summary_redisplay_msg(mainwin->summaryview);
2320 debug_print("forced charset: %s\n", str ? str : "Auto-Detect");
2324 static void hide_read_messages (MainWindow *mainwin, guint action,
2327 if (!mainwin->summaryview->folder_item
2328 || gtk_object_get_data(GTK_OBJECT(widget), "dont_toggle"))
2330 summary_toggle_show_read_messages(mainwin->summaryview);
2333 static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2335 if (mainwin->menu_lock_count) return;
2336 if (!mainwin->summaryview->folder_item) return;
2338 if (GTK_CHECK_MENU_ITEM(widget)->active) {
2339 summary_thread_build(mainwin->summaryview);
2340 /* mainwin->summaryview->folder_item->threaded = TRUE; */
2342 summary_unthread(mainwin->summaryview);
2343 /* mainwin->summaryview->folder_item->threaded = FALSE; */
2347 static void expand_threads_cb(MainWindow *mainwin, guint action,
2350 summary_expand_threads(mainwin->summaryview);
2353 static void collapse_threads_cb(MainWindow *mainwin, guint action,
2356 summary_collapse_threads(mainwin->summaryview);
2359 static void set_display_item_cb(MainWindow *mainwin, guint action,
2362 prefs_summary_column_open();
2365 static void sort_summary_cb(MainWindow *mainwin, guint action,
2368 FolderItem *item = mainwin->summaryview->folder_item;
2369 GtkWidget *menuitem;
2371 if (mainwin->menu_lock_count) return;
2373 if (GTK_CHECK_MENU_ITEM(widget)->active && item) {
2374 menuitem = gtk_item_factory_get_item
2375 (mainwin->menu_factory, "/View/Sort/Ascending");
2376 summary_sort(mainwin->summaryview, (FolderSortKey)action,
2377 GTK_CHECK_MENU_ITEM(menuitem)->active
2378 ? SORT_ASCENDING : SORT_DESCENDING);
2382 static void sort_summary_type_cb(MainWindow *mainwin, guint action,
2385 FolderItem *item = mainwin->summaryview->folder_item;
2387 if (mainwin->menu_lock_count) return;
2389 if (GTK_CHECK_MENU_ITEM(widget)->active && item)
2390 summary_sort(mainwin->summaryview,
2391 item->sort_key, (FolderSortType)action);
2394 static void attract_by_subject_cb(MainWindow *mainwin, guint action,
2397 summary_attract_by_subject(mainwin->summaryview);
2400 static void delete_duplicated_cb(MainWindow *mainwin, guint action,
2403 summary_delete_duplicated(mainwin->summaryview);
2406 static void filter_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2408 summary_filter(mainwin->summaryview);
2411 static void execute_summary_cb(MainWindow *mainwin, guint action,
2414 summary_execute(mainwin->summaryview);
2417 static void update_summary_cb(MainWindow *mainwin, guint action,
2421 FolderView *folderview = mainwin->folderview;
2423 if (!mainwin->summaryview->folder_item) return;
2424 if (!folderview->opened) return;
2426 folder_update_op_count();
2428 fitem = gtk_ctree_node_get_row_data(GTK_CTREE(folderview->ctree),
2429 folderview->opened);
2432 folder_item_scan(fitem);
2433 summary_show(mainwin->summaryview, fitem);
2436 static void prev_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2438 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
2441 static void next_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2443 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
2446 static void prev_unread_cb(MainWindow *mainwin, guint action,
2449 summary_select_prev_unread(mainwin->summaryview);
2452 static void next_unread_cb(MainWindow *mainwin, guint action,
2455 summary_select_next_unread(mainwin->summaryview);
2458 static void prev_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2460 summary_select_prev_new(mainwin->summaryview);
2463 static void next_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2465 summary_select_next_new(mainwin->summaryview);
2468 static void prev_marked_cb(MainWindow *mainwin, guint action,
2471 summary_select_prev_marked(mainwin->summaryview);
2474 static void next_marked_cb(MainWindow *mainwin, guint action,
2477 summary_select_next_marked(mainwin->summaryview);
2480 static void prev_labeled_cb(MainWindow *mainwin, guint action,
2483 summary_select_prev_labeled(mainwin->summaryview);
2486 static void next_labeled_cb(MainWindow *mainwin, guint action,
2489 summary_select_next_labeled(mainwin->summaryview);
2492 static void goto_folder_cb(MainWindow *mainwin, guint action,
2495 FolderItem *to_folder;
2497 to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL);
2500 folderview_select(mainwin->folderview, to_folder);
2503 static void copy_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2505 messageview_copy_clipboard(mainwin->messageview);
2508 static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2510 MessageView *msgview = mainwin->messageview;
2512 if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->ctree))
2513 summary_select_all(mainwin->summaryview);
2514 else if (messageview_is_visible(msgview) &&
2515 (GTK_WIDGET_HAS_FOCUS(msgview->textview->text) ||
2516 GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text)))
2517 messageview_select_all(mainwin->messageview);
2520 static void select_thread_cb(MainWindow *mainwin, guint action,
2523 summary_select_thread(mainwin->summaryview);
2526 static void create_filter_cb(MainWindow *mainwin, guint action,
2529 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action);
2532 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
2535 prefs_common_open();
2538 static void prefs_scoring_open_cb(MainWindow *mainwin, guint action,
2541 prefs_scoring_open(NULL);
2544 static void prefs_filtering_open_cb(MainWindow *mainwin, guint action,
2547 prefs_filtering_open(NULL, NULL, NULL);
2550 static void prefs_template_open_cb(MainWindow *mainwin, guint action,
2553 prefs_template_open();
2556 static void prefs_actions_open_cb(MainWindow *mainwin, guint action,
2559 prefs_actions_open(mainwin);
2562 static void ssl_manager_open_cb(MainWindow *mainwin, guint action,
2565 ssl_manager_open(mainwin);
2568 static void prefs_account_open_cb(MainWindow *mainwin, guint action,
2572 new_account_cb(mainwin, 0, widget);
2574 account_open(cur_account);
2578 static void new_account_cb(MainWindow *mainwin, guint action,
2581 account_edit_open();
2582 if (!compose_get_compose_list()) account_add();
2585 static void account_menu_cb(GtkMenuItem *menuitem, gpointer data)
2587 cur_account = (PrefsAccount *)data;
2588 main_window_reflect_prefs_all();
2591 static void manual_open_cb(MainWindow *mainwin, guint action,
2594 manual_open((ManualType)action);
2597 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
2599 MainWindow *mainwin = (MainWindow *)data;
2603 str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
2604 LOCAL_FOLDER(folder)->rootpath,
2608 str = g_strdup_printf(_("Scanning folder %s ..."),
2609 LOCAL_FOLDER(folder)->rootpath);
2611 STATUSBAR_PUSH(mainwin, str);
2612 STATUSBAR_POP(mainwin);
2616 #define BREAK_ON_MODIFIER_KEY() \
2617 if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
2619 void mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
2622 MainWindow *mainwin = (MainWindow*) data;
2624 if (!mainwin || !event) return;
2626 switch (event->keyval) {
2627 case GDK_Q: /* Quit */
2628 BREAK_ON_MODIFIER_KEY();
2630 app_exit_cb(mainwin, 0, NULL);
2633 if (mainwin->folderview && mainwin->summaryview
2634 && !mainwin->summaryview->displayed) {
2635 summary_lock(mainwin->summaryview);
2636 folderview_select_next_unread(mainwin->folderview);
2637 summary_unlock(mainwin->summaryview);
2645 #undef BREAK_ON_MODIFIER_KEY
2648 * Harvest addresses for selected folder.
2650 static void addr_harvest_cb( MainWindow *mainwin,
2654 addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
2658 * Harvest addresses for selected messages in summary view.
2660 static void addr_harvest_msg_cb( MainWindow *mainwin,
2664 summary_harvest_address( mainwin->summaryview );