2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 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 <gtk/gtkmain.h>
24 #include <gtk/gtkwindow.h>
25 #include <gtk/gtkwidget.h>
26 #include <gtk/gtksignal.h>
27 #include <gtk/gtkvbox.h>
28 #include <gtk/gtkcontainer.h>
29 #include <gtk/gtkstatusbar.h>
30 #include <gtk/gtkhpaned.h>
31 #include <gtk/gtkvpaned.h>
32 #include <gtk/gtkcheckmenuitem.h>
33 #include <gtk/gtkitemfactory.h>
34 #include <gtk/gtkeditable.h>
35 #include <gtk/gtkmenu.h>
36 #include <gtk/gtkmenuitem.h>
37 #include <gtk/gtkhandlebox.h>
38 #include <gtk/gtktoolbar.h>
39 #include <gtk/gtkbutton.h>
44 #include "mainwindow.h"
45 #include "folderview.h"
46 #include "foldersel.h"
47 #include "summaryview.h"
48 #include "summary_search.h"
49 #include "messageview.h"
50 #include "headerview.h"
58 #include "prefs_common.h"
59 #include "prefs_filter.h"
60 #include "prefs_scoring.h"
61 #include "prefs_account.h"
62 #include "prefs_folder_item.h"
64 #include "addressbook.h"
65 #include "headerwindow.h"
66 #include "logwindow.h"
67 #include "manage_window.h"
68 #include "alertpanel.h"
69 #include "statusbar.h"
70 #include "inputdialog.h"
77 #define AC_LABEL_WIDTH 240
79 #define STATUSBAR_PUSH(mainwin, str) \
81 gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar), \
82 mainwin->mainwin_cid, str); \
83 gtkut_widget_wait_for_draw(mainwin->hbox_stat); \
86 #define STATUSBAR_POP(mainwin) \
88 gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar), \
89 mainwin->mainwin_cid); \
92 /* list of all instantiated MainWindow */
93 static GList *mainwin_list = NULL;
95 static GdkCursor *watch_cursor;
97 static void main_window_show_cur_account (MainWindow *mainwin);
99 static void main_window_set_widgets (MainWindow *mainwin,
101 static void main_window_toolbar_create (MainWindow *mainwin,
102 GtkWidget *container);
104 /* callback functions */
105 static void toolbar_inc_cb (GtkWidget *widget,
107 static void toolbar_inc_all_cb (GtkWidget *widget,
109 static void toolbar_send_cb (GtkWidget *widget,
112 static void toolbar_compose_cb (GtkWidget *widget,
114 static void toolbar_reply_cb (GtkWidget *widget,
116 static void toolbar_reply_to_all_cb (GtkWidget *widget,
118 static void toolbar_reply_to_author_cb (GtkWidget *widget,
120 static void toolbar_forward_cb (GtkWidget *widget,
123 static void toolbar_delete_cb (GtkWidget *widget,
125 static void toolbar_exec_cb (GtkWidget *widget,
128 static void toolbar_next_unread_cb (GtkWidget *widget,
131 static void toolbar_prefs_cb (GtkWidget *widget,
133 static void toolbar_account_cb (GtkWidget *widget,
136 static void toolbar_account_button_pressed (GtkWidget *widget,
137 GdkEventButton *event,
139 static void ac_label_button_pressed (GtkWidget *widget,
140 GdkEventButton *event,
143 static gint main_window_close_cb (GtkWidget *widget,
147 static void add_mailbox_cb (MainWindow *mainwin,
150 static void update_folderview_cb (MainWindow *mainwin,
153 static void new_folder_cb (MainWindow *mainwin,
156 static void rename_folder_cb (MainWindow *mainwin,
159 static void delete_folder_cb (MainWindow *mainwin,
162 static void import_mbox_cb (MainWindow *mainwin,
165 static void export_mbox_cb (MainWindow *mainwin,
168 static void empty_trash_cb (MainWindow *mainwin,
172 static void save_as_cb (MainWindow *mainwin,
175 static void print_cb (MainWindow *mainwin,
178 static void app_exit_cb (MainWindow *mainwin,
182 static void toggle_folder_cb (MainWindow *mainwin,
185 static void toggle_message_cb (MainWindow *mainwin,
188 static void toggle_toolbar_cb (MainWindow *mainwin,
191 static void toggle_statusbar_cb (MainWindow *mainwin,
195 static void separate_widget_cb(GtkCheckMenuItem *checkitem, guint action);
197 static void addressbook_open_cb (MainWindow *mainwin,
200 static void log_window_show_cb (MainWindow *mainwin,
204 static void inc_mail_cb (MainWindow *mainwin,
207 static void inc_all_account_mail_cb (MainWindow *mainwin,
211 static void send_queue_cb (MainWindow *mainwin,
215 static void compose_cb (MainWindow *mainwin,
218 static void reply_cb (MainWindow *mainwin,
222 static void open_msg_cb (MainWindow *mainwin,
226 static void view_source_cb (MainWindow *mainwin,
230 static void reedit_cb (MainWindow *mainwin,
234 static void move_to_cb (MainWindow *mainwin,
237 static void copy_to_cb (MainWindow *mainwin,
240 static void delete_cb (MainWindow *mainwin,
244 static void mark_cb (MainWindow *mainwin,
247 static void unmark_cb (MainWindow *mainwin,
251 static void mark_as_unread_cb (MainWindow *mainwin,
254 static void mark_as_read_cb (MainWindow *mainwin,
258 static void set_charset_cb (MainWindow *mainwin,
262 static void thread_cb (MainWindow *mainwin,
265 static void set_display_item_cb (MainWindow *mainwin,
268 static void sort_summary_cb (MainWindow *mainwin,
271 static void attract_by_subject_cb(MainWindow *mainwin,
275 static void delete_duplicated_cb (MainWindow *mainwin,
278 static void filter_cb (MainWindow *mainwin,
281 static void execute_summary_cb (MainWindow *mainwin,
284 static void update_summary_cb (MainWindow *mainwin,
288 static void prev_cb (MainWindow *mainwin,
291 static void next_cb (MainWindow *mainwin,
295 static void next_unread_cb (MainWindow *mainwin,
299 static void next_marked_cb (MainWindow *mainwin,
303 static void prev_marked_cb (MainWindow *mainwin,
307 static void goto_folder_cb (MainWindow *mainwin,
311 static void copy_cb (MainWindow *mainwin,
314 static void allsel_cb (MainWindow *mainwin,
318 static void prefs_common_open_cb (MainWindow *mainwin,
321 static void prefs_filter_open_cb (MainWindow *mainwin,
324 static void prefs_scoring_open_cb (MainWindow *mainwin,
327 static void prefs_filtering_open_cb (MainWindow *mainwin,
330 static void prefs_account_open_cb(MainWindow *mainwin,
333 static void new_account_cb (MainWindow *mainwin,
337 static void account_menu_cb (GtkMenuItem *menuitem,
340 static void manual_open_cb (MainWindow *mainwin,
344 static void scan_tree_func (Folder *folder,
348 #define SEPARATE_ACTION 667
350 static GtkItemFactoryEntry mainwin_entries[] =
352 {N_("/_File"), NULL, NULL, 0, "<Branch>"},
353 {N_("/_File/_Add mailbox..."), NULL, add_mailbox_cb, 0, NULL},
354 {N_("/_File/_Update folder tree"), NULL, update_folderview_cb, 0, NULL},
355 {N_("/_File/_Folder"), NULL, NULL, 0, "<Branch>"},
356 {N_("/_File/_Folder/Create _new folder..."),
357 NULL, new_folder_cb, 0, NULL},
358 {N_("/_File/_Folder/_Rename folder..."),NULL, rename_folder_cb, 0, NULL},
359 {N_("/_File/_Folder/_Delete folder"), NULL, delete_folder_cb, 0, NULL},
360 {N_("/_File/_Import mbox file..."), NULL, import_mbox_cb, 0, NULL},
361 {N_("/_File/_Export to mbox file..."), NULL, export_mbox_cb, 0, NULL},
362 {N_("/_File/Empty _trash"), NULL, empty_trash_cb, 0, NULL},
363 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
364 {N_("/_File/_Save as..."), NULL, save_as_cb, 0, NULL},
365 {N_("/_File/_Print..."), "<alt>P", print_cb, 0, NULL},
366 {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
367 {N_("/_File/_Close"), "<alt>W", app_exit_cb, 0, NULL},
368 {N_("/_File/E_xit"), "<alt>Q", app_exit_cb, 0, NULL},
370 {N_("/_Edit"), NULL, NULL, 0, "<Branch>"},
371 {N_("/_Edit/_Copy"), "<control>C", copy_cb, 0, NULL},
372 {N_("/_Edit/Select _all"), "<control>A", allsel_cb, 0, NULL},
373 {N_("/_Edit/---"), NULL, NULL, 0, "<Separator>"},
374 {N_("/_Edit/_Search"), "<control>S", summary_search_cb, 0, NULL},
376 {N_("/_View"), NULL, NULL, 0, "<Branch>"},
377 {N_("/_View/_Folder tree"), NULL, toggle_folder_cb, 0, "<ToggleItem>"},
378 {N_("/_View/_Message view"), NULL, toggle_message_cb, 0, "<ToggleItem>"},
379 {N_("/_View/_Toolbar"), NULL, NULL, 0, "<Branch>"},
380 {N_("/_View/_Toolbar/Icon _and text"), NULL, toggle_toolbar_cb, TOOLBAR_BOTH, "<RadioItem>"},
381 {N_("/_View/_Toolbar/_Icon"), NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Toolbar/Icon and text"},
382 {N_("/_View/_Toolbar/_Text"), NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Toolbar/Icon and text"},
383 {N_("/_View/_Toolbar/_Non-display"), NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Toolbar/Icon and text"},
384 {N_("/_View/_Status bar"), NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
385 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
386 {N_("/_View/Separate f_older tree"), NULL, NULL, SEPARATE_ACTION + SEPARATE_FOLDER, "<ToggleItem>"},
387 {N_("/_View/Separate m_essage view"), NULL, NULL, SEPARATE_ACTION + SEPARATE_MESSAGE, "<ToggleItem>"},
388 {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
389 {N_("/_View/_Code set"), NULL, NULL, 0, "<Branch>"},
390 {N_("/_View/_Code set/_Auto detect"),
391 NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
393 #define CODESET_SEPARATOR \
394 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"}
395 #define CODESET_ACTION(action) \
396 NULL, set_charset_cb, action, "/View/Code set/Auto detect"
398 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"},
399 {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
400 CODESET_ACTION(C_US_ASCII)},
403 {N_("/_View/_Code set/Unicode (_UTF-8)"),
404 CODESET_ACTION(C_UTF_8)},
407 {N_("/_View/_Code set/Western European (ISO-8859-_1)"),
408 CODESET_ACTION(C_ISO_8859_1)},
411 {N_("/_View/_Code set/Central European (ISO-8859-_2)"),
412 CODESET_ACTION(C_ISO_8859_2)},
414 {N_("/_View/_Code set/_Baltic (ISO-8859-13)"),
415 CODESET_ACTION(C_ISO_8859_13)},
416 {N_("/_View/_Code set/Baltic (ISO-8859-_4)"),
417 CODESET_ACTION(C_ISO_8859_4)},
419 {N_("/_View/_Code set/Greek (ISO-8859-_7)"),
420 CODESET_ACTION(C_ISO_8859_7)},
422 {N_("/_View/_Code set/Turkish (ISO-8859-_9)"),
423 CODESET_ACTION(C_ISO_8859_9)},
425 {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"),
426 CODESET_ACTION(C_ISO_8859_5)},
427 {N_("/_View/_Code set/Cyrillic (KOI8-_R)"),
428 CODESET_ACTION(C_KOI8_R)},
429 {N_("/_View/_Code set/Cyrillic (Windows-1251)"),
430 CODESET_ACTION(C_CP1251)},
433 {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
434 CODESET_ACTION(C_ISO_2022_JP)},
436 {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
437 CODESET_ACTION(C_ISO_2022_JP_2)},
439 {N_("/_View/_Code set/Japanese (_EUC-JP)"),
440 CODESET_ACTION(C_EUC_JP)},
441 {N_("/_View/_Code set/Japanese (_Shift__JIS)"),
442 CODESET_ACTION(C_SHIFT_JIS)},
445 {N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
446 CODESET_ACTION(C_GB2312)},
447 {N_("/_View/_Code set/Traditional Chinese (_Big5)"),
448 CODESET_ACTION(C_BIG5)},
449 {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"),
450 CODESET_ACTION(C_EUC_TW)},
451 {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"),
452 CODESET_ACTION(C_ISO_2022_CN)},
454 {N_("/_View/_Code set/Korean (EUC-_KR)"),
455 CODESET_ACTION(C_EUC_KR)},
456 {N_("/_View/_Code set/Korean (ISO-2022-KR)"),
457 CODESET_ACTION(C_ISO_2022_KR)},
460 #undef CODESET_SEPARATOR
461 #undef CODESET_ACTION
463 {N_("/_Message"), NULL, NULL, 0, "<Branch>"},
464 {N_("/_Message/Rece_ive new mail"), "<alt>I", inc_mail_cb, 0, NULL},
465 {N_("/_Message/Receive from _all accounts"),
466 "<shift><alt>I", inc_all_account_mail_cb, 0, NULL},
467 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
468 {N_("/_Message/Send queued messa_ges"),
469 NULL, send_queue_cb, 0, NULL},
470 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
471 {N_("/_Message/Compose _new message"), "<alt>N", compose_cb, 0, NULL},
472 {N_("/_Message/_Reply"), "<alt>R", reply_cb, COMPOSE_REPLY, NULL},
473 {N_("/_Message/Reply to a_ll"), "<shift><alt>R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
474 {N_("/_Message/Reply to author"), NULL, reply_cb, COMPOSE_REPLY_TO_AUTHOR, NULL},
475 {N_("/_Message/_Forward"), "<control>F", reply_cb, COMPOSE_FORWARD, NULL},
476 {N_("/_Message/Forward as an a_ttachment"),
477 "<shift><control>F", reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL},
478 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
479 {N_("/_Message/M_ove..."), "<alt>O", move_to_cb, 0, NULL},
480 {N_("/_Message/_Copy..."), NULL, copy_to_cb, 0, NULL},
481 {N_("/_Message/_Delete"), "<alt>D", delete_cb, 0, NULL},
482 {N_("/_Message/_Mark"), NULL, NULL, 0, "<Branch>"},
483 {N_("/_Message/_Mark/_Mark"), NULL, mark_cb, 0, NULL},
484 {N_("/_Message/_Mark/_Unmark"), NULL, unmark_cb, 0, NULL},
485 {N_("/_Message/_Mark/---"), NULL, NULL, 0, "<Separator>"},
486 {N_("/_Message/_Mark/Mark as unr_ead"), NULL, mark_as_unread_cb, 0, NULL},
487 {N_("/_Message/_Mark/Mark it as _being read"),
488 NULL, mark_as_read_cb, 0, NULL},
489 {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
490 {N_("/_Message/Open in new _window"), "<shift><control>N", open_msg_cb, 0, NULL},
491 {N_("/_Message/View _source"), "<control>U", view_source_cb, 0, NULL},
492 {N_("/_Message/Show all _header"), "<control>H", header_window_show_cb, 0, NULL},
493 {N_("/_Message/Re_edit"), NULL, reedit_cb, 0, NULL},
495 {N_("/_Summary"), NULL, NULL, 0, "<Branch>"},
496 {N_("/_Summary/_Delete duplicated messages"),
497 NULL, delete_duplicated_cb, 0, NULL},
498 {N_("/_Summary/_Filter messages"), NULL, filter_cb, 0, NULL},
499 {N_("/_Summary/E_xecute"), "<alt>X", execute_summary_cb, 0, NULL},
500 {N_("/_Summary/_Update"), "<alt>U", update_summary_cb, 0, NULL},
501 {N_("/_Summary/---"), NULL, NULL, 0, "<Separator>"},
502 {N_("/_Summary/_Prev message"), NULL, prev_cb, 0, NULL},
503 {N_("/_Summary/_Next message"), NULL, next_cb, 0, NULL},
504 {N_("/_Summary/N_ext unread message"), NULL, next_unread_cb, 0, NULL},
505 {N_("/_Summary/Prev marked message"), NULL, prev_marked_cb, 0, NULL},
506 {N_("/_Summary/Next marked message"), NULL, next_marked_cb, 0, NULL},
507 {N_("/_Summary/---"), NULL, NULL, 0, "<Separator>"},
508 {N_("/_Summary/_Go to other folder"), "<alt>G", goto_folder_cb, 0, NULL},
509 {N_("/_Summary/---"), NULL, NULL, 0, "<Separator>"},
510 {N_("/_Summary/_Sort"), NULL, NULL, 0, "<Branch>"},
511 {N_("/_Summary/_Sort/Sort by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, NULL},
512 {N_("/_Summary/_Sort/Sort by s_ize"), NULL, sort_summary_cb, SORT_BY_SIZE, NULL},
513 {N_("/_Summary/_Sort/Sort by _date"), NULL, sort_summary_cb, SORT_BY_DATE, NULL},
514 {N_("/_Summary/_Sort/Sort by _from"), NULL, sort_summary_cb, SORT_BY_FROM, NULL},
515 {N_("/_Summary/_Sort/Sort by _subject"),NULL, sort_summary_cb, SORT_BY_SUBJECT, NULL},
516 {N_("/_Summary/_Sort/Sort by sco_re"), NULL, sort_summary_cb, SORT_BY_SCORE, NULL},
517 {N_("/_Summary/_Sort/---"), NULL, NULL, 0, "<Separator>"},
518 {N_("/_Summary/_Sort/_Attract by subject"),
519 NULL, attract_by_subject_cb, 0, NULL},
520 {N_("/_Summary/_Thread view"), "<control>T", thread_cb, 0, NULL},
521 {N_("/_Summary/Unt_hread view"), "<shift><control>T", thread_cb, 1, NULL},
522 {N_("/_Summary/Set display _item..."), NULL, set_display_item_cb, 0, NULL},
524 {N_("/_Tool"), NULL, NULL, 0, "<Branch>"},
525 {N_("/_Tool/_Address book"), "<alt>A", addressbook_open_cb, 0, NULL},
526 {N_("/_Tool/_Log window"), "<alt>L", log_window_show_cb, 0, NULL},
528 {N_("/_Configuration"), NULL, NULL, 0, "<Branch>"},
529 {N_("/_Configuration/_Common preferences..."),
530 NULL, prefs_common_open_cb, 0, NULL},
531 {N_("/_Configuration/_Filter setting..."),
532 NULL, prefs_filter_open_cb, 0, NULL},
533 {N_("/_Configuration/_Scoring ..."),
534 NULL, prefs_scoring_open_cb, 0, NULL},
535 {N_("/_Configuration/_Filtering ..."),
536 NULL, prefs_filtering_open_cb, 0, NULL},
537 {N_("/_Configuration/_Preferences per account..."),
538 NULL, prefs_account_open_cb, 0, NULL},
539 {N_("/_Configuration/---"), NULL, NULL, 0, "<Separator>"},
540 {N_("/_Configuration/Create _new account..."),
541 NULL, new_account_cb, 0, NULL},
542 {N_("/_Configuration/_Edit accounts..."),
543 NULL, account_edit_open, 0, NULL},
544 {N_("/_Configuration/C_hange current account"),
545 NULL, NULL, 0, "<Branch>"},
547 {N_("/_Help"), NULL, NULL, 0, "<LastBranch>"},
548 {N_("/_Help/_Manual"), NULL, NULL, 0, "<Branch>"},
549 {N_("/_Help/_Manual/_English"), NULL, NULL, MANUAL_LANG_EN, NULL},
550 {N_("/_Help/_Manual/_Japanese"), NULL, manual_open_cb, MANUAL_LANG_JA, NULL},
551 {N_("/_Help/---"), NULL, NULL, 0, "<Separator>"},
552 {N_("/_Help/_About"), NULL, about_show, 0, NULL}
555 MainWindow *main_window_create(SeparateType type)
561 GtkWidget *handlebox;
562 GtkWidget *vbox_body;
563 GtkWidget *hbox_stat;
564 GtkWidget *statusbar;
565 GtkWidget *ac_button;
568 FolderView *folderview;
569 SummaryView *summaryview;
570 MessageView *messageview;
571 GdkColormap *colormap;
574 guint n_menu_entries;
575 GtkItemFactory *ifactory;
580 debug_print(_("Creating main window...\n"));
581 mainwin = g_new0(MainWindow, 1);
584 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
585 gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
586 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
587 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
588 GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
589 gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
590 GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
591 gtk_signal_connect(GTK_OBJECT(window), "focus_out_event",
592 GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
593 gtk_widget_realize(window);
595 vbox = gtk_vbox_new(FALSE, 0);
596 gtk_widget_show(vbox);
597 gtk_container_add(GTK_CONTAINER(window), vbox);
600 n_menu_entries = sizeof(mainwin_entries) / sizeof(mainwin_entries[0]);
601 menubar = menubar_create(window, mainwin_entries,
602 n_menu_entries, "<Main>", mainwin);
604 gtk_widget_show(menubar);
605 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
607 handlebox = gtk_handle_box_new();
608 gtk_widget_show(handlebox);
609 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
611 main_window_toolbar_create(mainwin, handlebox);
613 /* vbox that contains body */
614 vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH);
615 gtk_widget_show(vbox_body);
616 gtk_container_set_border_width(GTK_CONTAINER(vbox_body), BORDER_WIDTH);
617 gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
619 hbox_stat = gtk_hbox_new(FALSE, 2);
620 gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
622 statusbar = statusbar_create();
623 gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
625 ac_button = gtk_button_new();
626 gtk_button_set_relief(GTK_BUTTON(ac_button), GTK_RELIEF_NONE);
627 GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
628 gtk_widget_set_usize(ac_button, -1, 1);
629 gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
630 gtk_signal_connect(GTK_OBJECT(ac_button), "button_press_event",
631 GTK_SIGNAL_FUNC(ac_label_button_pressed), mainwin);
633 ac_label = gtk_label_new("");
634 gtk_container_add(GTK_CONTAINER(ac_button), ac_label);
636 gtk_widget_show_all(hbox_stat);
639 mainwin->folderview = folderview = folderview_create();
640 mainwin->summaryview = summaryview = summary_create();
641 mainwin->messageview = messageview = messageview_create();
642 mainwin->headerwin = header_window_create();
643 mainwin->logwin = log_window_create();
645 folderview->mainwin = mainwin;
646 folderview->summaryview = summaryview;
648 summaryview->mainwin = mainwin;
649 summaryview->folderview = folderview;
650 summaryview->messageview = messageview;
651 summaryview->headerwin = mainwin->headerwin;
652 summaryview->window = window;
654 messageview->mainwin = mainwin;
656 mainwin->window = window;
657 mainwin->vbox = vbox;
658 mainwin->menubar = menubar;
659 mainwin->handlebox = handlebox;
660 mainwin->vbox_body = vbox_body;
661 mainwin->hbox_stat = hbox_stat;
662 mainwin->statusbar = statusbar;
663 mainwin->ac_button = ac_button;
664 mainwin->ac_label = ac_label;
666 /* set context IDs for status bar */
667 mainwin->mainwin_cid = gtk_statusbar_get_context_id
668 (GTK_STATUSBAR(statusbar), "Main Window");
669 mainwin->folderview_cid = gtk_statusbar_get_context_id
670 (GTK_STATUSBAR(statusbar), "Folder View");
671 mainwin->summaryview_cid = gtk_statusbar_get_context_id
672 (GTK_STATUSBAR(statusbar), "Summary View");
674 /* allocate colors for summary view and folder view */
675 summaryview->color_marked.red = summaryview->color_marked.green = 0;
676 summaryview->color_marked.blue = (guint16)65535;
678 summaryview->color_dim.red = summaryview->color_dim.green =
679 summaryview->color_dim.blue = COLOR_DIM;
681 summaryview->color_normal.red = summaryview->color_normal.green =
682 summaryview->color_normal.blue = 0;
684 folderview->color_new.red = (guint16)55000;
685 folderview->color_new.green = folderview->color_new.blue = 15000;
687 folderview->color_normal.red = folderview->color_normal.green =
688 folderview->color_normal.blue = 0;
690 color[0] = summaryview->color_marked;
691 color[1] = summaryview->color_dim;
692 color[2] = summaryview->color_normal;
693 color[3] = folderview->color_new;
694 color[4] = folderview->color_normal;
696 colormap = gdk_window_get_colormap(window->window);
697 gdk_colormap_alloc_colors(colormap, color, 5, FALSE, TRUE, success);
698 for (i = 0; i < 5; i++) {
699 if (success[i] == FALSE)
700 g_warning(_("MainWindow: color allocation %d failed\n"), i);
703 debug_print(_("done.\n"));
705 main_window_set_widgets(mainwin, type);
708 ifactory = gtk_item_factory_from_widget(menubar);
709 menuitem = gtk_item_factory_get_item
710 (ifactory, "/View/Code set/Auto detect");
711 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
713 switch (prefs_common.toolbar_style) {
715 menuitem = gtk_item_factory_get_item
716 (ifactory, "/View/Toolbar/Non-display");
719 menuitem = gtk_item_factory_get_item
720 (ifactory, "/View/Toolbar/Icon");
723 menuitem = gtk_item_factory_get_item
724 (ifactory, "/View/Toolbar/Text");
727 menuitem = gtk_item_factory_get_item
728 (ifactory, "/View/Toolbar/Icon and text");
730 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
732 gtk_widget_hide(mainwin->hbox_stat);
733 menuitem = gtk_item_factory_get_item(ifactory, "/View/Status bar");
734 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
735 prefs_common.show_statusbar);
737 /* set the check of the SEPARATE_xxx menu items. we also need the main window
738 * as a property and pass the action type to the callback */
739 menuitem = gtk_item_factory_get_widget_by_action(ifactory, SEPARATE_ACTION + SEPARATE_FOLDER);
741 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), type & SEPARATE_FOLDER);
742 gtk_object_set_data(GTK_OBJECT(menuitem), "mainwindow", mainwin);
743 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(separate_widget_cb),
744 GUINT_TO_POINTER(SEPARATE_FOLDER));
746 menuitem = gtk_item_factory_get_widget_by_action(ifactory, SEPARATE_ACTION + SEPARATE_MESSAGE);
748 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), type & SEPARATE_MESSAGE);
749 gtk_object_set_data(GTK_OBJECT(menuitem), "mainwindow", mainwin);
750 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(separate_widget_cb),
751 GUINT_TO_POINTER(SEPARATE_MESSAGE));
753 menu_set_sensitive(ifactory, "/Summary/Thread view",
754 prefs_common.enable_thread ? FALSE : TRUE);
755 menu_set_sensitive(ifactory, "/Summary/Unthread view",
756 prefs_common.enable_thread ? TRUE : FALSE);
757 menu_set_sensitive(ifactory, "/Help/Manual/English", FALSE);
759 /* set account selection menu */
760 ac_menu = gtk_item_factory_get_widget
761 (ifactory, "/Configuration/Change current account");
762 mainwin->ac_menu = ac_menu;
764 main_window_set_toolbar_sensitive(mainwin, FALSE);
766 /* show main window */
767 gtk_widget_set_uposition(mainwin->window,
768 prefs_common.mainwin_x,
769 prefs_common.mainwin_y);
770 gtk_widget_set_usize(window, prefs_common.mainwin_width,
771 prefs_common.mainwin_height);
772 gtk_widget_show(mainwin->window);
774 /* initialize views */
775 folderview_init(folderview);
776 summary_init(summaryview);
777 messageview_init(messageview);
778 header_window_init(mainwin->headerwin);
779 log_window_init(mainwin->logwin);
781 mainwin->cursor_count = 0;
784 watch_cursor = gdk_cursor_new(GDK_WATCH);
786 mainwin_list = g_list_append(mainwin_list, mainwin);
791 void main_window_cursor_wait(MainWindow *mainwin)
793 if (mainwin->cursor_count == 0)
794 gdk_window_set_cursor(mainwin->window->window, watch_cursor);
796 mainwin->cursor_count++;
801 void main_window_cursor_normal(MainWindow *mainwin)
803 if (mainwin->cursor_count)
804 mainwin->cursor_count--;
806 if (mainwin->cursor_count == 0)
807 gdk_window_set_cursor(mainwin->window->window, NULL);
812 void main_window_reflect_prefs_all(void)
817 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
818 mainwin = (MainWindow *)cur->data;
820 main_window_show_cur_account(mainwin);
822 gtk_widget_set_sensitive(mainwin->get_btn, TRUE);
823 gtk_widget_set_sensitive(mainwin->getall_btn, TRUE);
825 gtk_widget_set_sensitive(mainwin->get_btn, FALSE);
826 gtk_widget_set_sensitive(mainwin->getall_btn, FALSE);
828 if (prefs_common.immediate_exec)
829 gtk_widget_hide(mainwin->exec_btn);
831 gtk_widget_show(mainwin->exec_btn);
833 summary_change_display_item(mainwin->summaryview);
834 summary_redisplay_msg(mainwin->summaryview);
835 headerview_set_visibility(mainwin->messageview->headerview,
836 prefs_common.display_header_pane);
840 void main_window_set_account_menu(GList *account_list)
842 GList *cur, *cur_ac, *cur_item;
845 PrefsAccount *ac_prefs;
847 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
848 mainwin = (MainWindow *)cur->data;
850 /* destroy all previous menu item */
851 cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children;
852 while (cur_item != NULL) {
853 GList *next = cur_item->next;
854 gtk_widget_destroy(GTK_WIDGET(cur_item->data));
858 for (cur_ac = account_list; cur_ac != NULL;
859 cur_ac = cur_ac->next) {
860 ac_prefs = (PrefsAccount *)cur_ac->data;
862 menuitem = gtk_menu_item_new_with_label
863 (ac_prefs->account_name
864 ? ac_prefs->account_name : _("Untitled"));
865 gtk_widget_show(menuitem);
866 gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem);
867 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
868 GTK_SIGNAL_FUNC(account_menu_cb),
874 static void main_window_show_cur_account(MainWindow *mainwin)
879 ac_name = g_strdup(cur_account
880 ? (cur_account->account_name
881 ? cur_account->account_name : _("Untitled"))
885 buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
887 buf = g_strdup(PROG_VERSION);
888 gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
891 buf = g_strdup_printf(_("Current account: %s"), ac_name);
892 gtk_label_set_text(GTK_LABEL(mainwin->ac_label), buf);
893 gtk_widget_queue_resize(mainwin->ac_button);
899 void main_window_separation_change(MainWindow *mainwin, SeparateType type)
901 GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview);
902 GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview);
903 GtkWidget *message_wid = GTK_WIDGET_PTR(mainwin->messageview);
905 if (mainwin->type == type) return;
907 /* remove widgets from those containers */
908 gtk_widget_ref(folder_wid);
909 gtk_widget_ref(summary_wid);
910 gtk_widget_ref(message_wid);
912 (GTK_CONTAINER(folder_wid->parent), folder_wid);
914 (GTK_CONTAINER(summary_wid->parent), summary_wid);
916 (GTK_CONTAINER(message_wid->parent), message_wid);
918 /* clean containers */
919 switch (mainwin->type) {
921 gtk_widget_destroy(mainwin->win.sep_none.hpaned);
923 case SEPARATE_FOLDER:
924 gtk_widget_destroy(mainwin->win.sep_folder.vpaned);
925 gtk_widget_destroy(mainwin->win.sep_folder.folderwin);
927 case SEPARATE_MESSAGE:
928 gtk_widget_destroy(mainwin->win.sep_message.hpaned);
929 gtk_widget_destroy(mainwin->win.sep_message.messagewin);
932 gtk_widget_destroy(mainwin->win.sep_both.messagewin);
933 gtk_widget_destroy(mainwin->win.sep_both.folderwin);
937 gtk_widget_hide(mainwin->window);
938 main_window_set_widgets(mainwin, type);
939 gtk_widget_show(mainwin->window);
941 gtk_widget_unref(folder_wid);
942 gtk_widget_unref(summary_wid);
943 gtk_widget_unref(message_wid);
946 void main_window_get_size(MainWindow *mainwin)
948 GtkAllocation *allocation;
950 allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
952 prefs_common.summaryview_width = allocation->width;
954 if (mainwin->summaryview->msg_is_toggled_on)
955 prefs_common.summaryview_height = allocation->height;
957 prefs_common.mainview_width = allocation->width;
959 allocation = &mainwin->window->allocation;
961 prefs_common.mainview_height = allocation->height;
962 prefs_common.mainwin_width = allocation->width;
963 prefs_common.mainwin_height = allocation->height;
965 allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
967 prefs_common.folderview_width = allocation->width;
968 prefs_common.folderview_height = allocation->height;
971 void main_window_get_position(MainWindow *mainwin)
975 gtkut_widget_get_uposition(mainwin->window, &x, &y);
977 prefs_common.mainview_x = x;
978 prefs_common.mainview_y = y;
979 prefs_common.mainwin_x = x;
980 prefs_common.mainwin_y = y;
982 debug_print(_("window position: x = %d, y = %d\n"), x, y);
985 void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
990 if (alertpanel(_("Empty trash"),
991 _("Empty all messages in trash?"),
992 _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
994 manage_window_focus_in(mainwin->window, NULL, NULL);
997 procmsg_empty_trash();
999 for (list = folder_get_list(); list != NULL; list = list->next) {
1002 folder = list->data;
1003 if (folder->trash) {
1004 folder_item_scan(folder->trash);
1005 folderview_update_item(folder->trash, TRUE);
1009 if (mainwin->summaryview->folder_item &&
1010 mainwin->summaryview->folder_item->stype == F_TRASH)
1011 gtk_widget_grab_focus(mainwin->folderview->ctree);
1014 void main_window_add_mailbox(MainWindow *mainwin)
1019 path = input_dialog(_("Add mailbox"),
1020 _("Input the location of mailbox.\n"
1021 "If the existing mailbox is specified, it will be\n"
1022 "scanned automatically."),
1025 if (folder_find_from_path(path)) {
1026 alertpanel_error(_("The mailbox `%s' already exists."), path);
1030 if (!strcmp(path, "Mail"))
1031 folder = folder_new(F_MH, _("Mailbox"), path);
1033 folder = folder_new(F_MH, g_basename(path), path);
1036 if (folder->create_tree(folder) < 0) {
1037 alertpanel_error(_("Creation of the mailbox failed.\n"
1038 "Maybe some files already exist, or you don't have the permission to write there."));
1039 folder_destroy(folder);
1044 folder_set_ui_func(folder, scan_tree_func, mainwin);
1045 folder->scan_tree(folder);
1046 folder_set_ui_func(folder, NULL, NULL);
1048 folderview_set(mainwin->folderview);
1051 void main_window_set_toolbar_sensitive(MainWindow *mainwin, gboolean sensitive)
1053 gtk_widget_set_sensitive(mainwin->reply_btn, sensitive);
1054 gtk_widget_set_sensitive(mainwin->replyall_btn, sensitive);
1055 gtk_widget_set_sensitive(mainwin->replyauthor_btn, sensitive);
1056 gtk_widget_set_sensitive(mainwin->fwd_btn, sensitive);
1057 gtk_widget_set_sensitive(mainwin->exec_btn, sensitive);
1058 gtk_widget_set_sensitive(mainwin->next_btn, sensitive);
1060 if (!mainwin->summaryview->folder_item ||
1061 mainwin->summaryview->folder_item->folder->type == F_NEWS)
1062 gtk_widget_set_sensitive(mainwin->delete_btn, FALSE);
1064 gtk_widget_set_sensitive(mainwin->delete_btn, sensitive);
1067 void main_window_set_menu_sensitive(MainWindow *mainwin, gint selection)
1069 GtkItemFactory *ifactory;
1073 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
1075 if (selection == SUMMARY_SELECTED_SINGLE)
1079 if (!mainwin->summaryview->folder_item ||
1080 mainwin->summaryview->folder_item->folder->type == F_NEWS)
1085 menu_set_sensitive(ifactory, "/File/Save as...", sens);
1086 menu_set_sensitive(ifactory, "/Message/Reply", sens);
1087 menu_set_sensitive(ifactory, "/Message/Reply to all", sens);
1088 menu_set_sensitive(ifactory, "/Message/Reply to author", sens);
1089 menu_set_sensitive(ifactory, "/Message/Forward", sens);
1090 menu_set_sensitive(ifactory, "/Message/Forward as an attachment", sens);
1091 menu_set_sensitive(ifactory, "/Message/Open in new window", sens);
1092 menu_set_sensitive(ifactory, "/Message/Show all header", sens);
1093 menu_set_sensitive(ifactory, "/Message/View source", sens);
1094 if (sens && (!mainwin->summaryview->folder_item ||
1095 mainwin->summaryview->folder_item->stype != F_DRAFT))
1097 menu_set_sensitive(ifactory, "/Message/Reedit", sens);
1099 if (selection == SUMMARY_SELECTED_SINGLE ||
1100 selection == SUMMARY_SELECTED_MULTIPLE)
1105 menu_set_sensitive(ifactory, "/File/Print..." , sens);
1106 menu_set_sensitive(ifactory, "/Message/Move...", sens && exec);
1107 menu_set_sensitive(ifactory, "/Message/Copy...", sens && exec);
1108 menu_set_sensitive(ifactory, "/Message/Delete" , sens && exec);
1109 menu_set_sensitive(ifactory, "/Message/Mark" , sens);
1111 if (selection != SUMMARY_NONE)
1116 menu_set_sensitive(ifactory, "/Summary/Delete duplicated messages", sens && exec);
1117 menu_set_sensitive(ifactory, "/Summary/Filter messages", sens && exec);
1118 menu_set_sensitive(ifactory, "/Summary/Execute", sens);
1119 menu_set_sensitive(ifactory, "/Summary/Prev message", sens);
1120 menu_set_sensitive(ifactory, "/Summary/Next message", sens);
1121 menu_set_sensitive(ifactory, "/Summary/Next unread message", sens);
1122 menu_set_sensitive(ifactory, "/Summary/Sort", sens);
1125 void main_window_popup(MainWindow *mainwin)
1131 gdk_window_get_origin(mainwin->window->window, &x, &y);
1132 sx = gdk_screen_width();
1133 sy = gdk_screen_height();
1134 x %= sx; if (x < 0) x += sx;
1135 y %= sy; if (y < 0) y += sy;
1136 gdk_window_move(mainwin->window->window, x, y);
1137 gdk_window_raise(mainwin->window->window);
1139 debug_print("window position: x = %d, y = %d\n", x, y);
1141 switch (mainwin->type) {
1142 case SEPARATE_FOLDER:
1143 widget = mainwin->win.sep_folder.folderwin;
1144 gdk_window_get_origin(widget->window, &x, &y);
1145 x %= sx; if (x < 0) x += sx;
1146 y %= sy; if (y < 0) y += sy;
1147 gdk_window_move(widget->window, x, y);
1148 gdk_window_raise(widget->window);
1150 case SEPARATE_MESSAGE:
1151 widget = mainwin->win.sep_message.messagewin;
1152 gdk_window_get_origin(widget->window, &x, &y);
1153 x %= sx; if (x < 0) x += sx;
1154 y %= sy; if (y < 0) y += sy;
1155 gdk_window_move(widget->window, x, y);
1156 gdk_window_raise(widget->window);
1159 widget = mainwin->win.sep_both.folderwin;
1160 gdk_window_get_origin(widget->window, &x, &y);
1161 x %= sx; if (x < 0) x += sx;
1162 y %= sy; if (y < 0) y += sy;
1163 gdk_window_move(widget->window, x, y);
1164 gdk_window_raise(widget->window);
1165 widget = mainwin->win.sep_both.messagewin;
1166 gdk_window_get_origin(widget->window, &x, &y);
1167 x %= sx; if (x < 0) x += sx;
1168 y %= sy; if (y < 0) y += sy;
1169 gdk_window_move(widget->window, x, y);
1170 gdk_window_raise(widget->window);
1176 static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
1178 GtkWidget *folderwin = NULL;
1179 GtkWidget *messagewin = NULL;
1182 GtkWidget *vbox_body = mainwin->vbox_body;
1184 debug_print(_("Setting widgets..."));
1186 /* create separated window(s) if needed */
1187 if (type & SEPARATE_FOLDER) {
1188 folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1189 gtk_window_set_policy(GTK_WINDOW(folderwin),
1191 gtk_widget_set_usize(folderwin, -1,
1192 prefs_common.mainview_height);
1193 gtk_container_set_border_width(GTK_CONTAINER(folderwin),
1195 gtk_signal_connect(GTK_OBJECT(folderwin), "delete_event",
1196 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
1199 if (type & SEPARATE_MESSAGE) {
1200 messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1201 gtk_window_set_policy(GTK_WINDOW(messagewin),
1203 gtk_widget_set_usize
1204 (messagewin, prefs_common.mainview_width,
1205 prefs_common.mainview_height
1206 - prefs_common.summaryview_height
1207 + DEFAULT_HEADERVIEW_HEIGHT);
1208 gtk_container_set_border_width(GTK_CONTAINER(messagewin),
1210 gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
1211 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
1217 hpaned = gtk_hpaned_new();
1218 gtk_widget_show(hpaned);
1219 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1220 gtk_paned_add1(GTK_PANED(hpaned),
1221 GTK_WIDGET_PTR(mainwin->folderview));
1223 vpaned = gtk_vpaned_new();
1224 if (mainwin->summaryview->msg_is_toggled_on) {
1225 gtk_paned_add2(GTK_PANED(hpaned), vpaned);
1226 gtk_paned_add1(GTK_PANED(vpaned),
1227 GTK_WIDGET_PTR(mainwin->summaryview));
1229 gtk_paned_add2(GTK_PANED(hpaned),
1230 GTK_WIDGET_PTR(mainwin->summaryview));
1231 gtk_widget_ref(vpaned);
1233 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1234 prefs_common.summaryview_width,
1235 prefs_common.summaryview_height);
1236 gtk_paned_add2(GTK_PANED(vpaned),
1237 GTK_WIDGET_PTR(mainwin->messageview));
1238 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1239 prefs_common.mainview_width, -1);
1240 gtk_widget_set_usize(mainwin->window,
1241 prefs_common.folderview_width +
1242 prefs_common.mainview_width,
1243 prefs_common.mainwin_height);
1244 gtk_widget_show_all(vpaned);
1246 mainwin->win.sep_none.hpaned = hpaned;
1247 mainwin->win.sep_none.vpaned = vpaned;
1249 case SEPARATE_FOLDER:
1250 vpaned = gtk_vpaned_new();
1251 if (mainwin->summaryview->msg_is_toggled_on) {
1252 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned,
1254 gtk_paned_add1(GTK_PANED(vpaned),
1255 GTK_WIDGET_PTR(mainwin->summaryview));
1257 gtk_box_pack_start(GTK_BOX(vbox_body),
1258 GTK_WIDGET_PTR(mainwin->summaryview),
1260 gtk_widget_ref(vpaned);
1262 gtk_paned_add2(GTK_PANED(vpaned),
1263 GTK_WIDGET_PTR(mainwin->messageview));
1264 gtk_widget_show_all(vpaned);
1265 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1266 prefs_common.summaryview_width,
1267 prefs_common.summaryview_height);
1268 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
1269 prefs_common.mainview_width, -1);
1270 gtk_widget_set_usize(mainwin->window,
1271 prefs_common.mainview_width,
1272 prefs_common.mainview_height);
1274 gtk_container_add(GTK_CONTAINER(folderwin),
1275 GTK_WIDGET_PTR(mainwin->folderview));
1277 mainwin->win.sep_folder.folderwin = folderwin;
1278 mainwin->win.sep_folder.vpaned = vpaned;
1280 gtk_widget_show_all(folderwin);
1282 case SEPARATE_MESSAGE:
1283 hpaned = gtk_hpaned_new();
1284 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
1286 gtk_paned_add1(GTK_PANED(hpaned),
1287 GTK_WIDGET_PTR(mainwin->folderview));
1288 gtk_paned_add2(GTK_PANED(hpaned),
1289 GTK_WIDGET_PTR(mainwin->summaryview));
1290 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1291 prefs_common.summaryview_width,
1292 prefs_common.summaryview_height);
1293 gtk_widget_set_usize(mainwin->window,
1294 prefs_common.folderview_width +
1295 prefs_common.mainview_width,
1296 prefs_common.mainwin_height);
1297 gtk_widget_show_all(hpaned);
1298 gtk_container_add(GTK_CONTAINER(messagewin),
1299 GTK_WIDGET_PTR(mainwin->messageview));
1301 mainwin->win.sep_message.messagewin = messagewin;
1302 mainwin->win.sep_message.hpaned = hpaned;
1304 gtk_widget_show_all(messagewin);
1307 gtk_box_pack_start(GTK_BOX(vbox_body),
1308 GTK_WIDGET_PTR(mainwin->summaryview),
1310 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
1311 prefs_common.summaryview_width,
1312 prefs_common.summaryview_height);
1313 gtk_widget_set_usize(mainwin->window,
1314 prefs_common.mainview_width,
1315 prefs_common.mainwin_height);
1316 gtk_container_add(GTK_CONTAINER(folderwin),
1317 GTK_WIDGET_PTR(mainwin->folderview));
1318 gtk_container_add(GTK_CONTAINER(messagewin),
1319 GTK_WIDGET_PTR(mainwin->messageview));
1321 mainwin->win.sep_both.folderwin = folderwin;
1322 mainwin->win.sep_both.messagewin = messagewin;
1324 gtk_widget_show_all(folderwin);
1325 gtk_widget_show_all(messagewin);
1329 mainwin->type = type;
1331 debug_print(_("done.\n"));
1334 #include "pixmaps/stock_mail_receive.xpm"
1335 #include "pixmaps/stock_mail_receive_all.xpm"
1336 #include "pixmaps/stock_mail_compose.xpm"
1337 #include "pixmaps/stock_mail_reply.xpm"
1338 #include "pixmaps/stock_mail_reply_to_all.xpm"
1339 #include "pixmaps/stock_mail_reply_to_author.xpm"
1340 #include "pixmaps/stock_mail_forward.xpm"
1341 #include "pixmaps/stock_mail_send.xpm"
1342 #include "pixmaps/stock_preferences.xpm"
1343 #include "pixmaps/stock_properties.xpm"
1344 #include "pixmaps/stock_down_arrow.xpm"
1345 #include "pixmaps/stock_close.xpm"
1346 #include "pixmaps/stock_exec.xpm"
1348 #define CREATE_TOOLBAR_ICON(xpm_d) \
1350 icon = gdk_pixmap_create_from_xpm_d(container->window, &mask, \
1351 &container->style->white, \
1353 icon_wid = gtk_pixmap_new(icon, mask); \
1356 static void main_window_toolbar_create(MainWindow *mainwin,
1357 GtkWidget *container)
1362 GtkWidget *icon_wid;
1364 GtkWidget *getall_btn;
1365 GtkWidget *compose_btn;
1366 GtkWidget *reply_btn;
1367 GtkWidget *replyall_btn;
1368 GtkWidget *replyauthor_btn;
1370 GtkWidget *send_btn;
1372 GtkWidget *prefs_btn;
1373 GtkWidget *account_btn;
1375 GtkWidget *next_btn;
1376 GtkWidget *delete_btn;
1377 GtkWidget *exec_btn;
1379 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
1381 gtk_container_add(GTK_CONTAINER(container), toolbar);
1382 gtk_container_set_border_width(GTK_CONTAINER(container), 2);
1383 gtk_toolbar_set_button_relief(GTK_TOOLBAR(toolbar), GTK_RELIEF_NONE);
1384 gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar),
1385 GTK_TOOLBAR_SPACE_LINE);
1387 CREATE_TOOLBAR_ICON(stock_mail_receive_xpm);
1388 get_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1390 _("Incorporate new mail"),
1392 icon_wid, toolbar_inc_cb, mainwin);
1393 CREATE_TOOLBAR_ICON(stock_mail_receive_all_xpm);
1394 getall_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1396 _("Incorporate new mail of all accounts"),
1402 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
1404 CREATE_TOOLBAR_ICON(stock_mail_send_xpm);
1405 send_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1407 _("Send queued message(s)"),
1413 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
1415 CREATE_TOOLBAR_ICON(stock_mail_compose_xpm);
1416 compose_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1418 _("Compose new message"),
1423 CREATE_TOOLBAR_ICON(stock_mail_reply_xpm);
1424 reply_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1426 _("Reply to the message"),
1431 CREATE_TOOLBAR_ICON(stock_mail_reply_to_all_xpm);
1432 replyall_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1437 toolbar_reply_to_all_cb,
1439 CREATE_TOOLBAR_ICON(stock_mail_reply_to_author_xpm);
1440 replyauthor_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1442 _("Reply to author"),
1445 toolbar_reply_to_author_cb,
1447 CREATE_TOOLBAR_ICON(stock_mail_forward_xpm);
1448 fwd_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1450 _("Forward the message"),
1456 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
1458 CREATE_TOOLBAR_ICON(stock_close_xpm);
1459 delete_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1461 _("Delete the message"),
1467 CREATE_TOOLBAR_ICON(stock_exec_xpm);
1468 exec_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1470 _("Execute marked process"),
1476 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
1478 CREATE_TOOLBAR_ICON(stock_down_arrow_xpm);
1479 next_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1481 _("Next unread message"),
1484 toolbar_next_unread_cb,
1488 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
1490 CREATE_TOOLBAR_ICON(stock_preferences_xpm);
1491 prefs_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1493 _("Common preference"),
1498 CREATE_TOOLBAR_ICON(stock_properties_xpm);
1499 account_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1501 _("Account setting"),
1506 gtk_signal_connect(GTK_OBJECT(account_btn), "button_press_event",
1507 GTK_SIGNAL_FUNC(toolbar_account_button_pressed),
1511 mainwin->toolbar = toolbar;
1512 mainwin->get_btn = get_btn;
1513 mainwin->getall_btn = getall_btn;
1514 mainwin->compose_btn = compose_btn;
1515 mainwin->reply_btn = reply_btn;
1516 mainwin->replyall_btn = replyall_btn;
1517 mainwin->replyauthor_btn = replyauthor_btn;
1518 mainwin->fwd_btn = fwd_btn;
1519 mainwin->send_btn = send_btn;
1521 mainwin->prefs_btn = prefs_btn;
1522 mainwin->account_btn = account_btn;
1524 mainwin->next_btn = next_btn;
1525 mainwin->delete_btn = delete_btn;
1526 mainwin->exec_btn = exec_btn;
1528 gtk_widget_show_all(toolbar);
1531 /* callback functions */
1533 static void toolbar_inc_cb (GtkWidget *widget,
1536 MainWindow *mainwin = (MainWindow *)data;
1538 inc_mail_cb(mainwin, 0, NULL);
1541 static void toolbar_inc_all_cb (GtkWidget *widget,
1544 MainWindow *mainwin = (MainWindow *)data;
1546 inc_all_account_mail_cb(mainwin, 0, NULL);
1549 static void toolbar_send_cb (GtkWidget *widget,
1552 MainWindow *mainwin = (MainWindow *)data;
1554 send_queue_cb(mainwin, 0, NULL);
1557 static void toolbar_compose_cb (GtkWidget *widget,
1560 MainWindow *mainwin = (MainWindow *)data;
1562 compose_cb(mainwin, 0, NULL);
1565 static void toolbar_reply_cb (GtkWidget *widget,
1568 MainWindow *mainwin = (MainWindow *)data;
1570 reply_cb(mainwin, COMPOSE_REPLY, NULL);
1573 static void toolbar_reply_to_all_cb (GtkWidget *widget,
1576 MainWindow *mainwin = (MainWindow *)data;
1578 reply_cb(mainwin, COMPOSE_REPLY_TO_ALL, NULL);
1581 static void toolbar_reply_to_author_cb (GtkWidget *widget,
1584 MainWindow *mainwin = (MainWindow *)data;
1586 reply_cb(mainwin, COMPOSE_REPLY_TO_AUTHOR, NULL);
1589 static void toolbar_forward_cb (GtkWidget *widget,
1592 MainWindow *mainwin = (MainWindow *)data;
1594 reply_cb(mainwin, COMPOSE_FORWARD, NULL);
1597 static void toolbar_delete_cb (GtkWidget *widget,
1600 MainWindow *mainwin = (MainWindow *)data;
1602 summary_delete(mainwin->summaryview);
1605 static void toolbar_exec_cb (GtkWidget *widget,
1608 MainWindow *mainwin = (MainWindow *)data;
1610 summary_execute(mainwin->summaryview);
1613 static void toolbar_next_unread_cb (GtkWidget *widget,
1616 MainWindow *mainwin = (MainWindow *)data;
1618 next_unread_cb(mainwin, 0, NULL);
1621 static void toolbar_prefs_cb (GtkWidget *widget,
1624 prefs_common_open();
1627 static void toolbar_account_cb (GtkWidget *widget,
1630 MainWindow *mainwin = (MainWindow *)data;
1632 prefs_account_open_cb(mainwin, 0, NULL);
1635 static void toolbar_account_button_pressed(GtkWidget *widget,
1636 GdkEventButton *event,
1639 MainWindow *mainwin = (MainWindow *)data;
1642 if (event->button != 3) return;
1644 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL, NULL, NULL,
1645 event->button, event->time);
1648 static void ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
1651 MainWindow *mainwin = (MainWindow *)data;
1655 gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL, NULL, NULL,
1656 event->button, event->time);
1659 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
1662 app_exit_cb(data, 0, widget);
1667 static void add_mailbox_cb(MainWindow *mainwin, guint action,
1670 main_window_add_mailbox(mainwin);
1673 static void update_folderview_cb(MainWindow *mainwin, guint action,
1676 summary_show(mainwin->summaryview, NULL, FALSE);
1677 folderview_update_all();
1680 static void new_folder_cb(MainWindow *mainwin, guint action,
1683 folderview_new_folder(mainwin->folderview);
1686 static void rename_folder_cb(MainWindow *mainwin, guint action,
1689 folderview_rename_folder(mainwin->folderview);
1692 static void delete_folder_cb(MainWindow *mainwin, guint action,
1695 folderview_delete_folder(mainwin->folderview);
1698 static void import_mbox_cb(MainWindow *mainwin, guint action,
1701 import_mbox(mainwin->summaryview->folder_item);
1704 static void export_mbox_cb(MainWindow *mainwin, guint action,
1707 export_mbox(mainwin->summaryview->folder_item);
1710 static void empty_trash_cb(MainWindow *mainwin, guint action,
1713 main_window_empty_trash(mainwin, TRUE);
1716 static void save_as_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1718 summary_save_as(mainwin->summaryview);
1721 static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1723 summary_print(mainwin->summaryview);
1726 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1728 if (prefs_common.confirm_on_exit) {
1729 if (alertpanel(_("Exit"), _("Exit this program?"),
1730 _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
1732 manage_window_focus_in(mainwin->window, NULL, NULL);
1735 app_will_exit(widget, mainwin);
1738 static void toggle_folder_cb(MainWindow *mainwin, guint action,
1741 switch (mainwin->type) {
1743 case SEPARATE_MESSAGE:
1745 case SEPARATE_FOLDER:
1746 if (GTK_CHECK_MENU_ITEM(widget)->active)
1747 gtk_widget_show(mainwin->win.sep_folder.folderwin);
1749 gtk_widget_hide(mainwin->win.sep_folder.folderwin);
1752 if (GTK_CHECK_MENU_ITEM(widget)->active)
1753 gtk_widget_show(mainwin->win.sep_both.folderwin);
1755 gtk_widget_hide(mainwin->win.sep_both.folderwin);
1760 static void toggle_message_cb(MainWindow *mainwin, guint action,
1763 switch (mainwin->type) {
1765 case SEPARATE_FOLDER:
1767 case SEPARATE_MESSAGE:
1768 if (GTK_CHECK_MENU_ITEM(widget)->active)
1769 gtk_widget_show(mainwin->win.sep_message.messagewin);
1771 gtk_widget_hide(mainwin->win.sep_message.messagewin);
1774 if (GTK_CHECK_MENU_ITEM(widget)->active)
1775 gtk_widget_show(mainwin->win.sep_both.messagewin);
1777 gtk_widget_hide(mainwin->win.sep_both.messagewin);
1782 static void toggle_toolbar_cb(MainWindow *mainwin, guint action,
1785 switch ((ToolbarStyle)action) {
1787 gtk_widget_hide(mainwin->handlebox);
1789 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
1793 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
1797 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar),
1802 if (action != TOOLBAR_NONE) {
1803 gtk_widget_show(mainwin->handlebox);
1804 gtk_widget_queue_resize(mainwin->handlebox);
1807 mainwin->toolbar_style = (ToolbarStyle)action;
1808 prefs_common.toolbar_style = (ToolbarStyle)action;
1811 static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
1814 if (GTK_CHECK_MENU_ITEM(widget)->active) {
1815 gtk_widget_show(mainwin->hbox_stat);
1816 prefs_common.show_statusbar = TRUE;
1818 gtk_widget_hide(mainwin->hbox_stat);
1819 prefs_common.show_statusbar = FALSE;
1823 static void separate_widget_cb(GtkCheckMenuItem *checkitem, guint action)
1825 MainWindow *mainwin;
1828 mainwin = (MainWindow *) gtk_object_get_data(GTK_OBJECT(checkitem), "mainwindow");
1829 g_return_if_fail(mainwin != NULL);
1831 type = mainwin->type ^ action;
1832 main_window_separation_change(mainwin, type);
1834 prefs_common.sep_folder = (type & SEPARATE_FOLDER) != 0;
1835 prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
1838 static void addressbook_open_cb(MainWindow *mainwin, guint action,
1841 addressbook_open(NULL);
1844 static void log_window_show_cb(MainWindow *mainwin, guint action,
1847 log_window_show(mainwin->logwin);
1850 static void inc_mail_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1855 static void inc_all_account_mail_cb(MainWindow *mainwin, guint action,
1858 inc_all_account_mail(mainwin);
1861 static void send_queue_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1865 if (procmsg_send_queue() < 0)
1866 alertpanel_error(_("Sending queued message failed."));
1868 statusbar_pop_all();
1870 for (list = folder_get_list(); list != NULL; list = list->next) {
1873 folder = list->data;
1874 if (folder->queue) {
1875 folder_item_scan(folder->queue);
1876 folderview_update_item(folder->queue, TRUE);
1881 static void compose_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1883 if (mainwin->summaryview->folder_item)
1884 compose_new(mainwin->summaryview->folder_item->folder->account);
1889 static void reply_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1893 msginfo = gtk_ctree_node_get_row_data
1894 (GTK_CTREE(mainwin->summaryview->ctree),
1895 mainwin->summaryview->selected);
1897 if (!msginfo) return;
1901 compose_reply(msginfo, prefs_common.reply_with_quote,
1904 case COMPOSE_REPLY_TO_ALL:
1905 compose_reply(msginfo, prefs_common.reply_with_quote,
1908 case COMPOSE_REPLY_TO_AUTHOR:
1909 compose_reply(msginfo, prefs_common.reply_with_quote,
1912 case COMPOSE_FORWARD:
1913 compose_forward(NULL, msginfo, FALSE);
1915 case COMPOSE_FORWARD_AS_ATTACH:
1916 compose_forward(NULL, msginfo, TRUE);
1919 compose_reply(msginfo, prefs_common.reply_with_quote,
1923 summary_set_marks_selected(mainwin->summaryview);
1926 static void move_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1928 summary_move_to(mainwin->summaryview);
1931 static void copy_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1933 summary_copy_to(mainwin->summaryview);
1936 static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1938 summary_delete(mainwin->summaryview);
1941 static void open_msg_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1943 summary_open_msg(mainwin->summaryview);
1946 static void view_source_cb(MainWindow *mainwin, guint action,
1949 summary_view_source(mainwin->summaryview);
1952 static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1954 summary_reedit(mainwin->summaryview);
1957 static void mark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1959 summary_mark(mainwin->summaryview);
1962 static void unmark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
1964 summary_unmark(mainwin->summaryview);
1967 static void mark_as_unread_cb(MainWindow *mainwin, guint action,
1970 summary_mark_as_unread(mainwin->summaryview);
1973 static void mark_as_read_cb(MainWindow *mainwin, guint action,
1976 summary_mark_as_read(mainwin->summaryview);
1979 static void set_charset_cb(MainWindow *mainwin, guint action,
1984 str = conv_get_charset_str((CharSet)action);
1985 g_free(prefs_common.force_charset);
1986 prefs_common.force_charset = str ? g_strdup(str) : NULL;
1988 summary_redisplay_msg(mainwin->summaryview);
1990 debug_print(_("forced charset: %s\n"), str ? str : "Auto-Detect");
1993 void main_window_set_thread_option(MainWindow *mainwin)
1995 GtkItemFactory *ifactory;
1997 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
1999 if (mainwin->summaryview->folder_item->prefs->enable_thread) {
2000 menu_set_sensitive(ifactory, "/Summary/Thread view", FALSE);
2001 menu_set_sensitive(ifactory, "/Summary/Unthread view", TRUE);
2002 summary_thread_build(mainwin->summaryview);
2005 menu_set_sensitive(ifactory, "/Summary/Thread view", TRUE);
2006 menu_set_sensitive(ifactory, "/Summary/Unthread view", FALSE);
2007 summary_unthread(mainwin->summaryview);
2009 prefs_folder_item_save_config(mainwin->summaryview->folder_item);
2012 static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2015 ifactory = gtk_item_factory_from_widget(widget);
2017 mainwin->summaryview->folder_item->prefs->enable_thread =
2018 !mainwin->summaryview->folder_item->prefs->enable_thread;
2019 main_window_set_thread_option(mainwin);
2023 summary_thread_build(mainwin->summaryview);
2024 mainwin->summaryview->folder_item->prefs->enable_thread =
2026 menu_set_sensitive(ifactory, "/Summary/Thread view", FALSE);
2027 menu_set_sensitive(ifactory, "/Summary/Unthread view", TRUE);
2029 summary_unthread(mainwin->summaryview);
2030 mainwin->summaryview->folder_item->prefs->enable_thread =
2032 menu_set_sensitive(ifactory, "/Summary/Thread view", TRUE);
2033 menu_set_sensitive(ifactory, "/Summary/Unthread view", FALSE);
2038 static void set_display_item_cb(MainWindow *mainwin, guint action,
2041 prefs_summary_display_item_set();
2044 static void sort_summary_cb(MainWindow *mainwin, guint action,
2047 summary_sort(mainwin->summaryview, (SummarySortType)action);
2050 static void attract_by_subject_cb(MainWindow *mainwin, guint action,
2053 summary_attract_by_subject(mainwin->summaryview);
2056 static void delete_duplicated_cb(MainWindow *mainwin, guint action,
2059 summary_delete_duplicated(mainwin->summaryview);
2062 static void filter_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2064 summary_filter(mainwin->summaryview);
2067 static void execute_summary_cb(MainWindow *mainwin, guint action,
2070 summary_execute(mainwin->summaryview);
2073 static void update_summary_cb(MainWindow *mainwin, guint action,
2077 FolderView *folderview = mainwin->folderview;
2079 if (!mainwin->summaryview->folder_item) return;
2080 if (!folderview->opened) return;
2082 fitem = gtk_ctree_node_get_row_data(GTK_CTREE(folderview->ctree),
2083 folderview->opened);
2086 summary_show(mainwin->summaryview, fitem, TRUE);
2089 static void prev_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2091 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
2094 static void next_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2096 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
2099 static void next_unread_cb(MainWindow *mainwin, guint action,
2102 summary_select_next_unread(mainwin->summaryview);
2105 static void next_marked_cb(MainWindow *mainwin, guint action,
2108 summary_select_next_marked(mainwin->summaryview);
2111 static void prev_marked_cb(MainWindow *mainwin, guint action,
2114 summary_select_prev_marked(mainwin->summaryview);
2117 static void goto_folder_cb(MainWindow *mainwin, guint action,
2120 FolderItem *to_folder;
2122 to_folder = foldersel_folder_sel(NULL);
2125 folderview_select(mainwin->folderview, to_folder);
2128 static void copy_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2130 messageview_copy_clipboard(mainwin->messageview);
2133 static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
2135 if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->ctree))
2136 summary_select_all(mainwin->summaryview);
2137 else if (mainwin->summaryview->msg_is_toggled_on &&
2138 GTK_WIDGET_HAS_FOCUS(mainwin->messageview->textview->text))
2139 messageview_select_all(mainwin->messageview);
2142 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
2145 prefs_common_open();
2148 static void prefs_filter_open_cb(MainWindow *mainwin, guint action,
2151 prefs_filter_open();
2154 static void prefs_scoring_open_cb(MainWindow *mainwin, guint action,
2157 prefs_scoring_open();
2160 static void prefs_filtering_open_cb(MainWindow *mainwin, guint action,
2163 prefs_filtering_open();
2166 static void prefs_account_open_cb(MainWindow *mainwin, guint action,
2170 new_account_cb(mainwin, 0, widget);
2172 gboolean prev_default = cur_account->is_default;
2174 prefs_account_open(cur_account);
2175 if (!prev_default && cur_account->is_default)
2176 account_set_as_default(cur_account);
2177 account_save_config_all();
2179 main_window_reflect_prefs_all();
2183 static void new_account_cb(MainWindow *mainwin, guint action,
2186 account_edit_open();
2187 if (!compose_get_compose_list()) account_add();
2190 static void account_menu_cb(GtkMenuItem *menuitem, gpointer data)
2192 cur_account = (PrefsAccount *)data;
2193 main_window_reflect_prefs_all();
2196 static void manual_open_cb(MainWindow *mainwin, guint action,
2199 manual_open((ManualLang)action);
2202 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
2204 MainWindow *mainwin = (MainWindow *)data;
2208 str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
2209 LOCAL_FOLDER(folder)->rootpath,
2213 str = g_strdup_printf(_("Scanning folder %s ..."),
2214 LOCAL_FOLDER(folder)->rootpath);
2216 STATUSBAR_PUSH(mainwin, str);
2217 STATUSBAR_POP(mainwin);