2 Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
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 3 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, see <http://www.gnu.org/licenses/>.
22 #include <glib/gi18n.h>
23 #include <gdk/gdkkeysyms.h>
28 #include "mainwindow.h"
29 #include "folderview.h"
30 #include "foldersel.h"
31 #include "summaryview.h"
32 #include "summary_search.h"
33 #include "messageview.h"
34 #include "message_search.h"
35 #include "headerview.h"
37 #include "stock_pixmap.h"
46 #include "prefs_common.h"
47 #include "prefs_actions.h"
48 #include "prefs_filtering.h"
49 #include "prefs_account.h"
50 #include "prefs_summary_column.h"
51 #include "prefs_folder_column.h"
52 #include "prefs_template.h"
55 #include "addressbook.h"
56 #include "logwindow.h"
57 #include "manage_window.h"
58 #include "alertpanel.h"
59 #include "statusbar.h"
60 #include "inputdialog.h"
67 #include "ssl_manager.h"
68 #include "sslcertwindow.h"
69 #include "prefs_gtk.h"
70 #include "pluginwindow.h"
72 #include "progressindicator.h"
73 #include "localfolder.h"
74 #include "filtering.h"
75 #include "folderutils.h"
76 #include "foldersort.h"
77 #include "icon_legend.h"
78 #include "colorlabel.h"
88 #define AC_LABEL_WIDTH 240
90 /* list of all instantiated MainWindow */
91 static GList *mainwin_list = NULL;
93 static GdkCursor *watch_cursor = NULL;
94 static GdkCursor *hand_cursor = NULL;
96 static gint iconified_count = 0;
98 static void main_window_menu_callback_block (MainWindow *mainwin);
99 static void main_window_menu_callback_unblock (MainWindow *mainwin);
101 static void main_window_show_cur_account (MainWindow *mainwin);
103 static void main_window_separation_change (MainWindow *mainwin,
104 LayoutType layout_mode);
106 static void main_window_set_widgets (MainWindow *mainwin,
107 LayoutType layout_mode);
109 static void toolbar_child_attached (GtkWidget *widget,
112 static void toolbar_child_detached (GtkWidget *widget,
116 static gboolean ac_label_button_pressed (GtkWidget *widget,
117 GdkEventButton *event,
120 static gint main_window_close_cb (GtkWidget *widget,
124 static void main_window_size_allocate_cb (GtkWidget *widget,
125 GtkAllocation *allocation,
127 static void folder_window_size_allocate_cb (GtkWidget *widget,
128 GtkAllocation *allocation,
130 static void message_window_size_allocate_cb (GtkWidget *widget,
131 GtkAllocation *allocation,
134 static void update_folderview_cb (GtkAction *action,
136 static void add_mailbox_cb (GtkAction *action,
138 static void foldersort_cb (GtkAction *action,
140 static void import_mbox_cb (GtkAction *action,
142 static void export_mbox_cb (GtkAction *action,
144 static void export_list_mbox_cb (GtkAction *action,
146 static void empty_trash_cb (GtkAction *action,
148 static void save_as_cb (GtkAction *action,
150 static void page_setup_cb (GtkAction *action,
152 static void print_cb (GtkAction *action,
154 static void app_exit_cb (GtkAction *action,
158 static void search_cb (GtkAction *action,
160 static void search_folder_cb (GtkAction *action,
163 static void toggle_message_cb (GtkAction *action,
165 static void toggle_toolbar_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
166 static void toggle_col_headers_cb(GtkAction *action,
169 static void toggle_statusbar_cb (GtkAction *action,
171 static void set_layout_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
173 static void addressbook_open_cb (GtkAction *action,
175 static void log_window_show_cb (GtkAction *action,
177 static void filtering_debug_window_show_cb (GtkAction *action,
180 static void inc_cancel_cb (GtkAction *action,
183 static void open_msg_cb (GtkAction *action,
186 static void view_source_cb (GtkAction *action,
189 static void show_all_header_cb (GtkAction *action,
191 static void toggle_fullscreen_cb (GtkAction *action,
194 static void hide_quotes_cb(GtkAction *action,
197 static void move_to_cb (GtkAction *action,
199 static void copy_to_cb (GtkAction *action,
201 static void delete_cb (GtkAction *action,
203 static void delete_trash_cb (GtkAction *action,
206 static void cancel_cb (GtkAction *action,
209 static void mark_cb (GtkAction *action,
211 static void unmark_cb (GtkAction *action,
214 static void mark_as_unread_cb (GtkAction *action,
216 static void mark_as_read_cb (GtkAction *action,
218 static void mark_all_read_cb (GtkAction *action,
220 static void mark_as_spam_cb (GtkAction *action,
222 static void mark_as_ham_cb (GtkAction *action,
225 static void ignore_thread_cb (GtkAction *action,
227 static void unignore_thread_cb (GtkAction *action,
229 static void watch_thread_cb (GtkAction *action,
231 static void unwatch_thread_cb (GtkAction *action,
233 static void lock_msgs_cb (GtkAction *action,
235 static void unlock_msgs_cb (GtkAction *action,
238 static void reedit_cb (GtkAction *action,
241 static void add_address_cb (GtkAction *action,
244 static void set_charset_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
246 static void set_decode_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
248 static void hide_read_messages (GtkAction *action,
250 static void hide_read_threads (GtkAction *action,
252 static void hide_del_messages (GtkAction *action,
255 static void thread_cb (GtkAction *action,
257 static void expand_threads_cb (GtkAction *action,
259 static void collapse_threads_cb (GtkAction *action,
262 static void set_summary_display_item_cb (GtkAction *action,
264 static void set_folder_display_item_cb (GtkAction *action,
266 static void sort_summary_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
267 static void sort_summary_type_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
268 static void attract_by_subject_cb(GtkAction *action,
271 static void delete_duplicated_cb (GtkAction *action,
273 static void delete_duplicated_all_cb (GtkAction *action,
275 static void filter_cb (GtkAction *action,
277 static void filter_list_cb (GtkAction *action,
279 static void process_cb (GtkAction *action,
281 static void execute_summary_cb (GtkAction *action,
283 static void expunge_summary_cb (GtkAction *action,
285 static void update_summary_cb (GtkAction *action,
288 static void prev_cb (GtkAction *action,
290 static void next_cb (GtkAction *action,
292 static void next_unread_cb (GtkAction *action,
294 static void prev_unread_cb (GtkAction *action,
297 static void prev_new_cb (GtkAction *action,
299 static void next_new_cb (GtkAction *action,
301 static void prev_marked_cb (GtkAction *action,
303 static void next_marked_cb (GtkAction *action,
305 static void prev_labeled_cb (GtkAction *action,
307 static void next_labeled_cb (GtkAction *action,
309 static void last_read_cb (GtkAction *action,
311 static void parent_cb (GtkAction *action,
314 static void goto_folder_cb (GtkAction *action,
316 static void goto_unread_folder_cb(GtkAction *action,
319 static void scroll_prev_line_cb (GtkAction *action,
321 static void scroll_next_line_cb (GtkAction *action,
323 static void scroll_prev_page_cb (GtkAction *action,
325 static void scroll_next_page_cb (GtkAction *action,
328 static void copy_cb (GtkAction *action,
330 static void allsel_cb (GtkAction *action,
332 static void select_thread_cb (GtkAction *action,
334 static void delete_thread_cb (GtkAction *action,
337 static void create_filter_cb (GtkAction *action,
339 static void create_processing_cb (GtkAction *action,
341 static void open_urls_cb (GtkAction *action,
344 static void prefs_template_open_cb (GtkAction *action,
346 static void prefs_actions_open_cb (GtkAction *action,
348 static void prefs_tags_open_cb (GtkAction *action,
350 static void prefs_account_open_cb (GtkAction *action,
353 static void prefs_pre_processing_open_cb (GtkAction *action,
356 static void prefs_post_processing_open_cb (GtkAction *action,
359 static void prefs_filtering_open_cb (GtkAction *action,
362 static void ssl_manager_open_cb (GtkAction *action,
365 static void new_account_cb (GtkAction *action,
368 static void account_selector_menu_cb (GtkMenuItem *menuitem,
370 static void account_receive_menu_cb (GtkMenuItem *menuitem,
373 static void account_compose_menu_cb (GtkMenuItem *menuitem,
376 static void prefs_open_cb (GtkAction *action,
378 static void plugins_open_cb (GtkAction *action,
381 static void online_switch_clicked(GtkButton *btn,
384 static void manual_open_cb (GtkAction *action,
386 static void manual_faq_open_cb (GtkAction *action,
389 static void legend_open_cb (GtkAction *action,
393 static void set_default_client_cb (GtkAction *action,
397 static void scan_tree_func (Folder *folder,
401 static void toggle_work_offline_cb(GtkAction *action,
404 static void addr_harvest_cb ( GtkAction *action,
407 static void addr_harvest_msg_cb ( GtkAction *action,
409 static void sync_cb ( GtkAction *action,
412 static void forget_session_passwords_cb (GtkAction *action,
415 static gboolean mainwindow_focus_in_event (GtkWidget *widget,
416 GdkEventFocus *focus,
418 static gboolean mainwindow_visibility_event_cb (GtkWidget *widget,
419 GdkEventVisibility *state,
421 static gboolean mainwindow_state_event_cb (GtkWidget *widget,
422 GdkEventWindowState *state,
424 static void main_window_reply_cb (GtkAction *action,
426 static gboolean mainwindow_progressindicator_hook (gpointer source,
429 static gint mailing_list_create_submenu(MainWindow *mainwindow,
432 static gint mailing_list_populate_submenu(GtkWidget *menu, const gchar * list_header);
434 static void get_url_part(const gchar **buf, gchar *url_decoded, gint maxlen);
436 static void mailing_list_compose(GtkWidget *w, gpointer *data);
438 static void mailing_list_open_uri(GtkWidget *w, gpointer *data);
439 #define SEPARATE_ACTION 500
440 static void mainwindow_quicksearch (GtkAction *action,
442 static gboolean any_folder_want_synchronise(void);
444 #define DO_ACTION(name, act) { if (!strcmp(a_name, name)) action = act; }
446 static void mainwindow_nothing_cb (GtkAction *action, gpointer data)
451 static void about_cb(GtkAction *gaction, gpointer data)
456 static void mw_inc_mail_cb (GtkAction *gaction, gpointer data)
458 inc_mail_cb(data, 0, NULL);
460 static void mw_inc_all_account_mail_cb (GtkAction *gaction, gpointer data)
462 inc_all_account_mail_cb(data, 0, NULL);
464 static void mw_send_queue_cb (GtkAction *gaction, gpointer data)
466 send_queue_cb(data, 0, NULL);
468 static void mw_compose_mail_cb (GtkAction *gaction, gpointer data)
470 compose_mail_cb(data, 0, NULL);
472 static void mw_compose_news_cb (GtkAction *gaction, gpointer data)
474 compose_news_cb(data, 0, NULL);
477 static GtkActionEntry mainwin_entries[] =
479 {"Menu", NULL, "Menu" },
481 {"File", NULL, N_("_File") },
482 {"Edit", NULL, N_("_Edit") },
483 {"View", NULL, N_("_View") },
484 {"Message", NULL, N_("_Message") },
485 {"Tools", NULL, N_("_Tools") },
486 {"Configuration", NULL, N_("_Configuration") },
487 {"Help", NULL, N_("_Help") },
490 {"File/AddMailbox", NULL, N_("_Add mailbox") },
491 {"File/AddMailbox/MH", NULL, N_("MH..."), NULL, NULL, G_CALLBACK(add_mailbox_cb) },
492 {"File/---", NULL, "---" },
494 {"File/SortMailboxes", NULL, N_("Change mailbox order..."), NULL, NULL, G_CALLBACK(foldersort_cb) },
496 /* {"File/---", NULL, "---" }, */
497 {"File/ImportMbox", NULL, N_("_Import mbox file..."), NULL, NULL, G_CALLBACK(import_mbox_cb) },
498 {"File/ExportMbox", NULL, N_("_Export to mbox file..."), NULL, NULL, G_CALLBACK(export_mbox_cb) },
499 {"File/ExportSelMbox", NULL, N_("_Export selected to mbox file..."), NULL, NULL, G_CALLBACK(export_list_mbox_cb) },
500 /* {"File/---", NULL, "---" }, */
501 {"File/EmptyTrashes", NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
502 /* {"File/---", NULL, "---" }, */
504 {"File/SaveAs", NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
506 {"File/PageSetup", NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
507 {"File/Print", NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
508 /* {"File/---", NULL, "---" }, */
509 {"File/SynchroniseFolders", NULL, N_("Synchronise folders"), "<control><shift>S", NULL, G_CALLBACK(sync_cb) },
510 /* {"File/---", NULL, "---" }, */
511 {"File/Exit", NULL, N_("E_xit"), "<control>Q", NULL, G_CALLBACK(app_exit_cb) },
514 {"Edit/Copy", NULL, N_("_Copy"), "<control>C", NULL, G_CALLBACK(copy_cb) },
515 {"Edit/SelectAll", NULL, N_("Select _all"), "<control>A", NULL, G_CALLBACK(allsel_cb) },
516 {"Edit/SelectThread", NULL, N_("Select _thread"), NULL, NULL, G_CALLBACK(select_thread_cb) },
517 {"Edit/DeleteThread", NULL, N_("_Delete thread"), NULL, NULL, G_CALLBACK(delete_thread_cb) },
518 {"Edit/---", NULL, "---" },
519 {"Edit/Find", NULL, N_("_Find in current message..."), "<control>F", NULL, G_CALLBACK(search_cb) },
520 {"Edit/SearchFolder", NULL, N_("_Search folder..."), "<shift><control>F", NULL, G_CALLBACK(search_folder_cb) },
521 {"Edit/QuickSearch", NULL, N_("_Quick search"), "slash", NULL, G_CALLBACK(mainwindow_quicksearch) },
524 {"View/ShowHide", NULL, N_("Show or hi_de") },
525 {"View/ShowHide/Toolbar", NULL, N_("_Toolbar") },
527 {"View/SetColumns", NULL, N_("Set displayed _columns") },
528 {"View/SetColumns/Folderlist", NULL, N_("in _Folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
529 {"View/SetColumns/Messagelist", NULL, N_("in _Message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
530 {"View/---", NULL, "---" },
534 {"View/Layout", NULL, N_("La_yout") },
537 {"View/Sort", NULL, N_("_Sort") },
538 {"View/Sort/---", NULL, "---" },
539 {"View/Sort/AttractSubj", NULL, N_("_Attract by subject"), NULL, NULL, G_CALLBACK(attract_by_subject_cb) },
541 {"View/ExpandThreads", NULL, N_("E_xpand all threads"), NULL, NULL, G_CALLBACK(expand_threads_cb) },
542 {"View/CollapseThreads", NULL, N_("Co_llapse all threads"), NULL, NULL, G_CALLBACK(collapse_threads_cb) },
544 {"View/Goto", NULL, N_("_Go to") },
545 {"View/Goto/Prev", NULL, N_("_Previous message"), "P", NULL, G_CALLBACK(prev_cb) },
546 {"View/Goto/Next", NULL, N_("_Next message"), "N", NULL, G_CALLBACK(next_cb) },
547 {"View/Goto/---", NULL, "---", NULL, NULL, NULL },
548 {"View/Goto/PrevUnread", NULL, N_("P_revious unread message"), "<shift>P", NULL, G_CALLBACK(prev_unread_cb) },
549 {"View/Goto/NextUnread", NULL, N_("N_ext unread message"), "<shift>N", NULL, G_CALLBACK(next_unread_cb) },
550 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
551 {"View/Goto/PrevNew", NULL, N_("Previous ne_w message"), NULL, NULL, G_CALLBACK(prev_new_cb) },
552 {"View/Goto/NextNew", NULL, N_("Ne_xt new message"), NULL, NULL, G_CALLBACK(next_new_cb) },
553 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
554 {"View/Goto/PrevMarked", NULL, N_("Previous _marked message"), NULL, NULL, G_CALLBACK(prev_marked_cb) },
555 {"View/Goto/NextMarked", NULL, N_("Next m_arked message"), NULL, NULL, G_CALLBACK(next_marked_cb) },
556 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
557 {"View/Goto/PrevLabeled", NULL, N_("Previous _labeled message"), NULL, NULL, G_CALLBACK(prev_labeled_cb) },
558 {"View/Goto/NextLabeled", NULL, N_("Next la_beled message"), NULL, NULL, G_CALLBACK(next_labeled_cb) },
559 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
560 {"View/Goto/LastRead", NULL, N_("Last read message"), NULL, NULL, G_CALLBACK(last_read_cb) },
561 {"View/Goto/ParentMessage", NULL, N_("Parent message"), "<control>Up", NULL, G_CALLBACK(parent_cb) },
562 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
563 {"View/Goto/NextUnreadFolder", NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
564 {"View/Goto/OtherFolder", NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
566 /* {"View/Scroll/---", NULL, "---", NULL, NULL, NULL }, */
567 {"View/Scroll", NULL, N_("Message scroll") },
568 {"View/Scroll/PrevLine", NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
569 {"View/Scroll/NextLine", NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
570 {"View/Scroll/PrevPage", NULL, N_("Previous page"), NULL, NULL, G_CALLBACK(scroll_prev_page_cb) },
571 {"View/Scroll/NextPage", NULL, N_("Next page"), NULL, NULL, G_CALLBACK(scroll_next_page_cb) },
573 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
574 {"View/Encoding", NULL, N_("Character _encoding") }, /* set_charset_cb */
575 {"View/Encoding/---", NULL, "---" },
576 #define ENC_ACTION(cs_char,c_char,string) \
577 { "View/Encoding/" cs_char, NULL, N_(string), NULL, NULL, c_char }
579 {"View/Encoding/Western", NULL, N_("Western European") },
580 {"View/Encoding/Baltic", NULL, N_("Baltic") },
581 {"View/Encoding/Hebrew", NULL, N_("Hebrew") },
582 {"View/Encoding/Arabic", NULL, N_("Arabic") },
583 {"View/Encoding/Cyrillic", NULL, N_("Cyrillic") },
584 {"View/Encoding/Japanese", NULL, N_("Japanese") },
585 {"View/Encoding/Chinese", NULL, N_("Chinese") },
586 {"View/Encoding/Korean", NULL, N_("Korean") },
587 {"View/Encoding/Thai", NULL, N_("Thai") },
589 {"View/Decode", NULL, N_("Decode") }, /* set_decode_cb */
590 {"View/Decode/---", NULL, "---" },
592 #define DEC_ACTION(cs_type,c_type,string) \
593 { "View/Decode/" cs_type, NULL, N_(string), NULL, NULL, c_type }
595 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
596 {"View/OpenNewWindow", NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(open_msg_cb) },
597 {"View/MessageSource", NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
598 {"View/Quotes", NULL, N_("Quotes") },
599 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
600 {"View/UpdateSummary", NULL, N_("_Update summary"), "<control><alt>U", NULL, G_CALLBACK(update_summary_cb) },
603 {"Message/Receive", NULL, N_("Recei_ve") },
604 {"Message/Receive/CurrentAccount", NULL, N_("Get from _current account"), "<control>I", NULL, G_CALLBACK(mw_inc_mail_cb) },
605 {"Message/Receive/AllAccounts", NULL, N_("Get from _all accounts"), "<shift><control>I", NULL, G_CALLBACK(mw_inc_all_account_mail_cb) },
606 {"Message/Receive/CancelReceiving", NULL, N_("Cancel receivin_g"), NULL, NULL, G_CALLBACK(inc_cancel_cb) },
607 {"Message/Receive/---", NULL, "---" },
608 {"Message/Receive/PlaceHolder", NULL, "PlaceHolder,", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
609 {"Message/SendQueue", NULL, N_("_Send queued messages"), NULL, NULL, G_CALLBACK(mw_send_queue_cb) },
611 {"Message/---", NULL, "---" },
613 {"Message/ComposeEmail", NULL, N_("Compose a_n email message"), "<control>M", NULL, G_CALLBACK(mw_compose_mail_cb) },
614 {"Message/ComposeNews", NULL, N_("Compose a news message"), NULL, NULL, G_CALLBACK(mw_compose_news_cb) },
616 {"Message/Reply", NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY */
617 {"Message/ReplyTo", NULL, N_("Repl_y to") },
618 {"Message/ReplyTo/All", NULL, N_("_all"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
619 {"Message/ReplyTo/Sender", NULL, N_("_sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
620 {"Message/ReplyTo/List", NULL, N_("mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
621 {"Message/FollowupReply", NULL, N_("Follow-up and reply to"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FOLLOWUP_AND_REPLY_TO */
622 /*{"Message/---", NULL, "---" },*/
624 {"Message/Forward", NULL, N_("_Forward"), "<control><alt>F", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_INLINE */
625 {"Message/ForwardAtt", NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */
626 {"Message/Redirect", NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REDIRECT */
628 {"Message/MailingList", NULL, N_("Mailing-_List") },
629 {"Message/MailingList/Post", NULL, N_("Post") },
630 {"Message/MailingList/Post/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
631 {"Message/MailingList/Help", NULL, N_("Help") },
632 {"Message/MailingList/Help/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
633 {"Message/MailingList/Subscribe", NULL, N_("Subscribe") },
634 {"Message/MailingList/Subscribe/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
635 {"Message/MailingList/Unsubscribe", NULL, N_("Unsubscribe") },
636 {"Message/MailingList/Unsubscribe/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
637 {"Message/MailingList/ViewArchive", NULL, N_("View archive") },
638 {"Message/MailingList/ViewArchive/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
639 {"Message/MailingList/ContactOwner", NULL, N_("Contact owner") },
640 {"Message/MailingList/ContactOwner/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
641 /*{"Message/---", NULL, "---" },*/
643 {"Message/Move", NULL, N_("M_ove..."), "<control>O", NULL, G_CALLBACK(move_to_cb) },
644 {"Message/Copy", NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(copy_to_cb) },
645 {"Message/Trash", NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(delete_trash_cb) },
646 {"Message/Delete", NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(delete_cb) },
647 {"Message/CancelNews", NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
648 /*{"Message/---", NULL, "---" },*/
650 {"Message/Mark", NULL, N_("_Mark") },
651 {"Message/Mark/Mark", NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
652 {"Message/Mark/Unmark", NULL, N_("_Unmark"), "U", NULL, G_CALLBACK(unmark_cb) },
653 {"Message/Mark/---", NULL, "---", NULL, NULL, NULL },
655 {"Message/Mark/MarkUnread", NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
656 {"Message/Mark/MarkRead", NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(mark_as_read_cb) },
657 {"Message/Mark/MarkAllRead", NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
658 {"Message/Mark/IgnoreThread", NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(ignore_thread_cb) },
659 {"Message/Mark/UnignoreThread", NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(unignore_thread_cb) },
660 {"Message/Mark/WatchThread", NULL, N_("Watch thread"), NULL, NULL, G_CALLBACK(watch_thread_cb) },
661 {"Message/Mark/UnwatchThread", NULL, N_("Unwatch thread"), NULL, NULL, G_CALLBACK(unwatch_thread_cb) },
664 {"Message/Mark/MarkSpam", NULL, N_("Mark as _spam"), NULL, NULL, G_CALLBACK(mark_as_spam_cb) },
665 {"Message/Mark/MarkHam", NULL, N_("Mark as _ham"), NULL, NULL, G_CALLBACK(mark_as_ham_cb) },
668 {"Message/Mark/Lock", NULL, N_("Lock"), NULL, NULL, G_CALLBACK(lock_msgs_cb) },
669 {"Message/Mark/Unlock", NULL, N_("Unlock"), NULL, NULL, G_CALLBACK(unlock_msgs_cb) },
671 {"Message/ColorLabel", NULL, N_("Color la_bel") },
672 {"Message/Tags", NULL, N_("Ta_gs") },
673 /*{"Message/---", NULL, "---" },*/
675 {"Message/Reedit", NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
679 {"Tools/AddressBook", NULL, N_("_Address book"), "<control><shift>A", NULL, G_CALLBACK(addressbook_open_cb) },
680 {"Tools/AddSenderToAB", NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) },
682 {"Tools/CollectAddresses", NULL, N_("C_ollect addresses") },
683 {"Tools/CollectAddresses/FromFolder", NULL, N_("from Current _folder..."), NULL, NULL, G_CALLBACK(addr_harvest_cb) },
684 {"Tools/CollectAddresses/FromSelected", NULL, N_("from Selected _messages..."), NULL, NULL, G_CALLBACK(addr_harvest_msg_cb) },
685 {"Tools/---", NULL, "---", NULL, NULL, NULL },
687 {"Tools/FilterFolder", NULL, N_("_Filter all messages in folder"), NULL, NULL, G_CALLBACK(filter_cb) },
688 {"Tools/FilterSelected", NULL, N_("Filter _selected messages"), NULL, NULL, G_CALLBACK(filter_list_cb) },
689 {"Tools/RunProcessing", NULL, N_("Run folder pr_ocessing rules"), NULL, NULL, G_CALLBACK(process_cb) },
691 {"Tools/CreateFilterRule", NULL, N_("_Create filter rule") },
692 {"Tools/CreateFilterRule/Automatically",NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_AUTO */
693 {"Tools/CreateFilterRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
694 {"Tools/CreateFilterRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO */
695 {"Tools/CreateFilterRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
697 {"Tools/CreateProcessingRule", NULL, N_("Create processing rule") },
698 {"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) },
699 {"Tools/CreateProcessingRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) },
700 {"Tools/CreateProcessingRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) },
701 {"Tools/CreateProcessingRule/BySubject",NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) },
702 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
704 {"Tools/ListUrls", NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) },
706 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
707 {"Tools/Actions", NULL, N_("Actio_ns") },
708 {"Tools/Actions/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
709 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
711 {"Tools/CheckNewMessages", NULL, N_("Ch_eck for new messages in all folders"), NULL, NULL, G_CALLBACK(update_folderview_cb) },
712 {"Tools/DeleteDuplicates", NULL, N_("Delete du_plicated messages") },
713 {"Tools/DeleteDuplicates/SelFolder", NULL, N_("In selected folder"), NULL, NULL, G_CALLBACK(delete_duplicated_cb) },
714 {"Tools/DeleteDuplicates/AllFolders", NULL, N_("In all folders"), NULL, NULL, G_CALLBACK(delete_duplicated_all_cb) },
715 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
717 {"Tools/Execute", NULL, N_("E_xecute"), "X", NULL, G_CALLBACK(execute_summary_cb) },
718 {"Tools/Expunge", NULL, N_("Exp_unge"), "<control>E", NULL, G_CALLBACK(expunge_summary_cb) },
720 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
721 {"Tools/SSLCertificates", NULL, N_("SSL cer_tificates"), NULL, NULL, G_CALLBACK(ssl_manager_open_cb) },
723 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
725 {"Tools/FilteringLog", NULL, N_("Filtering Lo_g"), NULL, NULL, G_CALLBACK(filtering_debug_window_show_cb) },
727 {"Tools/NetworkLog", NULL, N_("Network _Log"), "<shift><control>L", NULL, G_CALLBACK(log_window_show_cb) },
728 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
729 {"Tools/ForgetSessionPasswords", NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) },
731 /* Configuration menu */
732 {"Configuration/ChangeAccount", NULL, N_("C_hange current account") },
733 {"Configuration/ChangeAccount/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
734 {"Configuration/AccountPrefs", NULL, N_("_Preferences for current account..."), NULL, NULL, G_CALLBACK(prefs_account_open_cb) },
735 {"Configuration/CreateAccount", NULL, N_("Create _new account..."), NULL, NULL, G_CALLBACK(new_account_cb) },
736 {"Configuration/EditAccounts", NULL, N_("_Edit accounts..."), NULL, NULL, G_CALLBACK(account_edit_open) },
737 {"Configuration/---", NULL, "---", NULL, NULL, NULL },
739 {"Configuration/Preferences", NULL, N_("P_references..."), NULL, NULL, G_CALLBACK(prefs_open_cb) },
740 {"Configuration/PreProcessing", NULL, N_("Pre-pr_ocessing..."), NULL, NULL, G_CALLBACK(prefs_pre_processing_open_cb) },
741 {"Configuration/PostProcessing", NULL, N_("Post-pro_cessing..."), NULL, NULL, G_CALLBACK(prefs_post_processing_open_cb) },
742 {"Configuration/Filtering", NULL, N_("_Filtering..."), NULL, NULL, G_CALLBACK(prefs_filtering_open_cb) },
743 {"Configuration/Templates", NULL, N_("_Templates..."), NULL, NULL, G_CALLBACK(prefs_template_open_cb) },
744 {"Configuration/Actions", NULL, N_("_Actions..."), NULL, NULL, G_CALLBACK(prefs_actions_open_cb) },
745 {"Configuration/Tags", NULL, N_("Tag_s..."), NULL, NULL, G_CALLBACK(prefs_tags_open_cb) },
746 /*{"Configuration/---", NULL, "---", NULL, NULL, NULL }, */
747 {"Configuration/Plugins", NULL, N_("Plu_gins..."), NULL, NULL, G_CALLBACK(plugins_open_cb) },
750 {"Help/Manual", NULL, N_("_Manual"), NULL, NULL, G_CALLBACK(manual_open_cb) },
751 {"Help/FAQ", NULL, N_("_Online User-contributed FAQ"), NULL, NULL, G_CALLBACK(manual_faq_open_cb) },
752 {"Help/IconLegend", NULL, N_("Icon _Legend"), NULL, NULL, G_CALLBACK(legend_open_cb) },
754 {"Help/SetDefault", NULL, N_("Set as default client"), NULL, NULL, G_CALLBACK(set_default_client_cb) },
756 {"Help/---", NULL, "---" },
757 {"Help/About", NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_cb) },
760 static GtkToggleActionEntry mainwin_toggle_entries[] = {
761 {"File/OfflineMode", NULL, N_("Offline _mode"), "<control>W", NULL, G_CALLBACK(toggle_work_offline_cb) }, /*toggle*/
762 {"View/ShowHide/MessageView", NULL, N_("_Message view"), "V", NULL, G_CALLBACK(toggle_message_cb) }, /* toggle */
764 {"View/ShowHide/StatusBar", NULL, N_("Status _bar"), NULL, NULL, G_CALLBACK(toggle_statusbar_cb) }, /* toggle */
766 {"View/ShowHide/ColumnHeaders", NULL, N_("Column headers"), NULL, NULL, G_CALLBACK(toggle_col_headers_cb) }, /* toggle */
767 {"View/ThreadView", NULL, N_("Th_read view"), "<control>T", NULL, G_CALLBACK(thread_cb) }, /* toggle */
768 {"View/HideReadThreads", NULL, N_("Hide read threads"), NULL, NULL, G_CALLBACK(hide_read_threads) }, /* toggle */
769 {"View/HideReadMessages", NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages) }, /* toggle */
770 {"View/HideDelMessages", NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages) }, /* toggle */
772 {"View/FullScreen", NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb) }, /* toggle */
774 {"View/AllHeaders", NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
775 {"View/Quotes/CollapseAll", NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb) }, /* 1 toggle */
776 {"View/Quotes/Collapse2", NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 2 toggle */
777 {"View/Quotes/Collapse3", NULL, N_("Collapse from level _3"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 3 toggle */
780 static GtkRadioActionEntry mainwin_showhide_radio_entries[] = { /* toggle_toolbar_cb */
781 {"View/ShowHide/Toolbar/TextBelowIcon", NULL, N_("Text _below icons"), NULL, NULL, TOOLBAR_BOTH }, /* radio TOOLBAR_BOTH */
782 {"View/ShowHide/Toolbar/TextBesideIcon",NULL, N_("Text be_side icons"), NULL, NULL, TOOLBAR_BOTH_HORIZ }, /* radio TOOLBAR_BOTH_HORIZ */
783 {"View/ShowHide/Toolbar/IconOnly", NULL, N_("_Icons only"), NULL, NULL, TOOLBAR_ICON }, /* radio TOOLBAR_ICON */
784 {"View/ShowHide/Toolbar/TextOnly", NULL, N_("_Text only"), NULL, NULL, TOOLBAR_TEXT }, /* radio TOOLBAR_TEXT */
786 {"View/ShowHide/Toolbar/Hide", NULL, N_("_Hide"), NULL, NULL, TOOLBAR_NONE }, /* radio TOOLBAR_NONE */
790 static GtkRadioActionEntry mainwin_layout_radio_entries[] = { /* set_layout_cb */
791 {"View/Layout/Standard", NULL, N_("_Standard"), NULL, NULL, NORMAL_LAYOUT }, /* radio NORMAL_LAYOUT */
792 {"View/Layout/ThreeColumns", NULL, N_("_Three columns"), NULL, NULL, VERTICAL_LAYOUT }, /* radio VERTICAL_LAYOUT */
793 {"View/Layout/WideMessage", NULL, N_("_Wide message"), NULL, NULL, WIDE_LAYOUT }, /* radio WIDE_LAYOUT */
794 {"View/Layout/WideMessageList", NULL, N_("W_ide message list"), NULL, NULL, WIDE_MSGLIST_LAYOUT }, /* radio WIDE_MSGLIST_LAYOUT */
795 {"View/Layout/SmallScreen", NULL, N_("S_mall screen"), NULL, NULL, SMALL_LAYOUT }, /* radio SMALL_LAYOUT */
798 static GtkRadioActionEntry mainwin_sort_radio_entries[] = { /* sort_summary_cb */
799 {"View/Sort/Number", NULL, N_("by _Number"), NULL, NULL, SORT_BY_NUMBER }, /* radio SORT_BY_NUMBER */
800 {"View/Sort/Size", NULL, N_("by S_ize"), NULL, NULL, SORT_BY_SIZE }, /* radio SORT_BY_SIZE */
801 {"View/Sort/Date", NULL, N_("by _Date"), NULL, NULL, SORT_BY_DATE }, /* radio SORT_BY_DATE */
802 {"View/Sort/ThreadDate", NULL, N_("by Thread date"), NULL, NULL, SORT_BY_THREAD_DATE }, /* radio SORT_BY_THREAD_DATE */
803 {"View/Sort/From", NULL, N_("by _From"), NULL, NULL, SORT_BY_FROM }, /* radio SORT_BY_FROM */
804 {"View/Sort/To", NULL, N_("by _To"), NULL, NULL, SORT_BY_TO }, /* radio SORT_BY_TO */
805 {"View/Sort/Subject", NULL, N_("by S_ubject"), NULL, NULL, SORT_BY_SUBJECT }, /* radio SORT_BY_SUBJECT */
806 {"View/Sort/Color", NULL, N_("by _Color label"), NULL, NULL, SORT_BY_LABEL }, /* radio SORT_BY_LABEL */
807 {"View/Sort/Tag", NULL, N_("by Tag"), NULL, NULL, SORT_BY_TAGS }, /* radio SORT_BY_TAGS */
808 {"View/Sort/Mark", NULL, N_("by _Mark"), NULL, NULL, SORT_BY_MARK }, /* radio SORT_BY_MARK */
809 {"View/Sort/Status", NULL, N_("by _Status"), NULL, NULL, SORT_BY_STATUS }, /* radio SORT_BY_STATUS */
810 {"View/Sort/Attachment", NULL, N_("by A_ttachment"), NULL, NULL, SORT_BY_MIME }, /* radio SORT_BY_MIME */
811 {"View/Sort/Score", NULL, N_("by Score"), NULL, NULL, SORT_BY_SCORE }, /* radio SORT_BY_SCORE */
812 {"View/Sort/Locked", NULL, N_("by Locked"), NULL, NULL, SORT_BY_LOCKED }, /* radio SORT_BY_LOCKED */
813 {"View/Sort/DontSort", NULL, N_("D_on't sort"), NULL, NULL, SORT_BY_NONE }, /* radio SORT_BY_NONE */
816 static GtkRadioActionEntry mainwin_sorttype_radio_entries[] = { /* sort_summary_type_cb */
817 {"View/Sort/Ascending", NULL, N_("Ascending"), NULL, NULL, SORT_ASCENDING }, /* radio SORT_ASCENDING */
818 {"View/Sort/Descending", NULL, N_("Descending"), NULL, NULL, SORT_DESCENDING }, /* radio SORT_DESCENDING */
821 static GtkRadioActionEntry mainwin_radio_enc_entries[] =
823 ENC_ACTION(CS_AUTO, C_AUTO, N_("_Automatic")), /* RADIO set_charset_cb */
824 ENC_ACTION(CS_US_ASCII, C_US_ASCII, N_("7bit ASCII (US-ASC_II)")), /* RADIO set_charset_cb */
825 ENC_ACTION(CS_UTF_8, C_UTF_8, N_("Unicode (_UTF-8)")), /* RADIO set_charset_cb */
826 ENC_ACTION("Western/"CS_ISO_8859_1, C_ISO_8859_1, "ISO-8859-_1"), /* RADIO set_charset_cb */
827 ENC_ACTION("Western/"CS_ISO_8859_15, C_ISO_8859_15, "ISO-8859-15"), /* RADIO set_charset_cb */
828 ENC_ACTION("Western/"CS_WINDOWS_1252, C_WINDOWS_1252, "Windows-1252"), /* RADIO set_charset_cb */
829 ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, N_("Central European (ISO-8859-_2)")), /* RADIO set_charset_cb */
830 ENC_ACTION("Baltic/"CS_ISO_8859_13, C_ISO_8859_13, "ISO-8859-13"), /* RADIO set_charset_cb */
831 ENC_ACTION("Baltic/"CS_ISO_8859_4, C_ISO_8859_14, "ISO-8859-_4"), /* RADIO set_charset_cb */
832 ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, N_("Greek (ISO-8859-_7)")), /* RADIO set_charset_cb */
833 ENC_ACTION("Hebrew/"CS_ISO_8859_8, C_ISO_8859_8, "ISO-8859-_8"), /* RADIO set_charset_cb */
834 ENC_ACTION("Hebrew/"CS_WINDOWS_1255, C_WINDOWS_1255, "Windows-1255"), /* RADIO set_charset_cb */
835 ENC_ACTION("Arabic/"CS_ISO_8859_6, C_ISO_8859_6, "ISO-8859-_6"), /* RADIO set_charset_cb */
836 ENC_ACTION("Arabic/"CS_WINDOWS_1256, C_WINDOWS_1256, "Windows-1256"), /* RADIO set_charset_cb */
837 ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, N_("Turkish (ISO-8859-_9)")), /* RADIO set_charset_cb */
838 ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO set_charset_cb */
839 ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO set_charset_cb */
840 ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO set_charset_cb */
841 ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO set_charset_cb */
842 ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO set_charset_cb */
843 ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */
844 ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */
845 ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */
846 ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO set_charset_cb */
847 ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */
848 ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */
849 ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */
850 ENC_ACTION("Chinese/"CS_EUC_TW, C_EUC_TW, "EUC-_TW"), /* RADIO set_charset_cb */
851 ENC_ACTION("Korean/"CS_EUC_KR, C_EUC_KR, "_EUC-KR"), /* RADIO set_charset_cb */
852 ENC_ACTION("Korean/"CS_ISO_2022_KR, C_ISO_2022_KR, "_ISO-2022-KR"), /* RADIO set_charset_cb */
853 ENC_ACTION("Thai/"CS_TIS_620, C_TIS_620, "_TIS-620-KR"), /* RADIO set_charset_cb */
854 ENC_ACTION("Thai/"CS_WINDOWS_874, C_WINDOWS_874, "_Windows-874"), /* RADIO set_charset_cb */
857 static GtkRadioActionEntry mainwin_radio_dec_entries[] =
859 DEC_ACTION("AutoDetect", 0, N_("_Auto detect")), /* set_decode_cb */
861 DEC_ACTION("8bit", ENC_8BIT, "_8bit"),
862 DEC_ACTION("QP", ENC_QUOTED_PRINTABLE, "_Quoted printable"),
863 DEC_ACTION("B64", ENC_BASE64, "_Base64"),
864 DEC_ACTION("Uuencode", ENC_X_UUENCODE, "_Uuencode"),
867 static gboolean offline_ask_sync = TRUE;
868 static guint lastkey;
869 static gboolean is_obscured = FALSE;
871 static gboolean main_window_accel_activate (GtkAccelGroup *accelgroup,
877 MainWindow *mainwin = (MainWindow *)user_data;
879 if (mainwin->summaryview &&
880 mainwin->summaryview->quicksearch &&
881 quicksearch_has_focus(mainwin->summaryview->quicksearch) &&
882 (mod == 0 || mod == GDK_SHIFT_MASK)) {
883 quicksearch_pass_key(mainwin->summaryview->quicksearch, lastkey, mod);
889 #define N_COLOR_LABELS colorlabel_get_color_count()
891 static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item,
896 GtkCheckMenuItem **items;
898 GList *children, *cur;
901 mainwin = (MainWindow *)data;
902 cm_return_if_fail(mainwin != NULL);
904 sel = summary_get_selection(mainwin->summaryview);
907 menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
908 cm_return_if_fail(menu != NULL);
910 Xalloca(items, (N_COLOR_LABELS + 1) * sizeof(GtkWidget *), return);
912 /* NOTE: don't return prematurely because we set the "dont_toggle"
913 * state for check menu items. This would be bad! */
914 g_object_set_data(G_OBJECT(menu), "dont_toggle",
917 /* clear items. get item pointers. */
918 children = gtk_container_get_children(GTK_CONTAINER(menu));
919 for (n = 0, cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
920 if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
921 gtk_check_menu_item_set_active
922 (GTK_CHECK_MENU_ITEM(cur->data), FALSE);
923 items[n] = GTK_CHECK_MENU_ITEM(cur->data);
928 g_list_free(children);
930 if (n == (N_COLOR_LABELS + 1)) {
931 /* iterate all messages and set the state of the appropriate
933 for (; sel != NULL; sel = sel->next) {
937 msginfo = (MsgInfo *)sel->data;
939 clabel = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
940 if (!gtk_check_menu_item_get_active(items[clabel]))
941 gtk_check_menu_item_set_active
942 (items[clabel], TRUE);
946 g_warning("invalid number of color elements (%d)\n", n);
949 /* reset "dont_toggle" state */
950 g_object_set_data(G_OBJECT(menu), "dont_toggle",
954 static void mainwindow_colorlabel_menu_item_activate_cb(GtkWidget *widget,
957 guint color = GPOINTER_TO_UINT(data);
960 mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
961 cm_return_if_fail(mainwin != NULL);
963 /* "dont_toggle" state set? */
964 if (g_object_get_data(G_OBJECT(mainwin->colorlabel_menu),
968 summary_set_colorlabel(mainwin->summaryview, color, NULL);
971 static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
976 GList *children, *cur;
978 GHashTable *menu_table = g_hash_table_new_full(
982 GHashTable *menu_allsel_table = g_hash_table_new_full(
987 mainwin = (MainWindow *)data;
988 cm_return_if_fail(mainwin != NULL);
990 sel = summary_get_selection(mainwin->summaryview);
993 menu = GTK_MENU_SHELL(mainwin->tags_menu);
994 cm_return_if_fail(menu != NULL);
996 /* NOTE: don't return prematurely because we set the "dont_toggle"
997 * state for check menu items */
998 g_object_set_data(G_OBJECT(menu), "dont_toggle",
1001 /* clear items. get item pointers. */
1002 children = gtk_container_get_children(GTK_CONTAINER(menu));
1003 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
1004 if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
1005 gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cur->data),
1007 gtk_check_menu_item_set_active
1008 (GTK_CHECK_MENU_ITEM(cur->data), FALSE);
1010 g_hash_table_insert(menu_table, GINT_TO_POINTER(id), GTK_CHECK_MENU_ITEM(cur->data));
1011 g_hash_table_insert(menu_allsel_table, GINT_TO_POINTER(id), GINT_TO_POINTER(0));
1015 g_list_free(children);
1017 /* iterate all messages and set the state of the appropriate
1020 for (; sel != NULL; sel = sel->next) {
1022 GSList *tags = NULL;
1024 GtkCheckMenuItem *item;
1025 msginfo = (MsgInfo *)sel->data;
1028 tags = msginfo->tags;
1032 for (; tags; tags = tags->next) {
1033 gint num_checked = GPOINTER_TO_INT(g_hash_table_lookup(menu_allsel_table, tags->data));
1034 id = GPOINTER_TO_INT(tags->data);
1035 item = g_hash_table_lookup(menu_table, GINT_TO_POINTER(tags->data));
1036 if (item && !gtk_check_menu_item_get_active(item)) {
1037 gtk_check_menu_item_set_active
1041 g_hash_table_replace(menu_allsel_table, tags->data, GINT_TO_POINTER(num_checked));
1046 children = gtk_container_get_children(GTK_CONTAINER(menu));
1047 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
1048 if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
1049 gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cur->data),
1051 gint num_checked = GPOINTER_TO_INT(g_hash_table_lookup(menu_allsel_table, GINT_TO_POINTER(id)));
1052 if (num_checked < sel_len && num_checked > 0)
1053 gtk_check_menu_item_set_inconsistent(GTK_CHECK_MENU_ITEM(cur->data), TRUE);
1055 gtk_check_menu_item_set_inconsistent(GTK_CHECK_MENU_ITEM(cur->data), FALSE);
1058 g_list_free(children);
1060 g_hash_table_destroy(menu_table);
1061 g_hash_table_destroy(menu_allsel_table);
1062 /* reset "dont_toggle" state */
1063 g_object_set_data(G_OBJECT(menu), "dont_toggle",
1064 GINT_TO_POINTER(0));
1067 static void mainwindow_tags_menu_item_activate_cb(GtkWidget *widget,
1070 gint id = GPOINTER_TO_INT(data);
1071 gboolean set = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
1072 MainWindow *mainwin;
1074 mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
1075 cm_return_if_fail(mainwin != NULL);
1077 /* "dont_toggle" state set? */
1078 if (g_object_get_data(G_OBJECT(mainwin->tags_menu),
1084 summary_set_tag(mainwin->summaryview, id, NULL);
1087 void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
1088 GClosure *closure, GtkMenuItem *item)
1090 GList *closures = gtk_widget_list_accel_closures(GTK_WIDGET(item));
1092 for (cur = closures; cur; cur = cur->next) {
1093 if (closure == cur->data) {
1094 GtkLabel *label = g_object_get_data(G_OBJECT(item), "accel_label");
1097 if (keyval == GDK_KEY_BackSpace) {
1098 const gchar *accel_path;
1099 accel_path = gtk_menu_item_get_accel_path(item);
1100 keyval = 0; modifier = 0;
1101 gtk_accel_map_change_entry (accel_path, keyval, modifier, TRUE);
1103 new_accel = gtk_accelerator_get_label(keyval, modifier);
1104 gtk_label_set_text(label, new_accel);
1110 static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refresh)
1112 GtkWidget *label_menuitem;
1116 gchar *accel_path = NULL;
1118 label_menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/ColorLabel");
1119 g_signal_connect(G_OBJECT(label_menuitem), "activate",
1120 G_CALLBACK(mainwindow_colorlabel_menu_item_activate_item_cb),
1122 gtk_widget_show(label_menuitem);
1124 menu = gtk_menu_new();
1125 gtk_menu_set_accel_group (GTK_MENU (menu),
1126 gtk_ui_manager_get_accel_group(mainwin->ui_manager));
1128 /* create sub items. for the menu item activation callback we pass the
1129 * index of label_colors[] as data parameter. for the None color we
1130 * pass an invalid (high) value. also we attach a data pointer so we
1131 * can always get back the Mainwindow pointer. */
1133 item = gtk_check_menu_item_new_with_label(_("None"));
1134 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1135 g_signal_connect(G_OBJECT(item), "activate",
1136 G_CALLBACK(mainwindow_colorlabel_menu_item_activate_cb),
1137 GUINT_TO_POINTER(0));
1138 g_object_set_data(G_OBJECT(item), "mainwin", mainwin);
1139 gtk_widget_show(item);
1141 accel_path = g_strdup_printf("<ClawsColorLabels>/None");
1142 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1144 gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_0, GDK_CONTROL_MASK);
1146 item = gtk_menu_item_new();
1147 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1148 gtk_widget_show(item);
1150 /* create pixmap/label menu items */
1151 for (i = 0; i < N_COLOR_LABELS; i++) {
1152 item = colorlabel_create_check_color_menu_item(
1153 i, refresh, MAINWIN_COLORMENU);
1154 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1155 g_signal_connect(G_OBJECT(item), "activate",
1156 G_CALLBACK(mainwindow_colorlabel_menu_item_activate_cb),
1157 GUINT_TO_POINTER(i + 1));
1158 g_object_set_data(G_OBJECT(item), "mainwin",
1160 gtk_widget_show(item);
1161 accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
1162 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1164 gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
1166 g_signal_connect (gtk_ui_manager_get_accel_group(mainwin->ui_manager),
1167 "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
1171 gtk_widget_show(menu);
1172 gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
1173 mainwin->colorlabel_menu = menu;
1176 static void mainwindow_tags_menu_item_apply_tags_activate_cb(GtkWidget *widget,
1179 MainWindow *mainwin;
1181 mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
1182 cm_return_if_fail(mainwin != NULL);
1184 /* "dont_toggle" state set? */
1185 if (g_object_get_data(G_OBJECT(mainwin->tags_menu),
1189 tag_apply_open(summary_get_selection(mainwin->summaryview));
1192 static gint mainwin_tag_cmp_list(gconstpointer a, gconstpointer b)
1194 gint id_a = GPOINTER_TO_INT(a);
1195 gint id_b = GPOINTER_TO_INT(b);
1196 const gchar *tag_a = tags_get_tag(id_a);
1197 const gchar *tag_b = tags_get_tag(id_b);
1201 return tag_b == NULL ? 0:1;
1204 return tag_a == NULL ? 0:1;
1206 return g_utf8_collate(tag_a, tag_b);
1209 static void mainwindow_tags_menu_create(MainWindow *mainwin, gboolean refresh)
1211 GtkWidget *label_menuitem;
1214 GSList *cur = tags_get_list();
1215 GSList *orig = NULL;
1216 gboolean existing_tags = FALSE;
1218 cur = orig = g_slist_sort(cur, mainwin_tag_cmp_list);
1220 label_menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Tags");
1221 g_signal_connect(G_OBJECT(label_menuitem), "activate",
1222 G_CALLBACK(mainwindow_tags_menu_item_activate_item_cb),
1225 gtk_widget_show(label_menuitem);
1227 menu = gtk_menu_new();
1228 gtk_menu_set_accel_group (GTK_MENU (menu),
1229 gtk_ui_manager_get_accel_group(mainwin->ui_manager));
1231 /* create tags menu items */
1232 for (; cur; cur = cur->next) {
1233 gint id = GPOINTER_TO_INT(cur->data);
1234 const gchar *tag = tags_get_tag(id);
1236 item = gtk_check_menu_item_new_with_label(tag);
1237 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1238 g_signal_connect(G_OBJECT(item), "activate",
1239 G_CALLBACK(mainwindow_tags_menu_item_activate_cb),
1240 GINT_TO_POINTER(id));
1241 g_object_set_data(G_OBJECT(item), "mainwin",
1243 g_object_set_data(G_OBJECT(item), "tag_id",
1244 GINT_TO_POINTER(id));
1245 gtk_widget_show(item);
1246 accel_path = g_strconcat("<ClawsTags>/",tag, NULL);
1247 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1249 existing_tags = TRUE;
1251 if (existing_tags) {
1253 item = gtk_menu_item_new();
1254 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1255 gtk_widget_show(item);
1258 item = gtk_menu_item_new_with_label(_("Apply tags..."));
1259 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1260 g_signal_connect(G_OBJECT(item), "activate",
1261 G_CALLBACK(mainwindow_tags_menu_item_apply_tags_activate_cb),
1263 g_object_set_data(G_OBJECT(item), "mainwin",
1265 gtk_widget_show(item);
1266 accel_path = g_strdup_printf("<ClawsTags>/ApplyTags");
1267 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1269 gtk_accel_map_add_entry("<ClawsTags>/ApplyTags", GDK_T, GDK_CONTROL_MASK|GDK_SHIFT_MASK);
1272 gtk_widget_show(menu);
1273 gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
1274 mainwin->tags_menu = menu;
1276 #ifndef GENERIC_UMPC
1277 static gboolean warning_icon_pressed(GtkWidget *widget, GdkEventButton *evt,
1278 MainWindow *mainwindow)
1280 if (evt && evt->button == 1) {
1281 log_window_show_error(mainwindow->logwin);
1282 gtk_widget_hide(mainwindow->warning_btn);
1287 static gboolean warning_visi_notify(GtkWidget *widget,
1288 GdkEventVisibility *event,
1289 MainWindow *mainwindow)
1291 gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), hand_cursor);
1295 static gboolean warning_leave_notify(GtkWidget *widget,
1296 GdkEventCrossing *event,
1297 MainWindow *mainwindow)
1299 gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), NULL);
1303 static gboolean warning_enter_notify(GtkWidget *widget,
1304 GdkEventCrossing *event,
1305 MainWindow *mainwindow)
1307 gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), hand_cursor);
1311 void mainwindow_show_error(void)
1313 MainWindow *mainwin = mainwindow_get_mainwindow();
1314 gtk_widget_show(mainwin->warning_btn);
1317 void mainwindow_clear_error(MainWindow *mainwin)
1319 gtk_widget_hide(mainwin->warning_btn);
1322 #define BREAK_ON_MODIFIER_KEY() \
1323 if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
1325 static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
1328 MainWindow *mainwin = (MainWindow*) data;
1330 if (!mainwin || !event)
1333 if (quicksearch_has_focus(mainwin->summaryview->quicksearch))
1335 lastkey = event->keyval;
1339 switch (event->keyval) {
1340 case GDK_KEY_Q: /* Quit */
1342 BREAK_ON_MODIFIER_KEY();
1344 if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
1345 app_exit_cb(NULL, mainwin);
1350 BREAK_ON_MODIFIER_KEY();
1351 if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
1352 if (mainwin->folderview != NULL && mainwin->summaryview != NULL
1353 && ((!mainwin->summaryview->displayed
1354 && !mainwin->summaryview->selected)
1355 || (mainwin->summaryview->folder_item
1356 && mainwin->summaryview->folder_item->total_msgs == 0))) {
1357 g_signal_stop_emission_by_name(G_OBJECT(widget),
1359 folderview_select_next_unread(mainwin->folderview, TRUE);
1366 if (maemo_mainwindow_is_fullscreen(widget)) {
1367 gtk_window_unfullscreen(GTK_WINDOW(widget));
1369 gtk_window_fullscreen(GTK_WINDOW(widget));
1374 PangoFontDescription *font_desc;
1376 font_desc = pango_font_description_from_string(prefs_common.normalfont);
1377 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1379 size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1380 g_free(prefs_common.normalfont);
1381 prefs_common.normalfont = pango_font_description_to_string(font_desc);
1382 main_window_reflect_prefs_all();
1384 pango_font_description_free(font_desc);
1385 font_desc = pango_font_description_from_string(prefs_common.textfont);
1386 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1388 size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1389 g_free(prefs_common.textfont);
1390 prefs_common.textfont = pango_font_description_to_string(font_desc);
1391 main_window_reflect_prefs_all();
1393 pango_font_description_free(font_desc);
1398 PangoFontDescription *font_desc;
1400 font_desc = pango_font_description_from_string(prefs_common.normalfont);
1401 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1403 size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1404 g_free(prefs_common.normalfont);
1405 prefs_common.normalfont = pango_font_description_to_string(font_desc);
1406 main_window_reflect_prefs_all();
1408 pango_font_description_free(font_desc);
1409 font_desc = pango_font_description_from_string(prefs_common.textfont);
1410 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1412 size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1413 g_free(prefs_common.textfont);
1414 prefs_common.textfont = pango_font_description_to_string(font_desc);
1415 main_window_reflect_prefs_all();
1417 pango_font_description_free(font_desc);
1420 case GDK_KEY_Escape:
1421 if (mainwin->summaryview &&
1422 mainwin->summaryview->ext_messageview &&
1423 mainwin->summaryview->ext_messageview->window &&
1424 widget == mainwin->summaryview->ext_messageview->window) {
1425 messageview_destroy(mainwin->summaryview->ext_messageview);
1435 #undef BREAK_ON_MODIFIER_KEY
1438 void mainwindow_maemo_led_set(gboolean state) {
1439 static gint last_state = -1;
1440 if (last_state == state)
1442 last_state = (gint)state;
1443 if (prefs_common.maemo_show_led) {
1445 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1446 "--dest=com.nokia.mce "
1447 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate "
1448 "string:PatternCommunicationEvent", TRUE);
1449 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1450 "--dest=com.nokia.mce "
1451 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate "
1452 "string:PatternCommunicationEmail", TRUE);
1454 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1455 "--dest=com.nokia.mce "
1456 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate "
1457 "string:PatternCommunicationEvent", TRUE);
1458 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1459 "--dest=com.nokia.mce "
1460 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate "
1461 "string:PatternCommunicationEmail", TRUE);
1466 static void led_update(FolderItem *removed_item)
1468 guint new, unread, unreadmarked, marked, total, replied;
1469 guint forwarded, locked, ignored, watched;
1471 folder_count_total_msgs(&new, &unread, &unreadmarked, &marked, &total,
1472 &replied, &forwarded, &locked, &ignored,
1475 total -= removed_item->total_msgs;
1476 new -= removed_item->new_msgs;
1477 unread -= removed_item->unread_msgs;
1481 mainwindow_maemo_led_set(TRUE);
1483 mainwindow_maemo_led_set(FALSE);
1486 static gboolean maemo_folder_item_update_hook(gpointer source, gpointer data)
1493 static gboolean maemo_folder_update_hook(gpointer source, gpointer data)
1495 FolderUpdateData *hookdata;
1497 if (hookdata->update_flags & FOLDER_REMOVE_FOLDERITEM)
1498 led_update(hookdata->item);
1505 static void main_window_install_maemo_hooks(MainWindow *mainwin)
1507 gint maemo_item_hook_id, maemo_folder_hook_id;
1509 maemo_item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, maemo_folder_item_update_hook, NULL);
1510 if (maemo_item_hook_id == -1) {
1514 maemo_folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, maemo_folder_update_hook, NULL);
1515 if (maemo_folder_hook_id == -1) {
1516 goto err_out_folder;
1522 hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, maemo_item_hook_id);
1528 MainWindow *main_window_create()
1530 MainWindow *mainwin;
1534 GtkWidget *handlebox;
1535 GtkWidget *vbox_body;
1536 GtkWidget *menuitem;
1537 #ifndef GENERIC_UMPC
1538 GtkWidget *hbox_stat;
1539 GtkWidget *statusbar;
1540 GtkWidget *progressbar;
1541 GtkWidget *statuslabel;
1542 GtkWidget *ac_button;
1543 GtkWidget *ac_label;
1544 GtkWidget *online_pixmap;
1545 GtkWidget *offline_pixmap;
1546 GtkWidget *warning_icon;
1547 GtkWidget *warning_btn;
1549 GtkWidget *online_switch;
1550 GtkWidget *offline_switch;
1551 FolderView *folderview;
1552 SummaryView *summaryview;
1553 MessageView *messageview;
1554 #if !GTK_CHECK_VERSION(3, 0, 0)
1555 GdkColormap *colormap;
1556 gboolean success[4];
1562 static GdkGeometry geometry;
1564 debug_print("Creating main window...\n");
1565 mainwin = g_new0(MainWindow, 1);
1568 window = GTK_WIDGET(gtkut_window_new(GTK_WINDOW_TOPLEVEL, "mainwindow"));
1569 gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
1570 gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
1572 prefs_common.layout_mode = SMALL_LAYOUT;
1574 if (!geometry.min_height) {
1575 geometry.min_width = 320;
1576 geometry.min_height = 200;
1578 gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
1581 g_signal_connect(G_OBJECT(window), "delete_event",
1582 G_CALLBACK(main_window_close_cb), mainwin);
1583 MANAGE_WINDOW_SIGNALS_CONNECT(window);
1584 g_signal_connect(G_OBJECT(window), "focus_in_event",
1585 G_CALLBACK(mainwindow_focus_in_event),
1587 g_signal_connect(G_OBJECT(window), "key_press_event",
1588 G_CALLBACK(mainwindow_key_pressed), mainwin);
1590 gtk_widget_realize(window);
1591 gtk_widget_add_events(window, GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);
1594 gtkut_widget_set_app_icon(window);
1596 vbox = gtk_vbox_new(FALSE, 0);
1597 gtk_widget_show(vbox);
1598 gtk_container_add(GTK_CONTAINER(window), vbox);
1602 mainwin->ui_manager = gtk_ui_manager_new();
1603 mainwin->action_group = cm_menu_create_action_group_full(mainwin->ui_manager,"Menu", mainwin_entries,
1604 G_N_ELEMENTS(mainwin_entries), (gpointer)mainwin);
1605 gtk_action_group_add_toggle_actions(mainwin->action_group, mainwin_toggle_entries,
1606 G_N_ELEMENTS(mainwin_toggle_entries), (gpointer)mainwin);
1607 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_showhide_radio_entries,
1608 G_N_ELEMENTS(mainwin_showhide_radio_entries), C_AUTO, G_CALLBACK(toggle_toolbar_cb), (gpointer)mainwin);
1609 #ifndef GENERIC_UMPC
1610 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_layout_radio_entries,
1611 G_N_ELEMENTS(mainwin_layout_radio_entries), C_AUTO, G_CALLBACK(set_layout_cb), (gpointer)mainwin);
1613 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_sort_radio_entries,
1614 G_N_ELEMENTS(mainwin_sort_radio_entries), C_AUTO, G_CALLBACK(sort_summary_cb), (gpointer)mainwin);
1615 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_sorttype_radio_entries,
1616 G_N_ELEMENTS(mainwin_sorttype_radio_entries), C_AUTO, G_CALLBACK(sort_summary_type_cb), (gpointer)mainwin);
1617 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_radio_enc_entries,
1618 G_N_ELEMENTS(mainwin_radio_enc_entries), C_AUTO, G_CALLBACK(set_charset_cb), (gpointer)mainwin);
1619 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_radio_dec_entries,
1620 G_N_ELEMENTS(mainwin_radio_dec_entries), C_AUTO, G_CALLBACK(set_decode_cb), (gpointer)mainwin);
1623 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR)
1625 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_POPUP)
1627 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "File", "File", GTK_UI_MANAGER_MENU)
1628 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Edit", "Edit", GTK_UI_MANAGER_MENU)
1629 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "View", "View", GTK_UI_MANAGER_MENU)
1630 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Message", "Message", GTK_UI_MANAGER_MENU)
1631 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Tools", "Tools", GTK_UI_MANAGER_MENU)
1632 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Configuration", "Configuration", GTK_UI_MANAGER_MENU)
1633 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Help", "Help", GTK_UI_MANAGER_MENU)
1636 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "AddMailbox", "File/AddMailbox", GTK_UI_MANAGER_MENU)
1637 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File/AddMailbox", "MH", "File/AddMailbox/MH", GTK_UI_MANAGER_MENUITEM)
1638 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR)
1639 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SortMailboxes", "File/SortMailboxes", GTK_UI_MANAGER_MENUITEM)
1640 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator2", "File/---", GTK_UI_MANAGER_SEPARATOR)
1641 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ImportMbox", "File/ImportMbox", GTK_UI_MANAGER_MENUITEM)
1642 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ExportMbox", "File/ExportMbox", GTK_UI_MANAGER_MENUITEM)
1643 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ExportSelMbox", "File/ExportSelMbox", GTK_UI_MANAGER_MENUITEM)
1644 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator3", "File/---", GTK_UI_MANAGER_SEPARATOR)
1645 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "EmptyTrashes", "File/EmptyTrashes", GTK_UI_MANAGER_MENUITEM)
1646 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator4", "File/---", GTK_UI_MANAGER_SEPARATOR)
1647 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
1648 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
1649 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
1650 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
1651 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "OfflineMode", "File/OfflineMode", GTK_UI_MANAGER_MENUITEM)
1652 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SynchroniseFolders", "File/SynchroniseFolders", GTK_UI_MANAGER_MENUITEM)
1653 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
1654 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Exit", "File/Exit", GTK_UI_MANAGER_MENUITEM)
1657 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Copy", "Edit/Copy", GTK_UI_MANAGER_MENUITEM)
1658 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectAll", "Edit/SelectAll", GTK_UI_MANAGER_MENUITEM)
1659 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectThread", "Edit/SelectThread", GTK_UI_MANAGER_MENUITEM)
1660 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "DeleteThread", "Edit/DeleteThread", GTK_UI_MANAGER_MENUITEM)
1661 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Separator1", "Edit/---", GTK_UI_MANAGER_SEPARATOR)
1662 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Find", "Edit/Find", GTK_UI_MANAGER_MENUITEM)
1663 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SearchFolder", "Edit/SearchFolder", GTK_UI_MANAGER_MENUITEM)
1664 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "QuickSearch", "Edit/QuickSearch", GTK_UI_MANAGER_MENUITEM)
1667 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ShowHide", "View/ShowHide", GTK_UI_MANAGER_MENU)
1668 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "Toolbar", "View/ShowHide/Toolbar", GTK_UI_MANAGER_MENU)
1669 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBelowIcon", "View/ShowHide/Toolbar/TextBelowIcon", GTK_UI_MANAGER_MENUITEM)
1670 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBesideIcon", "View/ShowHide/Toolbar/TextBesideIcon", GTK_UI_MANAGER_MENUITEM)
1671 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "IconOnly", "View/ShowHide/Toolbar/IconOnly", GTK_UI_MANAGER_MENUITEM)
1672 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextOnly", "View/ShowHide/Toolbar/TextOnly", GTK_UI_MANAGER_MENUITEM)
1673 #ifndef GENERIC_UMPC
1674 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "Hide", "View/ShowHide/Toolbar/Hide", GTK_UI_MANAGER_MENUITEM)
1676 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "MessageView", "View/ShowHide/MessageView", GTK_UI_MANAGER_MENUITEM)
1677 #ifndef GENERIC_UMPC
1678 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "StatusBar", "View/ShowHide/StatusBar", GTK_UI_MANAGER_MENUITEM)
1680 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "ColumnHeaders", "View/ShowHide/ColumnHeaders", GTK_UI_MANAGER_MENUITEM)
1681 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "SetColumns", "View/SetColumns", GTK_UI_MANAGER_MENU)
1682 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Folderlist", "View/SetColumns/Folderlist", GTK_UI_MANAGER_MENUITEM)
1683 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Messagelist", "View/SetColumns/Messagelist", GTK_UI_MANAGER_MENUITEM)
1684 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR)
1687 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "FullScreen", "View/FullScreen", GTK_UI_MANAGER_MENUITEM)
1689 #ifndef GENERIC_UMPC
1690 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Layout", "View/Layout", GTK_UI_MANAGER_MENU)
1691 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "Standard", "View/Layout/Standard", GTK_UI_MANAGER_MENUITEM)
1692 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "ThreeColumns", "View/Layout/ThreeColumns", GTK_UI_MANAGER_MENUITEM)
1693 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "WideMessage", "View/Layout/WideMessage", GTK_UI_MANAGER_MENUITEM)
1694 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "WideMessageList", "View/Layout/WideMessageList", GTK_UI_MANAGER_MENUITEM)
1695 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "SmallScreen", "View/Layout/SmallScreen", GTK_UI_MANAGER_MENUITEM)
1696 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator2", "View/---", GTK_UI_MANAGER_SEPARATOR)
1699 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Sort", "View/Sort", GTK_UI_MANAGER_MENU)
1700 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Number", "View/Sort/Number", GTK_UI_MANAGER_MENUITEM)
1701 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Size", "View/Sort/Size", GTK_UI_MANAGER_MENUITEM)
1702 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Date", "View/Sort/Date", GTK_UI_MANAGER_MENUITEM)
1703 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "ThreadDate", "View/Sort/ThreadDate", GTK_UI_MANAGER_MENUITEM)
1704 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "From", "View/Sort/From", GTK_UI_MANAGER_MENUITEM)
1705 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "To", "View/Sort/To", GTK_UI_MANAGER_MENUITEM)
1706 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Subject", "View/Sort/Subject", GTK_UI_MANAGER_MENUITEM)
1707 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Color", "View/Sort/Color", GTK_UI_MANAGER_MENUITEM)
1708 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Tag", "View/Sort/Tag", GTK_UI_MANAGER_MENUITEM)
1709 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Mark", "View/Sort/Mark", GTK_UI_MANAGER_MENUITEM)
1710 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Status", "View/Sort/Status", GTK_UI_MANAGER_MENUITEM)
1711 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Attachment", "View/Sort/Attachment", GTK_UI_MANAGER_MENUITEM)
1712 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Score", "View/Sort/Score", GTK_UI_MANAGER_MENUITEM)
1713 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Locked", "View/Sort/Locked", GTK_UI_MANAGER_MENUITEM)
1714 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "DontSort", "View/Sort/DontSort", GTK_UI_MANAGER_MENUITEM)
1715 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Separator1", "View/Sort/---", GTK_UI_MANAGER_SEPARATOR)
1716 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Ascending", "View/Sort/Ascending", GTK_UI_MANAGER_MENUITEM)
1717 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Descending", "View/Sort/Descending", GTK_UI_MANAGER_MENUITEM)
1718 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Separator2", "View/Sort/---", GTK_UI_MANAGER_SEPARATOR)
1719 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "AttractSubj", "View/Sort/AttractSubj", GTK_UI_MANAGER_MENUITEM)
1721 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ThreadView", "View/ThreadView", GTK_UI_MANAGER_MENUITEM)
1722 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ExpandThreads", "View/ExpandThreads", GTK_UI_MANAGER_MENUITEM)
1723 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "CollapseThreads", "View/CollapseThreads", GTK_UI_MANAGER_MENUITEM)
1724 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadThreads", "View/HideReadThreads", GTK_UI_MANAGER_MENUITEM)
1725 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadMessages", "View/HideReadMessages", GTK_UI_MANAGER_MENUITEM)
1726 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideDelMessages", "View/HideDelMessages", GTK_UI_MANAGER_MENUITEM)
1727 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator3", "View/---", GTK_UI_MANAGER_SEPARATOR)
1729 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Goto", "View/Goto", GTK_UI_MANAGER_MENU)
1730 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Prev", "View/Goto/Prev", GTK_UI_MANAGER_MENUITEM)
1731 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Next", "View/Goto/Next", GTK_UI_MANAGER_MENUITEM)
1732 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator1", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1733 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevUnread", "View/Goto/PrevUnread", GTK_UI_MANAGER_MENUITEM)
1734 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnread", "View/Goto/NextUnread", GTK_UI_MANAGER_MENUITEM)
1735 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator2", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1736 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevNew", "View/Goto/PrevNew", GTK_UI_MANAGER_MENUITEM)
1737 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextNew", "View/Goto/NextNew", GTK_UI_MANAGER_MENUITEM)
1738 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator3", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1739 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevMarked", "View/Goto/PrevMarked", GTK_UI_MANAGER_MENUITEM)
1740 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextMarked", "View/Goto/NextMarked", GTK_UI_MANAGER_MENUITEM)
1741 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator4", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1742 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevLabeled", "View/Goto/PrevLabeled", GTK_UI_MANAGER_MENUITEM)
1743 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextLabeled", "View/Goto/NextLabeled", GTK_UI_MANAGER_MENUITEM)
1744 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1745 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "LastRead", "View/Goto/LastRead", GTK_UI_MANAGER_MENUITEM)
1746 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
1747 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1748 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
1749 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
1750 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
1751 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
1752 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
1753 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevPage", "View/Scroll/PrevPage", GTK_UI_MANAGER_MENUITEM)
1754 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextPage", "View/Scroll/NextPage", GTK_UI_MANAGER_MENUITEM)
1755 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator4", "View/---", GTK_UI_MANAGER_SEPARATOR)
1757 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Encoding", "View/Encoding", GTK_UI_MANAGER_MENU)
1758 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_AUTO, "View/Encoding/"CS_AUTO, GTK_UI_MANAGER_MENUITEM)
1759 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Separator1", "View/Encoding/---", GTK_UI_MANAGER_SEPARATOR)
1760 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_US_ASCII, "View/Encoding/"CS_US_ASCII, GTK_UI_MANAGER_MENUITEM)
1761 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_UTF_8, "View/Encoding/"CS_UTF_8, GTK_UI_MANAGER_MENUITEM)
1762 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Separator2", "View/Encoding/---", GTK_UI_MANAGER_SEPARATOR)
1764 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Western", "View/Encoding/Western", GTK_UI_MANAGER_MENU)
1765 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Western", CS_ISO_8859_1, "View/Encoding/Western/"CS_ISO_8859_1, GTK_UI_MANAGER_MENUITEM)
1766 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Western", CS_ISO_8859_15, "View/Encoding/Western/"CS_ISO_8859_15, GTK_UI_MANAGER_MENUITEM)
1767 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Western", CS_WINDOWS_1252, "View/Encoding/Western/"CS_WINDOWS_1252, GTK_UI_MANAGER_MENUITEM)
1769 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_2, "View/Encoding/"CS_ISO_8859_2, GTK_UI_MANAGER_MENUITEM)
1771 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Baltic", "View/Encoding/Baltic", GTK_UI_MANAGER_MENU)
1772 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Baltic", CS_ISO_8859_13, "View/Encoding/Baltic/"CS_ISO_8859_13, GTK_UI_MANAGER_MENUITEM)
1773 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Baltic", CS_ISO_8859_4, "View/Encoding/Baltic/"CS_ISO_8859_4, GTK_UI_MANAGER_MENUITEM)
1775 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_7, "View/Encoding/"CS_ISO_8859_7, GTK_UI_MANAGER_MENUITEM)
1777 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Hebrew", "View/Encoding/Hebrew", GTK_UI_MANAGER_MENU)
1778 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Hebrew", CS_ISO_8859_8, "View/Encoding/Hebrew/"CS_ISO_8859_8, GTK_UI_MANAGER_MENUITEM)
1779 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Hebrew", CS_WINDOWS_1255, "View/Encoding/Hebrew/"CS_WINDOWS_1255, GTK_UI_MANAGER_MENUITEM)
1781 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Arabic", "View/Encoding/Arabic", GTK_UI_MANAGER_MENU)
1782 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Arabic", CS_ISO_8859_6, "View/Encoding/Arabic/"CS_ISO_8859_6, GTK_UI_MANAGER_MENUITEM)
1783 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Arabic", CS_WINDOWS_1256, "View/Encoding/Arabic/"CS_WINDOWS_1256, GTK_UI_MANAGER_MENUITEM)
1785 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_9, "View/Encoding/"CS_ISO_8859_9, GTK_UI_MANAGER_MENUITEM)
1787 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Cyrillic", "View/Encoding/Cyrillic", GTK_UI_MANAGER_MENU)
1788 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_ISO_8859_5, "View/Encoding/Cyrillic/"CS_ISO_8859_5, GTK_UI_MANAGER_MENUITEM)
1789 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_R, "View/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM)
1790 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_U, "View/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM)
1791 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_WINDOWS_1251, "View/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM)
1793 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Japanese", "View/Encoding/Japanese", GTK_UI_MANAGER_MENU)
1794 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_ISO_2022_JP, "View/Encoding/Japanese/"CS_ISO_2022_JP, GTK_UI_MANAGER_MENUITEM)
1795 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_ISO_2022_JP_2, "View/Encoding/Japanese/"CS_ISO_2022_JP_2, GTK_UI_MANAGER_MENUITEM)
1796 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_EUC_JP, "View/Encoding/Japanese/"CS_EUC_JP, GTK_UI_MANAGER_MENUITEM)
1797 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
1799 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU)
1800 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB18030, "View/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
1801 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
1802 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
1803 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
1804 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_EUC_TW, "View/Encoding/Chinese/"CS_EUC_TW, GTK_UI_MANAGER_MENUITEM)
1806 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Korean", "View/Encoding/Korean", GTK_UI_MANAGER_MENU)
1807 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Korean", CS_EUC_KR, "View/Encoding/Korean/"CS_EUC_KR, GTK_UI_MANAGER_MENUITEM)
1808 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Korean", CS_ISO_2022_KR, "View/Encoding/Korean/"CS_ISO_2022_KR, GTK_UI_MANAGER_MENUITEM)
1810 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Thai", "View/Encoding/Thai", GTK_UI_MANAGER_MENU)
1811 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Thai", CS_TIS_620, "View/Encoding/Thai/"CS_TIS_620, GTK_UI_MANAGER_MENUITEM)
1812 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Thai", CS_WINDOWS_874, "View/Encoding/Thai/"CS_WINDOWS_874, GTK_UI_MANAGER_MENUITEM)
1814 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Decode", "View/Decode", GTK_UI_MANAGER_MENU)
1815 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "AutoDetect", "View/Decode/AutoDetect", GTK_UI_MANAGER_MENUITEM)
1816 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "Separator1", "View/Decode/---", GTK_UI_MANAGER_SEPARATOR)
1817 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "8bit", "View/Decode/8bit", GTK_UI_MANAGER_MENUITEM)
1818 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "QP", "View/Decode/QP", GTK_UI_MANAGER_MENUITEM)
1819 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "B64", "View/Decode/B64", GTK_UI_MANAGER_MENUITEM)
1820 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "Uuencode", "View/Decode/Uuencode", GTK_UI_MANAGER_MENUITEM)
1821 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator5", "View/---", GTK_UI_MANAGER_SEPARATOR)
1823 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "OpenNewWindow", "View/OpenNewWindow", GTK_UI_MANAGER_MENUITEM)
1824 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "MessageSource", "View/MessageSource", GTK_UI_MANAGER_MENUITEM)
1825 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "AllHeaders", "View/AllHeaders", GTK_UI_MANAGER_MENUITEM)
1826 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Quotes", "View/Quotes", GTK_UI_MANAGER_MENU)
1827 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
1828 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
1829 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
1830 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator6", "View/---", GTK_UI_MANAGER_SEPARATOR)
1831 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "UpdateSummary", "View/UpdateSummary", GTK_UI_MANAGER_MENUITEM)
1834 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Receive", "Message/Receive", GTK_UI_MANAGER_MENU)
1835 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "CurrentAccount", "Message/Receive/CurrentAccount", GTK_UI_MANAGER_MENUITEM)
1836 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "AllAccounts", "Message/Receive/AllAccounts", GTK_UI_MANAGER_MENUITEM)
1837 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "CancelReceiving", "Message/Receive/CancelReceiving", GTK_UI_MANAGER_MENUITEM)
1838 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "Separator1", "Message/Receive/---", GTK_UI_MANAGER_SEPARATOR)
1839 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "PlaceHolder", "Message/Receive/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1840 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "SendQueue", "Message/SendQueue", GTK_UI_MANAGER_MENUITEM)
1841 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator1", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1843 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ComposeEmail", "Message/ComposeEmail", GTK_UI_MANAGER_MENUITEM)
1844 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ComposeNews", "Message/ComposeNews", GTK_UI_MANAGER_MENUITEM)
1845 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reply", "Message/Reply", GTK_UI_MANAGER_MENUITEM)
1846 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ReplyTo", "Message/ReplyTo", GTK_UI_MANAGER_MENU)
1847 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/ReplyTo", "All", "Message/ReplyTo/All", GTK_UI_MANAGER_MENUITEM)
1848 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/ReplyTo", "Sender", "Message/ReplyTo/Sender", GTK_UI_MANAGER_MENUITEM)
1849 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/ReplyTo", "List", "Message/ReplyTo/List", GTK_UI_MANAGER_MENUITEM)
1850 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "FollowupReply", "Message/FollowupReply", GTK_UI_MANAGER_MENUITEM)
1851 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator2", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1853 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Forward", "Message/Forward", GTK_UI_MANAGER_MENUITEM)
1854 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ForwardAtt", "Message/ForwardAtt", GTK_UI_MANAGER_MENUITEM)
1855 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Redirect", "Message/Redirect", GTK_UI_MANAGER_MENUITEM)
1856 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "MailingList", "Message/MailingList", GTK_UI_MANAGER_MENU)
1857 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Post", "Message/MailingList/Post", GTK_UI_MANAGER_MENU)
1858 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Help", "Message/MailingList/Help", GTK_UI_MANAGER_MENU)
1859 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Subscribe", "Message/MailingList/Subscribe", GTK_UI_MANAGER_MENU)
1860 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Unsubscribe", "Message/MailingList/Unsubscribe", GTK_UI_MANAGER_MENU)
1861 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "ViewArchive", "Message/MailingList/ViewArchive", GTK_UI_MANAGER_MENU)
1862 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "ContactOwner", "Message/MailingList/ContactOwner", GTK_UI_MANAGER_MENU)
1863 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Post", "PlaceHolder", "Message/MailingList/Post/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1864 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Help", "PlaceHolder", "Message/MailingList/Help/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1865 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Subscribe", "PlaceHolder", "Message/MailingList/Subscribe/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1866 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Unsubscribe", "PlaceHolder", "Message/MailingList/Unsubscribe/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1867 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/ViewArchive", "PlaceHolder", "Message/MailingList/ViewArchive/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1868 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/ContactOwner", "PlaceHolder", "Message/MailingList/ContactOwner/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1869 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator3", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1871 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Move", "Message/Move", GTK_UI_MANAGER_MENUITEM)
1872 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Copy", "Message/Copy", GTK_UI_MANAGER_MENUITEM)
1873 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Trash", "Message/Trash", GTK_UI_MANAGER_MENUITEM)
1874 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Delete", "Message/Delete", GTK_UI_MANAGER_MENUITEM)
1875 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CancelNews", "Message/CancelNews", GTK_UI_MANAGER_MENUITEM)
1876 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator4", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1878 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Mark", "Message/Mark", GTK_UI_MANAGER_MENU)
1879 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Mark", "Message/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
1880 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unmark", "Message/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
1881 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1882 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
1883 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
1884 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
1885 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
1886 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
1887 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "WatchThread", "Message/Mark/WatchThread", GTK_UI_MANAGER_MENUITEM)
1888 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnwatchThread", "Message/Mark/UnwatchThread", GTK_UI_MANAGER_MENUITEM)
1889 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1890 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkSpam", "Message/Mark/MarkSpam", GTK_UI_MANAGER_MENUITEM)
1891 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkHam", "Message/Mark/MarkHam", GTK_UI_MANAGER_MENUITEM)
1892 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1893 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Lock", "Message/Mark/Lock", GTK_UI_MANAGER_MENUITEM)
1894 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unlock", "Message/Mark/Unlock", GTK_UI_MANAGER_MENUITEM)
1895 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ColorLabel", "Message/ColorLabel", GTK_UI_MANAGER_MENUITEM)
1896 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Tags", "Message/Tags", GTK_UI_MANAGER_MENUITEM)
1897 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator5", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1899 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reedit", "Message/Reedit", GTK_UI_MANAGER_MENUITEM)
1900 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator6", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1903 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
1904 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddSenderToAB", "Tools/AddSenderToAB", GTK_UI_MANAGER_MENUITEM)
1905 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CollectAddresses", "Tools/CollectAddresses", GTK_UI_MANAGER_MENU)
1906 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CollectAddresses", "FromFolder", "Tools/CollectAddresses/FromFolder", GTK_UI_MANAGER_MENUITEM)
1907 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CollectAddresses", "FromSelected", "Tools/CollectAddresses/FromSelected", GTK_UI_MANAGER_MENUITEM)
1908 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator1", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1910 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilterFolder", "Tools/FilterFolder", GTK_UI_MANAGER_MENUITEM)
1911 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilterSelected", "Tools/FilterSelected", GTK_UI_MANAGER_MENUITEM)
1912 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "RunProcessing", "Tools/RunProcessing", GTK_UI_MANAGER_MENUITEM)
1913 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateFilterRule", "Tools/CreateFilterRule", GTK_UI_MANAGER_MENU)
1914 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "Automatically", "Tools/CreateFilterRule/Automatically", GTK_UI_MANAGER_MENUITEM)
1915 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
1916 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
1917 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
1919 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateProcessingRule", "Tools/CreateProcessingRule", GTK_UI_MANAGER_MENU)
1920 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "Automatically", "Tools/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM)
1921 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
1922 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
1923 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
1924 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator2", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1926 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ListUrls", "Tools/ListUrls", GTK_UI_MANAGER_MENUITEM)
1927 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator3", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1929 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Actions", "Tools/Actions", GTK_UI_MANAGER_MENU)
1930 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/Actions", "PlaceHolder", "Tools/Actions/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1931 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator4", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1933 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CheckNewMessages", "Tools/CheckNewMessages", GTK_UI_MANAGER_MENUITEM)
1934 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "DeleteDuplicates", "Tools/DeleteDuplicates", GTK_UI_MANAGER_MENU)
1935 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/DeleteDuplicates", "SelFolder", "Tools/DeleteDuplicates/SelFolder", GTK_UI_MANAGER_MENUITEM)
1936 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/DeleteDuplicates", "AllFolders", "Tools/DeleteDuplicates/AllFolders", GTK_UI_MANAGER_MENUITEM)
1937 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator5", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1939 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Execute", "Tools/Execute", GTK_UI_MANAGER_MENUITEM)
1940 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Expunge", "Tools/Expunge", GTK_UI_MANAGER_MENUITEM)
1942 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator6", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1943 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "SSLCertificates", "Tools/SSLCertificates", GTK_UI_MANAGER_MENUITEM)
1945 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator7", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1947 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilteringLog", "Tools/FilteringLog", GTK_UI_MANAGER_MENUITEM)
1949 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "NetworkLog", "Tools/NetworkLog", GTK_UI_MANAGER_MENUITEM)
1950 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator8", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1951 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetSessionPasswords", "Tools/ForgetSessionPasswords", GTK_UI_MANAGER_MENUITEM)
1952 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator9", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1954 /* Configuration menu */
1955 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "ChangeAccount", "Configuration/ChangeAccount", GTK_UI_MANAGER_MENU)
1956 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration/ChangeAccount", "PlaceHolder", "Configuration/ChangeAccount/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1957 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "AccountPrefs", "Configuration/AccountPrefs", GTK_UI_MANAGER_MENUITEM)
1958 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "CreateAccount", "Configuration/CreateAccount", GTK_UI_MANAGER_MENUITEM)
1959 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "EditAccounts", "Configuration/EditAccounts", GTK_UI_MANAGER_MENUITEM)
1960 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Separator1", "Configuration/---", GTK_UI_MANAGER_SEPARATOR)
1962 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Preferences", "Configuration/Preferences", GTK_UI_MANAGER_MENUITEM)
1963 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "PreProcessing", "Configuration/PreProcessing", GTK_UI_MANAGER_MENUITEM)
1964 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "PostProcessing", "Configuration/PostProcessing", GTK_UI_MANAGER_MENUITEM)
1965 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Filtering", "Configuration/Filtering", GTK_UI_MANAGER_MENUITEM)
1966 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Templates", "Configuration/Templates", GTK_UI_MANAGER_MENUITEM)
1967 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Actions", "Configuration/Actions", GTK_UI_MANAGER_MENUITEM)
1968 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Tags", "Configuration/Tags", GTK_UI_MANAGER_MENUITEM)
1970 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Separator2", "Configuration/---", GTK_UI_MANAGER_SEPARATOR)
1971 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Plugins", "Configuration/Plugins", GTK_UI_MANAGER_MENUITEM)
1974 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Manual", "Help/Manual", GTK_UI_MANAGER_MENUITEM)
1975 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "FAQ", "Help/FAQ", GTK_UI_MANAGER_MENUITEM)
1976 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "IconLegend", "Help/IconLegend", GTK_UI_MANAGER_MENUITEM)
1978 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Separator1", "Help/---", GTK_UI_MANAGER_SEPARATOR)
1979 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "SetDefault", "Help/SetDefault", GTK_UI_MANAGER_MENUITEM)
1981 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Separator2", "Help/---", GTK_UI_MANAGER_SEPARATOR)
1982 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "About", "Help/About", GTK_UI_MANAGER_MENUITEM)
1985 menubar = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu");
1986 gtk_widget_show_all(menubar);
1987 gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(mainwin->ui_manager));
1990 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
1992 hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar));
1995 if (prefs_common.toolbar_detachable) {
1996 handlebox = gtk_handle_box_new();
1997 gtk_widget_show(handlebox);
1998 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
1999 g_signal_connect(G_OBJECT(handlebox), "child_attached",
2000 G_CALLBACK(toolbar_child_attached), mainwin);
2001 g_signal_connect(G_OBJECT(handlebox), "child_detached",
2002 G_CALLBACK(toolbar_child_detached), mainwin);
2004 handlebox = gtk_hbox_new(FALSE, 0);
2005 gtk_widget_show(handlebox);
2006 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
2008 /* link window to mainwin->window to avoid gdk warnings */
2009 mainwin->window = window;
2010 mainwin_list = g_list_append(mainwin_list, mainwin);
2013 mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
2017 mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
2021 toolbar_set_learn_button
2025 /* vbox that contains body */
2026 vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH);
2027 gtk_widget_show(vbox_body);
2028 gtk_container_set_border_width(GTK_CONTAINER(vbox_body), BORDER_WIDTH);
2029 gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
2031 #ifndef GENERIC_UMPC
2032 hbox_stat = gtk_hbox_new(FALSE, 2);
2033 gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
2035 warning_icon = gtk_image_new_from_stock
2036 (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
2037 warning_btn = gtk_event_box_new();
2038 gtk_event_box_set_visible_window(GTK_EVENT_BOX(warning_btn), FALSE);
2040 mainwin->warning_btn = warning_btn;
2042 g_signal_connect(G_OBJECT(warning_btn), "button-press-event",
2043 G_CALLBACK(warning_icon_pressed),
2044 (gpointer) mainwin);
2045 g_signal_connect(G_OBJECT(warning_btn), "motion-notify-event",
2046 G_CALLBACK(warning_visi_notify), mainwin);
2047 g_signal_connect(G_OBJECT(warning_btn), "leave-notify-event",
2048 G_CALLBACK(warning_leave_notify), mainwin);
2049 g_signal_connect(G_OBJECT(warning_btn), "enter-notify-event",
2050 G_CALLBACK(warning_enter_notify), mainwin);
2052 gtk_container_add (GTK_CONTAINER(warning_btn), warning_icon);
2054 CLAWS_SET_TIP(warning_btn,
2055 _("Some error(s) happened. Click here to view log."));
2056 gtk_box_pack_start(GTK_BOX(hbox_stat), warning_btn, FALSE, FALSE, 0);
2058 statusbar = statusbar_create();
2059 gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
2061 progressbar = gtk_progress_bar_new();
2062 gtk_widget_set_size_request(progressbar, 120, 1);
2063 gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
2065 online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_ONLINE);
2066 offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_OFFLINE);
2067 online_switch = gtk_button_new ();
2068 gtkut_widget_set_can_focus(online_switch, FALSE);
2069 CLAWS_SET_TIP(online_switch,
2070 _("You are online. Click the icon to go offline"));
2071 offline_switch = gtk_button_new ();
2072 CLAWS_SET_TIP(offline_switch,
2073 _("You are offline. Click the icon to go online"));
2074 gtk_container_add (GTK_CONTAINER(online_switch), online_pixmap);
2075 gtk_button_set_relief (GTK_BUTTON(online_switch), GTK_RELIEF_NONE);
2076 g_signal_connect (G_OBJECT(online_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2077 gtk_box_pack_start (GTK_BOX(hbox_stat), online_switch, FALSE, FALSE, 0);
2078 gtk_container_add (GTK_CONTAINER(offline_switch), offline_pixmap);
2079 gtk_button_set_relief (GTK_BUTTON(offline_switch), GTK_RELIEF_NONE);
2080 g_signal_connect (G_OBJECT(offline_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2081 gtk_box_pack_start (GTK_BOX(hbox_stat), offline_switch, FALSE, FALSE, 0);
2083 statuslabel = gtk_label_new("");
2084 gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
2086 ac_button = gtk_button_new();
2087 CLAWS_SET_TIP(ac_button, _("Select account"));
2088 gtkut_widget_set_can_focus(ac_button, FALSE);
2089 gtk_widget_set_size_request(ac_button, -1, 0);
2090 gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
2091 g_signal_connect(G_OBJECT(ac_button), "button_press_event",
2092 G_CALLBACK(ac_label_button_pressed), mainwin);
2094 ac_label = gtk_label_new("");
2095 gtk_container_add(GTK_CONTAINER(ac_button), ac_label);
2097 gtk_widget_show_all(hbox_stat);
2099 gtk_widget_hide(offline_switch);
2100 gtk_widget_hide(progressbar);
2101 gtk_widget_hide(warning_btn);
2103 online_switch = gtk_button_new ();
2104 offline_switch = gtk_button_new ();
2105 g_signal_connect (G_OBJECT(online_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2106 g_signal_connect (G_OBJECT(offline_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2109 mainwin->folderview = folderview = folderview_create();
2110 mainwin->summaryview = summaryview = summary_create(mainwin);
2111 mainwin->messageview = messageview = messageview_create(mainwin);
2113 /* init log instances data before creating log views */
2114 set_log_title(LOG_PROTOCOL, _("Network log"));
2115 set_log_prefs(LOG_PROTOCOL,
2116 &prefs_common.logwin_width,
2117 &prefs_common.logwin_height);
2118 set_log_title(LOG_DEBUG_FILTERING, _("Filtering/processing debug log"));
2119 set_log_prefs(LOG_DEBUG_FILTERING,
2120 &prefs_common.filtering_debugwin_width,
2121 &prefs_common.filtering_debugwin_height);
2123 /* setup log windows */
2124 mainwin->logwin = log_window_create(LOG_PROTOCOL);
2125 log_window_init(mainwin->logwin);
2127 mainwin->filtering_debugwin = log_window_create(LOG_DEBUG_FILTERING);
2128 log_window_set_clipping(mainwin->logwin,
2129 prefs_common.cliplog,
2130 prefs_common.loglength);
2132 log_window_init(mainwin->filtering_debugwin);
2133 log_window_set_clipping(mainwin->filtering_debugwin,
2134 prefs_common.filtering_debug_cliplog,
2135 prefs_common.filtering_debug_loglength);
2136 if (prefs_common.enable_filtering_debug)
2137 log_message(LOG_DEBUG_FILTERING, _("filtering log enabled\n"));
2139 log_message(LOG_DEBUG_FILTERING, _("filtering log disabled\n"));
2141 folderview->mainwin = mainwin;
2142 folderview->summaryview = summaryview;
2144 summaryview->mainwin = mainwin;
2145 summaryview->folderview = folderview;
2146 summaryview->messageview = messageview;
2147 summaryview->window = window;
2149 mainwin->vbox = vbox;
2150 mainwin->menubar = menubar;
2151 mainwin->handlebox = handlebox;
2152 mainwin->vbox_body = vbox_body;
2153 mainwin->online_switch = online_switch;
2154 mainwin->offline_switch = offline_switch;
2155 #ifndef GENERIC_UMPC
2156 messageview->statusbar = statusbar;
2157 mainwin->statusbar = statusbar;
2158 mainwin->hbox_stat = hbox_stat;
2159 mainwin->progressbar = progressbar;
2160 mainwin->statuslabel = statuslabel;
2161 mainwin->online_pixmap = online_pixmap;
2162 mainwin->offline_pixmap = offline_pixmap;
2163 mainwin->ac_button = ac_button;
2164 mainwin->ac_label = ac_label;
2165 /* set context IDs for status bar */
2166 mainwin->mainwin_cid = gtk_statusbar_get_context_id
2167 (GTK_STATUSBAR(statusbar), "Main Window");
2168 mainwin->folderview_cid = gtk_statusbar_get_context_id
2169 (GTK_STATUSBAR(statusbar), "Folder View");
2170 mainwin->summaryview_cid = gtk_statusbar_get_context_id
2171 (GTK_STATUSBAR(statusbar), "Summary View");
2172 mainwin->messageview_cid = gtk_statusbar_get_context_id
2173 (GTK_STATUSBAR(statusbar), "Message View");
2174 messageview->statusbar_cid = mainwin->messageview_cid;
2177 messageview->statusbar = NULL;
2178 mainwin->statusbar = NULL;
2179 mainwin->hbox_stat = NULL;
2180 /* mainwin->progressbar is set in toolbar.c */
2181 mainwin->statuslabel = NULL;
2182 mainwin->online_pixmap = NULL;
2183 mainwin->offline_pixmap = NULL;
2184 mainwin->ac_button = NULL;
2185 mainwin->ac_label = NULL;
2188 /* allocate colors for summary view and folder view */
2189 summaryview->color_marked.red = summaryview->color_marked.green = 0;
2190 summaryview->color_marked.blue = (guint16)65535;
2192 summaryview->color_dim.red = summaryview->color_dim.green =
2193 summaryview->color_dim.blue = COLOR_DIM;
2195 gtkut_convert_int_to_gdk_color(prefs_common.color_new,
2196 &folderview->color_new);
2198 gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
2199 &folderview->color_op);
2201 summaryview->color_important.red = 0;
2202 summaryview->color_important.green = 0;
2203 summaryview->color_important.blue = (guint16)65535;
2205 color[0] = summaryview->color_marked;
2206 color[1] = summaryview->color_dim;
2207 color[2] = folderview->color_new;
2208 color[3] = folderview->color_op;
2210 #if !GTK_CHECK_VERSION(3, 0, 0)
2211 colormap = gdk_drawable_get_colormap(gtk_widget_get_window(window));
2212 gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
2213 for (i = 0; i < 4; i++) {
2214 if (success[i] == FALSE)
2215 g_warning("MainWindow: color allocation %d failed\n", i);
2219 debug_print("done.\n");
2221 messageview->visible = prefs_common.msgview_visible;
2223 main_window_set_widgets(mainwin, prefs_common.layout_mode);
2225 g_signal_connect(G_OBJECT(window), "size_allocate",
2226 G_CALLBACK(main_window_size_allocate_cb),
2229 /* set menu items */
2230 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Encoding/"CS_AUTO, TRUE);
2233 switch (prefs_common.toolbar_style) {
2235 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/Hide");
2238 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/IconOnly");
2241 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/TextOnly");
2244 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/TextBelowIcon");
2246 case TOOLBAR_BOTH_HORIZ:
2247 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/TextBesideIcon");
2249 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
2251 toolbar_set_style(mainwin->toolbar->toolbar,
2253 prefs_common.toolbar_style);
2254 #ifndef GENERIC_UMPC
2255 gtk_widget_hide(mainwin->hbox_stat);
2256 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/StatusBar");
2257 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
2258 prefs_common.show_statusbar);
2260 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/ColumnHeaders");
2261 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
2262 prefs_common.show_col_headers);
2263 /* set account selection menu */
2264 ac_menu = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Configuration/ChangeAccount");
2265 mainwin->ac_menu = ac_menu;
2267 toolbar_main_set_sensitive(mainwin);
2269 /* create actions menu */
2270 main_window_update_actions_menu(mainwin);
2272 main_create_mailing_list_menu (mainwin, NULL);
2274 /* attach accel groups to main window */
2275 #define ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win) \
2276 gtk_window_add_accel_group \
2278 gtk_ui_manager_get_accel_group(gtkut_ui_manager())); \
2279 g_signal_connect(G_OBJECT(gtk_ui_manager_get_accel_group(gtkut_ui_manager())), \
2281 G_CALLBACK(main_window_accel_activate), mainwin);
2283 ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
2285 g_signal_connect(G_OBJECT(window), "window_state_event",
2286 G_CALLBACK(mainwindow_state_event_cb), mainwin);
2287 g_signal_connect(G_OBJECT(window), "visibility_notify_event",
2288 G_CALLBACK(mainwindow_visibility_event_cb), mainwin);
2289 gtk_widget_add_events(GTK_WIDGET(window), GDK_VISIBILITY_NOTIFY_MASK);
2291 if (prefs_common.layout_mode == VERTICAL_LAYOUT ||
2292 prefs_common.layout_mode == SMALL_LAYOUT) {
2293 summary_relayout(mainwin->summaryview);
2295 summary_update_unread(mainwin->summaryview, NULL);
2297 /* initialize views */
2298 folderview_init(folderview);
2299 summary_init(summaryview);
2300 messageview_init(messageview);
2302 sslcertwindow_register_hook();
2304 mainwin->lock_count = 0;
2305 mainwin->menu_lock_count = 0;
2306 mainwin->cursor_count = 0;
2308 mainwin->progressindicator_hook =
2309 hooks_register_hook(PROGRESSINDICATOR_HOOKLIST, mainwindow_progressindicator_hook, mainwin);
2312 watch_cursor = gdk_cursor_new(GDK_WATCH);
2314 hand_cursor = gdk_cursor_new(GDK_HAND2);
2316 /* init work_offline */
2317 if (prefs_common.work_offline)
2318 online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
2320 mainwindow_colorlabel_menu_create(mainwin, FALSE);
2321 mainwindow_tags_menu_create(mainwin, FALSE);
2324 main_window_install_maemo_hooks(mainwin);
2327 if (prefs_common.mainwin_fullscreen) {
2328 cm_toggle_menu_set_active_full(mainwin->ui_manager,
2329 "Menu/View/FullScreen",
2336 void main_window_update_actions_menu(MainWindow *mainwin)
2338 action_update_mainwin_menu(mainwin->ui_manager, "/Menu/Tools/Actions", mainwin);
2341 void main_window_cursor_wait(MainWindow *mainwin)
2344 if (mainwin->cursor_count == 0) {
2345 gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), watch_cursor);
2346 textview_cursor_wait(mainwin->messageview->mimeview->textview);
2349 mainwin->cursor_count++;
2354 void main_window_cursor_normal(MainWindow *mainwin)
2356 if (mainwin->cursor_count)
2357 mainwin->cursor_count--;
2359 if (mainwin->cursor_count == 0) {
2360 gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), NULL);
2361 textview_cursor_normal(mainwin->messageview->mimeview->textview);
2366 /* lock / unlock the user-interface */
2367 void main_window_lock(MainWindow *mainwin)
2369 if (mainwin->lock_count == 0 && mainwin->ac_button)
2370 gtk_widget_set_sensitive(mainwin->ac_button, FALSE);
2372 mainwin->lock_count++;
2374 main_window_set_menu_sensitive(mainwin);
2375 toolbar_main_set_sensitive(mainwin);
2378 void main_window_unlock(MainWindow *mainwin)
2380 if (mainwin->lock_count)
2381 mainwin->lock_count--;
2383 main_window_set_menu_sensitive(mainwin);
2384 toolbar_main_set_sensitive(mainwin);
2386 if (mainwin->lock_count == 0 && mainwin->ac_button)
2387 gtk_widget_set_sensitive(mainwin->ac_button, TRUE);
2390 static void main_window_menu_callback_block(MainWindow *mainwin)
2392 mainwin->menu_lock_count++;
2395 static void main_window_menu_callback_unblock(MainWindow *mainwin)
2397 if (mainwin->menu_lock_count)
2398 mainwin->menu_lock_count--;
2401 static guint prefs_tag = 0;
2403 void main_window_reflect_prefs_all(void)
2405 main_window_reflect_prefs_all_real(FALSE);
2408 static gboolean reflect_prefs_timeout_cb(gpointer data)
2410 gboolean pixmap_theme_changed = GPOINTER_TO_INT(data);
2412 MainWindow *mainwin;
2413 #ifndef GENERIC_UMPC
2416 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2417 mainwin = (MainWindow *)cur->data;
2419 main_window_show_cur_account(mainwin);
2420 main_window_set_menu_sensitive(mainwin);
2421 toolbar_main_set_sensitive(mainwin);
2424 if (pixmap_theme_changed) {
2425 toolbar_update(TOOLBAR_MAIN, mainwin);
2426 messageview_reflect_prefs_pixmap_theme();
2427 compose_reflect_prefs_pixmap_theme();
2428 folderview_reinit_fonts(mainwin->folderview);
2429 summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
2430 foldersel_reflect_prefs_pixmap_theme();
2431 addressbook_reflect_prefs_pixmap_theme();
2432 #ifndef GENERIC_UMPC
2433 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
2434 gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
2435 mainwin->online_pixmap);
2436 gtk_container_add (GTK_CONTAINER(mainwin->online_switch), pixmap);
2437 gtk_widget_show(pixmap);
2438 mainwin->online_pixmap = pixmap;
2439 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_OFFLINE);
2440 gtk_container_remove(GTK_CONTAINER(mainwin->offline_switch),
2441 mainwin->offline_pixmap);
2442 gtk_container_add (GTK_CONTAINER(mainwin->offline_switch), pixmap);
2443 gtk_widget_show(pixmap);
2444 mainwin->offline_pixmap = pixmap;
2446 hooks_invoke(THEME_CHANGED_HOOKLIST, NULL);
2449 headerview_set_font(mainwin->messageview->headerview);
2450 headerview_set_visibility(mainwin->messageview->headerview,
2451 prefs_common.display_header_pane);
2452 textview_reflect_prefs(mainwin->messageview->mimeview->textview);
2453 folderview_reflect_prefs();
2454 summary_reflect_prefs();
2455 #ifndef GENERIC_UMPC
2456 summary_redisplay_msg(mainwin->summaryview);
2458 if (prefs_common.layout_mode == SMALL_LAYOUT) {
2459 if (mainwin->in_folder) {
2460 mainwindow_enter_folder(mainwin);
2462 mainwindow_exit_folder(mainwin);
2470 void main_window_reflect_prefs_all_now(void)
2472 reflect_prefs_timeout_cb(GINT_TO_POINTER(FALSE));
2475 void main_window_reflect_prefs_custom_colors(MainWindow *mainwin)
2478 GList *children, *cur;
2480 /* re-create colorlabel submenu */
2481 menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
2482 cm_return_if_fail(menu != NULL);
2484 /* clear items. get item pointers. */
2485 children = gtk_container_get_children(GTK_CONTAINER(menu));
2486 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
2487 g_signal_handlers_disconnect_matched
2488 (gtk_ui_manager_get_accel_group(mainwin->ui_manager),
2489 G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC,
2490 0, 0, NULL, mainwin_accel_changed_cb, cur->data);
2491 gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
2493 g_list_free(children);
2494 mainwindow_colorlabel_menu_create(mainwin, TRUE);
2495 summary_reflect_prefs_custom_colors(mainwin->summaryview);
2496 folderview_reinit_fonts(mainwin->folderview);
2499 static gint tags_tag = 0;
2500 static gboolean main_window_reflect_tags_changes_real(gpointer data)
2503 GList *children, *cur;
2504 MainWindow *mainwin = (MainWindow *)data;
2506 if (summary_is_locked(mainwin->summaryview)) {
2510 /* re-create tags submenu */
2511 menu = GTK_MENU_SHELL(mainwin->tags_menu);
2512 cm_return_val_if_fail(menu != NULL, FALSE);
2514 /* clear items. get item pointers. */
2515 children = gtk_container_get_children(GTK_CONTAINER(menu));
2516 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
2517 gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
2519 g_list_free(children);
2520 mainwindow_tags_menu_create(mainwin, TRUE);
2521 summary_reflect_tags_changes(mainwin->summaryview);
2527 void main_window_reflect_tags_changes(MainWindow *mainwin)
2529 if (tags_tag == 0) {
2530 tags_tag = g_timeout_add(100, main_window_reflect_tags_changes_real,
2535 void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
2537 if (prefs_tag == 0) {
2538 prefs_tag = g_timeout_add(100, reflect_prefs_timeout_cb,
2539 GINT_TO_POINTER(pixmap_theme_changed));
2543 void main_window_set_summary_column(void)
2546 MainWindow *mainwin;
2548 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2549 mainwin = (MainWindow *)cur->data;
2550 summary_set_column_order(mainwin->summaryview);
2554 void main_window_set_folder_column(void)
2557 MainWindow *mainwin;
2559 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2560 mainwin = (MainWindow *)cur->data;
2561 folderview_set_column_order(mainwin->folderview);
2565 static void main_window_set_account_selector_menu(MainWindow *mainwin,
2566 GList *account_list)
2569 GtkWidget *menuitem;
2570 PrefsAccount *ac_prefs;
2574 menu = gtk_menu_new();
2575 gtk_menu_set_accel_group (GTK_MENU (menu),
2576 gtk_ui_manager_get_accel_group(mainwin->ui_manager));
2578 for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
2579 ac_prefs = (PrefsAccount *)cur_ac->data;
2581 menuitem = gtk_menu_item_new_with_label
2582 (ac_prefs->account_name
2583 ? ac_prefs->account_name : _("Untitled"));
2584 gtk_widget_show(menuitem);
2585 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2586 g_signal_connect(G_OBJECT(menuitem), "activate",
2587 G_CALLBACK(account_selector_menu_cb),
2589 accel_path = g_strconcat("<Actions>/Menu/Configuration/ChangeAccount/",(ac_prefs->account_name
2590 ? ac_prefs->account_name : _("Untitled")), NULL );
2591 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(menuitem), accel_path);
2594 gtk_menu_item_set_submenu(GTK_MENU_ITEM(mainwin->ac_menu), menu);
2597 static void main_window_set_account_receive_menu(MainWindow *mainwin,
2598 GList *account_list)
2600 GList *children, *child;
2602 GtkWidget *menuitem;
2603 PrefsAccount *ac_prefs;
2605 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
2606 gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive")));
2608 /* search for separator */
2609 children = gtk_container_get_children(GTK_CONTAINER(menu));
2610 for (child = children; child != NULL; child = child->next) {
2611 if (child->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
2612 child = child->next;
2617 /* destroy all previous menu item */
2618 while (child != NULL) {
2619 gtk_widget_destroy(GTK_WIDGET(child->data));
2620 child = child->next;
2623 g_list_free(children);
2625 for (child = account_list; child != NULL; child = child->next) {
2626 ac_prefs = (PrefsAccount *)child->data;
2628 if (ac_prefs->protocol == A_NONE)
2631 menuitem = gtk_menu_item_new_with_label
2632 (ac_prefs->account_name ? ac_prefs->account_name
2634 gtk_widget_show(menuitem);
2635 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2636 g_signal_connect(G_OBJECT(menuitem), "activate",
2637 G_CALLBACK(account_receive_menu_cb),
2642 static void main_window_set_toolbar_combo_receive_menu(MainWindow *mainwin,
2643 GList *account_list)
2646 GtkWidget *menuitem;
2647 PrefsAccount *ac_prefs;
2648 GtkWidget *menu = NULL;
2650 if (mainwin->toolbar->getall_btn == NULL) /* button doesn't exist */
2653 menu = gtk_menu_tool_button_get_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->getall_btn));
2655 gtk_widget_destroy(menu);
2656 menu = gtk_menu_new();
2658 for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
2659 ac_prefs = (PrefsAccount *)cur_ac->data;
2661 if (ac_prefs->protocol == A_NONE)
2664 menuitem = gtk_menu_item_new_with_label
2665 (ac_prefs->account_name
2666 ? ac_prefs->account_name : _("Untitled"));
2667 gtk_widget_show(menuitem);
2668 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2669 g_signal_connect(G_OBJECT(menuitem), "activate",
2670 G_CALLBACK(account_receive_menu_cb),
2673 gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->getall_btn), menu);
2676 static void main_window_set_toolbar_combo_compose_menu(MainWindow *mainwin,
2677 GList *account_list)
2679 #ifndef GENERIC_UMPC
2681 GtkWidget *menuitem;
2682 PrefsAccount *ac_prefs;
2683 GtkWidget *menu = NULL;
2685 if (mainwin->toolbar->compose_mail_btn == NULL) /* button doesn't exist */
2688 menu = gtk_menu_tool_button_get_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->compose_mail_btn));
2690 gtk_widget_destroy(menu);
2691 menu = gtk_menu_new();
2693 for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
2694 ac_prefs = (PrefsAccount *)cur_ac->data;
2696 menuitem = gtk_menu_item_new_with_label
2697 (ac_prefs->account_name
2698 ? ac_prefs->account_name : _("Untitled"));
2699 gtk_widget_show(menuitem);
2700 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2701 g_signal_connect(G_OBJECT(menuitem), "activate",
2702 G_CALLBACK(account_compose_menu_cb),
2705 gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->compose_mail_btn), menu);
2709 void main_window_set_account_menu(GList *account_list)
2712 MainWindow *mainwin;
2714 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2715 mainwin = (MainWindow *)cur->data;
2716 main_window_set_account_selector_menu(mainwin, account_list);
2717 main_window_set_account_receive_menu(mainwin, account_list);
2718 main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
2719 main_window_set_toolbar_combo_compose_menu(mainwin, account_list);
2721 hooks_invoke(ACCOUNT_LIST_CHANGED_HOOKLIST, NULL);
2724 void main_window_set_account_menu_only_toolbar(GList *account_list)
2727 MainWindow *mainwin;
2729 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2730 mainwin = (MainWindow *)cur->data;
2731 main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
2732 main_window_set_toolbar_combo_compose_menu(mainwin, account_list);
2736 static void main_window_show_cur_account(MainWindow *mainwin)
2741 ac_name = g_strdup(cur_account
2742 ? (cur_account->account_name
2743 ? cur_account->account_name : _("Untitled"))
2747 buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
2749 buf = g_strdup(PROG_VERSION);
2750 gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
2753 if (mainwin->ac_label)
2754 gtk_label_set_text(GTK_LABEL(mainwin->ac_label), ac_name);
2755 if (mainwin->ac_button)
2756 gtk_widget_queue_resize(mainwin->ac_button);
2760 #ifndef GENERIC_UMPC
2761 static void main_window_separation_change(MainWindow *mainwin, LayoutType layout_mode)
2763 GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview);
2764 GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview);
2765 GtkWidget *message_wid = mainwin->messageview->vbox;
2767 if (layout_mode == prefs_common.layout_mode)
2770 debug_print("Changing window separation type from %d to %d\n",
2771 prefs_common.layout_mode, layout_mode);
2773 /* remove widgets from those containers */
2774 g_object_ref(folder_wid);
2775 g_object_ref(summary_wid);
2776 g_object_ref(message_wid);
2777 gtkut_container_remove
2778 (GTK_CONTAINER(gtk_widget_get_parent(folder_wid)), folder_wid);
2779 gtkut_container_remove
2780 (GTK_CONTAINER(gtk_widget_get_parent(summary_wid)), summary_wid);
2781 gtkut_container_remove
2782 (GTK_CONTAINER(gtk_widget_get_parent(message_wid)), message_wid);
2784 gtk_widget_hide(mainwin->window);
2785 main_window_set_widgets(mainwin, layout_mode);
2786 gtk_widget_show(mainwin->window);
2788 g_object_unref(folder_wid);
2789 g_object_unref(summary_wid);
2790 g_object_unref(message_wid);
2793 void mainwindow_reset_paned(GtkPaned *paned)
2797 if (gtk_paned_get_child1(GTK_PANED(paned)))
2798 gtk_widget_show(gtk_paned_get_child1(GTK_PANED(paned)));
2799 if (gtk_paned_get_child2(GTK_PANED(paned)))
2800 gtk_widget_show(gtk_paned_get_child2(GTK_PANED(paned)));
2803 g_object_get (G_OBJECT(paned),
2806 g_object_get (G_OBJECT(paned),
2810 gtk_paned_set_position(GTK_PANED(paned), mid);
2813 static void mainwin_paned_show_first(GtkPaned *paned)
2816 g_object_get (G_OBJECT(paned),
2820 if (gtk_paned_get_child1(GTK_PANED(paned)))
2821 gtk_widget_show(gtk_paned_get_child1(GTK_PANED(paned)));
2822 if (gtk_paned_get_child2(GTK_PANED(paned)))
2823 gtk_widget_hide(gtk_paned_get_child2(GTK_PANED(paned)));
2824 gtk_paned_set_position(GTK_PANED(paned), max);
2827 static void mainwin_paned_show_last(GtkPaned *paned)
2830 g_object_get (G_OBJECT(paned),
2834 if (gtk_paned_get_child1(GTK_PANED(paned)))
2835 gtk_widget_hide(gtk_paned_get_child1(GTK_PANED(paned)));
2836 if (gtk_paned_get_child2(GTK_PANED(paned)))
2837 gtk_widget_show(gtk_paned_get_child2(GTK_PANED(paned)));
2838 gtk_paned_set_position(GTK_PANED(paned), min);
2841 void main_window_toggle_message_view(MainWindow *mainwin)
2843 SummaryView *summaryview = mainwin->summaryview;
2844 GtkWidget *ppaned = NULL;
2845 GtkWidget *container = NULL;
2847 switch (prefs_common.layout_mode) {
2849 case VERTICAL_LAYOUT:
2851 ppaned = mainwin->vpaned;
2852 container = mainwin->hpaned;
2853 if (gtk_widget_get_parent(ppaned) != NULL) {
2854 mainwin->messageview->visible = FALSE;
2855 summaryview->displayed = NULL;
2856 g_object_ref(ppaned);
2857 gtkut_container_remove(GTK_CONTAINER(container), ppaned);
2858 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container);
2860 mainwin->messageview->visible = TRUE;
2861 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), ppaned);
2862 gtk_container_add(GTK_CONTAINER(container), ppaned);
2863 g_object_unref(ppaned);
2867 ppaned = mainwin->hpaned;
2868 container = mainwin->vpaned;
2869 if (gtk_widget_get_parent(mainwin->messageview->vbox) != NULL) {
2870 mainwin->messageview->visible = FALSE;
2871 summaryview->displayed = NULL;
2872 g_object_ref(mainwin->messageview->vbox);
2873 gtkut_container_remove(GTK_CONTAINER(container), mainwin->messageview->vbox);
2875 mainwin->messageview->visible = TRUE;
2876 gtk_container_add(GTK_CONTAINER(container), mainwin->messageview->vbox);
2877 g_object_unref(mainwin->messageview->vbox);
2880 case WIDE_MSGLIST_LAYOUT:
2881 g_warning("can't hide messageview in this wide msglist layout");
2885 if (messageview_is_visible(mainwin->messageview))
2886 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
2887 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
2889 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
2890 GTK_ARROW_UP, GTK_SHADOW_OUT);
2892 if (mainwin->messageview->visible == FALSE)
2893 messageview_clear(mainwin->messageview);
2895 main_window_set_menu_sensitive(mainwin);
2897 prefs_common.msgview_visible = mainwin->messageview->visible;
2899 if (messageview_is_visible(mainwin->messageview)) {
2900 gtk_widget_queue_resize(mainwin->hpaned);
2901 gtk_widget_queue_resize(mainwin->vpaned);
2903 summary_grab_focus(summaryview);
2904 if (!summary_is_list(summaryview)) {
2905 summary_show(summaryview, summaryview->folder_item);
2909 void main_window_get_size(MainWindow *mainwin)
2911 GtkAllocation allocation;
2913 if (mainwin_list == NULL || mainwin->messageview == NULL) {
2914 debug_print("called after messageview "
2915 "has been deallocated!\n");
2919 if (prefs_common.mainwin_fullscreen) {
2920 debug_print("mainwin in full screen state. "
2921 "Keeping original settings\n");
2924 gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->summaryview), &allocation);
2925 if (allocation.width > 1 && allocation.height > 1 && !prefs_common.mainwin_fullscreen) {
2926 prefs_common.summaryview_width = allocation.width;
2928 if (messageview_is_visible(mainwin->messageview))
2929 prefs_common.summaryview_height = allocation.height;
2931 prefs_common.mainview_width = allocation.width;
2934 gtk_widget_get_allocation(mainwin->window, &allocation);
2935 if (allocation.width > 1 && allocation.height > 1 &&
2936 !prefs_common.mainwin_maximised && !prefs_common.mainwin_fullscreen) {
2937 prefs_common.mainview_height = allocation.height;
2938 prefs_common.mainwin_width = allocation.width;
2939 prefs_common.mainwin_height = allocation.height;
2942 gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->folderview), &allocation);
2943 if (allocation.width > 1 && allocation.height > 1 &&
2944 !prefs_common.mainwin_fullscreen) {
2945 prefs_common.folderview_width = allocation.width;
2946 prefs_common.folderview_height = allocation.height;
2949 gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->messageview), &allocation);
2950 if (allocation.width > 1 && allocation.height > 1 &&
2951 !prefs_common.mainwin_fullscreen) {
2952 prefs_common.msgview_width = allocation.width;
2953 prefs_common.msgview_height = allocation.height;
2956 /* debug_print("summaryview size: %d x %d\n",
2957 prefs_common.summaryview_width,
2958 prefs_common.summaryview_height);
2959 debug_print("folderview size: %d x %d\n",
2960 prefs_common.folderview_width,
2961 prefs_common.folderview_height);
2962 debug_print("messageview size: %d x %d\n",
2963 prefs_common.msgview_width,
2964 prefs_common.msgview_height); */
2967 void main_window_get_position(MainWindow *mainwin)
2971 if (prefs_common.mainwin_maximised || prefs_common.mainwin_fullscreen)
2974 gtkut_widget_get_uposition(mainwin->window, &x, &y);
2976 prefs_common.mainview_x = x;
2977 prefs_common.mainview_y = y;
2978 prefs_common.mainwin_x = x;
2979 prefs_common.mainwin_y = y;
2981 debug_print("main window position: %d, %d\n", x, y);
2984 void main_window_progress_on(MainWindow *mainwin)
2986 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mainwin->progressbar), "");
2989 void main_window_progress_off(MainWindow *mainwin)
2991 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(mainwin->progressbar), 0.0);
2992 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mainwin->progressbar), "");
2995 gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean for_quit)
2997 if (confirm && procmsg_have_trashed_mails_fast()) {
3001 val = alertpanel(_("Empty trash"),
3002 _("Delete all messages in trash folders?"),
3003 GTK_STOCK_NO, "+" GTK_STOCK_YES, _("Don't quit"));
3005 val = alertpanel(_("Empty trash"),
3006 _("Delete all messages in trash folders?"),
3007 GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL);
3008 if (val == G_ALERTALTERNATE) {
3009 debug_print("will empty trash\n");
3010 } else if (val == G_ALERTDEFAULT) {
3011 debug_print("will not empty trash\n");
3014 return FALSE; /* cancel exit */
3016 manage_window_focus_in(mainwin->window, NULL, NULL);
3019 procmsg_empty_all_trash();
3021 if (mainwin->summaryview->folder_item &&
3022 mainwin->summaryview->folder_item->stype == F_TRASH)
3023 gtk_widget_grab_focus(mainwin->folderview->ctree);
3027 static void main_window_add_mailbox(MainWindow *mainwin)
3032 path = input_dialog(_("Add mailbox"),
3033 _("Input the location of mailbox.\n"
3034 "If an existing mailbox is specified, it will be\n"
3035 "scanned automatically."),
3038 if (folder_find_from_path(path)) {
3039 alertpanel_error(_("The mailbox '%s' already exists."), path);
3043 folder = folder_new(folder_get_class_from_string("mh"),
3044 !strcmp(path, "Mail") ? _("Mailbox") :
3045 g_path_get_basename(path), path);
3048 if (folder->klass->create_tree(folder) < 0) {
3049 alertpanel_error(_("Creation of the mailbox failed.\n"
3050 "Maybe some files already exist, or you don't have the permission to write there."));
3051 folder_destroy(folder);
3056 folder_set_ui_func(folder, scan_tree_func, mainwin);
3057 folder_scan_tree(folder, TRUE);
3058 folder_set_ui_func(folder, NULL, NULL);
3061 SensitiveCond main_window_get_current_state(MainWindow *mainwin)
3063 SensitiveCond state = 0;
3064 SummarySelection selection;
3065 FolderItem *item = mainwin->summaryview->folder_item;
3066 GList *account_list = account_get_list();
3069 selection = summary_get_selection_type(mainwin->summaryview);
3071 if (mainwin->lock_count == 0 && !claws_is_starting())
3072 state |= M_UNLOCKED;
3073 if (selection != SUMMARY_NONE)
3074 state |= M_MSG_EXIST;
3075 if (item && item->path && folder_item_parent(item) && !item->no_select) {
3077 /* if (item->folder->type != F_NEWS) */
3078 state |= M_ALLOW_DELETE;
3080 if (prefs_common.immediate_exec == 0
3081 && mainwin->lock_count == 0)
3082 state |= M_DELAY_EXEC;
3084 if ((selection == SUMMARY_NONE && item->hide_read_msgs)
3085 || selection != SUMMARY_NONE)
3086 state |= M_HIDE_READ_MSG;
3088 if ((selection == SUMMARY_NONE && item->hide_read_threads)
3089 || selection != SUMMARY_NONE)
3090 state |= M_HIDE_READ_THREADS;
3092 if (mainwin->summaryview->threaded)
3093 state |= M_THREADED;
3095 state |= M_UNTHREADED;
3096 if (selection == SUMMARY_SELECTED_SINGLE ||
3097 selection == SUMMARY_SELECTED_MULTIPLE)
3098 state |= M_TARGET_EXIST;
3099 if (selection == SUMMARY_SELECTED_SINGLE)
3100 state |= M_SINGLE_TARGET_EXIST;
3101 if (mainwin->summaryview->folder_item &&
3102 mainwin->summaryview->folder_item->folder->klass->type == F_NEWS)
3105 state |= M_NOT_NEWS;
3106 if (mainwin->summaryview->folder_item &&
3107 (mainwin->summaryview->folder_item->stype != F_TRASH ||
3108 !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
3109 state |= M_NOT_TRASH;
3111 if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
3112 state |= M_ACTIONS_EXIST;
3114 tmp = tags_get_list();
3115 if (tmp && g_slist_length(tmp))
3116 state |= M_TAGS_EXIST;
3119 if (procmsg_have_queued_mails_fast() && !procmsg_is_sending())
3120 state |= M_HAVE_QUEUED_MAILS;
3122 if (selection == SUMMARY_SELECTED_SINGLE &&
3124 (folder_has_parent_of_type(item, F_DRAFT) ||
3125 folder_has_parent_of_type(item, F_OUTBOX) ||
3126 folder_has_parent_of_type(item, F_QUEUE))))
3127 state |= M_ALLOW_REEDIT;
3129 state |= M_HAVE_ACCOUNT;
3131 if (cur_account && cur_account->protocol != A_NONE)
3132 state |= M_HAVE_RETRIEVABLE_ACCOUNT;
3134 if (any_folder_want_synchronise())
3135 state |= M_WANT_SYNC;
3137 if (item && item->prefs->processing && selection != SUMMARY_NONE)
3138 state |= M_HAVE_PROCESSING;
3140 if (g_list_length(account_list) > 1)
3141 state |= M_HAVE_MULTI_ACCOUNT;
3143 for ( ; account_list != NULL; account_list = account_list->next) {
3144 if (((PrefsAccount*)account_list->data)->protocol != A_NONE) {
3145 state |= M_HAVE_ANY_RETRIEVABLE_ACCOUNT;
3150 for ( ; account_list != NULL; account_list = account_list->next) {
3151 if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
3152 state |= M_HAVE_NEWS_ACCOUNT;
3157 if (procmsg_spam_can_learn() &&
3158 (mainwin->summaryview->folder_item &&
3159 mainwin->summaryview->folder_item->folder->klass->type != F_UNKNOWN &&
3160 mainwin->summaryview->folder_item->folder->klass->type != F_NEWS)) {
3161 state |= M_CAN_LEARN_SPAM;
3164 if (mainwin->summaryview->folder_item) {
3165 state |= M_FOLDER_SELECTED;
3168 if (inc_is_active())
3169 state |= M_INC_ACTIVE;
3170 if (imap_cancel_all_enabled())
3171 state |= M_INC_ACTIVE;
3173 if (mainwin->summaryview->deleted > 0)
3174 state |= M_DELETED_EXISTS;
3176 if (mainwin->summaryview->deleted > 0 ||
3177 mainwin->summaryview->moved > 0 ||
3178 mainwin->summaryview->copied > 0)
3179 state |= M_DELAY_EXEC;
3181 if (summary_is_list(mainwin->summaryview))
3182 state |= M_SUMMARY_ISLIST;
3184 if (prefs_common.layout_mode != SMALL_LAYOUT || mainwin->in_folder)
3185 state |= M_IN_MSGLIST;
3187 for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
3188 PrefsAccount *account = account_list->data;
3189 if (account->session_passwd || account->session_smtp_passwd) {
3190 state |= M_SESSION_PASSWORDS;
3200 void main_window_set_menu_sensitive(MainWindow *mainwin)
3202 SensitiveCond state;
3204 SummaryView *summaryview;
3207 GList *children, *cur_item;
3210 static const struct {
3214 {"Menu/File/SaveAs", M_TARGET_EXIST},
3215 {"Menu/File/Print" , M_TARGET_EXIST},
3216 {"Menu/File/SynchroniseFolders", M_WANT_SYNC},
3217 {"Menu/File/Exit" , M_UNLOCKED},
3219 {"Menu/Edit/SelectThread" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
3220 {"Menu/Edit/DeleteThread" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
3221 {"Menu/Edit/Find", M_SINGLE_TARGET_EXIST},
3222 {"Menu/Edit/QuickSearch", M_IN_MSGLIST},
3224 {"Menu/View/SetColumns/Folderlist" , M_UNLOCKED|M_SUMMARY_ISLIST},
3225 {"Menu/View/Sort" , M_EXEC|M_SUMMARY_ISLIST},
3226 {"Menu/View/ThreadView" , M_EXEC|M_SUMMARY_ISLIST},
3227 {"Menu/View/ExpandThreads" , M_MSG_EXIST|M_SUMMARY_ISLIST},
3228 {"Menu/View/CollapseThreads" , M_MSG_EXIST|M_SUMMARY_ISLIST},
3229 {"Menu/View/HideReadThreads" , M_HIDE_READ_THREADS|M_SUMMARY_ISLIST},
3230 {"Menu/View/HideReadMessages" , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
3231 {"Menu/View/HideDelMessages" , M_SUMMARY_ISLIST},
3232 {"Menu/View/Goto/Prev" , M_MSG_EXIST},
3233 {"Menu/View/Goto/Next" , M_MSG_EXIST},
3234 {"Menu/View/Goto/PrevUnread" , M_MSG_EXIST},
3235 {"Menu/View/Goto/PrevNew" , M_MSG_EXIST},
3236 {"Menu/View/Goto/PrevMarked" , M_MSG_EXIST},
3237 {"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
3238 {"Menu/View/Goto/NextLabeled", M_MSG_EXIST},
3239 {"Menu/View/Goto/LastRead" , M_SINGLE_TARGET_EXIST},
3240 {"Menu/View/Goto/ParentMessage" , M_SINGLE_TARGET_EXIST},
3241 {"Menu/View/OpenNewWindow" , M_SINGLE_TARGET_EXIST},
3242 {"Menu/View/MessageSource" , M_SINGLE_TARGET_EXIST},
3243 {"Menu/View/AllHeaders" , M_SINGLE_TARGET_EXIST},
3244 {"Menu/View/Quotes" , M_SINGLE_TARGET_EXIST},
3246 {"Menu/Message/Receive/CurrentAccount"
3247 , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT},
3248 {"Menu/Message/Receive/AllAccounts"
3249 , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT},
3250 {"Menu/Message/Receive/CancelReceiving"
3252 {"Menu/Message/SendQueue" , M_HAVE_ACCOUNT|M_HAVE_QUEUED_MAILS},
3253 {"Menu/Message/ComposeEmail", M_HAVE_ACCOUNT},
3254 {"Menu/Message/ComposeNews", M_HAVE_NEWS_ACCOUNT},
3255 {"Menu/Message/Reply" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3256 {"Menu/Message/ReplyTo" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3257 {"Menu/Message/FollowupReply", M_HAVE_ACCOUNT|M_TARGET_EXIST|M_NEWS|M_SUMMARY_ISLIST},
3258 {"Menu/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3259 {"Menu/Message/ForwardAtt" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3260 {"Menu/Message/Redirect" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3261 {"Menu/Message/Move" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
3262 {"Menu/Message/Copy" , M_TARGET_EXIST|M_EXEC},
3263 {"Menu/Message/Trash" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
3264 {"Menu/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE},
3265 {"Menu/Message/CancelNews" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NEWS},
3266 {"Menu/Message/Mark" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
3267 {"Menu/Message/Mark/MarkSpam" , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
3268 {"Menu/Message/Mark/MarkHam" , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
3269 {"Menu/Message/Mark/IgnoreThread" , M_TARGET_EXIST},
3270 {"Menu/Message/Mark/UnignoreThread" , M_TARGET_EXIST},
3271 {"Menu/Message/Mark/Lock" , M_TARGET_EXIST},
3272 {"Menu/Message/Mark/Unlock" , M_TARGET_EXIST},
3273 {"Menu/Message/ColorLabel" , M_TARGET_EXIST},
3274 {"Menu/Message/Tags" , M_TARGET_EXIST},
3275 {"Menu/Message/Reedit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
3277 {"Menu/Tools/AddSenderToAB" , M_SINGLE_TARGET_EXIST},
3278 {"Menu/Tools/CollectAddresses" , M_FOLDER_SELECTED},
3279 {"Menu/Tools/CollectAddresses/FromFolder"
3280 , M_FOLDER_SELECTED},
3281 {"Menu/Tools/CollectAddresses/FromSelected"
3283 {"Menu/Tools/FilterFolder", M_MSG_EXIST|M_EXEC},
3284 {"Menu/Tools/FilterSelected" , M_TARGET_EXIST|M_EXEC},
3285 {"Menu/Tools/RunProcessing" , M_HAVE_PROCESSING},
3286 {"Menu/Tools/CreateFilterRule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
3287 {"Menu/Tools/CreateProcessingRule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
3288 {"Menu/Tools/ListUrls" , M_TARGET_EXIST},
3289 {"Menu/Tools/Actions" , M_TARGET_EXIST|M_ACTIONS_EXIST},
3290 {"Menu/Tools/Execute" , M_DELAY_EXEC},
3291 {"Menu/Tools/Expunge" , M_DELETED_EXISTS},
3292 {"Menu/Tools/ForgetSessionPasswords" , M_SESSION_PASSWORDS},
3293 {"Menu/Tools/DeleteDuplicates/SelFolder" , M_MSG_EXIST|M_ALLOW_DELETE},
3295 {"Menu/Configuration", M_UNLOCKED},
3296 {"Menu/Configuration/ChangeAccount", M_HAVE_MULTI_ACCOUNT},
3297 {"Menu/Configuration/AccountPrefs", M_UNLOCKED},
3298 {"Menu/Configuration/CreateAccount", M_UNLOCKED},
3299 {"Menu/Configuration/EditAccounts", M_UNLOCKED},
3304 state = main_window_get_current_state(mainwin);
3306 for (i = 0; entry[i].entry != NULL; i++) {
3307 sensitive = ((entry[i].cond & state) == entry[i].cond);
3308 cm_menu_set_sensitive_full(mainwin->ui_manager, entry[i].entry, sensitive);
3311 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
3312 gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive")));
3314 children = gtk_container_get_children(GTK_CONTAINER(menu));
3315 for (cur_item = children; cur_item != NULL; cur_item = cur_item->next) {
3316 if (cur_item->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
3317 cur_item = cur_item->next;
3322 for (; cur_item != NULL; cur_item = cur_item->next) {
3323 gtk_widget_set_sensitive(GTK_WIDGET(cur_item->data),
3324 (M_UNLOCKED & state) != 0);
3327 g_list_free(children);
3329 main_window_menu_callback_block(mainwin);
3331 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
3332 messageview_is_visible(mainwin->messageview));
3334 summaryview = mainwin->summaryview;
3335 menu_path = "Menu/View/Sort/DontSort";
3337 switch (summaryview->sort_key) {
3338 case SORT_BY_NUMBER:
3339 menu_path = "Menu/View/Sort/Number"; break;
3341 menu_path = "Menu/View/Sort/Size"; break;
3343 menu_path = "Menu/View/Sort/Date"; break;
3344 case SORT_BY_THREAD_DATE:
3345 menu_path = "Menu/View/Sort/ThreadDate"; break;
3347 menu_path = "Menu/View/Sort/From"; break;
3349 menu_path = "Menu/View/Sort/To"; break;
3350 case SORT_BY_SUBJECT:
3351 menu_path = "Menu/View/Sort/Subject"; break;
3353 menu_path = "Menu/View/Sort/Color"; break;
3355 menu_path = "Menu/View/Sort/Mark"; break;
3356 case SORT_BY_STATUS:
3357 menu_path = "Menu/View/Sort/Status"; break;
3359 menu_path = "Menu/View/Sort/Attachment"; break;
3361 menu_path = "Menu/View/Sort/Score"; break;
3362 case SORT_BY_LOCKED:
3363 menu_path = "Menu/View/Sort/Locked"; break;
3365 menu_path = "Menu/View/Sort/Tag"; break;
3368 menu_path = "Menu/View/Sort/DontSort"; break;
3370 cm_toggle_menu_set_active_full(mainwin->ui_manager, menu_path, TRUE);
3372 if (summaryview->sort_type == SORT_ASCENDING) {
3373 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Sort/Ascending", TRUE);
3375 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Sort/Descending", TRUE);
3378 if (summaryview->sort_key != SORT_BY_NONE) {
3379 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Ascending", TRUE);
3380 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", TRUE);
3382 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Ascending", FALSE);
3383 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", FALSE);
3386 if (mainwin->messageview
3387 && mainwin->messageview->mimeview
3388 && mainwin->messageview->mimeview->textview)
3389 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
3390 prefs_common.show_all_headers);
3391 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & M_THREADED) != 0);
3392 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & M_THREADED) != 0);
3393 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & M_THREADED) != 0);
3394 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & M_THREADED) != 0);
3395 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
3396 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
3397 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
3399 if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs)
3400 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
3401 if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
3402 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
3404 main_window_menu_callback_unblock(mainwin);
3407 void main_create_mailing_list_menu (MainWindow *mainwin, MsgInfo *msginfo)
3412 is_menu = mailing_list_create_submenu (mainwin, msginfo);
3414 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList", TRUE);
3416 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList", FALSE);
3419 static gint mailing_list_create_submenu (MainWindow *mainwin, MsgInfo *msginfo)
3422 GtkWidget *menuitem;
3424 if (!msginfo || !msginfo->extradata) {
3425 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Post", FALSE);
3426 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Help", FALSE);
3427 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Subscribe", FALSE);
3428 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Unsubscribe", FALSE);
3429 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/ViewArchive", FALSE);
3430 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/ContactOwner", FALSE);
3434 /* Mailing list post */
3435 if (!strcmp2 (msginfo->extradata->list_post, "NO")) {
3436 g_free(msginfo->extradata->list_post);
3437 msginfo->extradata->list_post = g_strdup (_("No posting allowed"));
3439 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Post");
3441 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_post);
3443 /* Mailing list help */
3444 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Help");
3446 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_help);
3448 /* Mailing list subscribe */
3449 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Subscribe");
3451 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_subscribe);
3453 /* Mailing list unsubscribe */
3454 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Unsubscribe");
3456 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_unsubscribe);
3458 /* Mailing list view archive */
3459 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/ViewArchive");
3461 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_archive);
3463 /* Mailing list contact owner */
3464 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/ContactOwner");
3466 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_owner);
3471 static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * list_header)
3473 GtkWidget *item, *menu;
3474 const gchar *url_pt ;
3475 gchar url_decoded[BUFFSIZE];
3476 GList *children, *amenu;
3479 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
3481 /* First delete old submenu */
3482 /* FIXME: we can optimize this, and only change/add/delete necessary items */
3483 children = gtk_container_get_children(GTK_CONTAINER(menu));
3484 for (amenu = children; amenu; amenu = amenu->next) {
3485 item = GTK_WIDGET (amenu->data);
3486 gtk_widget_destroy (item);
3488 g_list_free(children);
3490 for (url_pt = list_header; url_pt && *url_pt;) {
3491 get_url_part (&url_pt, url_decoded, BUFFSIZE);
3493 if (!g_ascii_strncasecmp(url_decoded, "mailto:", 7)) {
3494 item = gtk_menu_item_new_with_label ((url_decoded));
3495 g_signal_connect(G_OBJECT(item), "activate",
3496 G_CALLBACK(mailing_list_compose),
3499 else if (!g_ascii_strncasecmp(url_decoded, "http:", 5) ||
3500 !g_ascii_strncasecmp(url_decoded, "https:",6)) {
3502 item = gtk_menu_item_new_with_label ((url_decoded));
3503 g_signal_connect(G_OBJECT(item), "activate",
3504 G_CALLBACK(mailing_list_open_uri),
3508 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
3509 gtk_widget_show (item);
3515 gtk_widget_set_sensitive (menuitem, TRUE);
3517 gtk_widget_set_sensitive (menuitem, FALSE);
3523 static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
3525 gchar tmp[BUFFSIZE];
3529 gboolean with_plus = TRUE;
3532 *url_decoded = '\0';
3536 /* Ignore spaces, comments and tabs () */
3537 for (;*buf == ' ' || *buf == '(' || *buf == '\t'; buf++)
3539 for (;*buf != ')' && *buf != 0x00; buf++);
3541 /* First non space and non comment must be a < */
3544 if (!strncmp(buf, "mailto:", strlen("mailto:")))
3546 for (i = 0; *buf != '>' && *buf != 0x00 && i<maxlen; tmp[i++] = *(buf++));
3551 *url_decoded = '\0';
3556 *url_decoded = '\0';
3562 decode_uri_with_plus (url_decoded, (const gchar *)tmp, with_plus);
3564 /* Prepare the work for the next url in the list */
3565 /* after the closing bracket >, ignore space, comments and tabs */
3566 for (;buf && *buf && (*buf == ' ' || *buf == '(' || *buf == '\t'); buf++)
3568 for (;*buf != ')' && *buf != 0x00; buf++);
3570 if (!buf || !*buf) {
3575 /* now first non space, non comment must be a comma */
3577 for (;*buf != 0x00; buf++);
3583 static void mailing_list_compose (GtkWidget *w, gpointer *data)
3585 const gchar *mailto;
3586 PrefsAccount *account = NULL;
3587 FolderItem *folder_item = NULL;
3589 mailto = gtk_label_get_text(GTK_LABEL (gtk_bin_get_child(GTK_BIN((w)))));
3590 if (mainwindow_get_mainwindow()) {
3591 folder_item = mainwindow_get_mainwindow()->summaryview->folder_item;
3592 if (folder_item && folder_item->prefs && folder_item->prefs->enable_default_account)
3593 account = account_find_from_id(folder_item->prefs->default_account);
3594 if (folder_item && !account)
3595 account = account_find_from_item(folder_item);
3598 compose_new_with_folderitem(account, folder_item, mailto+7);
3601 static void mailing_list_open_uri (GtkWidget *w, gpointer *data)
3604 const gchar *mailto;
3606 mailto = gtk_label_get_text(GTK_LABEL (gtk_bin_get_child(GTK_BIN((w)))));
3608 open_uri (mailto, prefs_common_get_uri_cmd());
3611 static void fix_folderview_scroll(MainWindow *mainwin)
3613 static gboolean fix_done = FALSE;
3618 gtk_widget_queue_resize(mainwin->folderview->ctree);
3623 void main_window_popup(MainWindow *mainwin)
3625 static gboolean first_start = TRUE;
3627 if (!gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
3628 main_window_show(mainwin);
3630 if (prefs_common.mainwin_maximised)
3631 gtk_window_maximize(GTK_WINDOW(mainwin->window));
3634 first_start = FALSE;
3636 gtkut_window_popup(mainwin->window);
3639 if (prefs_common.layout_mode == SMALL_LAYOUT) {
3640 if (mainwin->in_folder) {
3641 mainwindow_enter_folder(mainwin);
3643 mainwindow_exit_folder(mainwin);
3646 fix_folderview_scroll(mainwin);
3649 void main_window_show(MainWindow *mainwin)
3651 gtk_widget_show(mainwin->window);
3652 gtk_widget_show(mainwin->vbox_body);
3653 #ifndef GENERIC_UMPC
3654 gtk_window_move(GTK_WINDOW(mainwin->window),
3655 prefs_common.mainwin_x,
3656 prefs_common.mainwin_y);
3658 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
3659 prefs_common.folderview_width,
3660 prefs_common.folderview_height);
3661 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
3662 prefs_common.summaryview_width,
3663 prefs_common.summaryview_height);
3664 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
3665 prefs_common.msgview_width,
3666 prefs_common.msgview_height);
3670 void main_window_hide(MainWindow *mainwin)
3672 main_window_get_size(mainwin);
3673 main_window_get_position(mainwin);
3675 gtk_widget_hide(mainwin->window);
3676 gtk_widget_hide(mainwin->vbox_body);
3679 static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
3681 GtkWidget *folderwin = NULL;
3682 GtkWidget *messagewin = NULL;
3685 GtkWidget *vbox_body = mainwin->vbox_body;
3686 gboolean first_set = (mainwin->hpaned == NULL);
3687 debug_print("Setting widgets... ");
3689 #ifndef GENERIC_UMPC
3690 mainwin->messageview->statusbar = mainwin->statusbar;
3691 mainwin->messageview->statusbar_cid = mainwin->messageview_cid;
3693 /* clean top-most container */
3694 if (mainwin->hpaned) {
3695 if (gtk_widget_get_parent(mainwin->hpaned) == mainwin->vpaned)
3696 gtk_widget_destroy(mainwin->vpaned);
3698 gtk_widget_destroy(mainwin->hpaned);
3701 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
3702 (layout_mode != WIDE_MSGLIST_LAYOUT && layout_mode != SMALL_LAYOUT));
3703 switch (layout_mode) {
3704 case VERTICAL_LAYOUT:
3707 hpaned = gtk_hpaned_new();
3708 if (layout_mode == VERTICAL_LAYOUT)
3709 vpaned = gtk_hpaned_new();
3711 vpaned = gtk_vpaned_new();
3712 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
3713 gtk_paned_add1(GTK_PANED(hpaned),
3714 GTK_WIDGET_PTR(mainwin->folderview));
3715 gtk_widget_show(hpaned);
3716 gtk_widget_queue_resize(hpaned);
3718 if (messageview_is_visible(mainwin->messageview)) {
3719 gtk_paned_add2(GTK_PANED(hpaned), vpaned);
3720 gtk_paned_add1(GTK_PANED(vpaned),
3721 GTK_WIDGET_PTR(mainwin->summaryview));
3723 gtk_paned_add2(GTK_PANED(hpaned),
3724 GTK_WIDGET_PTR(mainwin->summaryview));
3725 g_object_ref(vpaned);
3727 gtk_paned_add2(GTK_PANED(vpaned),
3728 GTK_WIDGET_PTR(mainwin->messageview));
3729 gtk_widget_show(vpaned);
3730 if (layout_mode == SMALL_LAYOUT && first_set) {
3731 mainwin_paned_show_first(GTK_PANED(hpaned));
3733 gtk_widget_queue_resize(vpaned);
3736 vpaned = gtk_vpaned_new();
3737 hpaned = gtk_hpaned_new();
3738 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned, TRUE, TRUE, 0);
3739 gtk_paned_add1(GTK_PANED(vpaned), hpaned);
3741 gtk_paned_add1(GTK_PANED(hpaned),
3742 GTK_WIDGET_PTR(mainwin->folderview));
3743 gtk_paned_add2(GTK_PANED(hpaned),
3744 GTK_WIDGET_PTR(mainwin->summaryview));
3746 gtk_widget_show(hpaned);
3747 gtk_widget_queue_resize(hpaned);
3749 if (messageview_is_visible(mainwin->messageview)) {
3750 gtk_paned_add2(GTK_PANED(vpaned),
3751 GTK_WIDGET_PTR(mainwin->messageview));
3753 g_object_ref(GTK_WIDGET_PTR(mainwin->messageview));
3755 gtk_widget_show(vpaned);
3756 gtk_widget_queue_resize(vpaned);
3758 case WIDE_MSGLIST_LAYOUT:
3759 vpaned = gtk_vpaned_new();
3760 hpaned = gtk_hpaned_new();
3761 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned, TRUE, TRUE, 0);
3763 gtk_paned_add1(GTK_PANED(vpaned),
3764 GTK_WIDGET_PTR(mainwin->summaryview));
3765 gtk_paned_add1(GTK_PANED(hpaned),
3766 GTK_WIDGET_PTR(mainwin->folderview));
3768 gtk_widget_show(hpaned);
3769 gtk_widget_queue_resize(hpaned);
3771 if (messageview_is_visible(mainwin->messageview)) {
3772 gtk_paned_add2(GTK_PANED(hpaned),
3773 GTK_WIDGET_PTR(mainwin->messageview));
3775 g_object_ref(GTK_WIDGET_PTR(mainwin->messageview));
3777 gtk_paned_add2(GTK_PANED(vpaned), hpaned);
3779 gtk_widget_show(vpaned);
3780 gtk_widget_queue_resize(vpaned);
3783 g_warning("Unknown layout");
3787 mainwin->hpaned = hpaned;
3788 mainwin->vpaned = vpaned;
3790 if (layout_mode == SMALL_LAYOUT) {
3791 if (mainwin->messageview->visible)
3792 main_window_toggle_message_view(mainwin);
3795 if (layout_mode == SMALL_LAYOUT && first_set) {
3796 gtk_widget_realize(mainwin->window);
3797 gtk_widget_realize(mainwin->folderview->ctree);
3798 gtk_widget_realize(mainwin->summaryview->hbox);
3799 gtk_widget_realize(mainwin->summaryview->hbox_l);
3800 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
3801 prefs_common.folderview_width,
3802 prefs_common.folderview_height);
3803 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
3805 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
3807 gtk_widget_set_size_request(GTK_WIDGET(mainwin->window),
3808 prefs_common.mainwin_width,
3809 prefs_common.mainwin_height);
3810 gtk_paned_set_position(GTK_PANED(mainwin->hpaned), 800);
3812 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
3813 prefs_common.folderview_width,
3814 prefs_common.folderview_height);
3815 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
3816 prefs_common.summaryview_width,
3817 prefs_common.summaryview_height);
3818 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
3819 prefs_common.msgview_width,
3820 prefs_common.msgview_height);
3821 gtk_widget_set_size_request(GTK_WIDGET(mainwin->window),
3822 prefs_common.mainwin_width,
3823 prefs_common.mainwin_height);
3825 /* remove headerview if not in prefs */
3826 headerview_set_visibility(mainwin->messageview->headerview,
3827 prefs_common.display_header_pane);
3829 if (messageview_is_visible(mainwin->messageview))
3830 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
3831 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
3833 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
3834 GTK_ARROW_UP, GTK_SHADOW_OUT);
3836 gtk_window_move(GTK_WINDOW(mainwin->window),
3837 prefs_common.mainwin_x,
3838 prefs_common.mainwin_y);
3840 gtk_widget_queue_resize(vbox_body);
3841 gtk_widget_queue_resize(mainwin->vbox);
3842 gtk_widget_queue_resize(mainwin->window);
3843 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
3844 * and mimeview icon list/ctree lose track of their visibility states */
3845 if (!noticeview_is_visible(mainwin->messageview->noticeview))
3846 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
3847 if (!noticeview_is_visible(mainwin->messageview->mimeview->siginfoview))
3848 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->mimeview->siginfoview));
3849 if (mainwin->messageview->mimeview->ctree_mode)
3850 gtk_widget_hide(mainwin->messageview->mimeview->icon_mainbox);
3852 gtk_widget_hide(mainwin->messageview->mimeview->ctree_mainbox);
3854 prefs_common.layout_mode = layout_mode;
3856 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
3857 messageview_is_visible(mainwin->messageview));
3859 #ifndef GENERIC_UMPC
3860 switch (prefs_common.layout_mode) {
3862 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/Standard", TRUE);
3864 case VERTICAL_LAYOUT:
3865 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/ThreeColumns", TRUE);
3868 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/WideMessage", TRUE);
3870 case WIDE_MSGLIST_LAYOUT:
3871 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/WideMessageList", TRUE);
3874 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/SmallScreen", TRUE);
3881 (G_OBJECT(folderwin), "size_allocate",
3882 G_CALLBACK(folder_window_size_allocate_cb),
3887 (G_OBJECT(messagewin), "size_allocate",
3888 G_CALLBACK(message_window_size_allocate_cb),
3892 debug_print("done.\n");
3895 void main_window_destroy_all(void)
3897 while (mainwin_list != NULL) {
3898 MainWindow *mainwin = (MainWindow*)mainwin_list->data;
3900 /* free toolbar stuff */
3901 toolbar_clear_list(TOOLBAR_MAIN);
3902 TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
3903 TOOLBAR_DESTROY_ITEMS(mainwin->toolbar->item_list);
3905 summaryview_destroy(mainwin->summaryview);
3906 mainwin->folderview->mainwin = NULL;
3907 mainwin->summaryview->mainwin = NULL;
3908 mainwin->messageview->mainwin = NULL;
3910 g_free(mainwin->toolbar);
3913 mainwin_list = g_list_remove(mainwin_list, mainwin);
3915 g_list_free(mainwin_list);
3916 mainwin_list = NULL;
3919 static void toolbar_child_attached(GtkWidget *widget, GtkWidget *child,
3922 gtk_widget_set_size_request(child, 1, -1);
3925 static void toolbar_child_detached(GtkWidget *widget, GtkWidget *child,
3928 gtk_widget_set_size_request(child, -1, -1);
3930 #ifndef GENERIC_UMPC
3931 static gboolean ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
3934 MainWindow *mainwin = (MainWindow *)data;
3935 GtkWidget *menu = NULL;
3937 if (!event) return FALSE;
3939 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
3941 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(mainwin->ac_menu));
3943 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
3944 menu_button_position, widget,
3945 event->button, event->time);
3950 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
3953 MainWindow *mainwin = (MainWindow *)data;
3954 gboolean close_allowed = TRUE;
3956 hooks_invoke(MAIN_WINDOW_CLOSE, &close_allowed);
3958 if (close_allowed && mainwin->lock_count == 0)
3959 app_exit_cb(NULL, data);
3964 static void main_window_size_allocate_cb(GtkWidget *widget,
3965 GtkAllocation *allocation,
3968 MainWindow *mainwin = (MainWindow *)data;
3969 main_window_get_size(mainwin);
3972 static void folder_window_size_allocate_cb(GtkWidget *widget,
3973 GtkAllocation *allocation,
3976 MainWindow *mainwin = (MainWindow *)data;
3978 main_window_get_size(mainwin);
3981 static void message_window_size_allocate_cb(GtkWidget *widget,
3982 GtkAllocation *allocation,
3985 MainWindow *mainwin = (MainWindow *)data;
3987 main_window_get_size(mainwin);
3990 static void add_mailbox_cb(GtkAction *action, gpointer data)
3992 MainWindow *mainwin = (MainWindow *)data;
3993 main_window_add_mailbox(mainwin);
3996 static void update_folderview_cb(GtkAction *action, gpointer data)
3998 MainWindow *mainwin = (MainWindow *)data;
3999 summary_show(mainwin->summaryview, NULL);
4000 folderview_check_new_all();
4003 static void foldersort_cb(GtkAction *action, gpointer data)
4008 static void import_mbox_cb(GtkAction *action, gpointer data)
4010 MainWindow *mainwin = (MainWindow *)data;
4011 /* only notify if import has failed */
4012 if (import_mbox(mainwin->summaryview->folder_item) == -1) {
4013 alertpanel_error(_("Mbox import has failed."));
4017 static void export_mbox_cb(GtkAction *action, gpointer data)
4019 MainWindow *mainwin = (MainWindow *)data;
4020 /* only notify if export has failed */
4021 if (export_mbox(mainwin->summaryview->folder_item) == -1) {
4022 alertpanel_error(_("Export to mbox has failed."));
4026 static void export_list_mbox_cb(GtkAction *action, gpointer data)
4028 MainWindow *mainwin = (MainWindow *)data;
4029 /* only notify if export has failed */
4030 if (summaryview_export_mbox_list(mainwin->summaryview) == -1) {
4031 alertpanel_error(_("Export to mbox has failed."));
4035 static void empty_trash_cb(GtkAction *action, gpointer data)
4037 MainWindow *mainwin = (MainWindow *)data;
4038 main_window_empty_trash(mainwin, TRUE, FALSE);
4041 static void save_as_cb(GtkAction *action, gpointer data)
4043 MainWindow *mainwin = (MainWindow *)data;
4044 summary_save_as(mainwin->summaryview);
4047 static void print_cb(GtkAction *action, gpointer data)
4049 MainWindow *mainwin = (MainWindow *)data;
4050 summary_print(mainwin->summaryview);
4053 static void page_setup_cb(GtkAction *action, gpointer data)
4055 MainWindow *mainwin = (MainWindow *)data;
4058 win = (mainwin ? GTK_WINDOW(mainwin->window) : NULL);
4060 printing_page_setup(win);
4063 static void app_exit_cb(GtkAction *action, gpointer data)
4065 MainWindow *mainwin = (MainWindow *)data;
4066 if (prefs_common.clean_on_exit) {
4067 if (!main_window_empty_trash(mainwin, prefs_common.ask_on_clean, TRUE))
4071 if (prefs_common.confirm_on_exit) {
4072 if (alertpanel(_("Exit"), _("Exit Claws Mail?"),
4073 GTK_STOCK_CANCEL, GTK_STOCK_QUIT, NULL)
4074 != G_ALERTALTERNATE)
4076 manage_window_focus_in(mainwin->window, NULL, NULL);
4079 app_will_exit(NULL, mainwin);
4082 static void search_cb(GtkAction *action, gpointer data)
4084 MainWindow *mainwin = (MainWindow *)data;
4085 message_search(mainwin->messageview);
4088 static void search_folder_cb(GtkAction *action, gpointer data)
4090 MainWindow *mainwin = (MainWindow *)data;
4091 summary_search(mainwin->summaryview);
4094 static void mainwindow_quicksearch(GtkAction *action, gpointer data)
4096 MainWindow *mainwin = (MainWindow *)data;
4097 summaryview_activate_quicksearch(mainwin->summaryview, TRUE);
4100 static void toggle_message_cb(GtkAction *action, gpointer data)
4102 MainWindow *mainwin = (MainWindow *)data;
4105 active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
4107 if (active != messageview_is_visible(mainwin->messageview))
4108 summary_toggle_view(mainwin->summaryview);
4111 static void toggle_toolbar_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4113 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4114 MainWindow *mainwin = (MainWindow *)data;
4115 toolbar_toggle(value, mainwin);
4118 static void main_window_reply_cb(GtkAction *gaction, gpointer data)
4120 MainWindow *mainwin = (MainWindow *)data;
4121 MessageView *msgview = (MessageView*)mainwin->messageview;
4122 GSList *msginfo_list = NULL;
4123 gint action = COMPOSE_REPLY;
4124 const gchar *a_name = gtk_action_get_name(gaction);
4126 DO_ACTION("Message/Reply", COMPOSE_REPLY);
4127 DO_ACTION("Message/ReplyTo/All", COMPOSE_REPLY_TO_ALL);
4128 DO_ACTION("Message/ReplyTo/Sender", COMPOSE_REPLY_TO_SENDER);
4129 DO_ACTION("Message/ReplyTo/List", COMPOSE_REPLY_TO_LIST);
4130 DO_ACTION("Message/Forward", COMPOSE_FORWARD_INLINE);
4131 DO_ACTION("Message/ForwardAtt", COMPOSE_FORWARD_AS_ATTACH);
4132 DO_ACTION("Message/Redirect", COMPOSE_REDIRECT);
4133 DO_ACTION("Message/FollowupReply", COMPOSE_FOLLOWUP_AND_REPLY_TO);
4135 cm_return_if_fail(msgview != NULL);
4137 msginfo_list = summary_get_selection(mainwin->summaryview);
4138 cm_return_if_fail(msginfo_list != NULL);
4139 compose_reply_from_messageview(msgview, msginfo_list, action);
4140 g_slist_free(msginfo_list);
4143 static void toggle_col_headers_cb(GtkAction *gaction, gpointer data)
4145 MainWindow *mainwin = (MainWindow *)data;
4146 FolderView *folderview = mainwin->folderview;
4147 SummaryView *summaryview = mainwin->summaryview;
4148 MimeView *mimeview = mainwin->messageview->mimeview;
4150 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (gaction))) {
4151 gtk_cmclist_column_titles_show(GTK_CMCLIST(folderview->ctree));
4152 gtk_cmclist_column_titles_show(GTK_CMCLIST(summaryview->ctree));
4153 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mimeview->ctree), TRUE);
4154 prefs_common.show_col_headers = TRUE;
4156 gtk_cmclist_column_titles_hide(GTK_CMCLIST(folderview->ctree));
4157 gtk_cmclist_column_titles_hide(GTK_CMCLIST(summaryview->ctree));
4158 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mimeview->ctree), FALSE);
4159 prefs_common.show_col_headers = FALSE;
4163 #ifndef GENERIC_UMPC
4164 static void toggle_statusbar_cb(GtkAction *gaction, gpointer data)
4166 MainWindow *mainwin = (MainWindow *)data;
4167 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (gaction))) {
4168 gtk_widget_show(mainwin->hbox_stat);
4169 prefs_common.show_statusbar = TRUE;
4171 gtk_widget_hide(mainwin->hbox_stat);
4172 prefs_common.show_statusbar = FALSE;
4176 static void set_layout_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4178 MainWindow *mainwin = (MainWindow *)data;
4179 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4180 LayoutType layout_mode = value;
4181 LayoutType old_layout_mode = prefs_common.layout_mode;
4182 if (mainwin->menu_lock_count) {
4185 if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
4189 if (layout_mode == prefs_common.layout_mode) {
4193 if (!mainwin->messageview->visible && layout_mode != SMALL_LAYOUT)
4194 main_window_toggle_message_view(mainwin);
4195 else if (mainwin->messageview->visible && layout_mode == SMALL_LAYOUT)
4196 main_window_toggle_message_view(mainwin);
4198 main_window_separation_change(mainwin, layout_mode);
4199 mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
4200 if (old_layout_mode == SMALL_LAYOUT && layout_mode != SMALL_LAYOUT) {
4201 mainwindow_reset_paned(GTK_PANED(mainwin->hpaned));
4203 if (old_layout_mode != SMALL_LAYOUT && layout_mode == SMALL_LAYOUT) {
4204 mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
4205 mainwindow_exit_folder(mainwin);
4207 summary_relayout(mainwin->summaryview);
4208 summary_update_unread(mainwin->summaryview, NULL);
4212 void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
4215 offline_ask_sync = ask_sync;
4217 online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
4219 online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
4220 offline_ask_sync = TRUE;
4223 static void toggle_work_offline_cb (GtkAction *action, gpointer data)
4225 MainWindow *mainwin = (MainWindow *)data;
4226 main_window_toggle_work_offline(mainwin, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)), TRUE);
4229 static gboolean any_folder_want_synchronise(void)
4231 GList *folderlist = folder_get_list();
4233 /* see if there are synchronised folders */
4234 for (; folderlist; folderlist = folderlist->next) {
4235 Folder *folder = (Folder *)folderlist->data;
4236 if (folder_want_synchronise(folder)) {
4244 static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
4247 if (!any_folder_want_synchronise())
4250 if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
4251 _("Do you want to synchronise your folders now?"),
4252 GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
4255 if (offline_ask_sync)
4256 folder_synchronise(NULL);
4259 static void online_switch_clicked (GtkButton *btn, gpointer data)
4261 MainWindow *mainwin;
4262 gboolean have_connectivity;
4264 #ifdef HAVE_NETWORKMANAGER_SUPPORT
4265 have_connectivity = networkmanager_is_online(NULL);
4267 have_connectivity = TRUE;
4270 mainwin = (MainWindow *) data;
4272 cm_return_if_fail(mainwin != NULL);
4274 if (btn == GTK_BUTTON(mainwin->online_switch)) {
4275 #ifndef GENERIC_UMPC
4276 gtk_widget_hide (mainwin->online_switch);
4277 gtk_widget_show (mainwin->offline_switch);
4279 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/File/OfflineMode", TRUE);
4281 inc_autocheck_timer_remove();
4284 if (prefs_common.work_offline)
4287 if(have_connectivity)
4288 mainwindow_check_synchronise(mainwin, TRUE);
4289 prefs_common.work_offline = TRUE;
4290 imap_disconnect_all(have_connectivity);
4291 hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
4294 if (!prefs_common.work_offline)
4296 #ifndef GENERIC_UMPC
4297 gtk_widget_hide (mainwin->offline_switch);
4298 gtk_widget_show (mainwin->online_switch);
4300 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/File/OfflineMode", FALSE);
4301 prefs_common.work_offline = FALSE;
4302 inc_autocheck_timer_set();
4303 refresh_resolvers();
4304 hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
4308 static void addressbook_open_cb(GtkAction *action, gpointer data)
4310 addressbook_open(NULL);
4313 static void log_window_show_cb(GtkAction *action, gpointer data)
4315 MainWindow *mainwin = (MainWindow *)data;
4316 log_window_show(mainwin->logwin);
4319 static void filtering_debug_window_show_cb(GtkAction *action, gpointer data)
4321 MainWindow *mainwin = (MainWindow *)data;
4322 log_window_show(mainwin->filtering_debugwin);
4325 static void inc_cancel_cb(GtkAction *action, gpointer data)
4331 static void move_to_cb(GtkAction *action, gpointer data)
4333 MainWindow *mainwin = (MainWindow *)data;
4334 summary_move_to(mainwin->summaryview);
4337 static void copy_to_cb(GtkAction *action, gpointer data)
4339 MainWindow *mainwin = (MainWindow *)data;
4340 summary_copy_to(mainwin->summaryview);
4343 static void delete_cb(GtkAction *action, gpointer data)
4345 MainWindow *mainwin = (MainWindow *)data;
4346 summary_delete(mainwin->summaryview);
4349 static void delete_trash_cb(GtkAction *action, gpointer data)
4351 MainWindow *mainwin = (MainWindow *)data;
4352 summary_delete_trash(mainwin->summaryview);
4355 static void cancel_cb(GtkAction *action, gpointer data)
4357 MainWindow *mainwin = (MainWindow *)data;
4358 summary_cancel(mainwin->summaryview);
4361 static void open_msg_cb(GtkAction *action, gpointer data)
4363 MainWindow *mainwin = (MainWindow *)data;
4364 summary_open_msg(mainwin->summaryview);
4367 static void view_source_cb(GtkAction *action, gpointer data)
4369 MainWindow *mainwin = (MainWindow *)data;
4370 summary_view_source(mainwin->summaryview);
4373 static void show_all_header_cb(GtkAction *action, gpointer data)
4375 MainWindow *mainwin = (MainWindow *)data;
4376 if (mainwin->menu_lock_count) return;
4377 prefs_common.show_all_headers =
4378 gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
4379 summary_display_msg_selected(mainwin->summaryview,
4380 gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
4383 static void toggle_fullscreen_cb(GtkAction *action, gpointer data)
4385 MainWindow *mainwin = (MainWindow *)data;
4386 if (mainwin->menu_lock_count) return;
4387 if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
4388 gtk_window_unfullscreen(GTK_WINDOW(mainwin->window));
4389 prefs_common.mainwin_fullscreen = FALSE;
4392 prefs_common.mainwin_fullscreen = TRUE;
4393 gtk_window_fullscreen(GTK_WINDOW(mainwin->window));
4397 static void hide_quotes_cb(GtkAction *action, gpointer data)
4399 MainWindow *mainwin = (MainWindow *)data;
4401 if (mainwin->menu_lock_count) return;
4403 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
4404 const gchar *a_name = gtk_action_get_name(GTK_ACTION(action));
4405 if (!strcmp(a_name, "View/Quotes/CollapseAll")) prefs_common.hide_quotes = 1;
4406 else if (!strcmp(a_name, "View/Quotes/Collapse2")) prefs_common.hide_quotes = 2;
4407 else if (!strcmp(a_name, "View/Quotes/Collapse3")) prefs_common.hide_quotes = 3;
4409 prefs_common.hide_quotes = 0;
4411 mainwin->menu_lock_count++;
4412 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
4413 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
4414 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
4415 mainwin->menu_lock_count--;
4417 summary_redisplay_msg(mainwin->summaryview);
4420 static void mark_cb(GtkAction *action, gpointer data)
4422 MainWindow *mainwin = (MainWindow *)data;
4423 summary_mark(mainwin->summaryview);
4426 static void unmark_cb(GtkAction *action, gpointer data)
4428 MainWindow *mainwin = (MainWindow *)data;
4429 summary_unmark(mainwin->summaryview);
4432 static void mark_as_unread_cb(GtkAction *action, gpointer data)
4434 MainWindow *mainwin = (MainWindow *)data;
4435 summary_mark_as_unread(mainwin->summaryview);
4438 static void mark_as_read_cb(GtkAction *action, gpointer data)
4440 MainWindow *mainwin = (MainWindow *)data;
4441 summary_mark_as_read(mainwin->summaryview);
4444 static void mark_all_read_cb(GtkAction *action, gpointer data)
4446 MainWindow *mainwin = (MainWindow *)data;
4447 summary_mark_all_read(mainwin->summaryview);
4450 static void mark_as_spam_cb(GtkAction *action, gpointer data)
4452 MainWindow *mainwin = (MainWindow *)data;
4453 summary_mark_as_spam(mainwin->summaryview, TRUE, NULL);
4456 static void mark_as_ham_cb(GtkAction *action, gpointer data)
4458 MainWindow *mainwin = (MainWindow *)data;
4459 summary_mark_as_spam(mainwin->summaryview, FALSE, NULL);
4462 static void ignore_thread_cb(GtkAction *action, gpointer data)
4464 MainWindow *mainwin = (MainWindow *)data;
4465 summary_ignore_thread(mainwin->summaryview);
4468 static void unignore_thread_cb(GtkAction *action, gpointer data)
4470 MainWindow *mainwin = (MainWindow *)data;
4471 summary_unignore_thread(mainwin->summaryview);
4474 static void watch_thread_cb(GtkAction *action, gpointer data)
4476 MainWindow *mainwin = (MainWindow *)data;
4477 summary_watch_thread(mainwin->summaryview);
4480 static void unwatch_thread_cb(GtkAction *action, gpointer data)
4482 MainWindow *mainwin = (MainWindow *)data;
4483 summary_unwatch_thread(mainwin->summaryview);
4486 static void lock_msgs_cb(GtkAction *action, gpointer data)
4488 MainWindow *mainwin = (MainWindow *)data;
4489 summary_msgs_lock(mainwin->summaryview);
4492 static void unlock_msgs_cb(GtkAction *action, gpointer data)
4494 MainWindow *mainwin = (MainWindow *)data;
4495 summary_msgs_unlock(mainwin->summaryview);
4499 static void reedit_cb(GtkAction *action, gpointer data)
4501 MainWindow *mainwin = (MainWindow *)data;
4502 summary_reedit(mainwin->summaryview);
4505 static void open_urls_cb(GtkAction *action, gpointer data)
4507 MainWindow *mainwin = (MainWindow *)data;
4508 if (!mainwin->summaryview->displayed && mainwin->summaryview->selected) {
4509 summary_display_msg_selected(mainwin->summaryview,
4510 prefs_common.show_all_headers);
4512 messageview_list_urls(mainwin->messageview);
4515 static void add_address_cb(GtkAction *action, gpointer data)
4517 MainWindow *mainwin = (MainWindow *)data;
4518 summary_add_address(mainwin->summaryview);
4521 static void set_charset_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4523 MainWindow *mainwin = (MainWindow *)data;
4524 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4527 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
4528 str = conv_get_charset_str((CharSet)value);
4530 g_free(mainwin->messageview->forced_charset);
4531 mainwin->messageview->forced_charset = str ? g_strdup(str) : NULL;
4532 procmime_force_charset(str);
4534 summary_redisplay_msg(mainwin->summaryview);
4536 debug_print("forced charset: %s\n", str ? str : "Auto-Detect");
4540 static void set_decode_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4542 MainWindow *mainwin = (MainWindow *)data;
4543 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4544 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
4545 mainwin->messageview->forced_encoding = (EncodingType)value;
4547 summary_redisplay_msg(mainwin->summaryview);
4549 debug_print("forced encoding: %d\n", value);
4553 static void hide_read_messages (GtkAction *action, gpointer data)
4555 MainWindow *mainwin = (MainWindow *)data;
4556 GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideReadMessages");
4557 if (!mainwin->summaryview->folder_item
4558 || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
4560 summary_toggle_show_read_messages(mainwin->summaryview);
4563 static void hide_del_messages (GtkAction *action, gpointer data)
4565 MainWindow *mainwin = (MainWindow *)data;
4566 GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideDelMessages");
4567 if (!mainwin->summaryview->folder_item
4568 || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
4570 summary_toggle_show_del_messages(mainwin->summaryview);
4573 static void hide_read_threads (GtkAction *action, gpointer data)
4575 MainWindow *mainwin = (MainWindow *)data;
4576 GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideReadThreads");
4577 if (!mainwin->summaryview->folder_item
4578 || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
4580 summary_toggle_show_read_threads(mainwin->summaryview);
4583 static void thread_cb(GtkAction *action, gpointer data)
4585 MainWindow *mainwin = (MainWindow *)data;
4586 gboolean threaded = FALSE;
4587 if (mainwin->menu_lock_count) return;
4588 if (!mainwin->summaryview->folder_item) return;
4590 threaded = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
4592 mainwin->summaryview->folder_item->threaded = threaded;
4594 mainwin->summaryview->threaded = threaded;
4596 summary_show(mainwin->summaryview,
4597 mainwin->summaryview->folder_item);
4600 static void expand_threads_cb(GtkAction *action, gpointer data)
4602 MainWindow *mainwin = (MainWindow *)data;
4603 summary_expand_threads(mainwin->summaryview);
4606 static void collapse_threads_cb(GtkAction *action, gpointer data)
4608 MainWindow *mainwin = (MainWindow *)data;
4609 summary_collapse_threads(mainwin->summaryview);
4612 static void set_summary_display_item_cb(GtkAction *action, gpointer data)
4614 prefs_summary_column_open();
4617 static void set_folder_display_item_cb(GtkAction *action, gpointer data)
4619 prefs_folder_column_open();
4622 static void sort_summary_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4624 MainWindow *mainwin = (MainWindow *)data;
4625 FolderItem *item = mainwin->summaryview->folder_item;
4626 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4628 if (mainwin->menu_lock_count) return;
4630 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)) && item) {
4631 summary_sort(mainwin->summaryview, (FolderSortKey)value,
4633 item->sort_key = value;
4637 static void sort_summary_type_cb(GtkAction *gaction, GtkRadioAction *current, gpointer data)
4639 MainWindow *mainwin = (MainWindow *)data;
4640 FolderItem *item = mainwin->summaryview->folder_item;
4641 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4643 if (mainwin->menu_lock_count) return;
4645 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)) && item)
4646 summary_sort(mainwin->summaryview,
4647 item->sort_key, (FolderSortType)value);
4650 static void attract_by_subject_cb(GtkAction *action, gpointer data)
4652 MainWindow *mainwin = (MainWindow *)data;
4653 summary_attract_by_subject(mainwin->summaryview);
4656 static void delete_duplicated_cb(GtkAction *action, gpointer data)
4658 MainWindow *mainwin = (MainWindow *)data;
4661 item = folderview_get_selected_item(mainwin->folderview);
4663 main_window_cursor_wait(mainwin);
4664 STATUSBAR_PUSH(mainwin, _("Deleting duplicated messages..."));
4666 folderutils_delete_duplicates(item, prefs_common.immediate_exec ?
4667 DELETE_DUPLICATES_REMOVE : DELETE_DUPLICATES_SETFLAG);
4669 STATUSBAR_POP(mainwin);
4670 main_window_cursor_normal(mainwin);
4680 static void deldup_all(FolderItem *item, gpointer _data)
4682 struct DelDupsData *data = _data;
4685 result = folderutils_delete_duplicates(item, DELETE_DUPLICATES_REMOVE);
4687 data->dups += result;
4692 static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
4694 MainWindow *mainwin = (MainWindow *)mw;
4695 struct DelDupsData data = {0, 0};
4697 main_window_cursor_wait(mainwin);
4698 folder_func_to_all_folders(deldup_all, &data);
4699 main_window_cursor_normal(mainwin);
4701 alertpanel_notice(ngettext("Deleted %d duplicate message in %d folders.\n",
4702 "Deleted %d duplicate messages in %d folders.\n",
4704 data.dups, data.folders);
4707 static void filter_cb(GtkAction *action, gpointer data)
4709 MainWindow *mainwin = (MainWindow *)data;
4710 summary_filter(mainwin->summaryview, FALSE);
4713 static void filter_list_cb(GtkAction *action, gpointer data)
4715 MainWindow *mainwin = (MainWindow *)data;
4716 summary_filter(mainwin->summaryview, TRUE);
4719 static void process_cb(GtkAction *action, gpointer data)
4721 MainWindow *mainwin = (MainWindow *)data;
4722 FolderItem *item = mainwin->summaryview->folder_item;
4723 cm_return_if_fail(item != NULL);
4725 item->processing_pending = TRUE;
4726 folder_item_apply_processing(item);
4727 item->processing_pending = FALSE;
4730 static void execute_summary_cb(GtkAction *action, gpointer data)
4732 MainWindow *mainwin = (MainWindow *)data;
4733 summary_execute(mainwin->summaryview);
4736 static void expunge_summary_cb(GtkAction *action, gpointer data)
4738 MainWindow *mainwin = (MainWindow *)data;
4739 summary_expunge(mainwin->summaryview);
4742 static void update_summary_cb(GtkAction *action, gpointer data)
4744 MainWindow *mainwin = (MainWindow *)data;
4746 FolderView *folderview = mainwin->folderview;
4748 if (!mainwin->summaryview->folder_item) return;
4749 if (!folderview->opened) return;
4751 folder_update_op_count();
4753 fitem = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
4754 folderview->opened);
4757 folder_item_scan(fitem);
4758 summary_show(mainwin->summaryview, fitem);
4761 static void prev_cb(GtkAction *action, gpointer data)
4763 MainWindow *mainwin = (MainWindow *)data;
4764 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
4767 static void next_cb(GtkAction *action, gpointer data)
4769 MainWindow *mainwin = (MainWindow *)data;
4770 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
4773 static void prev_unread_cb(GtkAction *action, gpointer data)
4775 MainWindow *mainwin = (MainWindow *)data;
4776 summary_select_prev_unread(mainwin->summaryview);
4779 static void next_unread_cb(GtkAction *action, gpointer data)
4781 MainWindow *mainwin = (MainWindow *)data;
4782 summary_select_next_unread(mainwin->summaryview);
4785 static void prev_new_cb(GtkAction *action, gpointer data)
4787 MainWindow *mainwin = (MainWindow *)data;
4788 summary_select_prev_new(mainwin->summaryview);
4791 static void next_new_cb(GtkAction *action, gpointer data)
4793 MainWindow *mainwin = (MainWindow *)data;
4794 summary_select_next_new(mainwin->summaryview);
4797 static void prev_marked_cb(GtkAction *action, gpointer data)
4799 MainWindow *mainwin = (MainWindow *)data;
4800 summary_select_prev_marked(mainwin->summaryview);
4803 static void next_marked_cb(GtkAction *action, gpointer data)
4805 MainWindow *mainwin = (MainWindow *)data;
4806 summary_select_next_marked(mainwin->summaryview);
4809 static void prev_labeled_cb(GtkAction *action, gpointer data)
4811 MainWindow *mainwin = (MainWindow *)data;
4812 summary_select_prev_labeled(mainwin->summaryview);
4815 static void next_labeled_cb(GtkAction *action, gpointer data)
4817 MainWindow *mainwin = (MainWindow *)data;
4818 summary_select_next_labeled(mainwin->summaryview);
4821 static void last_read_cb(GtkAction *action, gpointer data)
4823 MainWindow *mainwin = (MainWindow *)data;
4824 summary_select_last_read(mainwin->summaryview);
4827 static void parent_cb(GtkAction *action, gpointer data)
4829 MainWindow *mainwin = (MainWindow *)data;
4830 summary_select_parent(mainwin->summaryview);
4833 static void goto_folder_cb(GtkAction *action, gpointer data)
4835 MainWindow *mainwin = (MainWindow *)data;
4836 FolderItem *to_folder;
4838 to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
4841 folderview_select(mainwin->folderview, to_folder);
4844 static void goto_unread_folder_cb(GtkAction *action, gpointer data)
4846 MainWindow *mainwin = (MainWindow *)data;
4847 folderview_select_next_unread(mainwin->folderview, FALSE);
4850 static void scroll_prev_line_cb(GtkAction *action, gpointer data)
4852 MainWindow *mainwin = (MainWindow *)data;
4853 mimeview_scroll_one_line(mainwin->messageview->mimeview,TRUE);
4856 static void scroll_next_line_cb(GtkAction *action, gpointer data)
4858 MainWindow *mainwin = (MainWindow *)data;
4859 mimeview_scroll_one_line(mainwin->messageview->mimeview,FALSE);
4862 static void scroll_prev_page_cb(GtkAction *action, gpointer data)
4864 MainWindow *mainwin = (MainWindow *)data;
4865 mimeview_scroll_page(mainwin->messageview->mimeview,TRUE);
4868 static void scroll_next_page_cb(GtkAction *action, gpointer data)
4870 MainWindow *mainwin = (MainWindow *)data;
4871 mimeview_scroll_page(mainwin->messageview->mimeview,FALSE);
4874 static void copy_cb(GtkAction *action, gpointer data)
4876 MainWindow *mainwin = (MainWindow *)data;
4877 messageview_copy_clipboard(mainwin->messageview);
4880 static void allsel_cb(GtkAction *action, gpointer data)
4882 MainWindow *mainwin = (MainWindow *)data;
4883 MessageView *msgview = mainwin->messageview;
4885 if (messageview_is_visible(msgview) &&
4886 (gtk_widget_has_focus(msgview->mimeview->textview->text)))
4887 messageview_select_all(mainwin->messageview);
4889 summary_select_all(mainwin->summaryview);
4892 static void select_thread_cb(GtkAction *action, gpointer data)
4894 MainWindow *mainwin = (MainWindow *)data;
4895 summary_select_thread(mainwin->summaryview, FALSE);
4898 static void delete_thread_cb(GtkAction *action, gpointer data)
4900 MainWindow *mainwin = (MainWindow *)data;
4901 summary_select_thread(mainwin->summaryview, TRUE);
4904 static void create_filter_cb(GtkAction *gaction, gpointer data)
4906 MainWindow *mainwin = (MainWindow *)data;
4907 const gchar *a_name = gtk_action_get_name(gaction);
4910 DO_ACTION("Tools/CreateFilterRule/Automatically", FILTER_BY_AUTO);
4911 DO_ACTION("Tools/CreateFilterRule/ByFrom", FILTER_BY_FROM);
4912 DO_ACTION("Tools/CreateFilterRule/ByTo", FILTER_BY_TO);
4913 DO_ACTION("Tools/CreateFilterRule/BySubject", FILTER_BY_SUBJECT);
4914 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 0);
4917 static void create_processing_cb(GtkAction *gaction, gpointer data)
4919 MainWindow *mainwin = (MainWindow *)data;
4920 const gchar *a_name = gtk_action_get_name(gaction);
4923 DO_ACTION("Tools/CreateProcessingRule/Automatically", FILTER_BY_AUTO);
4924 DO_ACTION("Tools/CreateProcessingRule/ByFrom", FILTER_BY_FROM);
4925 DO_ACTION("Tools/CreateProcessingRule/ByTo", FILTER_BY_TO);
4926 DO_ACTION("Tools/CreateProcessingRule/BySubject", FILTER_BY_SUBJECT);
4927 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 1);
4930 static void prefs_pre_processing_open_cb(GtkAction *action, gpointer data)
4932 prefs_filtering_open(&pre_global_processing,
4933 _("Processing rules to apply before folder rules"),
4934 MANUAL_ANCHOR_PROCESSING,
4938 static void prefs_post_processing_open_cb(GtkAction *action, gpointer data)
4940 prefs_filtering_open(&post_global_processing,
4941 _("Processing rules to apply after folder rules"),
4942 MANUAL_ANCHOR_PROCESSING,
4946 static void prefs_filtering_open_cb(GtkAction *action, gpointer data)
4948 prefs_filtering_open(&filtering_rules,
4949 _("Filtering configuration"),
4950 MANUAL_ANCHOR_FILTERING,
4954 static void prefs_template_open_cb(GtkAction *action, gpointer data)
4956 prefs_template_open();
4959 static void prefs_actions_open_cb(GtkAction *action, gpointer data)
4961 MainWindow *mainwin = (MainWindow *)data;
4962 prefs_actions_open(mainwin);
4965 static void prefs_tags_open_cb(GtkAction *action, gpointer data)
4967 MainWindow *mainwin = (MainWindow *)data;
4968 GSList * list = summary_get_selected_msg_list(mainwin->summaryview);
4969 tag_apply_open(list);
4972 static void ssl_manager_open_cb(GtkAction *action, gpointer data)
4974 MainWindow *mainwin = (MainWindow *)data;
4975 ssl_manager_open(mainwin);
4978 static void prefs_account_open_cb(GtkAction *action, gpointer data)
4980 MainWindow *mainwin = (MainWindow *)data;
4982 new_account_cb(NULL, mainwin);
4984 account_open(cur_account);
4988 static void new_account_cb(GtkAction *action, gpointer data)
4990 account_edit_open(NULL, NULL);
4991 if (!compose_get_compose_list()) account_add();
4994 static void account_selector_menu_cb(GtkMenuItem *menuitem, gpointer data)
4996 FolderItem *item = NULL;
4997 cur_account = (PrefsAccount *)data;
4999 if (!mainwindow_get_mainwindow())
5001 main_window_show_cur_account(mainwindow_get_mainwindow());
5002 toolbar_update(TOOLBAR_MAIN, mainwindow_get_mainwindow());
5003 main_window_set_menu_sensitive(mainwindow_get_mainwindow());
5004 toolbar_main_set_sensitive(mainwindow_get_mainwindow());
5005 item = folderview_get_selected_item(
5006 mainwindow_get_mainwindow()->folderview);
5008 toolbar_set_compose_button
5009 (mainwindow_get_mainwindow()->toolbar,
5010 FOLDER_TYPE(item->folder) == F_NEWS ?
5011 COMPOSEBUTTON_NEWS : COMPOSEBUTTON_MAIL);
5015 static void account_receive_menu_cb(GtkMenuItem *menuitem, gpointer data)
5017 MainWindow *mainwin = (MainWindow *)mainwin_list->data;
5018 PrefsAccount *account = (PrefsAccount *)data;
5020 inc_account_mail(mainwin, account);
5022 #ifndef GENERIC_UMPC
5023 static void account_compose_menu_cb(GtkMenuItem *menuitem, gpointer data)
5025 PrefsAccount *account = (PrefsAccount *)data;
5027 compose_new_with_folderitem(account, NULL, NULL);
5030 static void prefs_open_cb(GtkAction *action, gpointer data)
5035 static void plugins_open_cb(GtkAction *action, gpointer data)
5037 pluginwindow_create();
5040 static void manual_open_cb(GtkAction *action, gpointer data)
5042 manual_open(MANUAL_MANUAL_CLAWS, NULL);
5045 static void manual_faq_open_cb(GtkAction *action, gpointer data)
5047 manual_open(MANUAL_FAQ_CLAWS, NULL);
5050 static void legend_open_cb(GtkAction *action, gpointer data)
5056 static void set_default_client_cb(GtkAction *action, gpointer data)
5058 char exename[MAX_PATH];
5059 gchar *binary_icon = NULL;
5060 gchar *binary_compose = NULL;
5061 gchar *binary_run = NULL;
5063 if ( !GetModuleFileNameA (0, exename, sizeof (exename)) ) {
5064 alertpanel_error(_("Can not register as default client: impossible to get executable path."));
5067 binary_icon = g_strconcat(exename, ",0", NULL);
5068 binary_compose = g_strconcat(exename, " --compose %1", NULL);
5069 binary_run = g_strconcat(exename, NULL);
5071 /* Try to set the Mail Start menu item to Claws. It may fail if we're not root; we don't care */
5072 r = write_w32_registry_string("HKLM", "Software\\Clients\\Mail",
5075 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail",
5078 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail",
5081 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5082 "", "URL:MailTo-Protocol");
5084 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5085 "URL Protocol", "");
5087 r = write_w32_registry_dword ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5090 r = write_w32_registry_string ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5091 "FriendlyTypeName", "Claws-Mail URL");
5093 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\DefaultIcon",
5096 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\shell\\open\\command",
5097 "", binary_compose);
5099 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\shell\\open\\command",
5103 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto",
5104 "", "URL:MailTo-Protocol");
5106 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto",
5107 "URL Protocol", "");
5109 r = write_w32_registry_dword ("HKCU", "Software\\Classes\\mailto",
5112 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto",
5113 "FriendlyTypeName", "Claws-Mail URL");
5115 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\DefaultIcon",
5118 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\shell\\open\\command",
5119 "", binary_compose);
5122 SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\Mail");
5123 alertpanel_notice(_("Claws Mail has been registered as default client."));
5125 alertpanel_error(_("Can not register as default client: impossible to write to the registry."));
5127 g_free(binary_icon);
5128 g_free(binary_compose);
5133 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
5135 MainWindow *mainwin = (MainWindow *)data;
5139 str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
5140 LOCAL_FOLDER(folder)->rootpath,
5144 str = g_strdup_printf(_("Scanning folder %s ..."),
5145 LOCAL_FOLDER(folder)->rootpath);
5147 STATUSBAR_PUSH(mainwin, str);
5148 STATUSBAR_POP(mainwin);
5152 static gboolean mainwindow_focus_in_event(GtkWidget *widget, GdkEventFocus *focus,
5155 SummaryView *summary;
5157 cm_return_val_if_fail(data, FALSE);
5158 if (!g_list_find(mainwin_list, data))
5160 summary = ((MainWindow *)data)->summaryview;
5161 cm_return_val_if_fail(summary, FALSE);
5163 if (GTK_CMCLIST(summary->ctree)->selection &&
5164 g_list_length(GTK_CMCLIST(summary->ctree)->selection) > 1)
5170 static gboolean mainwindow_visibility_event_cb(GtkWidget *widget, GdkEventVisibility *event,
5173 is_obscured = (event->state == GDK_VISIBILITY_FULLY_OBSCURED);
5177 static gboolean mainwindow_state_event_cb(GtkWidget *widget, GdkEventWindowState *state,
5180 if (!claws_is_starting()
5181 && state->changed_mask&GDK_WINDOW_STATE_ICONIFIED
5182 && state->new_window_state&GDK_WINDOW_STATE_ICONIFIED) {
5184 if (iconified_count > 0)
5185 hooks_invoke(MAIN_WINDOW_GOT_ICONIFIED, NULL);
5187 } else if (!claws_is_starting()) {
5188 prefs_common.mainwin_maximised =
5189 ((state->new_window_state&GDK_WINDOW_STATE_MAXIMIZED) != 0);
5191 if (state->new_window_state == 0)
5192 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(widget), FALSE);
5196 gboolean mainwindow_is_obscured(void)
5202 * Harvest addresses for selected folder.
5204 static void addr_harvest_cb( GtkAction *action, gpointer data)
5206 MainWindow *mainwin = (MainWindow *)data;
5207 addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
5211 * Harvest addresses for selected messages in summary view.
5213 static void addr_harvest_msg_cb( GtkAction *action, gpointer data)
5215 MainWindow *mainwin = (MainWindow *)data;
5216 summary_harvest_address( mainwin->summaryview );
5220 *\brief get a MainWindow
5222 *\return MainWindow * The first mainwindow in the mainwin_list
5224 MainWindow *mainwindow_get_mainwindow(void)
5226 if (mainwin_list && mainwin_list->data)
5227 return (MainWindow *)(mainwin_list->data);
5232 static gboolean mainwindow_progressindicator_hook(gpointer source, gpointer userdata)
5234 ProgressData *data = (ProgressData *) source;
5235 MainWindow *mainwin = (MainWindow *) userdata;
5237 switch (data->cmd) {
5238 case PROGRESS_COMMAND_START:
5239 case PROGRESS_COMMAND_STOP:
5240 gtk_progress_bar_set_fraction
5241 (GTK_PROGRESS_BAR(mainwin->progressbar), 0.0);
5243 case PROGRESS_COMMAND_SET_PERCENTAGE:
5244 gtk_progress_bar_set_fraction
5245 (GTK_PROGRESS_BAR(mainwin->progressbar), data->value);
5248 while (gtk_events_pending()) gtk_main_iteration ();
5253 static void sync_cb(GtkAction *action, gpointer data)
5255 MainWindow *mainwin = (MainWindow *)data;
5256 mainwindow_check_synchronise(mainwin, FALSE);
5259 static void forget_session_passwords_cb(GtkAction *action, gpointer data)
5261 MainWindow *mainwin = (MainWindow *)data;
5266 main_window_lock(mainwin);
5267 for (list = account_get_list(); list != NULL; list = list->next) {
5268 PrefsAccount *account = list->data;
5269 if (account->session_passwd) {
5270 g_free(account->session_passwd);
5271 account->session_passwd = NULL;
5274 if (account->session_smtp_passwd) {
5275 g_free(account->session_smtp_passwd);
5276 account->session_smtp_passwd = NULL;
5281 main_window_unlock(mainwin);
5282 alertpanel_notice(ngettext("Forgotten %d password in %d accounts.\n",
5283 "Forgotten %d passwords in %d accounts.\n",
5287 void mainwindow_learn (MainWindow *mainwin, gboolean is_spam)
5289 summary_mark_as_spam(mainwin->summaryview, is_spam, NULL);
5292 void mainwindow_jump_to(const gchar *target, gboolean popup)
5296 FolderItem *item = NULL;
5298 MainWindow *mainwin = mainwindow_get_mainwindow();
5299 gchar *from_uri = NULL;
5304 g_print("not initialized\n");
5308 if ((from_uri = g_filename_from_uri(target, NULL, NULL)) != NULL)
5311 tmp = g_strdup(target);
5313 if ((p = strstr(tmp, "\r")) != NULL)
5315 if ((p = strstr(tmp, "\n")) != NULL)
5318 if ((item = folder_find_item_from_identifier(tmp))) {
5319 g_print("selecting folder '%s'\n", tmp);
5320 folderview_select(mainwin->folderview, item);
5322 main_window_popup(mainwin);
5327 msg = strrchr(tmp, G_DIR_SEPARATOR);
5330 if ((item = folder_find_item_from_identifier(tmp))) {
5331 g_print("selecting folder '%s'\n", tmp);
5332 folderview_select(mainwin->folderview, item);
5333 } else if ((item = folder_find_item_from_real_path(tmp))) {
5334 g_print("selecting folder '%s'\n", tmp);
5335 folderview_select(mainwin->folderview, item);
5337 g_print("'%s' not found\n", tmp);
5339 if (item && msg && atoi(msg)) {
5340 g_print("selecting message %d\n", atoi(msg));
5341 summary_select_by_msgnum(mainwin->summaryview, atoi(msg));
5342 summary_display_msg_selected(mainwin->summaryview, FALSE);
5344 main_window_popup(mainwin);
5347 } else if (item && msg[0] == '<' && msg[strlen(msg)-1] == '>') {
5348 MsgInfo *msginfo = NULL;
5350 msg[strlen(msg)-1] = '\0';
5351 msginfo = folder_item_get_msginfo_by_msgid(item, msg);
5353 g_print("selecting message %s\n", msg);
5354 summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum);
5355 summary_display_msg_selected(mainwin->summaryview, FALSE);
5357 main_window_popup(mainwin);
5359 procmsg_msginfo_free(msginfo);
5362 g_print("'%s' not found\n", msg);
5365 g_print("'%s' not found\n", msg);
5368 g_print("'%s' not found\n", tmp);
5374 void mainwindow_exit_folder(MainWindow *mainwin) {
5375 if (prefs_common.layout_mode == SMALL_LAYOUT) {
5376 folderview_close_opened(mainwin->folderview);
5377 mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
5378 gtk_widget_grab_focus(mainwin->folderview->ctree);
5380 mainwin->in_folder = FALSE;
5381 main_window_set_menu_sensitive(mainwin);
5384 void mainwindow_enter_folder(MainWindow *mainwin) {
5385 if (prefs_common.layout_mode == SMALL_LAYOUT) {
5386 mainwin_paned_show_last(GTK_PANED(mainwin->hpaned));
5388 mainwin->in_folder = TRUE;
5389 main_window_set_menu_sensitive(mainwin);
5393 gboolean maemo_mainwindow_is_fullscreen(GtkWidget *widget)
5396 gtk_window_get_size(GTK_WINDOW(widget), &w, &h);
5400 void maemo_window_full_screen_if_needed (GtkWindow *window)
5402 if (maemo_mainwindow_is_fullscreen(mainwindow_get_mainwindow()->window)) {
5403 gtk_window_fullscreen(GTK_WINDOW(window));
5407 void maemo_connect_key_press_to_mainwindow (GtkWindow *window)
5409 g_signal_connect(G_OBJECT(window), "key_press_event",
5410 G_CALLBACK(mainwindow_key_pressed), mainwindow_get_mainwindow());