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_filtering.h"
61 #include "prefs_scoring.h"
62 #include "prefs_account.h"
63 #include "prefs_folder_item.h"
65 #include "addressbook.h"
66 #include "headerwindow.h"
67 #include "logwindow.h"
68 #include "manage_window.h"
69 #include "alertpanel.h"
70 #include "statusbar.h"
71 #include "inputdialog.h"
77 #include "prefs_templates.h"
79 #define AC_LABEL_WIDTH 240
81 #define STATUSBAR_PUSH(mainwin, str) \
83 gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar), \
84 mainwin->mainwin_cid, str); \
85 gtkut_widget_wait_for_draw(mainwin->hbox_stat); \
88 #define STATUSBAR_POP(mainwin) \
90 gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar), \
91 mainwin->mainwin_cid); \
94 /* list of all instantiated MainWindow */
95 static GList
*mainwin_list
= NULL
;
97 static GdkCursor
*watch_cursor
;
99 static void main_window_show_cur_account (MainWindow
*mainwin
);
101 static void main_window_set_widgets (MainWindow
*mainwin
,
103 static void main_window_toolbar_create (MainWindow
*mainwin
,
104 GtkWidget
*container
);
106 /* callback functions */
107 static void toolbar_inc_cb (GtkWidget
*widget
,
109 static void toolbar_inc_all_cb (GtkWidget
*widget
,
111 static void toolbar_send_cb (GtkWidget
*widget
,
114 static void toolbar_compose_cb (GtkWidget
*widget
,
116 static void toolbar_popup_compose_type_cb(GtkWidget
*widget
,
118 static void toolbar_popup_compose_type_set(GtkWidget
*widget
,
120 static void toolbar_compose_news_cb (GtkWidget
*widget
,
122 static void toolbar_compose_mail_cb (GtkWidget
*widget
,
124 static void toolbar_reply_cb (GtkWidget
*widget
,
126 static void toolbar_reply_to_all_cb (GtkWidget
*widget
,
128 static void toolbar_reply_to_sender_cb (GtkWidget
*widget
,
130 static void toolbar_forward_cb (GtkWidget
*widget
,
133 static void toolbar_delete_cb (GtkWidget
*widget
,
135 static void toolbar_exec_cb (GtkWidget
*widget
,
138 static void toolbar_next_unread_cb (GtkWidget
*widget
,
141 static void toolbar_prefs_cb (GtkWidget
*widget
,
143 static void toolbar_account_cb (GtkWidget
*widget
,
146 static void toolbar_account_button_pressed (GtkWidget
*widget
,
147 GdkEventButton
*event
,
149 static void ac_label_button_pressed (GtkWidget
*widget
,
150 GdkEventButton
*event
,
152 static void ac_menu_popup_closed (GtkMenuShell
*menu_shell
,
155 static gint
main_window_close_cb (GtkWidget
*widget
,
159 static void add_mailbox_cb (MainWindow
*mainwin
,
162 static void add_mbox_cb (MainWindow
*mainwin
,
165 static void update_folderview_cb (MainWindow
*mainwin
,
168 static void new_folder_cb (MainWindow
*mainwin
,
171 static void rename_folder_cb (MainWindow
*mainwin
,
174 static void delete_folder_cb (MainWindow
*mainwin
,
177 static void import_mbox_cb (MainWindow
*mainwin
,
180 static void export_mbox_cb (MainWindow
*mainwin
,
183 static void empty_trash_cb (MainWindow
*mainwin
,
187 static void save_as_cb (MainWindow
*mainwin
,
190 static void print_cb (MainWindow
*mainwin
,
193 static void app_exit_cb (MainWindow
*mainwin
,
197 static void toggle_folder_cb (MainWindow
*mainwin
,
200 static void toggle_message_cb (MainWindow
*mainwin
,
203 static void toggle_toolbar_cb (MainWindow
*mainwin
,
206 static void toggle_statusbar_cb (MainWindow
*mainwin
,
209 static void separate_widget_cb (GtkCheckMenuItem
*checkitem
,
213 static void addressbook_open_cb (MainWindow
*mainwin
,
216 static void log_window_show_cb (MainWindow
*mainwin
,
220 static void inc_mail_cb (MainWindow
*mainwin
,
223 static void inc_all_account_mail_cb (MainWindow
*mainwin
,
227 static void send_queue_cb (MainWindow
*mainwin
,
231 static void compose_cb (MainWindow
*mainwin
,
234 static void compose_mail_cb(MainWindow
*mainwin
, guint action
,
236 static void compose_news_cb(MainWindow
*mainwin
, guint action
,
238 static void reply_cb (MainWindow
*mainwin
,
242 static void open_msg_cb (MainWindow
*mainwin
,
246 static void view_source_cb (MainWindow
*mainwin
,
250 static void reedit_cb (MainWindow
*mainwin
,
254 static void move_to_cb (MainWindow
*mainwin
,
257 static void copy_to_cb (MainWindow
*mainwin
,
260 static void delete_cb (MainWindow
*mainwin
,
264 static void mark_cb (MainWindow
*mainwin
,
267 static void unmark_cb (MainWindow
*mainwin
,
271 static void mark_as_unread_cb (MainWindow
*mainwin
,
274 static void mark_as_read_cb (MainWindow
*mainwin
,
278 static void set_charset_cb (MainWindow
*mainwin
,
282 static void thread_cb (MainWindow
*mainwin
,
285 static void set_display_item_cb (MainWindow
*mainwin
,
288 static void sort_summary_cb (MainWindow
*mainwin
,
291 static void attract_by_subject_cb(MainWindow
*mainwin
,
295 static void delete_duplicated_cb (MainWindow
*mainwin
,
298 static void filter_cb (MainWindow
*mainwin
,
301 static void execute_summary_cb (MainWindow
*mainwin
,
304 static void update_summary_cb (MainWindow
*mainwin
,
308 static void prev_cb (MainWindow
*mainwin
,
311 static void next_cb (MainWindow
*mainwin
,
315 static void next_unread_cb (MainWindow
*mainwin
,
319 static void next_marked_cb (MainWindow
*mainwin
,
323 static void prev_marked_cb (MainWindow
*mainwin
,
327 static void goto_folder_cb (MainWindow
*mainwin
,
331 static void copy_cb (MainWindow
*mainwin
,
334 static void allsel_cb (MainWindow
*mainwin
,
338 static void prefs_common_open_cb (MainWindow
*mainwin
,
341 static void prefs_filter_open_cb (MainWindow
*mainwin
,
344 static void prefs_scoring_open_cb (MainWindow
*mainwin
,
347 static void prefs_filtering_open_cb (MainWindow
*mainwin
,
350 static void prefs_account_open_cb(MainWindow
*mainwin
,
353 static void new_account_cb (MainWindow
*mainwin
,
357 static void account_menu_cb (GtkMenuItem
*menuitem
,
360 static void manual_open_cb (MainWindow
*mainwin
,
364 static void scan_tree_func (Folder
*folder
,
368 static void activate_compose_button (MainWindow
*mainwin
,
370 ComposeButtonType type
);
372 static void prefs_templates_open_cb(MainWindow
*mainwin
,
376 #define SEPARATE_ACTION 667
378 static GtkItemFactoryEntry mainwin_entries
[] =
380 {N_("/_File"), NULL
, NULL
, 0, "<Branch>"},
381 {N_("/_File/_Add mailbox..."), NULL
, add_mailbox_cb
, 0, NULL
},
382 {N_("/_File/_Add mbox mailbox..."), NULL
, add_mbox_cb
, 0, NULL
},
383 {N_("/_File/_Update folder tree"), NULL
, update_folderview_cb
, 0, NULL
},
384 {N_("/_File/_Folder"), NULL
, NULL
, 0, "<Branch>"},
385 {N_("/_File/_Folder/Create _new folder..."),
386 NULL
, new_folder_cb
, 0, NULL
},
387 {N_("/_File/_Folder/_Rename folder..."),NULL
, rename_folder_cb
, 0, NULL
},
388 {N_("/_File/_Folder/_Delete folder"), NULL
, delete_folder_cb
, 0, NULL
},
389 {N_("/_File/_Import mbox file..."), NULL
, import_mbox_cb
, 0, NULL
},
390 {N_("/_File/_Export to mbox file..."), NULL
, export_mbox_cb
, 0, NULL
},
391 {N_("/_File/Empty _trash"), NULL
, empty_trash_cb
, 0, NULL
},
392 {N_("/_File/---"), NULL
, NULL
, 0, "<Separator>"},
393 {N_("/_File/_Save as..."), NULL
, save_as_cb
, 0, NULL
},
394 {N_("/_File/_Print..."), "<alt>P", print_cb
, 0, NULL
},
395 {N_("/_File/---"), NULL
, NULL
, 0, "<Separator>"},
396 {N_("/_File/_Close"), "<alt>W", app_exit_cb
, 0, NULL
},
397 {N_("/_File/E_xit"), "<alt>Q", app_exit_cb
, 0, NULL
},
399 {N_("/_Edit"), NULL
, NULL
, 0, "<Branch>"},
400 {N_("/_Edit/_Copy"), "<control>C", copy_cb
, 0, NULL
},
401 {N_("/_Edit/Select _all"), "<control>A", allsel_cb
, 0, NULL
},
402 {N_("/_Edit/---"), NULL
, NULL
, 0, "<Separator>"},
403 {N_("/_Edit/_Search"), "<control>S", summary_search_cb
, 0, NULL
},
405 {N_("/_View"), NULL
, NULL
, 0, "<Branch>"},
406 {N_("/_View/_Folder tree"), NULL
, toggle_folder_cb
, 0, "<ToggleItem>"},
407 {N_("/_View/_Message view"), NULL
, toggle_message_cb
, 0, "<ToggleItem>"},
408 {N_("/_View/_Toolbar"), NULL
, NULL
, 0, "<Branch>"},
409 {N_("/_View/_Toolbar/Icon _and text"), NULL
, toggle_toolbar_cb
, TOOLBAR_BOTH
, "<RadioItem>"},
410 {N_("/_View/_Toolbar/_Icon"), NULL
, toggle_toolbar_cb
, TOOLBAR_ICON
, "/View/Toolbar/Icon and text"},
411 {N_("/_View/_Toolbar/_Text"), NULL
, toggle_toolbar_cb
, TOOLBAR_TEXT
, "/View/Toolbar/Icon and text"},
412 {N_("/_View/_Toolbar/_None"), NULL
, toggle_toolbar_cb
, TOOLBAR_NONE
, "/View/Toolbar/Icon and text"},
413 {N_("/_View/_Status bar"), NULL
, toggle_statusbar_cb
, 0, "<ToggleItem>"},
414 {N_("/_View/---"), NULL
, NULL
, 0, "<Separator>"},
415 {N_("/_View/Separate f_older tree"), NULL
, NULL
, SEPARATE_ACTION
+ SEPARATE_FOLDER
, "<ToggleItem>"},
416 {N_("/_View/Separate m_essage view"), NULL
, NULL
, SEPARATE_ACTION
+ SEPARATE_MESSAGE
, "<ToggleItem>"},
417 {N_("/_View/---"), NULL
, NULL
, 0, "<Separator>"},
418 {N_("/_View/_Code set"), NULL
, NULL
, 0, "<Branch>"},
419 {N_("/_View/_Code set/_Auto detect"),
420 NULL
, set_charset_cb
, C_AUTO
, "<RadioItem>"},
422 #define CODESET_SEPARATOR \
423 {N_("/_View/_Code set/---"), NULL, NULL, 0, "<Separator>"}
424 #define CODESET_ACTION(action) \
425 NULL, set_charset_cb, action, "/View/Code set/Auto detect"
427 {N_("/_View/_Code set/---"), NULL
, NULL
, 0, "<Separator>"},
428 {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
429 CODESET_ACTION(C_US_ASCII
)},
432 {N_("/_View/_Code set/Unicode (_UTF-8)"),
433 CODESET_ACTION(C_UTF_8
)},
436 {N_("/_View/_Code set/Western European (ISO-8859-_1)"),
437 CODESET_ACTION(C_ISO_8859_1
)},
440 {N_("/_View/_Code set/Central European (ISO-8859-_2)"),
441 CODESET_ACTION(C_ISO_8859_2
)},
443 {N_("/_View/_Code set/_Baltic (ISO-8859-13)"),
444 CODESET_ACTION(C_ISO_8859_13
)},
445 {N_("/_View/_Code set/Baltic (ISO-8859-_4)"),
446 CODESET_ACTION(C_ISO_8859_4
)},
448 {N_("/_View/_Code set/Greek (ISO-8859-_7)"),
449 CODESET_ACTION(C_ISO_8859_7
)},
451 {N_("/_View/_Code set/Turkish (ISO-8859-_9)"),
452 CODESET_ACTION(C_ISO_8859_9
)},
454 {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"),
455 CODESET_ACTION(C_ISO_8859_5
)},
456 {N_("/_View/_Code set/Cyrillic (KOI8-_R)"),
457 CODESET_ACTION(C_KOI8_R
)},
458 {N_("/_View/_Code set/Cyrillic (Windows-1251)"),
459 CODESET_ACTION(C_CP1251
)},
462 {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
463 CODESET_ACTION(C_ISO_2022_JP
)},
465 {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
466 CODESET_ACTION(C_ISO_2022_JP_2
)},
468 {N_("/_View/_Code set/Japanese (_EUC-JP)"),
469 CODESET_ACTION(C_EUC_JP
)},
470 {N_("/_View/_Code set/Japanese (_Shift__JIS)"),
471 CODESET_ACTION(C_SHIFT_JIS
)},
474 {N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
475 CODESET_ACTION(C_GB2312
)},
476 {N_("/_View/_Code set/Traditional Chinese (_Big5)"),
477 CODESET_ACTION(C_BIG5
)},
478 {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"),
479 CODESET_ACTION(C_EUC_TW
)},
480 {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"),
481 CODESET_ACTION(C_ISO_2022_CN
)},
483 {N_("/_View/_Code set/Korean (EUC-_KR)"),
484 CODESET_ACTION(C_EUC_KR
)},
485 {N_("/_View/_Code set/Korean (ISO-2022-KR)"),
486 CODESET_ACTION(C_ISO_2022_KR
)},
489 #undef CODESET_SEPARATOR
490 #undef CODESET_ACTION
492 {N_("/_Message"), NULL
, NULL
, 0, "<Branch>"},
493 {N_("/_Message/Get new ma_il"), "<alt>I", inc_mail_cb
, 0, NULL
},
494 {N_("/_Message/Get from _all accounts"),
495 "<shift><alt>I", inc_all_account_mail_cb
, 0, NULL
},
496 {N_("/_Message/---"), NULL
, NULL
, 0, "<Separator>"},
497 {N_("/_Message/Send queued messa_ges"),
498 NULL
, send_queue_cb
, 0, NULL
},
499 {N_("/_Message/---"), NULL
, NULL
, 0, "<Separator>"},
500 {N_("/_Message/Compose a_n email message"), "<alt>N", compose_mail_cb
, 0, NULL
},
501 {N_("/_Message/Compose a news message"), NULL
, compose_news_cb
, 0, NULL
},
502 {N_("/_Message/_Reply"), "<alt>R", reply_cb
, COMPOSE_REPLY
, NULL
},
503 {N_("/_Message/Repl_y to sender"), "<control><alt>R", reply_cb
, COMPOSE_REPLY_TO_SENDER
, NULL
},
504 {N_("/_Message/Follow-up and reply to"), NULL
, reply_cb
, COMPOSE_FOLLOWUP_AND_REPLY_TO
, NULL
},
505 {N_("/_Message/Reply to a_ll"), "<shift><alt>R", reply_cb
, COMPOSE_REPLY_TO_ALL
, NULL
},
506 {N_("/_Message/_Forward"), "<control>F", reply_cb
, COMPOSE_FORWARD
, NULL
},
507 {N_("/_Message/Forward as a_ttachment"),
508 "<shift><control>F", reply_cb
, COMPOSE_FORWARD_AS_ATTACH
, NULL
},
509 {N_("/_Message/---"), NULL
, NULL
, 0, "<Separator>"},
510 {N_("/_Message/M_ove..."), "<alt>O", move_to_cb
, 0, NULL
},
511 {N_("/_Message/_Copy..."), NULL
, copy_to_cb
, 0, NULL
},
512 {N_("/_Message/_Delete"), "<alt>D", delete_cb
, 0, NULL
},
513 {N_("/_Message/_Mark"), NULL
, NULL
, 0, "<Branch>"},
514 {N_("/_Message/_Mark/_Mark"), NULL
, mark_cb
, 0, NULL
},
515 {N_("/_Message/_Mark/_Unmark"), NULL
, unmark_cb
, 0, NULL
},
516 {N_("/_Message/_Mark/---"), NULL
, NULL
, 0, "<Separator>"},
517 {N_("/_Message/_Mark/Mark as unr_ead"), NULL
, mark_as_unread_cb
, 0, NULL
},
518 {N_("/_Message/_Mark/Mark as rea_d"),
519 NULL
, mark_as_read_cb
, 0, NULL
},
520 {N_("/_Message/---"), NULL
, NULL
, 0, "<Separator>"},
521 {N_("/_Message/Open in new _window"), "<shift><control>N", open_msg_cb
, 0, NULL
},
522 {N_("/_Message/View _source"), "<control>U", view_source_cb
, 0, NULL
},
523 {N_("/_Message/Show all _header"), "<control>H", header_window_show_cb
, 0, NULL
},
524 {N_("/_Message/Re-_edit"), NULL
, reedit_cb
, 0, NULL
},
526 {N_("/_Summary"), NULL
, NULL
, 0, "<Branch>"},
527 {N_("/_Summary/_Delete duplicated messages"),
528 NULL
, delete_duplicated_cb
, 0, NULL
},
529 {N_("/_Summary/_Filter messages"), NULL
, filter_cb
, 0, NULL
},
530 {N_("/_Summary/E_xecute"), "<alt>X", execute_summary_cb
, 0, NULL
},
531 {N_("/_Summary/_Update"), "<alt>U", update_summary_cb
, 0, NULL
},
532 {N_("/_Summary/---"), NULL
, NULL
, 0, "<Separator>"},
533 {N_("/_Summary/_Prev message"), NULL
, prev_cb
, 0, NULL
},
534 {N_("/_Summary/_Next message"), NULL
, next_cb
, 0, NULL
},
535 {N_("/_Summary/N_ext unread message"), NULL
, next_unread_cb
, 0, NULL
},
536 {N_("/_Summary/Prev marked message"), NULL
, prev_marked_cb
, 0, NULL
},
537 {N_("/_Summary/Next marked message"), NULL
, next_marked_cb
, 0, NULL
},
538 {N_("/_Summary/---"), NULL
, NULL
, 0, "<Separator>"},
539 {N_("/_Summary/_Go to other folder"), "<alt>G", goto_folder_cb
, 0, NULL
},
540 {N_("/_Summary/---"), NULL
, NULL
, 0, "<Separator>"},
541 {N_("/_Summary/_Sort"), NULL
, NULL
, 0, "<Branch>"},
542 {N_("/_Summary/_Sort/Sort by _number"), NULL
, sort_summary_cb
, SORT_BY_NUMBER
, NULL
},
543 {N_("/_Summary/_Sort/Sort by s_ize"), NULL
, sort_summary_cb
, SORT_BY_SIZE
, NULL
},
544 {N_("/_Summary/_Sort/Sort by _date"), NULL
, sort_summary_cb
, SORT_BY_DATE
, NULL
},
545 {N_("/_Summary/_Sort/Sort by _from"), NULL
, sort_summary_cb
, SORT_BY_FROM
, NULL
},
546 {N_("/_Summary/_Sort/Sort by _subject"),NULL
, sort_summary_cb
, SORT_BY_SUBJECT
, NULL
},
547 {N_("/_Summary/_Sort/Sort by sco_re"), NULL
, sort_summary_cb
, SORT_BY_SCORE
, NULL
},
548 {N_("/_Summary/_Sort/Sort by _label"), NULL
, sort_summary_cb
, SORT_BY_LABEL
, NULL
},
549 {N_("/_Summary/_Sort/---"), NULL
, NULL
, 0, "<Separator>"},
550 {N_("/_Summary/_Sort/_Attract by subject"),
551 NULL
, attract_by_subject_cb
, 0, NULL
},
552 {N_("/_Summary/_Thread view"), "<control>T", thread_cb
, 0, NULL
},
553 {N_("/_Summary/Unt_hread view"), "<shift><control>T", thread_cb
, 1, NULL
},
554 {N_("/_Summary/Set display _item..."), NULL
, set_display_item_cb
, 0, NULL
},
556 {N_("/_Tool"), NULL
, NULL
, 0, "<Branch>"},
557 {N_("/_Tool/_Address book"), "<alt>A", addressbook_open_cb
, 0, NULL
},
558 {N_("/_Tool/_Log window"), "<alt>L", log_window_show_cb
, 0, NULL
},
560 {N_("/_Configuration"), NULL
, NULL
, 0, "<Branch>"},
561 {N_("/_Configuration/_Common preferences..."),
562 NULL
, prefs_common_open_cb
, 0, NULL
},
563 {N_("/_Configuration/_Filter setting..."),
564 NULL
, prefs_filter_open_cb
, 0, NULL
},
565 {N_("/_Configuration/_Scoring ..."),
566 NULL
, prefs_scoring_open_cb
, 0, NULL
},
567 {N_("/_Configuration/_Filtering ..."),
568 NULL
, prefs_filtering_open_cb
, 0, NULL
},
569 {N_("/_Configuration/_Templates ..."),
570 NULL
, prefs_templates_open_cb
, 0, NULL
},
571 {N_("/_Configuration/_Preferences per account..."),
572 NULL
, prefs_account_open_cb
, 0, NULL
},
573 {N_("/_Configuration/---"), NULL
, NULL
, 0, "<Separator>"},
574 {N_("/_Configuration/Create _new account..."),
575 NULL
, new_account_cb
, 0, NULL
},
576 {N_("/_Configuration/_Edit accounts..."),
577 NULL
, account_edit_open
, 0, NULL
},
578 {N_("/_Configuration/C_hange current account"),
579 NULL
, NULL
, 0, "<Branch>"},
581 {N_("/_Help"), NULL
, NULL
, 0, "<LastBranch>"},
582 {N_("/_Help/_Manual"), NULL
, NULL
, 0, "<Branch>"},
583 {N_("/_Help/_Manual/_English"), NULL
, manual_open_cb
, MANUAL_LANG_EN
, NULL
},
584 {N_("/_Help/_Manual/_Japanese"), NULL
, manual_open_cb
, MANUAL_LANG_JA
, NULL
},
585 {N_("/_Help/---"), NULL
, NULL
, 0, "<Separator>"},
586 {N_("/_Help/_About"), NULL
, about_show
, 0, NULL
}
589 MainWindow
*main_window_create(SeparateType type
)
595 GtkWidget
*handlebox
;
596 GtkWidget
*vbox_body
;
597 GtkWidget
*hbox_stat
;
598 GtkWidget
*statusbar
;
599 GtkWidget
*ac_button
;
602 FolderView
*folderview
;
603 SummaryView
*summaryview
;
604 MessageView
*messageview
;
605 GdkColormap
*colormap
;
608 guint n_menu_entries
;
609 GtkItemFactory
*ifactory
;
614 debug_print(_("Creating main window...\n"));
615 mainwin
= g_new0(MainWindow
, 1);
618 window
= gtk_window_new(GTK_WINDOW_TOPLEVEL
);
619 gtk_window_set_title(GTK_WINDOW(window
), PROG_VERSION
);
620 gtk_window_set_policy(GTK_WINDOW(window
), TRUE
, TRUE
, FALSE
);
621 gtk_signal_connect(GTK_OBJECT(window
), "delete_event",
622 GTK_SIGNAL_FUNC(main_window_close_cb
), mainwin
);
623 gtk_signal_connect(GTK_OBJECT(window
), "focus_in_event",
624 GTK_SIGNAL_FUNC(manage_window_focus_in
), NULL
);
625 gtk_signal_connect(GTK_OBJECT(window
), "focus_out_event",
626 GTK_SIGNAL_FUNC(manage_window_focus_out
), NULL
);
627 gtk_widget_realize(window
);
629 vbox
= gtk_vbox_new(FALSE
, 0);
630 gtk_widget_show(vbox
);
631 gtk_container_add(GTK_CONTAINER(window
), vbox
);
634 n_menu_entries
= sizeof(mainwin_entries
) / sizeof(mainwin_entries
[0]);
635 menubar
= menubar_create(window
, mainwin_entries
,
636 n_menu_entries
, "<Main>", mainwin
);
637 gtk_widget_show(menubar
);
638 gtk_box_pack_start(GTK_BOX(vbox
), menubar
, FALSE
, TRUE
, 0);
640 handlebox
= gtk_handle_box_new();
641 gtk_widget_show(handlebox
);
642 gtk_box_pack_start(GTK_BOX(vbox
), handlebox
, FALSE
, FALSE
, 0);
644 main_window_toolbar_create(mainwin
, handlebox
);
646 /* vbox that contains body */
647 vbox_body
= gtk_vbox_new(FALSE
, BORDER_WIDTH
);
648 gtk_widget_show(vbox_body
);
649 gtk_container_set_border_width(GTK_CONTAINER(vbox_body
), BORDER_WIDTH
);
650 gtk_box_pack_start(GTK_BOX(vbox
), vbox_body
, TRUE
, TRUE
, 0);
652 hbox_stat
= gtk_hbox_new(FALSE
, 2);
653 gtk_box_pack_end(GTK_BOX(vbox_body
), hbox_stat
, FALSE
, FALSE
, 0);
655 statusbar
= statusbar_create();
656 gtk_box_pack_start(GTK_BOX(hbox_stat
), statusbar
, TRUE
, TRUE
, 0);
658 ac_button
= gtk_button_new();
659 gtk_button_set_relief(GTK_BUTTON(ac_button
), GTK_RELIEF_NONE
);
660 GTK_WIDGET_UNSET_FLAGS(ac_button
, GTK_CAN_FOCUS
);
661 gtk_widget_set_usize(ac_button
, -1, 1);
662 gtk_box_pack_end(GTK_BOX(hbox_stat
), ac_button
, FALSE
, FALSE
, 0);
663 gtk_signal_connect(GTK_OBJECT(ac_button
), "button_press_event",
664 GTK_SIGNAL_FUNC(ac_label_button_pressed
), mainwin
);
666 ac_label
= gtk_label_new("");
667 gtk_container_add(GTK_CONTAINER(ac_button
), ac_label
);
669 gtk_widget_show_all(hbox_stat
);
672 mainwin
->folderview
= folderview
= folderview_create();
673 mainwin
->summaryview
= summaryview
= summary_create();
674 mainwin
->messageview
= messageview
= messageview_create();
675 mainwin
->headerwin
= header_window_create();
676 mainwin
->logwin
= log_window_create();
678 folderview
->mainwin
= mainwin
;
679 folderview
->summaryview
= summaryview
;
681 summaryview
->mainwin
= mainwin
;
682 summaryview
->folderview
= folderview
;
683 summaryview
->messageview
= messageview
;
684 summaryview
->headerwin
= mainwin
->headerwin
;
685 summaryview
->window
= window
;
687 messageview
->mainwin
= mainwin
;
689 mainwin
->window
= window
;
690 mainwin
->vbox
= vbox
;
691 mainwin
->menubar
= menubar
;
692 mainwin
->handlebox
= handlebox
;
693 mainwin
->vbox_body
= vbox_body
;
694 mainwin
->hbox_stat
= hbox_stat
;
695 mainwin
->statusbar
= statusbar
;
696 mainwin
->ac_button
= ac_button
;
697 mainwin
->ac_label
= ac_label
;
699 /* set context IDs for status bar */
700 mainwin
->mainwin_cid
= gtk_statusbar_get_context_id
701 (GTK_STATUSBAR(statusbar
), "Main Window");
702 mainwin
->folderview_cid
= gtk_statusbar_get_context_id
703 (GTK_STATUSBAR(statusbar
), "Folder View");
704 mainwin
->summaryview_cid
= gtk_statusbar_get_context_id
705 (GTK_STATUSBAR(statusbar
), "Summary View");
707 /* allocate colors for summary view and folder view */
708 summaryview
->color_marked
.red
= summaryview
->color_marked
.green
= 0;
709 summaryview
->color_marked
.blue
= (guint16
)65535;
711 summaryview
->color_dim
.red
= summaryview
->color_dim
.green
=
712 summaryview
->color_dim
.blue
= COLOR_DIM
;
714 folderview
->color_new
.red
= (guint16
)55000;
715 folderview
->color_new
.green
= folderview
->color_new
.blue
= 15000;
717 gtkut_convert_int_to_gdk_color(prefs_common
.tgt_folder_col
,
718 &folderview
->color_op
);
720 summaryview
->color_important
.red
= 0;
721 summaryview
->color_marked
.green
= 0;
722 summaryview
->color_important
.blue
= (guint16
)65535;
724 color
[0] = summaryview
->color_marked
;
725 color
[1] = summaryview
->color_dim
;
726 color
[2] = folderview
->color_new
;
727 color
[3] = folderview
->color_op
;
729 colormap
= gdk_window_get_colormap(window
->window
);
730 gdk_colormap_alloc_colors(colormap
, color
, 4, FALSE
, TRUE
, success
);
731 for (i
= 0; i
< 4; i
++) {
732 if (success
[i
] == FALSE
)
733 g_warning(_("MainWindow: color allocation %d failed\n"), i
);
736 debug_print(_("done.\n"));
738 main_window_set_widgets(mainwin
, type
);
741 ifactory
= gtk_item_factory_from_widget(menubar
);
742 menuitem
= gtk_item_factory_get_item
743 (ifactory
, "/View/Code set/Auto detect");
744 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem
), TRUE
);
746 switch (prefs_common
.toolbar_style
) {
748 menuitem
= gtk_item_factory_get_item
749 (ifactory
, "/View/Toolbar/None");
752 menuitem
= gtk_item_factory_get_item
753 (ifactory
, "/View/Toolbar/Icon");
756 menuitem
= gtk_item_factory_get_item
757 (ifactory
, "/View/Toolbar/Text");
760 menuitem
= gtk_item_factory_get_item
761 (ifactory
, "/View/Toolbar/Icon and text");
763 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem
), TRUE
);
765 gtk_widget_hide(mainwin
->hbox_stat
);
766 menuitem
= gtk_item_factory_get_item(ifactory
, "/View/Status bar");
767 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem
),
768 prefs_common
.show_statusbar
);
770 /* set the check of the SEPARATE_xxx menu items. we also need the main window
771 * as a property and pass the action type to the callback */
772 menuitem
= gtk_item_factory_get_widget_by_action(ifactory
, SEPARATE_ACTION
+ SEPARATE_FOLDER
);
774 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem
), type
& SEPARATE_FOLDER
);
775 gtk_object_set_data(GTK_OBJECT(menuitem
), "mainwindow", mainwin
);
776 gtk_signal_connect(GTK_OBJECT(menuitem
), "toggled", GTK_SIGNAL_FUNC(separate_widget_cb
),
777 GUINT_TO_POINTER(SEPARATE_FOLDER
));
779 menuitem
= gtk_item_factory_get_widget_by_action(ifactory
, SEPARATE_ACTION
+ SEPARATE_MESSAGE
);
781 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem
), type
& SEPARATE_MESSAGE
);
782 gtk_object_set_data(GTK_OBJECT(menuitem
), "mainwindow", mainwin
);
783 gtk_signal_connect(GTK_OBJECT(menuitem
), "toggled", GTK_SIGNAL_FUNC(separate_widget_cb
),
784 GUINT_TO_POINTER(SEPARATE_MESSAGE
));
787 menu_set_sensitive(ifactory
, "/Summary/Thread view",
788 prefs_common
.enable_thread
? FALSE
: TRUE
);
789 menu_set_sensitive(ifactory
, "/Summary/Unthread view",
790 prefs_common
.enable_thread
? TRUE
: FALSE
);
792 /*main_window_set_thread_option(mainwin);*/
795 /* set account selection menu */
796 ac_menu
= gtk_item_factory_get_widget
797 (ifactory
, "/Configuration/Change current account");
798 gtk_signal_connect(GTK_OBJECT(ac_menu
), "selection_done",
799 GTK_SIGNAL_FUNC(ac_menu_popup_closed
), mainwin
);
800 mainwin
->ac_menu
= ac_menu
;
802 main_window_set_toolbar_sensitive(mainwin
, FALSE
);
804 /* show main window */
805 gtk_widget_set_uposition(mainwin
->window
,
806 prefs_common
.mainwin_x
,
807 prefs_common
.mainwin_y
);
808 gtk_widget_set_usize(window
, prefs_common
.mainwin_width
,
809 prefs_common
.mainwin_height
);
810 gtk_widget_show(mainwin
->window
);
812 /* initialize views */
813 folderview_init(folderview
);
814 summary_init(summaryview
);
815 messageview_init(messageview
);
816 header_window_init(mainwin
->headerwin
);
817 log_window_init(mainwin
->logwin
);
819 mainwin
->lock_count
= 0;
820 mainwin
->cursor_count
= 0;
823 watch_cursor
= gdk_cursor_new(GDK_WATCH
);
825 mainwin_list
= g_list_append(mainwin_list
, mainwin
);
830 void main_window_cursor_wait(MainWindow
*mainwin
)
833 if (mainwin
->cursor_count
== 0)
834 gdk_window_set_cursor(mainwin
->window
->window
, watch_cursor
);
836 mainwin
->cursor_count
++;
841 void main_window_cursor_normal(MainWindow
*mainwin
)
843 if (mainwin
->cursor_count
)
844 mainwin
->cursor_count
--;
846 if (mainwin
->cursor_count
== 0)
847 gdk_window_set_cursor(mainwin
->window
->window
, NULL
);
852 /* lock / unlock the user-interface */
853 void main_window_lock(MainWindow
*mainwin
)
855 if (mainwin
->lock_count
== 0) {
856 gtk_widget_set_sensitive(mainwin
->toolbar
, FALSE
);
857 gtk_widget_set_sensitive(mainwin
->ac_button
, FALSE
);
860 mainwin
->lock_count
++;
862 main_window_set_menu_sensitive(mainwin
);
865 void main_window_unlock(MainWindow
*mainwin
)
867 if (mainwin
->lock_count
)
868 mainwin
->lock_count
--;
870 main_window_set_menu_sensitive(mainwin
);
872 if (mainwin
->lock_count
== 0) {
873 gtk_widget_set_sensitive(mainwin
->toolbar
, TRUE
);
874 gtk_widget_set_sensitive(mainwin
->ac_button
, TRUE
);
878 void main_window_reflect_prefs_all(void)
883 for (cur
= mainwin_list
; cur
!= NULL
; cur
= cur
->next
) {
884 mainwin
= (MainWindow
*)cur
->data
;
886 main_window_show_cur_account(mainwin
);
888 gtk_widget_set_sensitive(mainwin
->get_btn
, TRUE
);
889 gtk_widget_set_sensitive(mainwin
->getall_btn
, TRUE
);
891 gtk_widget_set_sensitive(mainwin
->get_btn
, FALSE
);
892 gtk_widget_set_sensitive(mainwin
->getall_btn
, FALSE
);
895 if (prefs_common
.immediate_exec
)
896 gtk_widget_hide(mainwin
->exec_btn
);
898 gtk_widget_show(mainwin
->exec_btn
);
900 summary_change_display_item(mainwin
->summaryview
);
901 summary_redisplay_msg(mainwin
->summaryview
);
902 headerview_set_visibility(mainwin
->messageview
->headerview
,
903 prefs_common
.display_header_pane
);
907 void main_window_set_account_menu(GList
*account_list
)
909 GList
*cur
, *cur_ac
, *cur_item
;
912 PrefsAccount
*ac_prefs
;
914 for (cur
= mainwin_list
; cur
!= NULL
; cur
= cur
->next
) {
915 mainwin
= (MainWindow
*)cur
->data
;
917 /* destroy all previous menu item */
918 cur_item
= GTK_MENU_SHELL(mainwin
->ac_menu
)->children
;
919 while (cur_item
!= NULL
) {
920 GList
*next
= cur_item
->next
;
921 gtk_widget_destroy(GTK_WIDGET(cur_item
->data
));
925 for (cur_ac
= account_list
; cur_ac
!= NULL
;
926 cur_ac
= cur_ac
->next
) {
927 ac_prefs
= (PrefsAccount
*)cur_ac
->data
;
929 menuitem
= gtk_menu_item_new_with_label
930 (ac_prefs
->account_name
931 ? ac_prefs
->account_name
: _("Untitled"));
932 gtk_widget_show(menuitem
);
933 gtk_menu_append(GTK_MENU(mainwin
->ac_menu
), menuitem
);
934 gtk_signal_connect(GTK_OBJECT(menuitem
), "activate",
935 GTK_SIGNAL_FUNC(account_menu_cb
),
941 static void main_window_show_cur_account(MainWindow
*mainwin
)
946 ac_name
= g_strdup(cur_account
947 ? (cur_account
->account_name
948 ? cur_account
->account_name
: _("Untitled"))
952 buf
= g_strdup_printf("%s - %s", ac_name
, PROG_VERSION
);
954 buf
= g_strdup(PROG_VERSION
);
955 gtk_window_set_title(GTK_WINDOW(mainwin
->window
), buf
);
958 buf
= g_strdup_printf(_("Current account: %s"), ac_name
);
959 gtk_label_set_text(GTK_LABEL(mainwin
->ac_label
), buf
);
960 gtk_widget_queue_resize(mainwin
->ac_button
);
966 void main_window_separation_change(MainWindow
*mainwin
, SeparateType type
)
968 GtkWidget
*folder_wid
= GTK_WIDGET_PTR(mainwin
->folderview
);
969 GtkWidget
*summary_wid
= GTK_WIDGET_PTR(mainwin
->summaryview
);
970 GtkWidget
*message_wid
= GTK_WIDGET_PTR(mainwin
->messageview
);
972 if (mainwin
->type
== type
) return;
974 /* remove widgets from those containers */
975 gtk_widget_ref(folder_wid
);
976 gtk_widget_ref(summary_wid
);
977 gtk_widget_ref(message_wid
);
979 (GTK_CONTAINER(folder_wid
->parent
), folder_wid
);
981 (GTK_CONTAINER(summary_wid
->parent
), summary_wid
);
983 (GTK_CONTAINER(message_wid
->parent
), message_wid
);
985 /* clean containers */
986 switch (mainwin
->type
) {
988 gtk_widget_destroy(mainwin
->win
.sep_none
.hpaned
);
990 case SEPARATE_FOLDER
:
991 gtk_widget_destroy(mainwin
->win
.sep_folder
.vpaned
);
992 gtk_widget_destroy(mainwin
->win
.sep_folder
.folderwin
);
994 case SEPARATE_MESSAGE
:
995 gtk_widget_destroy(mainwin
->win
.sep_message
.hpaned
);
996 gtk_widget_destroy(mainwin
->win
.sep_message
.messagewin
);
999 gtk_widget_destroy(mainwin
->win
.sep_both
.messagewin
);
1000 gtk_widget_destroy(mainwin
->win
.sep_both
.folderwin
);
1004 gtk_widget_hide(mainwin
->window
);
1005 main_window_set_widgets(mainwin
, type
);
1006 gtk_widget_show(mainwin
->window
);
1008 gtk_widget_unref(folder_wid
);
1009 gtk_widget_unref(summary_wid
);
1010 gtk_widget_unref(message_wid
);
1013 void main_window_get_size(MainWindow
*mainwin
)
1015 GtkAllocation
*allocation
;
1017 allocation
= &(GTK_WIDGET_PTR(mainwin
->summaryview
)->allocation
);
1019 prefs_common
.summaryview_width
= allocation
->width
;
1021 if (mainwin
->summaryview
->msg_is_toggled_on
)
1022 prefs_common
.summaryview_height
= allocation
->height
;
1024 prefs_common
.mainview_width
= allocation
->width
;
1026 allocation
= &mainwin
->window
->allocation
;
1028 prefs_common
.mainview_height
= allocation
->height
;
1029 prefs_common
.mainwin_width
= allocation
->width
;
1030 prefs_common
.mainwin_height
= allocation
->height
;
1032 allocation
= &(GTK_WIDGET_PTR(mainwin
->folderview
)->allocation
);
1034 prefs_common
.folderview_width
= allocation
->width
;
1035 prefs_common
.folderview_height
= allocation
->height
;
1038 void main_window_get_position(MainWindow
*mainwin
)
1042 gtkut_widget_get_uposition(mainwin
->window
, &x
, &y
);
1044 prefs_common
.mainview_x
= x
;
1045 prefs_common
.mainview_y
= y
;
1046 prefs_common
.mainwin_x
= x
;
1047 prefs_common
.mainwin_y
= y
;
1049 debug_print(_("window position: x = %d, y = %d\n"), x
, y
);
1052 void main_window_empty_trash(MainWindow
*mainwin
, gboolean confirm
)
1057 if (alertpanel(_("Empty trash"),
1058 _("Empty all messages in trash?"),
1059 _("Yes"), _("No"), NULL
) != G_ALERTDEFAULT
)
1061 manage_window_focus_in(mainwin
->window
, NULL
, NULL
);
1064 procmsg_empty_trash();
1066 for (list
= folder_get_list(); list
!= NULL
; list
= list
->next
) {
1069 folder
= list
->data
;
1070 if (folder
->trash
) {
1071 folder_item_scan(folder
->trash
);
1072 folderview_update_item(folder
->trash
, TRUE
);
1076 if (mainwin
->summaryview
->folder_item
&&
1077 mainwin
->summaryview
->folder_item
->stype
== F_TRASH
)
1078 gtk_widget_grab_focus(mainwin
->folderview
->ctree
);
1081 void main_window_add_mailbox(MainWindow
*mainwin
)
1086 path
= input_dialog(_("Add mailbox"),
1087 _("Input the location of mailbox.\n"
1088 "If the existing mailbox is specified, it will be\n"
1089 "scanned automatically."),
1092 if (folder_find_from_path(path
)) {
1093 alertpanel_error(_("The mailbox `%s' already exists."), path
);
1097 if (!strcmp(path
, "Mail"))
1098 folder
= folder_new(F_MH
, _("Mailbox"), path
);
1100 folder
= folder_new(F_MH
, g_basename(path
), path
);
1103 if (folder
->create_tree(folder
) < 0) {
1104 alertpanel_error(_("Creation of the mailbox failed.\n"
1105 "Maybe some files already exist, or you don't have the permission to write there."));
1106 folder_destroy(folder
);
1111 folder_set_ui_func(folder
, scan_tree_func
, mainwin
);
1112 folder
->scan_tree(folder
);
1113 folder_set_ui_func(folder
, NULL
, NULL
);
1115 folderview_set(mainwin
->folderview
);
1118 void main_window_add_mbox(MainWindow
*mainwin
)
1124 path
= input_dialog(_("Add mbox mailbox"),
1125 _("Input the location of mailbox."),
1130 if (folder_find_from_path(path
)) {
1131 alertpanel_error(_("The mailbox `%s' already exists."), path
);
1137 if (!strcmp(path, "Mail"))
1138 folder = folder_new(F_MBOX, _("Mailbox"), path);
1142 folder
= folder_new(F_MBOX
, g_basename(path
), path
);
1145 if (folder
->create_tree(folder
) < 0) {
1146 alertpanel_error(_("Creation of the mailbox failed."));
1147 folder_destroy(folder
);
1153 item
= folder_item_new(folder
->name
, NULL
);
1154 item
->folder
= folder
;
1155 folder
->node
= g_node_new(item
);
1157 folder
->create_folder(folder
, item
, "inbox");
1158 folder
->create_folder(folder
, item
, "outbox");
1159 folder
->create_folder(folder
, item
, "queue");
1160 folder
->create_folder(folder
, item
, "draft");
1161 folder
->create_folder(folder
, item
, "trash");
1163 folderview_set(mainwin
->folderview
);
1166 void main_window_set_toolbar_sensitive(MainWindow
*mainwin
, gboolean sensitive
)
1168 gtk_widget_set_sensitive(mainwin
->reply_btn
, sensitive
);
1169 gtk_widget_set_sensitive(mainwin
->replyall_btn
, sensitive
);
1170 gtk_widget_set_sensitive(mainwin
->replysender_btn
, sensitive
);
1171 gtk_widget_set_sensitive(mainwin
->fwd_btn
, sensitive
);
1172 gtk_widget_set_sensitive(mainwin
->exec_btn
, sensitive
);
1173 gtk_widget_set_sensitive(mainwin
->next_btn
, sensitive
);
1175 if (!mainwin
->summaryview
->folder_item
||
1176 mainwin
->summaryview
->folder_item
->folder
->type
== F_NEWS
)
1177 gtk_widget_set_sensitive(mainwin
->delete_btn
, FALSE
);
1179 gtk_widget_set_sensitive(mainwin
->delete_btn
, sensitive
);
1184 M_UNLOCKED
= 1 << 0,
1185 M_MSG_EXIST
= 1 << 1,
1186 M_TARGET_EXIST
= 1 << 2,
1187 M_SINGLE_TARGET_EXIST
= 1 << 3,
1189 M_ALLOW_REEDIT
= 1 << 5
1190 } MenuItemSensitiveCond
;
1192 void main_window_set_menu_sensitive(MainWindow
*mainwin
)
1194 GtkItemFactory
*ifactory
;
1195 SummarySelection selection
;
1196 MenuItemSensitiveCond state
= 0;
1200 static const struct {
1202 MenuItemSensitiveCond cond
;
1204 {"/File/Add mailbox..." , M_UNLOCKED
},
1205 {"/File/Update folder tree" , M_UNLOCKED
},
1206 {"/File/Folder" , M_UNLOCKED
},
1207 {"/File/Import mbox file..." , M_UNLOCKED
},
1208 {"/File/Export to mbox file...", M_UNLOCKED
},
1209 {"/File/Empty trash" , M_UNLOCKED
},
1210 {"/File/Save as...", M_SINGLE_TARGET_EXIST
|M_UNLOCKED
},
1211 {"/File/Print..." , M_TARGET_EXIST
|M_UNLOCKED
},
1212 {"/File/Close", M_UNLOCKED
},
1213 {"/File/Exit" , M_UNLOCKED
},
1215 {"/Message/Get new mail" , M_UNLOCKED
},
1216 {"/Message/Get from all accounts", M_UNLOCKED
},
1217 {"/Message/Reply" , M_SINGLE_TARGET_EXIST
},
1218 {"/Message/Reply to sender" , M_SINGLE_TARGET_EXIST
},
1219 {"/Message/Reply to all" , M_SINGLE_TARGET_EXIST
},
1220 {"/Message/Forward" , M_SINGLE_TARGET_EXIST
},
1221 {"/Message/Forward as attachment", M_SINGLE_TARGET_EXIST
},
1222 {"/Message/Open in new window" , M_SINGLE_TARGET_EXIST
},
1223 {"/Message/Show all header" , M_SINGLE_TARGET_EXIST
},
1224 {"/Message/View source" , M_SINGLE_TARGET_EXIST
},
1225 {"/Message/Move...", M_TARGET_EXIST
|M_EXEC
|M_UNLOCKED
},
1226 {"/Message/Copy...", M_TARGET_EXIST
|M_EXEC
|M_UNLOCKED
},
1227 {"/Message/Delete" , M_TARGET_EXIST
|M_EXEC
|M_UNLOCKED
},
1228 {"/Message/Mark" , M_TARGET_EXIST
},
1229 {"/Message/Re-edit", M_ALLOW_REEDIT
},
1231 {"/Summary/Delete duplicated messages", M_MSG_EXIST
|M_EXEC
|M_UNLOCKED
},
1232 {"/Summary/Filter messages", M_MSG_EXIST
|M_EXEC
|M_UNLOCKED
},
1233 {"/Summary/Execute" , M_MSG_EXIST
|M_UNLOCKED
},
1234 {"/Summary/Prev message" , M_MSG_EXIST
},
1235 {"/Summary/Next message" , M_MSG_EXIST
},
1236 {"/Summary/Next unread message", M_MSG_EXIST
},
1237 {"/Summary/Sort" , M_MSG_EXIST
},
1239 {"/Configuration", M_UNLOCKED
},
1244 ifactory
= gtk_item_factory_from_widget(mainwin
->menubar
);
1245 selection
= summary_get_selection_type(mainwin
->summaryview
);
1247 if (mainwin
->lock_count
== 0)
1248 state
|= M_UNLOCKED
;
1249 if (selection
!= SUMMARY_NONE
)
1250 state
|= M_MSG_EXIST
;
1251 if (selection
== SUMMARY_SELECTED_SINGLE
||
1252 selection
== SUMMARY_SELECTED_MULTIPLE
)
1253 state
|= M_TARGET_EXIST
;
1254 if (selection
== SUMMARY_SELECTED_SINGLE
)
1255 state
|= M_SINGLE_TARGET_EXIST
;
1256 if (mainwin
->summaryview
->folder_item
&&
1257 mainwin
->summaryview
->folder_item
->folder
->type
!= F_NEWS
)
1259 if (selection
== SUMMARY_SELECTED_SINGLE
&&
1260 (mainwin
->summaryview
->folder_item
&&
1261 mainwin
->summaryview
->folder_item
->stype
== F_DRAFT
))
1262 state
|= M_ALLOW_REEDIT
;
1264 for (i
= 0; entry
[i
].entry
!= NULL
; i
++) {
1265 sensitive
= ((entry
[i
].cond
& state
) == entry
[i
].cond
);
1266 menu_set_sensitive(ifactory
, entry
[i
].entry
, sensitive
);
1270 void main_window_popup(MainWindow
*mainwin
)
1276 gdk_window_get_origin(mainwin
->window
->window
, &x
, &y
);
1277 sx
= gdk_screen_width();
1278 sy
= gdk_screen_height();
1279 x
%= sx
; if (x
< 0) x
+= sx
;
1280 y
%= sy
; if (y
< 0) y
+= sy
;
1281 gdk_window_move(mainwin
->window
->window
, x
, y
);
1282 gdk_window_raise(mainwin
->window
->window
);
1283 gdk_window_show(mainwin
->window
->window
);
1285 debug_print("window position: x = %d, y = %d\n", x
, y
);
1287 switch (mainwin
->type
) {
1288 case SEPARATE_FOLDER
:
1289 widget
= mainwin
->win
.sep_folder
.folderwin
;
1290 gdk_window_get_origin(widget
->window
, &x
, &y
);
1291 x
%= sx
; if (x
< 0) x
+= sx
;
1292 y
%= sy
; if (y
< 0) y
+= sy
;
1293 gdk_window_move(widget
->window
, x
, y
);
1294 gdk_window_raise(widget
->window
);
1296 case SEPARATE_MESSAGE
:
1297 widget
= mainwin
->win
.sep_message
.messagewin
;
1298 gdk_window_get_origin(widget
->window
, &x
, &y
);
1299 x
%= sx
; if (x
< 0) x
+= sx
;
1300 y
%= sy
; if (y
< 0) y
+= sy
;
1301 gdk_window_move(widget
->window
, x
, y
);
1302 gdk_window_raise(widget
->window
);
1305 widget
= mainwin
->win
.sep_both
.folderwin
;
1306 gdk_window_get_origin(widget
->window
, &x
, &y
);
1307 x
%= sx
; if (x
< 0) x
+= sx
;
1308 y
%= sy
; if (y
< 0) y
+= sy
;
1309 gdk_window_move(widget
->window
, x
, y
);
1310 gdk_window_raise(widget
->window
);
1311 widget
= mainwin
->win
.sep_both
.messagewin
;
1312 gdk_window_get_origin(widget
->window
, &x
, &y
);
1313 x
%= sx
; if (x
< 0) x
+= sx
;
1314 y
%= sy
; if (y
< 0) y
+= sy
;
1315 gdk_window_move(widget
->window
, x
, y
);
1316 gdk_window_raise(widget
->window
);
1323 static void main_window_set_widgets(MainWindow
*mainwin
, SeparateType type
)
1325 GtkWidget
*folderwin
= NULL
;
1326 GtkWidget
*messagewin
= NULL
;
1329 GtkWidget
*vbox_body
= mainwin
->vbox_body
;
1331 debug_print(_("Setting widgets..."));
1333 /* create separated window(s) if needed */
1334 if (type
& SEPARATE_FOLDER
) {
1335 folderwin
= gtk_window_new(GTK_WINDOW_TOPLEVEL
);
1336 gtk_window_set_policy(GTK_WINDOW(folderwin
),
1338 gtk_widget_set_usize(folderwin
, -1,
1339 prefs_common
.mainview_height
);
1340 gtk_container_set_border_width(GTK_CONTAINER(folderwin
),
1342 gtk_signal_connect(GTK_OBJECT(folderwin
), "delete_event",
1343 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete
),
1346 if (type
& SEPARATE_MESSAGE
) {
1347 messagewin
= gtk_window_new(GTK_WINDOW_TOPLEVEL
);
1348 gtk_window_set_policy(GTK_WINDOW(messagewin
),
1350 gtk_widget_set_usize
1351 (messagewin
, prefs_common
.mainview_width
,
1352 prefs_common
.mainview_height
1353 - prefs_common
.summaryview_height
1354 + DEFAULT_HEADERVIEW_HEIGHT
);
1355 gtk_container_set_border_width(GTK_CONTAINER(messagewin
),
1357 gtk_signal_connect(GTK_OBJECT(messagewin
), "delete_event",
1358 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete
),
1364 hpaned
= gtk_hpaned_new();
1365 gtk_widget_show(hpaned
);
1366 gtk_box_pack_start(GTK_BOX(vbox_body
), hpaned
, TRUE
, TRUE
, 0);
1367 gtk_paned_add1(GTK_PANED(hpaned
),
1368 GTK_WIDGET_PTR(mainwin
->folderview
));
1370 vpaned
= gtk_vpaned_new();
1371 if (mainwin
->summaryview
->msg_is_toggled_on
) {
1372 gtk_paned_add2(GTK_PANED(hpaned
), vpaned
);
1373 gtk_paned_add1(GTK_PANED(vpaned
),
1374 GTK_WIDGET_PTR(mainwin
->summaryview
));
1376 gtk_paned_add2(GTK_PANED(hpaned
),
1377 GTK_WIDGET_PTR(mainwin
->summaryview
));
1378 gtk_widget_ref(vpaned
);
1380 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin
->summaryview
),
1381 prefs_common
.summaryview_width
,
1382 prefs_common
.summaryview_height
);
1383 gtk_paned_add2(GTK_PANED(vpaned
),
1384 GTK_WIDGET_PTR(mainwin
->messageview
));
1385 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin
->messageview
),
1386 prefs_common
.mainview_width
, -1);
1387 gtk_widget_set_usize(mainwin
->window
,
1388 prefs_common
.folderview_width
+
1389 prefs_common
.mainview_width
,
1390 prefs_common
.mainwin_height
);
1391 gtk_widget_show_all(vpaned
);
1393 mainwin
->win
.sep_none
.hpaned
= hpaned
;
1394 mainwin
->win
.sep_none
.vpaned
= vpaned
;
1396 case SEPARATE_FOLDER
:
1397 vpaned
= gtk_vpaned_new();
1398 if (mainwin
->summaryview
->msg_is_toggled_on
) {
1399 gtk_box_pack_start(GTK_BOX(vbox_body
), vpaned
,
1401 gtk_paned_add1(GTK_PANED(vpaned
),
1402 GTK_WIDGET_PTR(mainwin
->summaryview
));
1404 gtk_box_pack_start(GTK_BOX(vbox_body
),
1405 GTK_WIDGET_PTR(mainwin
->summaryview
),
1407 gtk_widget_ref(vpaned
);
1409 gtk_paned_add2(GTK_PANED(vpaned
),
1410 GTK_WIDGET_PTR(mainwin
->messageview
));
1411 gtk_widget_show_all(vpaned
);
1412 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin
->summaryview
),
1413 prefs_common
.summaryview_width
,
1414 prefs_common
.summaryview_height
);
1415 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin
->messageview
),
1416 prefs_common
.mainview_width
, -1);
1417 gtk_widget_set_usize(mainwin
->window
,
1418 prefs_common
.mainview_width
,
1419 prefs_common
.mainview_height
);
1421 gtk_container_add(GTK_CONTAINER(folderwin
),
1422 GTK_WIDGET_PTR(mainwin
->folderview
));
1424 mainwin
->win
.sep_folder
.folderwin
= folderwin
;
1425 mainwin
->win
.sep_folder
.vpaned
= vpaned
;
1427 gtk_widget_show_all(folderwin
);
1429 case SEPARATE_MESSAGE
:
1430 hpaned
= gtk_hpaned_new();
1431 gtk_box_pack_start(GTK_BOX(vbox_body
), hpaned
, TRUE
, TRUE
, 0);
1433 gtk_paned_add1(GTK_PANED(hpaned
),
1434 GTK_WIDGET_PTR(mainwin
->folderview
));
1435 gtk_paned_add2(GTK_PANED(hpaned
),
1436 GTK_WIDGET_PTR(mainwin
->summaryview
));
1437 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin
->summaryview
),
1438 prefs_common
.summaryview_width
,
1439 prefs_common
.summaryview_height
);
1440 gtk_widget_set_usize(mainwin
->window
,
1441 prefs_common
.folderview_width
+
1442 prefs_common
.mainview_width
,
1443 prefs_common
.mainwin_height
);
1444 gtk_widget_show_all(hpaned
);
1445 gtk_container_add(GTK_CONTAINER(messagewin
),
1446 GTK_WIDGET_PTR(mainwin
->messageview
));
1448 mainwin
->win
.sep_message
.messagewin
= messagewin
;
1449 mainwin
->win
.sep_message
.hpaned
= hpaned
;
1451 gtk_widget_show_all(messagewin
);
1454 gtk_box_pack_start(GTK_BOX(vbox_body
),
1455 GTK_WIDGET_PTR(mainwin
->summaryview
),
1457 gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin
->summaryview
),
1458 prefs_common
.summaryview_width
,
1459 prefs_common
.summaryview_height
);
1460 gtk_widget_set_usize(mainwin
->window
,
1461 prefs_common
.mainview_width
,
1462 prefs_common
.mainwin_height
);
1463 gtk_container_add(GTK_CONTAINER(folderwin
),
1464 GTK_WIDGET_PTR(mainwin
->folderview
));
1465 gtk_container_add(GTK_CONTAINER(messagewin
),
1466 GTK_WIDGET_PTR(mainwin
->messageview
));
1468 mainwin
->win
.sep_both
.folderwin
= folderwin
;
1469 mainwin
->win
.sep_both
.messagewin
= messagewin
;
1471 gtk_widget_show_all(folderwin
);
1472 gtk_widget_show_all(messagewin
);
1476 mainwin
->type
= type
;
1478 debug_print(_("done.\n"));
1481 #include "pixmaps/stock_mail_receive.xpm"
1482 #include "pixmaps/stock_mail_receive_all.xpm"
1483 #include "pixmaps/stock_mail_compose.xpm"
1484 #include "pixmaps/stock_news_compose.xpm"
1485 #include "pixmaps/stock_mail_reply.xpm"
1486 #include "pixmaps/stock_mail_reply_to_all.xpm"
1487 #include "pixmaps/stock_mail_reply_to_author.xpm"
1488 #include "pixmaps/stock_mail_forward.xpm"
1489 #include "pixmaps/stock_mail_send.xpm"
1490 #include "pixmaps/stock_preferences.xpm"
1491 #include "pixmaps/stock_properties.xpm"
1492 #include "pixmaps/stock_down_arrow.xpm"
1493 #include "pixmaps/stock_close.xpm"
1494 #include "pixmaps/stock_exec.xpm"
1496 #define CREATE_TOOLBAR_ICON(xpm_d) \
1498 icon = gdk_pixmap_create_from_xpm_d(container->window, &mask, \
1499 &container->style->white, \
1501 icon_wid = gtk_pixmap_new(icon, mask); \
1504 static void main_window_toolbar_create(MainWindow
*mainwin
,
1505 GtkWidget
*container
)
1510 GtkWidget
*icon_wid
;
1512 GtkWidget
*getall_btn
;
1513 GtkWidget
*compose_mail_btn
;
1514 GtkWidget
*compose_news_btn
;
1515 GtkWidget
*compose_mail_btn_plain
;
1516 GtkWidget
*compose_news_btn_plain
;
1517 GtkWidget
*reply_btn
;
1518 GtkWidget
*replyall_btn
;
1519 GtkWidget
*replysender_btn
;
1521 GtkWidget
*send_btn
;
1523 GtkWidget *prefs_btn;
1524 GtkWidget *account_btn;
1526 GtkWidget
*next_btn
;
1527 GtkWidget
*delete_btn
;
1528 GtkWidget
*exec_btn
;
1529 GtkWidget
*compose_type_btn
;
1530 GtkWidget
*compose_type_arrow
;
1531 GtkWidget
*compose_box
;
1532 GtkWidget
*compose_label
;
1533 GtkTooltips
*tooltips
;
1535 toolbar
= gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL
,
1537 gtk_container_add(GTK_CONTAINER(container
), toolbar
);
1538 gtk_container_set_border_width(GTK_CONTAINER(container
), 2);
1539 gtk_toolbar_set_button_relief(GTK_TOOLBAR(toolbar
), GTK_RELIEF_NONE
);
1540 gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar
),
1541 GTK_TOOLBAR_SPACE_LINE
);
1543 CREATE_TOOLBAR_ICON(stock_mail_receive_xpm
);
1544 get_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1546 _("Get new mail from current account"),
1548 icon_wid
, toolbar_inc_cb
, mainwin
);
1549 CREATE_TOOLBAR_ICON(stock_mail_receive_all_xpm
);
1550 getall_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1552 _("Get new mail from all accounts"),
1558 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar
));
1560 CREATE_TOOLBAR_ICON(stock_mail_send_xpm
);
1561 send_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1563 _("Send queued message(s)"),
1569 /* to implement Leandro's "combined" compose buttons, we create
1570 * two sets of compose buttons, one for normal (text + icon)
1571 * toolbar, and one for both text-only and icon-only toolbar;
1572 * we switch between those sets. */
1574 /* insert compose mail button widget */
1576 compose_mail_btn
= gtk_button_new();
1577 gtk_widget_show(compose_mail_btn
);
1578 tooltips
= gtk_tooltips_new();
1579 gtk_tooltips_set_tip(tooltips
, compose_mail_btn
,
1580 _("Compose email message"),
1582 compose_box
= gtk_vbox_new(0, 0);
1583 gtk_widget_show(compose_box
);
1585 gtk_container_add(GTK_CONTAINER(compose_mail_btn
), compose_box
);
1586 CREATE_TOOLBAR_ICON(stock_mail_compose_xpm
);
1587 gtk_box_pack_start(GTK_BOX(compose_box
), icon_wid
, FALSE
, FALSE
, 0);
1589 compose_label
= gtk_label_new(_("Email"));
1590 gtk_widget_show(compose_label
);
1591 gtk_box_pack_start(GTK_BOX(compose_box
), compose_label
, FALSE
, FALSE
, 0);
1593 GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(compose_mail_btn
), GTK_CAN_FOCUS
);
1594 gtk_button_set_relief(GTK_BUTTON(compose_mail_btn
), GTK_RELIEF_NONE
);
1595 gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar
), compose_mail_btn
,
1598 /* insert compose news button widget */
1600 compose_news_btn
= gtk_button_new();
1601 gtk_widget_show(compose_news_btn
);
1602 tooltips
= gtk_tooltips_new();
1603 gtk_tooltips_set_tip(tooltips
, compose_news_btn
,
1604 _("Compose news article"),
1606 compose_box
= gtk_vbox_new(0, 0);
1607 gtk_widget_show(compose_box
);
1609 gtk_container_add(GTK_CONTAINER(compose_news_btn
), compose_box
);
1610 CREATE_TOOLBAR_ICON(stock_news_compose_xpm
);
1611 gtk_box_pack_start(GTK_BOX(compose_box
), icon_wid
, FALSE
, FALSE
, 0);
1613 compose_label
= gtk_label_new(_("News"));
1614 gtk_widget_show(compose_label
);
1615 gtk_box_pack_start(GTK_BOX(compose_box
), compose_label
, FALSE
, FALSE
, 0);
1617 GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(compose_news_btn
), GTK_CAN_FOCUS
);
1618 gtk_button_set_relief(GTK_BUTTON(compose_news_btn
), GTK_RELIEF_NONE
);
1619 gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar
), compose_news_btn
,
1622 /* insert compose btn plain */
1624 CREATE_TOOLBAR_ICON(stock_mail_compose_xpm
);
1625 compose_mail_btn_plain
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1627 _("Compose an email message"),
1630 toolbar_compose_mail_cb
,
1633 /* insert compose btn plain */
1635 CREATE_TOOLBAR_ICON(stock_news_compose_xpm
);
1636 compose_news_btn_plain
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1638 _("Compose a news message"),
1641 toolbar_compose_news_cb
,
1644 /* insert compose button type widget */
1646 compose_type_btn
= gtk_button_new();
1647 gtk_widget_show(compose_type_btn
);
1649 compose_type_arrow
= gtk_arrow_new(GTK_ARROW_DOWN
, GTK_SHADOW_OUT
);
1650 gtk_widget_show(compose_type_arrow
);
1652 gtk_container_add(GTK_CONTAINER(compose_type_btn
), compose_type_arrow
);
1654 GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(compose_type_btn
), GTK_CAN_FOCUS
);
1655 gtk_button_set_relief(GTK_BUTTON(compose_type_btn
), GTK_RELIEF_NONE
);
1657 gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar
), compose_type_btn
,
1660 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar
));
1662 CREATE_TOOLBAR_ICON(stock_mail_reply_xpm
);
1663 reply_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1665 _("Reply to the message"),
1670 CREATE_TOOLBAR_ICON(stock_mail_reply_to_all_xpm
);
1671 replyall_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1676 toolbar_reply_to_all_cb
,
1678 CREATE_TOOLBAR_ICON(stock_mail_reply_to_author_xpm
);
1679 replysender_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1681 _("Reply to sender"),
1684 toolbar_reply_to_sender_cb
,
1686 CREATE_TOOLBAR_ICON(stock_mail_forward_xpm
);
1687 fwd_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1689 _("Forward the message"),
1695 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar
));
1697 CREATE_TOOLBAR_ICON(stock_close_xpm
);
1698 delete_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1700 _("Delete the message"),
1706 CREATE_TOOLBAR_ICON(stock_exec_xpm
);
1707 exec_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1709 _("Execute marked process"),
1715 CREATE_TOOLBAR_ICON(stock_down_arrow_xpm
);
1716 next_btn
= gtk_toolbar_append_item(GTK_TOOLBAR(toolbar
),
1718 _("Next unread message"),
1721 toolbar_next_unread_cb
,
1725 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
1727 CREATE_TOOLBAR_ICON(stock_preferences_xpm);
1728 prefs_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1730 _("Common preference"),
1735 CREATE_TOOLBAR_ICON(stock_properties_xpm);
1736 account_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
1738 _("Account setting"),
1743 gtk_signal_connect(GTK_OBJECT(account_btn), "button_press_event",
1744 GTK_SIGNAL_FUNC(toolbar_account_button_pressed),
1748 gtk_signal_connect(GTK_OBJECT(compose_type_btn
), "clicked",
1749 GTK_SIGNAL_FUNC(toolbar_popup_compose_type_cb
),
1752 gtk_signal_connect(GTK_OBJECT(compose_mail_btn
), "clicked",
1753 GTK_SIGNAL_FUNC(toolbar_compose_mail_cb
),
1756 gtk_signal_connect(GTK_OBJECT(compose_news_btn
), "clicked",
1757 GTK_SIGNAL_FUNC(toolbar_compose_news_cb
),
1760 mainwin
->toolbar
= toolbar
;
1761 mainwin
->get_btn
= get_btn
;
1762 mainwin
->getall_btn
= getall_btn
;
1763 mainwin
->compose_mail_btn
= compose_mail_btn
;
1764 mainwin
->compose_news_btn
= compose_news_btn
;
1765 mainwin
->compose_mail_btn_plain
= compose_mail_btn_plain
;
1766 mainwin
->compose_news_btn_plain
= compose_news_btn_plain
;
1767 mainwin
->reply_btn
= reply_btn
;
1768 mainwin
->replyall_btn
= replyall_btn
;
1769 mainwin
->replysender_btn
= replysender_btn
;
1770 mainwin
->fwd_btn
= fwd_btn
;
1771 mainwin
->send_btn
= send_btn
;
1773 mainwin->prefs_btn = prefs_btn;
1774 mainwin->account_btn = account_btn;
1776 mainwin
->next_btn
= next_btn
;
1777 mainwin
->delete_btn
= delete_btn
;
1778 mainwin
->exec_btn
= exec_btn
;
1780 gtk_widget_show_all(toolbar
);
1782 /* activate Leandro menu system */
1783 activate_compose_button(mainwin
,
1784 prefs_common
.toolbar_style
,
1785 mainwin
->compose_btn_type
);
1788 /* callback functions */
1790 static void toolbar_popup_compose_type_cb (GtkWidget
*widget
,
1793 MainWindow
*mainwindow
= (MainWindow
*) data
;
1794 GtkWidget
*compose_menu
, *compose_item
;
1796 g_return_if_fail(mainwindow
!= NULL
);
1798 compose_menu
= gtk_menu_new();
1800 compose_item
= gtk_menu_item_new_with_label(_("Email message"));
1801 gtk_widget_show(compose_item
);
1802 gtk_menu_append(GTK_MENU(compose_menu
), compose_item
);
1803 gtk_signal_connect(GTK_OBJECT(compose_item
), "activate",
1804 GTK_SIGNAL_FUNC(toolbar_popup_compose_type_set
),
1806 gtk_object_set_data(GTK_OBJECT(compose_item
), "entry", GINT_TO_POINTER(COMPOSEBUTTON_MAIL
));
1808 compose_item
= gtk_menu_item_new_with_label(_("News article"));
1809 gtk_widget_show(compose_item
);
1810 gtk_menu_append(GTK_MENU(compose_menu
), compose_item
);
1811 gtk_signal_connect(GTK_OBJECT(compose_item
), "activate",
1812 GTK_SIGNAL_FUNC(toolbar_popup_compose_type_set
),
1814 gtk_object_set_data(GTK_OBJECT(compose_item
), "entry", GINT_TO_POINTER(COMPOSEBUTTON_NEWS
));
1816 gtk_menu_popup(GTK_MENU(compose_menu
), NULL
, NULL
, NULL
,
1820 static void toolbar_popup_compose_type_set(GtkWidget
*widget
, gpointer data
)
1822 ComposeButtonType compose_type
= GPOINTER_TO_INT( gtk_object_get_data(GTK_OBJECT(widget
), "entry") );
1823 MainWindow
*mainwindow
= (MainWindow
*) data
;
1825 mainwindow
->compose_btn_type
= compose_type
;
1827 activate_compose_button(mainwindow
, prefs_common
.toolbar_style
, mainwindow
->compose_btn_type
);
1830 static void toolbar_inc_cb (GtkWidget
*widget
,
1833 MainWindow
*mainwin
= (MainWindow
*)data
;
1835 inc_mail_cb(mainwin
, 0, NULL
);
1838 static void toolbar_inc_all_cb (GtkWidget
*widget
,
1841 MainWindow
*mainwin
= (MainWindow
*)data
;
1843 inc_all_account_mail_cb(mainwin
, 0, NULL
);
1846 static void toolbar_send_cb (GtkWidget
*widget
,
1849 MainWindow
*mainwin
= (MainWindow
*)data
;
1851 send_queue_cb(mainwin
, 0, NULL
);
1854 static void toolbar_compose_cb (GtkWidget
*widget
,
1857 MainWindow
*mainwin
= (MainWindow
*)data
;
1859 if (mainwin
->compose_btn_type
== COMPOSEBUTTON_MAIL
)
1860 compose_cb(mainwin
, 0, NULL
);
1862 compose_news_cb(mainwin
, 0, NULL
);
1865 static void toolbar_compose_news_cb (GtkWidget
*widget
,
1868 MainWindow
*mainwin
= (MainWindow
*)data
;
1870 compose_news_cb(mainwin
, 0, NULL
);
1873 static void toolbar_compose_mail_cb (GtkWidget
*widget
,
1876 MainWindow
*mainwin
= (MainWindow
*)data
;
1878 compose_mail_cb(mainwin
, 0, NULL
);
1881 static void toolbar_reply_cb (GtkWidget
*widget
,
1884 MainWindow
*mainwin
= (MainWindow
*)data
;
1886 reply_cb(mainwin
, COMPOSE_REPLY
, NULL
);
1889 static void toolbar_reply_to_all_cb (GtkWidget
*widget
,
1892 MainWindow
*mainwin
= (MainWindow
*)data
;
1894 reply_cb(mainwin
, COMPOSE_REPLY_TO_ALL
, NULL
);
1897 static void toolbar_reply_to_sender_cb (GtkWidget
*widget
,
1900 MainWindow
*mainwin
= (MainWindow
*)data
;
1902 reply_cb(mainwin
, COMPOSE_REPLY_TO_SENDER
, NULL
);
1905 static void toolbar_forward_cb (GtkWidget
*widget
,
1908 MainWindow
*mainwin
= (MainWindow
*)data
;
1910 if (prefs_common
.forward_as_attachment
)
1911 reply_cb(mainwin
, COMPOSE_FORWARD_AS_ATTACH
, NULL
);
1913 reply_cb(mainwin
, COMPOSE_FORWARD
, NULL
);
1916 static void toolbar_delete_cb (GtkWidget
*widget
,
1919 MainWindow
*mainwin
= (MainWindow
*)data
;
1921 summary_delete(mainwin
->summaryview
);
1924 static void toolbar_exec_cb (GtkWidget
*widget
,
1927 MainWindow
*mainwin
= (MainWindow
*)data
;
1929 summary_execute(mainwin
->summaryview
);
1932 static void toolbar_next_unread_cb (GtkWidget
*widget
,
1935 MainWindow
*mainwin
= (MainWindow
*)data
;
1937 next_unread_cb(mainwin
, 0, NULL
);
1940 static void toolbar_prefs_cb (GtkWidget
*widget
,
1943 prefs_common_open();
1946 static void toolbar_account_cb (GtkWidget
*widget
,
1949 MainWindow
*mainwin
= (MainWindow
*)data
;
1951 prefs_account_open_cb(mainwin
, 0, NULL
);
1954 static void toolbar_account_button_pressed(GtkWidget
*widget
,
1955 GdkEventButton
*event
,
1958 MainWindow
*mainwin
= (MainWindow
*)data
;
1961 if (event
->button
!= 3) return;
1963 gtk_button_set_relief(GTK_BUTTON(widget
), GTK_RELIEF_NORMAL
);
1964 gtk_object_set_data(GTK_OBJECT(mainwin
->ac_menu
), "menu_button",
1967 gtk_menu_popup(GTK_MENU(mainwin
->ac_menu
), NULL
, NULL
,
1968 menu_button_position
, widget
,
1969 event
->button
, event
->time
);
1972 static void ac_label_button_pressed(GtkWidget
*widget
, GdkEventButton
*event
,
1975 MainWindow
*mainwin
= (MainWindow
*)data
;
1979 gtk_button_set_relief(GTK_BUTTON(widget
), GTK_RELIEF_NORMAL
);
1980 gtk_object_set_data(GTK_OBJECT(mainwin
->ac_menu
), "menu_button",
1983 gtk_menu_popup(GTK_MENU(mainwin
->ac_menu
), NULL
, NULL
,
1984 menu_button_position
, widget
,
1985 event
->button
, event
->time
);
1988 static void ac_menu_popup_closed(GtkMenuShell
*menu_shell
, gpointer data
)
1990 MainWindow
*mainwin
= (MainWindow
*)data
;
1993 button
= gtk_object_get_data(GTK_OBJECT(menu_shell
), "menu_button");
1994 gtk_button_set_relief(GTK_BUTTON(button
), GTK_RELIEF_NONE
);
1995 gtk_object_remove_data(GTK_OBJECT(mainwin
->ac_menu
), "menu_button");
1998 static gint
main_window_close_cb(GtkWidget
*widget
, GdkEventAny
*event
,
2001 app_exit_cb(data
, 0, widget
);
2006 static void add_mailbox_cb(MainWindow
*mainwin
, guint action
,
2009 main_window_add_mailbox(mainwin
);
2012 static void add_mbox_cb(MainWindow
*mainwin
, guint action
,
2015 main_window_add_mbox(mainwin
);
2018 static void update_folderview_cb(MainWindow
*mainwin
, guint action
,
2021 summary_show(mainwin
->summaryview
, NULL
, FALSE
);
2022 folderview_update_all();
2025 static void new_folder_cb(MainWindow
*mainwin
, guint action
,
2028 folderview_new_folder(mainwin
->folderview
);
2031 static void rename_folder_cb(MainWindow
*mainwin
, guint action
,
2034 folderview_rename_folder(mainwin
->folderview
);
2037 static void delete_folder_cb(MainWindow
*mainwin
, guint action
,
2040 folderview_delete_folder(mainwin
->folderview
);
2043 static void import_mbox_cb(MainWindow
*mainwin
, guint action
,
2046 import_mbox(mainwin
->summaryview
->folder_item
);
2049 static void export_mbox_cb(MainWindow
*mainwin
, guint action
,
2052 export_mbox(mainwin
->summaryview
->folder_item
);
2055 static void empty_trash_cb(MainWindow
*mainwin
, guint action
,
2058 main_window_empty_trash(mainwin
, TRUE
);
2061 static void save_as_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2063 summary_save_as(mainwin
->summaryview
);
2066 static void print_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2068 summary_print(mainwin
->summaryview
);
2071 static void app_exit_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2073 if (prefs_common
.confirm_on_exit
) {
2074 if (alertpanel(_("Exit"), _("Exit this program?"),
2075 _("OK"), _("Cancel"), NULL
) != G_ALERTDEFAULT
)
2077 manage_window_focus_in(mainwin
->window
, NULL
, NULL
);
2080 app_will_exit(widget
, mainwin
);
2083 static void toggle_folder_cb(MainWindow
*mainwin
, guint action
,
2086 switch (mainwin
->type
) {
2088 case SEPARATE_MESSAGE
:
2090 case SEPARATE_FOLDER
:
2091 if (GTK_CHECK_MENU_ITEM(widget
)->active
)
2092 gtk_widget_show(mainwin
->win
.sep_folder
.folderwin
);
2094 gtk_widget_hide(mainwin
->win
.sep_folder
.folderwin
);
2097 if (GTK_CHECK_MENU_ITEM(widget
)->active
)
2098 gtk_widget_show(mainwin
->win
.sep_both
.folderwin
);
2100 gtk_widget_hide(mainwin
->win
.sep_both
.folderwin
);
2105 static void toggle_message_cb(MainWindow
*mainwin
, guint action
,
2108 switch (mainwin
->type
) {
2110 case SEPARATE_FOLDER
:
2112 case SEPARATE_MESSAGE
:
2113 if (GTK_CHECK_MENU_ITEM(widget
)->active
)
2114 gtk_widget_show(mainwin
->win
.sep_message
.messagewin
);
2116 gtk_widget_hide(mainwin
->win
.sep_message
.messagewin
);
2119 if (GTK_CHECK_MENU_ITEM(widget
)->active
)
2120 gtk_widget_show(mainwin
->win
.sep_both
.messagewin
);
2122 gtk_widget_hide(mainwin
->win
.sep_both
.messagewin
);
2127 static void toggle_toolbar_cb(MainWindow
*mainwin
, guint action
,
2130 activate_compose_button(mainwin
, (ToolbarStyle
)action
,
2131 mainwin
->compose_btn_type
);
2133 switch ((ToolbarStyle
)action
) {
2135 gtk_widget_hide(mainwin
->handlebox
);
2137 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin
->toolbar
),
2141 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin
->toolbar
),
2145 gtk_toolbar_set_style(GTK_TOOLBAR(mainwin
->toolbar
),
2150 if (action
!= TOOLBAR_NONE
) {
2151 gtk_widget_show(mainwin
->handlebox
);
2152 gtk_widget_queue_resize(mainwin
->handlebox
);
2155 mainwin
->toolbar_style
= (ToolbarStyle
)action
;
2156 prefs_common
.toolbar_style
= (ToolbarStyle
)action
;
2159 static void toggle_statusbar_cb(MainWindow
*mainwin
, guint action
,
2162 if (GTK_CHECK_MENU_ITEM(widget
)->active
) {
2163 gtk_widget_show(mainwin
->hbox_stat
);
2164 prefs_common
.show_statusbar
= TRUE
;
2166 gtk_widget_hide(mainwin
->hbox_stat
);
2167 prefs_common
.show_statusbar
= FALSE
;
2171 static void separate_widget_cb(GtkCheckMenuItem
*checkitem
, guint action
, GtkWidget
*widget
)
2174 MainWindow
*mainwin
;
2177 mainwin
= (MainWindow
*) gtk_object_get_data(GTK_OBJECT(checkitem
), "mainwindow");
2178 g_return_if_fail(mainwin
!= NULL
);
2180 type
= mainwin
->type
^ action
;
2181 main_window_separation_change(mainwin
, type
);
2183 prefs_common
.sep_folder
= (type
& SEPARATE_FOLDER
) != 0;
2184 prefs_common
.sep_msg
= (type
& SEPARATE_MESSAGE
) != 0;
2187 static void addressbook_open_cb(MainWindow
*mainwin
, guint action
,
2190 addressbook_open(NULL
);
2193 static void log_window_show_cb(MainWindow
*mainwin
, guint action
,
2196 log_window_show(mainwin
->logwin
);
2199 static void inc_mail_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2204 static void inc_all_account_mail_cb(MainWindow
*mainwin
, guint action
,
2207 inc_all_account_mail(mainwin
);
2210 static void send_queue_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2214 if (procmsg_send_queue() < 0)
2215 alertpanel_error(_("Sending queued message failed."));
2217 statusbar_pop_all();
2219 for (list
= folder_get_list(); list
!= NULL
; list
= list
->next
) {
2222 folder
= list
->data
;
2223 if (folder
->queue
) {
2224 folder_item_scan(folder
->queue
);
2225 folderview_update_item(folder
->queue
, TRUE
);
2230 static void compose_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2232 if (mainwin
->summaryview
->folder_item
) {
2233 if (mainwin
->summaryview
->folder_item
->folder
->account
!= NULL
2234 && mainwin
->summaryview
->folder_item
->folder
->account
->protocol
== A_NNTP
)
2235 compose_new_with_recipient(mainwin
->summaryview
->folder_item
->folder
->account
, mainwin
->summaryview
->folder_item
->path
);
2237 compose_new_with_folderitem(mainwin
->summaryview
->folder_item
->folder
->account
, mainwin
->summaryview
->folder_item
);
2243 static void compose_mail_cb(MainWindow
*mainwin
, guint action
,
2250 if (mainwin
->summaryview
->folder_item
) {
2251 ac
= mainwin
->summaryview
->folder_item
->folder
->account
;
2252 if (ac
&& ac
->protocol
!= A_NNTP
) {
2253 compose_new_with_folderitem(ac
, mainwin
->summaryview
->folder_item
);
2258 if(cur_account
&& (cur_account
->protocol
!= A_NNTP
)) {
2259 compose_new_with_folderitem(cur_account
, mainwin
->summaryview
->folder_item
);
2263 list
= account_get_list();
2264 for(cur
= list
; cur
!= NULL
; cur
= g_list_next(cur
)) {
2265 ac
= (PrefsAccount
*) cur
->data
;
2266 if (ac
->protocol
!= A_NNTP
) {
2267 compose_new_with_folderitem(ac
, mainwin
->summaryview
->folder_item
);
2273 static void compose_news_cb(MainWindow
*mainwin
, guint action
,
2276 PrefsAccount
* ac
= NULL
;
2280 if (mainwin
->summaryview
->folder_item
) {
2281 ac
= mainwin
->summaryview
->folder_item
->folder
->account
;
2282 if (ac
&& ac
->protocol
== A_NNTP
) {
2283 compose_new_with_recipient
2284 (ac
, mainwin
->summaryview
->folder_item
->path
);
2289 list
= account_get_list();
2290 for(cur
= list
; cur
!= NULL
; cur
= g_list_next(cur
)) {
2291 ac
= (PrefsAccount
*) cur
->data
;
2292 if (ac
->protocol
== A_NNTP
) {
2299 static void reply_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2301 GList
*sel
= GTK_CLIST(mainwin
->summaryview
->ctree
)->selection
;
2304 msginfo
= gtk_ctree_node_get_row_data
2305 (GTK_CTREE(mainwin
->summaryview
->ctree
),
2306 mainwin
->summaryview
->selected
);
2308 if (!msginfo
) return;
2312 compose_reply(msginfo
, prefs_common
.reply_with_quote
,
2315 case COMPOSE_REPLY_TO_SENDER
:
2316 compose_reply(msginfo
, prefs_common
.reply_with_quote
,
2319 case COMPOSE_FOLLOWUP_AND_REPLY_TO
:
2320 compose_followup_and_reply_to(msginfo
,
2321 prefs_common
.reply_with_quote
,
2324 case COMPOSE_REPLY_TO_ALL
:
2325 compose_reply(msginfo
, prefs_common
.reply_with_quote
,
2328 case COMPOSE_FORWARD
:
2330 compose_forward(NULL
, msginfo
, FALSE
);
2333 /* if (sel->next) FALL_THROUGH */
2334 case COMPOSE_FORWARD_AS_ATTACH
:
2336 GSList
*msginfo_list
= NULL
;
2337 for ( ; sel
!= NULL
; sel
= sel
->next
)
2338 msginfo_list
= g_slist_append(msginfo_list
,
2339 gtk_ctree_node_get_row_data(GTK_CTREE(mainwin
->summaryview
->ctree
),
2340 GTK_CTREE_NODE(sel
->data
)));
2341 compose_forward_multiple(NULL
, msginfo_list
);
2342 g_slist_free(msginfo_list
);
2346 g_warning("reply_cb(): invalid action type: %d\n", action
);
2349 summary_set_marks_selected(mainwin
->summaryview
);
2352 static void move_to_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2354 summary_move_to(mainwin
->summaryview
);
2357 static void copy_to_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2359 summary_copy_to(mainwin
->summaryview
);
2362 static void delete_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2364 summary_delete(mainwin
->summaryview
);
2367 static void open_msg_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2369 summary_open_msg(mainwin
->summaryview
);
2372 static void view_source_cb(MainWindow
*mainwin
, guint action
,
2375 summary_view_source(mainwin
->summaryview
);
2378 static void reedit_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2380 summary_reedit(mainwin
->summaryview
);
2383 static void mark_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2385 summary_mark(mainwin
->summaryview
);
2388 static void unmark_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2390 summary_unmark(mainwin
->summaryview
);
2393 static void mark_as_unread_cb(MainWindow
*mainwin
, guint action
,
2396 summary_mark_as_unread(mainwin
->summaryview
);
2399 static void mark_as_read_cb(MainWindow
*mainwin
, guint action
,
2402 summary_mark_as_read(mainwin
->summaryview
);
2405 static void set_charset_cb(MainWindow
*mainwin
, guint action
,
2410 str
= conv_get_charset_str((CharSet
)action
);
2411 g_free(prefs_common
.force_charset
);
2412 prefs_common
.force_charset
= str
? g_strdup(str
) : NULL
;
2414 summary_redisplay_msg(mainwin
->summaryview
);
2416 debug_print(_("forced charset: %s\n"), str
? str
: "Auto-Detect");
2419 /*void main_window_set_thread_option(MainWindow *mainwin)
2421 GtkItemFactory *ifactory;
2422 gboolean no_item = FALSE;
2424 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
2426 if (mainwin->summaryview == NULL)
2428 else if (mainwin->summaryview->folder_item == NULL)
2432 menu_set_sensitive(ifactory, "/Summary/Thread view", FALSE);
2433 menu_set_sensitive(ifactory, "/Summary/Unthread view", FALSE);
2436 if (mainwin->summaryview->folder_item->prefs->enable_thread) {
2437 menu_set_sensitive(ifactory,
2438 "/Summary/Thread view", FALSE);
2439 menu_set_sensitive(ifactory,
2440 "/Summary/Unthread view", TRUE);
2441 summary_thread_build(mainwin->summaryview, TRUE);
2444 menu_set_sensitive(ifactory,
2445 "/Summary/Thread view", TRUE);
2446 menu_set_sensitive(ifactory,
2447 "/Summary/Unthread view", FALSE);
2448 summary_unthread(mainwin->summaryview);
2450 prefs_folder_item_save_config(mainwin->summaryview->folder_item);
2454 static void thread_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2456 /*mainwin->summaryview->folder_item->prefs->enable_thread =
2457 !mainwin->summaryview->folder_item->prefs->enable_thread;
2458 main_window_set_thread_option(mainwin);
2461 GtkItemFactory
*ifactory
;
2463 ifactory
= gtk_item_factory_from_widget(widget
);
2466 summary_thread_build(mainwin
->summaryview
, FALSE
);
2467 prefs_common
.enable_thread
= TRUE
;
2468 menu_set_sensitive(ifactory
, "/Summary/Thread view", FALSE
);
2469 menu_set_sensitive(ifactory
, "/Summary/Unthread view", TRUE
);
2471 summary_unthread(mainwin
->summaryview
);
2472 prefs_common
.enable_thread
= FALSE
;
2473 menu_set_sensitive(ifactory
, "/Summary/Thread view", TRUE
);
2474 menu_set_sensitive(ifactory
, "/Summary/Unthread view", FALSE
);
2478 static void set_display_item_cb(MainWindow
*mainwin
, guint action
,
2481 prefs_summary_display_item_set();
2484 static void sort_summary_cb(MainWindow
*mainwin
, guint action
,
2487 summary_sort(mainwin
->summaryview
, (SummarySortType
)action
);
2490 static void attract_by_subject_cb(MainWindow
*mainwin
, guint action
,
2493 summary_attract_by_subject(mainwin
->summaryview
);
2496 static void delete_duplicated_cb(MainWindow
*mainwin
, guint action
,
2499 summary_delete_duplicated(mainwin
->summaryview
);
2502 static void filter_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2504 summary_filter(mainwin
->summaryview
);
2507 static void execute_summary_cb(MainWindow
*mainwin
, guint action
,
2510 summary_execute(mainwin
->summaryview
);
2513 static void update_summary_cb(MainWindow
*mainwin
, guint action
,
2517 FolderView
*folderview
= mainwin
->folderview
;
2519 if (!mainwin
->summaryview
->folder_item
) return;
2520 if (!folderview
->opened
) return;
2522 folder_update_op_count();
2524 fitem
= gtk_ctree_node_get_row_data(GTK_CTREE(folderview
->ctree
),
2525 folderview
->opened
);
2528 summary_show(mainwin
->summaryview
, fitem
, TRUE
);
2531 static void prev_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2533 summary_step(mainwin
->summaryview
, GTK_SCROLL_STEP_BACKWARD
);
2536 static void next_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2538 summary_step(mainwin
->summaryview
, GTK_SCROLL_STEP_FORWARD
);
2541 static void next_unread_cb(MainWindow
*mainwin
, guint action
,
2544 summary_select_next_unread(mainwin
->summaryview
);
2547 static void next_marked_cb(MainWindow
*mainwin
, guint action
,
2550 summary_select_next_marked(mainwin
->summaryview
);
2553 static void prev_marked_cb(MainWindow
*mainwin
, guint action
,
2556 summary_select_prev_marked(mainwin
->summaryview
);
2559 static void goto_folder_cb(MainWindow
*mainwin
, guint action
,
2562 FolderItem
*to_folder
;
2564 to_folder
= foldersel_folder_sel(NULL
, NULL
);
2567 folderview_select(mainwin
->folderview
, to_folder
);
2570 static void copy_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2572 messageview_copy_clipboard(mainwin
->messageview
);
2575 static void allsel_cb(MainWindow
*mainwin
, guint action
, GtkWidget
*widget
)
2577 if (GTK_WIDGET_HAS_FOCUS(mainwin
->summaryview
->ctree
))
2578 summary_select_all(mainwin
->summaryview
);
2579 else if (mainwin
->summaryview
->msg_is_toggled_on
&&
2580 GTK_WIDGET_HAS_FOCUS(mainwin
->messageview
->textview
->text
))
2581 messageview_select_all(mainwin
->messageview
);
2584 static void prefs_common_open_cb(MainWindow
*mainwin
, guint action
,
2587 prefs_common_open();
2590 static void prefs_filter_open_cb(MainWindow
*mainwin
, guint action
,
2593 prefs_filter_open();
2596 static void prefs_scoring_open_cb(MainWindow
*mainwin
, guint action
,
2599 prefs_scoring_open(NULL
);
2602 static void prefs_filtering_open_cb(MainWindow
*mainwin
, guint action
,
2605 prefs_filtering_open();
2608 static void prefs_account_open_cb(MainWindow
*mainwin
, guint action
,
2612 new_account_cb(mainwin
, 0, widget
);
2614 gboolean prev_default
= cur_account
->is_default
;
2616 prefs_account_open(cur_account
);
2617 if (!prev_default
&& cur_account
->is_default
)
2618 account_set_as_default(cur_account
);
2619 account_save_config_all();
2621 main_window_reflect_prefs_all();
2625 static void new_account_cb(MainWindow
*mainwin
, guint action
,
2628 account_edit_open();
2629 if (!compose_get_compose_list()) account_add();
2632 static void account_menu_cb(GtkMenuItem
*menuitem
, gpointer data
)
2634 cur_account
= (PrefsAccount
*)data
;
2635 main_window_reflect_prefs_all();
2638 static void manual_open_cb(MainWindow
*mainwin
, guint action
,
2641 manual_open((ManualLang
)action
);
2644 static void scan_tree_func(Folder
*folder
, FolderItem
*item
, gpointer data
)
2646 MainWindow
*mainwin
= (MainWindow
*)data
;
2650 str
= g_strdup_printf(_("Scanning folder %s%c%s ..."),
2651 LOCAL_FOLDER(folder
)->rootpath
,
2655 str
= g_strdup_printf(_("Scanning folder %s ..."),
2656 LOCAL_FOLDER(folder
)->rootpath
);
2658 STATUSBAR_PUSH(mainwin
, str
);
2659 STATUSBAR_POP(mainwin
);
2663 static void activate_compose_button (MainWindow
*mainwin
,
2665 ComposeButtonType type
)
2667 if (style
== TOOLBAR_NONE
)
2670 if (style
== TOOLBAR_BOTH
) {
2671 gtk_widget_hide(mainwin
->compose_mail_btn_plain
);
2672 gtk_widget_hide(mainwin
->compose_news_btn_plain
);
2673 gtk_widget_hide(type
== COMPOSEBUTTON_NEWS
? mainwin
->compose_mail_btn
2674 : mainwin
->compose_news_btn
);
2675 gtk_widget_show(type
== COMPOSEBUTTON_NEWS
? mainwin
->compose_news_btn
2676 : mainwin
->compose_mail_btn
);
2677 mainwin
->compose_btn_type
= type
;
2680 gtk_widget_hide(mainwin
->compose_news_btn
);
2681 gtk_widget_hide(mainwin
->compose_mail_btn
);
2682 gtk_widget_hide(type
== COMPOSEBUTTON_NEWS
? mainwin
->compose_mail_btn_plain
2683 : mainwin
->compose_news_btn_plain
);
2684 gtk_widget_show(type
== COMPOSEBUTTON_NEWS
? mainwin
->compose_news_btn_plain
2685 : mainwin
->compose_mail_btn_plain
);
2686 mainwin
->compose_btn_type
= type
;
2690 static void prefs_templates_open_cb(MainWindow
*mainwin
, guint action
,
2693 prefs_templates_open();