2 Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 Copyright (C) 1999-2012 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 "folder_item_prefs.h"
31 #include "foldersel.h"
32 #include "summaryview.h"
33 #include "summary_search.h"
34 #include "messageview.h"
36 #include "message_search.h"
37 #include "headerview.h"
39 #include "stock_pixmap.h"
48 #include "prefs_common.h"
49 #include "prefs_actions.h"
50 #include "prefs_filtering.h"
51 #include "prefs_account.h"
52 #include "prefs_summary_column.h"
53 #include "prefs_folder_column.h"
54 #include "prefs_template.h"
57 #ifndef USE_NEW_ADDRBOOK
58 #include "addressbook.h"
60 #include "addressbook-dbus.h"
62 #include "logwindow.h"
63 #include "manage_window.h"
64 #include "alertpanel.h"
65 #include "statusbar.h"
66 #include "inputdialog.h"
73 #include "ssl_manager.h"
74 #include "sslcertwindow.h"
75 #include "prefs_gtk.h"
76 #include "pluginwindow.h"
78 #include "progressindicator.h"
79 #include "localfolder.h"
80 #include "filtering.h"
81 #include "folderutils.h"
82 #include "foldersort.h"
83 #include "icon_legend.h"
84 #include "colorlabel.h"
95 #define AC_LABEL_WIDTH 240
97 /* list of all instantiated MainWindow */
98 static GList *mainwin_list = NULL;
100 static GdkCursor *watch_cursor = NULL;
101 static GdkCursor *hand_cursor = NULL;
103 static gint iconified_count = 0;
105 static void main_window_menu_callback_block (MainWindow *mainwin);
106 static void main_window_menu_callback_unblock (MainWindow *mainwin);
108 static void main_window_show_cur_account (MainWindow *mainwin);
110 static void main_window_separation_change (MainWindow *mainwin,
111 LayoutType layout_mode);
113 static void main_window_set_widgets (MainWindow *mainwin,
114 LayoutType layout_mode);
116 static void toolbar_child_attached (GtkWidget *widget,
119 static void toolbar_child_detached (GtkWidget *widget,
123 static gboolean ac_label_button_pressed (GtkWidget *widget,
124 GdkEventButton *event,
127 static gint main_window_close_cb (GtkWidget *widget,
131 static void main_window_size_allocate_cb (GtkWidget *widget,
132 GtkAllocation *allocation,
134 static void folder_window_size_allocate_cb (GtkWidget *widget,
135 GtkAllocation *allocation,
137 static void message_window_size_allocate_cb (GtkWidget *widget,
138 GtkAllocation *allocation,
141 static void update_folderview_cb (GtkAction *action,
143 static void add_mailbox_cb (GtkAction *action,
145 static void foldersort_cb (GtkAction *action,
147 static void import_mbox_cb (GtkAction *action,
149 static void export_mbox_cb (GtkAction *action,
151 static void export_list_mbox_cb (GtkAction *action,
153 static void empty_trash_cb (GtkAction *action,
155 static void save_as_cb (GtkAction *action,
157 static void page_setup_cb (GtkAction *action,
159 static void print_cb (GtkAction *action,
161 static void app_exit_cb (GtkAction *action,
165 static void search_cb (GtkAction *action,
167 static void search_folder_cb (GtkAction *action,
170 static void toggle_message_cb (GtkAction *action,
172 static void toggle_toolbar_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
173 static void toggle_col_headers_cb(GtkAction *action,
176 static void toggle_statusbar_cb (GtkAction *action,
178 static void set_layout_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
180 static void addressbook_open_cb (GtkAction *action,
182 static void log_window_show_cb (GtkAction *action,
184 static void filtering_debug_window_show_cb (GtkAction *action,
187 static void inc_cancel_cb (GtkAction *action,
190 static void open_msg_cb (GtkAction *action,
193 static void view_source_cb (GtkAction *action,
196 static void show_all_header_cb (GtkAction *action,
198 static void toggle_fullscreen_cb (GtkAction *action,
201 static void hide_quotes_cb(GtkAction *action,
204 static void move_to_cb (GtkAction *action,
206 static void copy_to_cb (GtkAction *action,
208 static void delete_cb (GtkAction *action,
210 static void delete_trash_cb (GtkAction *action,
213 static void cancel_cb (GtkAction *action,
216 static void mark_cb (GtkAction *action,
218 static void unmark_cb (GtkAction *action,
221 static void mark_as_unread_cb (GtkAction *action,
223 static void mark_as_read_cb (GtkAction *action,
225 static void mark_all_read_cb (GtkAction *action,
227 static void mark_as_spam_cb (GtkAction *action,
229 static void mark_as_ham_cb (GtkAction *action,
232 static void ignore_thread_cb (GtkAction *action,
234 static void unignore_thread_cb (GtkAction *action,
236 static void watch_thread_cb (GtkAction *action,
238 static void unwatch_thread_cb (GtkAction *action,
240 static void lock_msgs_cb (GtkAction *action,
242 static void unlock_msgs_cb (GtkAction *action,
245 static void reedit_cb (GtkAction *action,
248 static void add_address_cb (GtkAction *action,
251 static void set_charset_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
253 static void set_decode_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
255 static void hide_read_messages (GtkAction *action,
257 static void hide_read_threads (GtkAction *action,
259 static void hide_del_messages (GtkAction *action,
262 static void thread_cb (GtkAction *action,
264 static void expand_threads_cb (GtkAction *action,
266 static void collapse_threads_cb (GtkAction *action,
269 static void set_summary_display_item_cb (GtkAction *action,
271 static void set_folder_display_item_cb (GtkAction *action,
273 static void sort_summary_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
274 static void sort_summary_type_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
275 static void attract_by_subject_cb(GtkAction *action,
278 static void delete_duplicated_cb (GtkAction *action,
280 static void delete_duplicated_all_cb (GtkAction *action,
282 static void filter_cb (GtkAction *action,
284 static void filter_list_cb (GtkAction *action,
286 static void process_cb (GtkAction *action,
288 static void execute_summary_cb (GtkAction *action,
290 static void expunge_summary_cb (GtkAction *action,
292 static void update_summary_cb (GtkAction *action,
295 static void prev_cb (GtkAction *action,
297 static void next_cb (GtkAction *action,
299 static void next_unread_cb (GtkAction *action,
301 static void prev_unread_cb (GtkAction *action,
304 static void prev_new_cb (GtkAction *action,
306 static void next_new_cb (GtkAction *action,
308 static void prev_marked_cb (GtkAction *action,
310 static void next_marked_cb (GtkAction *action,
312 static void prev_labeled_cb (GtkAction *action,
314 static void next_labeled_cb (GtkAction *action,
316 static void prev_history_cb (GtkAction *action,
318 static void next_history_cb (GtkAction *action,
320 static void parent_cb (GtkAction *action,
323 static void goto_folder_cb (GtkAction *action,
325 static void goto_unread_folder_cb(GtkAction *action,
328 static void scroll_prev_line_cb (GtkAction *action,
330 static void scroll_next_line_cb (GtkAction *action,
332 static void scroll_prev_page_cb (GtkAction *action,
334 static void scroll_next_page_cb (GtkAction *action,
337 static void copy_cb (GtkAction *action,
339 static void allsel_cb (GtkAction *action,
341 static void select_thread_cb (GtkAction *action,
343 static void delete_thread_cb (GtkAction *action,
346 static void create_filter_cb (GtkAction *action,
348 static void create_processing_cb (GtkAction *action,
350 static void open_urls_cb (GtkAction *action,
353 static void prefs_template_open_cb (GtkAction *action,
355 static void prefs_actions_open_cb (GtkAction *action,
357 static void prefs_tags_open_cb (GtkAction *action,
359 static void prefs_account_open_cb (GtkAction *action,
362 static void prefs_pre_processing_open_cb (GtkAction *action,
365 static void prefs_post_processing_open_cb (GtkAction *action,
368 static void prefs_filtering_open_cb (GtkAction *action,
371 static void ssl_manager_open_cb (GtkAction *action,
374 static void new_account_cb (GtkAction *action,
377 static void account_selector_menu_cb (GtkMenuItem *menuitem,
379 static void account_receive_menu_cb (GtkMenuItem *menuitem,
382 static void account_compose_menu_cb (GtkMenuItem *menuitem,
385 static void prefs_open_cb (GtkAction *action,
387 static void plugins_open_cb (GtkAction *action,
390 static void online_switch_clicked(GtkButton *btn,
393 static void manual_open_cb (GtkAction *action,
395 static void manual_faq_open_cb (GtkAction *action,
398 static void legend_open_cb (GtkAction *action,
402 static void set_default_client_cb (GtkAction *action,
406 static void scan_tree_func (Folder *folder,
410 static void toggle_work_offline_cb(GtkAction *action,
413 static void addr_harvest_cb ( GtkAction *action,
416 static void addr_harvest_msg_cb ( GtkAction *action,
418 static void sync_cb ( GtkAction *action,
421 static void forget_session_passwords_cb (GtkAction *action,
424 static gboolean mainwindow_focus_in_event (GtkWidget *widget,
425 GdkEventFocus *focus,
427 static gboolean mainwindow_visibility_event_cb (GtkWidget *widget,
428 GdkEventVisibility *state,
430 static gboolean mainwindow_state_event_cb (GtkWidget *widget,
431 GdkEventWindowState *state,
433 static void main_window_reply_cb (GtkAction *action,
435 static gboolean mainwindow_progressindicator_hook (gpointer source,
438 static gint mailing_list_create_submenu(MainWindow *mainwindow,
441 static gint mailing_list_populate_submenu(GtkWidget *menu, const gchar * list_header);
443 static void get_url_part(const gchar **buf, gchar *url_decoded);
445 static void mailing_list_compose(GtkWidget *w, gpointer *data);
447 static void mailing_list_open_uri(GtkWidget *w, gpointer *data);
448 #define SEPARATE_ACTION 500
449 static void mainwindow_quicksearch (GtkAction *action,
451 static gboolean any_folder_want_synchronise(void);
453 static void save_part_as_cb(GtkAction *action, gpointer data);
454 static void view_part_as_text_cb(GtkAction *action, gpointer data);
455 static void open_part_cb(GtkAction *action, gpointer data);
457 static void open_part_with_cb(GtkAction *action, gpointer data);
459 static void check_signature_cb(GtkAction *action, gpointer data);
460 static void goto_next_part_cb(GtkAction *action, gpointer data);
461 static void goto_prev_part_cb(GtkAction *action, gpointer data);
462 #define DO_ACTION(name, act) { if (!strcmp(a_name, name)) action = act; }
464 static void mainwindow_nothing_cb (GtkAction *action, gpointer data)
469 static void about_cb(GtkAction *gaction, gpointer data)
474 static void mw_inc_mail_cb (GtkAction *gaction, gpointer data)
476 inc_mail_cb(data, 0, NULL);
478 static void mw_inc_all_account_mail_cb (GtkAction *gaction, gpointer data)
480 inc_all_account_mail_cb(data, 0, NULL);
482 static void mw_send_queue_cb (GtkAction *gaction, gpointer data)
484 send_queue_cb(data, 0, NULL);
486 static void mw_compose_mail_cb (GtkAction *gaction, gpointer data)
488 compose_mail_cb(data, 0, NULL);
490 static void mw_compose_news_cb (GtkAction *gaction, gpointer data)
492 compose_news_cb(data, 0, NULL);
495 static GtkActionEntry mainwin_entries[] =
497 {"Menu", NULL, "Menu" },
499 {"File", NULL, N_("_File") },
500 {"Edit", NULL, N_("_Edit") },
501 {"View", NULL, N_("_View") },
502 {"Message", NULL, N_("_Message") },
503 {"Tools", NULL, N_("_Tools") },
504 {"Configuration", NULL, N_("_Configuration") },
505 {"Help", NULL, N_("_Help") },
508 {"File/AddMailbox", NULL, N_("_Add mailbox") },
509 {"File/AddMailbox/MH", NULL, N_("MH..."), NULL, NULL, G_CALLBACK(add_mailbox_cb) },
510 {"File/---", NULL, "---" },
512 {"File/SortMailboxes", NULL, N_("Change mailbox order..."), NULL, NULL, G_CALLBACK(foldersort_cb) },
514 /* {"File/---", NULL, "---" }, */
515 {"File/ImportMbox", NULL, N_("_Import mbox file..."), NULL, NULL, G_CALLBACK(import_mbox_cb) },
516 {"File/ExportMbox", NULL, N_("_Export to mbox file..."), NULL, NULL, G_CALLBACK(export_mbox_cb) },
517 {"File/ExportSelMbox", NULL, N_("_Export selected to mbox file..."), NULL, NULL, G_CALLBACK(export_list_mbox_cb) },
518 /* {"File/---", NULL, "---" }, */
519 {"File/EmptyTrashes", NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
520 /* {"File/---", NULL, "---" }, */
522 {"File/SaveAs", NULL, N_("_Save email as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
523 {"File/SavePartAs", NULL, N_("_Save part as..."), "Y", NULL, G_CALLBACK(save_part_as_cb) },
524 /* {"File/---", NULL, "---" }, */
526 {"File/PageSetup", NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
527 {"File/Print", NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
528 /* {"File/---", NULL, "---" }, */
529 {"File/SynchroniseFolders", NULL, N_("Synchronise folders"), "<control><shift>S", NULL, G_CALLBACK(sync_cb) },
530 /* {"File/---", NULL, "---" }, */
531 {"File/Exit", NULL, N_("E_xit"), "<control>Q", NULL, G_CALLBACK(app_exit_cb) },
534 {"Edit/Copy", NULL, N_("_Copy"), "<control>C", NULL, G_CALLBACK(copy_cb) },
535 {"Edit/SelectAll", NULL, N_("Select _all"), "<control>A", NULL, G_CALLBACK(allsel_cb) },
536 {"Edit/SelectThread", NULL, N_("Select _thread"), NULL, NULL, G_CALLBACK(select_thread_cb) },
537 {"Edit/DeleteThread", NULL, N_("_Delete thread"), NULL, NULL, G_CALLBACK(delete_thread_cb) },
538 {"Edit/---", NULL, "---" },
539 {"Edit/Find", NULL, N_("_Find in current message..."), "<control>F", NULL, G_CALLBACK(search_cb) },
540 {"Edit/SearchFolder", NULL, N_("_Search folder..."), "<shift><control>F", NULL, G_CALLBACK(search_folder_cb) },
541 {"Edit/QuickSearch", NULL, N_("_Quick search"), "slash", NULL, G_CALLBACK(mainwindow_quicksearch) },
544 {"View/ShowHide", NULL, N_("Show or hi_de") },
545 {"View/ShowHide/Toolbar", NULL, N_("_Toolbar") },
547 {"View/SetColumns", NULL, N_("Set displayed _columns") },
548 {"View/SetColumns/Folderlist", NULL, N_("In _folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
549 {"View/SetColumns/Messagelist", NULL, N_("In _message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
550 {"View/---", NULL, "---" },
554 {"View/Layout", NULL, N_("La_yout") },
557 {"View/Sort", NULL, N_("_Sort") },
558 {"View/Sort/---", NULL, "---" },
559 {"View/Sort/AttractSubj", NULL, N_("_Attract by subject"), NULL, NULL, G_CALLBACK(attract_by_subject_cb) },
561 {"View/ExpandThreads", NULL, N_("E_xpand all threads"), NULL, NULL, G_CALLBACK(expand_threads_cb) },
562 {"View/CollapseThreads", NULL, N_("Co_llapse all threads"), NULL, NULL, G_CALLBACK(collapse_threads_cb) },
564 {"View/Goto", NULL, N_("_Go to") },
565 {"View/Goto/Prev", NULL, N_("_Previous message"), "P", NULL, G_CALLBACK(prev_cb) },
566 {"View/Goto/Next", NULL, N_("_Next message"), "N", NULL, G_CALLBACK(next_cb) },
567 {"View/Goto/---", NULL, "---", NULL, NULL, NULL },
568 {"View/Goto/PrevUnread", NULL, N_("P_revious unread message"), "<shift>P", NULL, G_CALLBACK(prev_unread_cb) },
569 {"View/Goto/NextUnread", NULL, N_("N_ext unread message"), "<shift>N", NULL, G_CALLBACK(next_unread_cb) },
570 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
571 {"View/Goto/PrevNew", NULL, N_("Previous ne_w message"), NULL, NULL, G_CALLBACK(prev_new_cb) },
572 {"View/Goto/NextNew", NULL, N_("Ne_xt new message"), NULL, NULL, G_CALLBACK(next_new_cb) },
573 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
574 {"View/Goto/PrevMarked", NULL, N_("Previous _marked message"), NULL, NULL, G_CALLBACK(prev_marked_cb) },
575 {"View/Goto/NextMarked", NULL, N_("Next m_arked message"), NULL, NULL, G_CALLBACK(next_marked_cb) },
576 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
577 {"View/Goto/PrevLabeled", NULL, N_("Previous _labeled message"), NULL, NULL, G_CALLBACK(prev_labeled_cb) },
578 {"View/Goto/NextLabeled", NULL, N_("Next la_beled message"), NULL, NULL, G_CALLBACK(next_labeled_cb) },
579 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
580 {"View/Goto/PrevHistory", NULL, N_("Previous opened message"), "<alt>Left", NULL, G_CALLBACK(prev_history_cb) },
581 {"View/Goto/NextHistory", NULL, N_("Next opened message"), "<alt>Right", NULL, G_CALLBACK(next_history_cb) },
582 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
583 {"View/Goto/ParentMessage", NULL, N_("Parent message"), "<control>Up", NULL, G_CALLBACK(parent_cb) },
584 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
585 {"View/Goto/NextUnreadFolder", NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
586 {"View/Goto/OtherFolder", NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
587 /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
588 {"View/Goto/NextPart", NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
589 {"View/Goto/PrevPart", NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
591 /* {"View/Scroll/---", NULL, "---", NULL, NULL, NULL }, */
592 {"View/Scroll", NULL, N_("Message scroll") },
593 {"View/Scroll/PrevLine", NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
594 {"View/Scroll/NextLine", NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
595 {"View/Scroll/PrevPage", NULL, N_("Previous page"), NULL, NULL, G_CALLBACK(scroll_prev_page_cb) },
596 {"View/Scroll/NextPage", NULL, N_("Next page"), NULL, NULL, G_CALLBACK(scroll_next_page_cb) },
598 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
599 {"View/Encoding", NULL, N_("Character _encoding") }, /* set_charset_cb */
600 {"View/Encoding/---", NULL, "---" },
601 #define ENC_ACTION(cs_char,c_char,string) \
602 { "View/Encoding/" cs_char, NULL, N_(string), NULL, NULL, c_char }
604 {"View/Encoding/Western", NULL, N_("Western European") },
605 {"View/Encoding/Baltic", NULL, N_("Baltic") },
606 {"View/Encoding/Hebrew", NULL, N_("Hebrew") },
607 {"View/Encoding/Arabic", NULL, N_("Arabic") },
608 {"View/Encoding/Cyrillic", NULL, N_("Cyrillic") },
609 {"View/Encoding/Japanese", NULL, N_("Japanese") },
610 {"View/Encoding/Chinese", NULL, N_("Chinese") },
611 {"View/Encoding/Korean", NULL, N_("Korean") },
612 {"View/Encoding/Thai", NULL, N_("Thai") },
614 {"View/Decode", NULL, N_("Decode") }, /* set_decode_cb */
615 {"View/Decode/---", NULL, "---" },
617 #define DEC_ACTION(cs_type,c_type,string) \
618 { "View/Decode/" cs_type, NULL, N_(string), NULL, NULL, c_type }
620 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
621 {"View/OpenNewWindow", NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(open_msg_cb) },
622 {"View/MessageSource", NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
623 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
624 {"View/Part", NULL, N_("Message part") },
625 {"View/Part/AsText", NULL, N_("View as text"), "T", NULL, G_CALLBACK(view_part_as_text_cb) },
626 {"View/Part/Open", NULL, N_("Open"), "L", NULL, G_CALLBACK(open_part_cb) },
628 {"View/Part/OpenWith", NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
630 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
632 {"View/Quotes", NULL, N_("Quotes") },
633 /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
634 {"View/UpdateSummary", NULL, N_("_Update summary"), "<control><alt>U", NULL, G_CALLBACK(update_summary_cb) },
637 {"Message/Receive", NULL, N_("Recei_ve") },
638 {"Message/Receive/CurrentAccount", NULL, N_("Get from _current account"), "<control>I", NULL, G_CALLBACK(mw_inc_mail_cb) },
639 {"Message/Receive/AllAccounts", NULL, N_("Get from _all accounts"), "<shift><control>I", NULL, G_CALLBACK(mw_inc_all_account_mail_cb) },
640 {"Message/Receive/CancelReceiving", NULL, N_("Cancel receivin_g"), NULL, NULL, G_CALLBACK(inc_cancel_cb) },
641 {"Message/Receive/---", NULL, "---" },
642 {"Message/Receive/PlaceHolder", NULL, "PlaceHolder,", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
643 {"Message/SendQueue", NULL, N_("_Send queued messages"), NULL, NULL, G_CALLBACK(mw_send_queue_cb) },
645 {"Message/---", NULL, "---" },
647 {"Message/ComposeEmail", NULL, N_("Compose a_n email message"), "<control>M", NULL, G_CALLBACK(mw_compose_mail_cb) },
648 {"Message/ComposeNews", NULL, N_("Compose a news message"), NULL, NULL, G_CALLBACK(mw_compose_news_cb) },
650 {"Message/Reply", NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY */
651 {"Message/ReplyTo", NULL, N_("Repl_y to") },
652 {"Message/ReplyTo/All", NULL, N_("_All"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
653 {"Message/ReplyTo/Sender", NULL, N_("_Sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
654 {"Message/ReplyTo/List", NULL, N_("Mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
655 {"Message/FollowupReply", NULL, N_("Follow-up and reply to"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FOLLOWUP_AND_REPLY_TO */
656 /*{"Message/---", NULL, "---" },*/
658 {"Message/Forward", NULL, N_("_Forward"), "<control><alt>F", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_INLINE */
659 {"Message/ForwardAtt", NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */
660 {"Message/Redirect", NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REDIRECT */
662 {"Message/MailingList", NULL, N_("Mailing-_List") },
663 {"Message/MailingList/Post", NULL, N_("Post") },
664 {"Message/MailingList/Post/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
665 {"Message/MailingList/Help", NULL, N_("Help") },
666 {"Message/MailingList/Help/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
667 {"Message/MailingList/Subscribe", NULL, N_("Subscribe") },
668 {"Message/MailingList/Subscribe/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
669 {"Message/MailingList/Unsubscribe", NULL, N_("Unsubscribe") },
670 {"Message/MailingList/Unsubscribe/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
671 {"Message/MailingList/ViewArchive", NULL, N_("View archive") },
672 {"Message/MailingList/ViewArchive/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
673 {"Message/MailingList/ContactOwner", NULL, N_("Contact owner") },
674 {"Message/MailingList/ContactOwner/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
677 {"Message/Move", NULL, N_("M_ove..."), "<control>O", NULL, G_CALLBACK(move_to_cb) },
678 {"Message/Copy", NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(copy_to_cb) },
679 {"Message/Trash", NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(delete_trash_cb) },
680 {"Message/Delete", NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(delete_cb) },
681 {"Message/CancelNews", NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
684 {"Message/Mark", NULL, N_("_Mark") },
685 {"Message/Mark/Mark", NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
686 {"Message/Mark/Unmark", NULL, N_("_Unmark"), "U", NULL, G_CALLBACK(unmark_cb) },
687 {"Message/Mark/---", NULL, "---", NULL, NULL, NULL },
689 {"Message/Mark/MarkUnread", NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
690 {"Message/Mark/MarkRead", NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(mark_as_read_cb) },
692 {"Message/Mark/MarkAllRead", NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
694 {"Message/Mark/IgnoreThread", NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(ignore_thread_cb) },
695 {"Message/Mark/UnignoreThread", NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(unignore_thread_cb) },
696 {"Message/Mark/WatchThread", NULL, N_("Watch thread"), NULL, NULL, G_CALLBACK(watch_thread_cb) },
697 {"Message/Mark/UnwatchThread", NULL, N_("Unwatch thread"), NULL, NULL, G_CALLBACK(unwatch_thread_cb) },
700 {"Message/Mark/MarkSpam", NULL, N_("Mark as _spam"), NULL, NULL, G_CALLBACK(mark_as_spam_cb) },
701 {"Message/Mark/MarkHam", NULL, N_("Mark as _ham"), NULL, NULL, G_CALLBACK(mark_as_ham_cb) },
704 {"Message/Mark/Lock", NULL, N_("Lock"), NULL, NULL, G_CALLBACK(lock_msgs_cb) },
705 {"Message/Mark/Unlock", NULL, N_("Unlock"), NULL, NULL, G_CALLBACK(unlock_msgs_cb) },
707 {"Message/ColorLabel", NULL, N_("Color la_bel") },
708 {"Message/Tags", NULL, N_("Ta_gs") },
709 /*{"Message/---", NULL, "---" },*/
711 {"Message/Reedit", NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
712 /*{"Message/---", NULL, "---" },*/
714 {"Message/CheckSignature", NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
718 {"Tools/AddressBook", NULL, N_("_Address book"), "<control><shift>A", NULL, G_CALLBACK(addressbook_open_cb) },
719 {"Tools/AddSenderToAB", NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) },
721 {"Tools/CollectAddresses", NULL, N_("C_ollect addresses") },
722 {"Tools/CollectAddresses/FromFolder", NULL, N_("From current _folder..."), NULL, NULL, G_CALLBACK(addr_harvest_cb) },
723 {"Tools/CollectAddresses/FromSelected", NULL, N_("From selected _messages..."), NULL, NULL, G_CALLBACK(addr_harvest_msg_cb) },
724 {"Tools/---", NULL, "---", NULL, NULL, NULL },
726 {"Tools/FilterFolder", NULL, N_("_Filter all messages in folder"), NULL, NULL, G_CALLBACK(filter_cb) },
727 {"Tools/FilterSelected", NULL, N_("Filter _selected messages"), NULL, NULL, G_CALLBACK(filter_list_cb) },
728 {"Tools/RunProcessing", NULL, N_("Run folder pr_ocessing rules"), NULL, NULL, G_CALLBACK(process_cb) },
730 {"Tools/CreateFilterRule", NULL, N_("_Create filter rule") },
731 {"Tools/CreateFilterRule/Automatically",NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_AUTO */
732 {"Tools/CreateFilterRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
733 {"Tools/CreateFilterRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO */
734 {"Tools/CreateFilterRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
736 {"Tools/CreateProcessingRule", NULL, N_("Create processing rule") },
737 {"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) },
738 {"Tools/CreateProcessingRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) },
739 {"Tools/CreateProcessingRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) },
740 {"Tools/CreateProcessingRule/BySubject",NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) },
741 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
743 {"Tools/ListUrls", NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) },
745 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
746 {"Tools/Actions", NULL, N_("Actio_ns") },
747 {"Tools/Actions/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
748 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
750 {"Tools/CheckNewMessages", NULL, N_("Ch_eck for new messages in all folders"), NULL, NULL, G_CALLBACK(update_folderview_cb) },
751 {"Tools/DeleteDuplicates", NULL, N_("Delete du_plicated messages") },
752 {"Tools/DeleteDuplicates/SelFolder", NULL, N_("In selected folder"), NULL, NULL, G_CALLBACK(delete_duplicated_cb) },
753 {"Tools/DeleteDuplicates/AllFolders", NULL, N_("In all folders"), NULL, NULL, G_CALLBACK(delete_duplicated_all_cb) },
754 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
756 {"Tools/Execute", NULL, N_("E_xecute"), "X", NULL, G_CALLBACK(execute_summary_cb) },
757 {"Tools/Expunge", NULL, N_("Exp_unge"), "<control>E", NULL, G_CALLBACK(expunge_summary_cb) },
759 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
760 {"Tools/SSLCertificates", NULL, N_("SSL cer_tificates"), NULL, NULL, G_CALLBACK(ssl_manager_open_cb) },
762 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
764 {"Tools/FilteringLog", NULL, N_("Filtering Lo_g"), NULL, NULL, G_CALLBACK(filtering_debug_window_show_cb) },
766 {"Tools/NetworkLog", NULL, N_("Network _Log"), "<shift><control>L", NULL, G_CALLBACK(log_window_show_cb) },
767 /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
768 {"Tools/ForgetSessionPasswords", NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) },
770 /* Configuration menu */
771 {"Configuration/ChangeAccount", NULL, N_("C_hange current account") },
772 {"Configuration/ChangeAccount/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
773 {"Configuration/AccountPrefs", NULL, N_("_Preferences for current account..."), NULL, NULL, G_CALLBACK(prefs_account_open_cb) },
774 {"Configuration/CreateAccount", NULL, N_("Create _new account..."), NULL, NULL, G_CALLBACK(new_account_cb) },
775 {"Configuration/EditAccounts", NULL, N_("_Edit accounts..."), NULL, NULL, G_CALLBACK(account_edit_open) },
776 {"Configuration/---", NULL, "---", NULL, NULL, NULL },
778 {"Configuration/Preferences", NULL, N_("P_references..."), NULL, NULL, G_CALLBACK(prefs_open_cb) },
779 {"Configuration/PreProcessing", NULL, N_("Pre-pr_ocessing..."), NULL, NULL, G_CALLBACK(prefs_pre_processing_open_cb) },
780 {"Configuration/PostProcessing", NULL, N_("Post-pro_cessing..."), NULL, NULL, G_CALLBACK(prefs_post_processing_open_cb) },
781 {"Configuration/Filtering", NULL, N_("_Filtering..."), NULL, NULL, G_CALLBACK(prefs_filtering_open_cb) },
782 {"Configuration/Templates", NULL, N_("_Templates..."), NULL, NULL, G_CALLBACK(prefs_template_open_cb) },
783 {"Configuration/Actions", NULL, N_("_Actions..."), NULL, NULL, G_CALLBACK(prefs_actions_open_cb) },
784 {"Configuration/Tags", NULL, N_("Tag_s..."), NULL, NULL, G_CALLBACK(prefs_tags_open_cb) },
785 /*{"Configuration/---", NULL, "---", NULL, NULL, NULL }, */
786 {"Configuration/Plugins", NULL, N_("Plu_gins..."), NULL, NULL, G_CALLBACK(plugins_open_cb) },
789 {"Help/Manual", NULL, N_("_Manual"), NULL, NULL, G_CALLBACK(manual_open_cb) },
790 {"Help/FAQ", NULL, N_("_Online User-contributed FAQ"), NULL, NULL, G_CALLBACK(manual_faq_open_cb) },
791 {"Help/IconLegend", NULL, N_("Icon _Legend"), NULL, NULL, G_CALLBACK(legend_open_cb) },
793 {"Help/SetDefault", NULL, N_("Set as default client"), NULL, NULL, G_CALLBACK(set_default_client_cb) },
795 {"Help/---", NULL, "---" },
796 {"Help/About", NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_cb) },
799 static GtkToggleActionEntry mainwin_toggle_entries[] = {
800 {"File/OfflineMode", NULL, N_("Offline _mode"), "<control>W", NULL, G_CALLBACK(toggle_work_offline_cb) }, /*toggle*/
801 {"View/ShowHide/MessageView", NULL, N_("_Message view"), "V", NULL, G_CALLBACK(toggle_message_cb) }, /* toggle */
803 {"View/ShowHide/StatusBar", NULL, N_("Status _bar"), NULL, NULL, G_CALLBACK(toggle_statusbar_cb) }, /* toggle */
805 {"View/ShowHide/ColumnHeaders", NULL, N_("Column headers"), NULL, NULL, G_CALLBACK(toggle_col_headers_cb) }, /* toggle */
806 {"View/ThreadView", NULL, N_("Th_read view"), "<control>T", NULL, G_CALLBACK(thread_cb) }, /* toggle */
807 {"View/HideReadThreads", NULL, N_("Hide read threads"), NULL, NULL, G_CALLBACK(hide_read_threads) }, /* toggle */
808 {"View/HideReadMessages", NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages) }, /* toggle */
809 {"View/HideDelMessages", NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages) }, /* toggle */
811 {"View/FullScreen", NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb) }, /* toggle */
813 {"View/AllHeaders", NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
814 {"View/Quotes/CollapseAll", NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb) }, /* 1 toggle */
815 {"View/Quotes/Collapse2", NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 2 toggle */
816 {"View/Quotes/Collapse3", NULL, N_("Collapse from level _3"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 3 toggle */
819 static GtkRadioActionEntry mainwin_showhide_radio_entries[] = { /* toggle_toolbar_cb */
820 {"View/ShowHide/Toolbar/TextBelowIcon", NULL, N_("Text _below icons"), NULL, NULL, TOOLBAR_BOTH }, /* radio TOOLBAR_BOTH */
821 {"View/ShowHide/Toolbar/TextBesideIcon",NULL, N_("Text be_side icons"), NULL, NULL, TOOLBAR_BOTH_HORIZ }, /* radio TOOLBAR_BOTH_HORIZ */
822 {"View/ShowHide/Toolbar/IconOnly", NULL, N_("_Icons only"), NULL, NULL, TOOLBAR_ICON }, /* radio TOOLBAR_ICON */
823 {"View/ShowHide/Toolbar/TextOnly", NULL, N_("_Text only"), NULL, NULL, TOOLBAR_TEXT }, /* radio TOOLBAR_TEXT */
825 {"View/ShowHide/Toolbar/Hide", NULL, N_("_Hide"), NULL, NULL, TOOLBAR_NONE }, /* radio TOOLBAR_NONE */
829 static GtkRadioActionEntry mainwin_layout_radio_entries[] = { /* set_layout_cb */
830 {"View/Layout/Standard", NULL, N_("_Standard"), NULL, NULL, NORMAL_LAYOUT }, /* radio NORMAL_LAYOUT */
831 {"View/Layout/ThreeColumns", NULL, N_("_Three columns"), NULL, NULL, VERTICAL_LAYOUT }, /* radio VERTICAL_LAYOUT */
832 {"View/Layout/WideMessage", NULL, N_("_Wide message"), NULL, NULL, WIDE_LAYOUT }, /* radio WIDE_LAYOUT */
833 {"View/Layout/WideMessageList", NULL, N_("W_ide message list"), NULL, NULL, WIDE_MSGLIST_LAYOUT }, /* radio WIDE_MSGLIST_LAYOUT */
834 {"View/Layout/SmallScreen", NULL, N_("S_mall screen"), NULL, NULL, SMALL_LAYOUT }, /* radio SMALL_LAYOUT */
837 static GtkRadioActionEntry mainwin_sort_radio_entries[] = { /* sort_summary_cb */
838 {"View/Sort/Number", NULL, N_("By _number"), NULL, NULL, SORT_BY_NUMBER }, /* radio SORT_BY_NUMBER */
839 {"View/Sort/Size", NULL, N_("By s_ize"), NULL, NULL, SORT_BY_SIZE }, /* radio SORT_BY_SIZE */
840 {"View/Sort/Date", NULL, N_("By _date"), NULL, NULL, SORT_BY_DATE }, /* radio SORT_BY_DATE */
841 {"View/Sort/ThreadDate", NULL, N_("By thread date"), NULL, NULL, SORT_BY_THREAD_DATE }, /* radio SORT_BY_THREAD_DATE */
842 {"View/Sort/From", NULL, N_("By _From"), NULL, NULL, SORT_BY_FROM }, /* radio SORT_BY_FROM */
843 {"View/Sort/To", NULL, N_("By _To"), NULL, NULL, SORT_BY_TO }, /* radio SORT_BY_TO */
844 {"View/Sort/Subject", NULL, N_("By s_ubject"), NULL, NULL, SORT_BY_SUBJECT }, /* radio SORT_BY_SUBJECT */
845 {"View/Sort/Color", NULL, N_("By _color label"), NULL, NULL, SORT_BY_LABEL }, /* radio SORT_BY_LABEL */
846 {"View/Sort/Tag", NULL, N_("By tag"), NULL, NULL, SORT_BY_TAGS }, /* radio SORT_BY_TAGS */
847 {"View/Sort/Mark", NULL, N_("By _mark"), NULL, NULL, SORT_BY_MARK }, /* radio SORT_BY_MARK */
848 {"View/Sort/Status", NULL, N_("By _status"), NULL, NULL, SORT_BY_STATUS }, /* radio SORT_BY_STATUS */
849 {"View/Sort/Attachment", NULL, N_("By a_ttachment"), NULL, NULL, SORT_BY_MIME }, /* radio SORT_BY_MIME */
850 {"View/Sort/Score", NULL, N_("By score"), NULL, NULL, SORT_BY_SCORE }, /* radio SORT_BY_SCORE */
851 {"View/Sort/Locked", NULL, N_("By locked"), NULL, NULL, SORT_BY_LOCKED }, /* radio SORT_BY_LOCKED */
852 {"View/Sort/DontSort", NULL, N_("D_on't sort"), NULL, NULL, SORT_BY_NONE }, /* radio SORT_BY_NONE */
855 static GtkRadioActionEntry mainwin_sorttype_radio_entries[] = { /* sort_summary_type_cb */
856 {"View/Sort/Ascending", NULL, N_("Ascending"), NULL, NULL, SORT_ASCENDING }, /* radio SORT_ASCENDING */
857 {"View/Sort/Descending", NULL, N_("Descending"), NULL, NULL, SORT_DESCENDING }, /* radio SORT_DESCENDING */
860 static GtkRadioActionEntry mainwin_radio_enc_entries[] =
862 ENC_ACTION(CS_AUTO, C_AUTO, N_("_Automatic")), /* RADIO set_charset_cb */
863 ENC_ACTION(CS_US_ASCII, C_US_ASCII, N_("7bit ASCII (US-ASC_II)")), /* RADIO set_charset_cb */
864 ENC_ACTION(CS_UTF_8, C_UTF_8, N_("Unicode (_UTF-8)")), /* RADIO set_charset_cb */
865 ENC_ACTION("Western/"CS_ISO_8859_1, C_ISO_8859_1, "ISO-8859-_1"), /* RADIO set_charset_cb */
866 ENC_ACTION("Western/"CS_ISO_8859_15, C_ISO_8859_15, "ISO-8859-15"), /* RADIO set_charset_cb */
867 ENC_ACTION("Western/"CS_WINDOWS_1252, C_WINDOWS_1252, "Windows-1252"), /* RADIO set_charset_cb */
868 ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, N_("Central European (ISO-8859-_2)")), /* RADIO set_charset_cb */
869 ENC_ACTION("Baltic/"CS_ISO_8859_13, C_ISO_8859_13, "ISO-8859-13"), /* RADIO set_charset_cb */
870 ENC_ACTION("Baltic/"CS_ISO_8859_4, C_ISO_8859_14, "ISO-8859-_4"), /* RADIO set_charset_cb */
871 ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, N_("Greek (ISO-8859-_7)")), /* RADIO set_charset_cb */
872 ENC_ACTION("Hebrew/"CS_ISO_8859_8, C_ISO_8859_8, "ISO-8859-_8"), /* RADIO set_charset_cb */
873 ENC_ACTION("Hebrew/"CS_WINDOWS_1255, C_WINDOWS_1255, "Windows-1255"), /* RADIO set_charset_cb */
874 ENC_ACTION("Arabic/"CS_ISO_8859_6, C_ISO_8859_6, "ISO-8859-_6"), /* RADIO set_charset_cb */
875 ENC_ACTION("Arabic/"CS_WINDOWS_1256, C_WINDOWS_1256, "Windows-1256"), /* RADIO set_charset_cb */
876 ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, N_("Turkish (ISO-8859-_9)")), /* RADIO set_charset_cb */
877 ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO set_charset_cb */
878 ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO set_charset_cb */
879 ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO set_charset_cb */
880 ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO set_charset_cb */
881 ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO set_charset_cb */
882 ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */
883 ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */
884 ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */
885 ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO set_charset_cb */
886 ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */
887 ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */
888 ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */
889 ENC_ACTION("Chinese/"CS_EUC_TW, C_EUC_TW, "EUC-_TW"), /* RADIO set_charset_cb */
890 ENC_ACTION("Korean/"CS_EUC_KR, C_EUC_KR, "_EUC-KR"), /* RADIO set_charset_cb */
891 ENC_ACTION("Korean/"CS_ISO_2022_KR, C_ISO_2022_KR, "_ISO-2022-KR"), /* RADIO set_charset_cb */
892 ENC_ACTION("Thai/"CS_TIS_620, C_TIS_620, "_TIS-620-KR"), /* RADIO set_charset_cb */
893 ENC_ACTION("Thai/"CS_WINDOWS_874, C_WINDOWS_874, "_Windows-874"), /* RADIO set_charset_cb */
896 static GtkRadioActionEntry mainwin_radio_dec_entries[] =
898 DEC_ACTION("AutoDetect", 0, N_("_Auto detect")), /* set_decode_cb */
900 DEC_ACTION("8bit", ENC_8BIT, "_8bit"),
901 DEC_ACTION("QP", ENC_QUOTED_PRINTABLE, "_Quoted printable"),
902 DEC_ACTION("B64", ENC_BASE64, "_Base64"),
903 DEC_ACTION("Uuencode", ENC_X_UUENCODE, "_Uuencode"),
906 static gboolean offline_ask_sync = TRUE;
907 static guint lastkey;
908 static gboolean is_obscured = FALSE;
910 static gboolean main_window_accel_activate (GtkAccelGroup *accelgroup,
916 MainWindow *mainwin = (MainWindow *)user_data;
918 if (mainwin->summaryview &&
919 mainwin->summaryview->quicksearch &&
920 quicksearch_has_focus(mainwin->summaryview->quicksearch) &&
921 (mod == 0 || mod == GDK_SHIFT_MASK)) {
922 quicksearch_pass_key(mainwin->summaryview->quicksearch, lastkey, mod);
928 #define N_COLOR_LABELS colorlabel_get_color_count()
930 static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item,
935 GtkCheckMenuItem **items;
937 GList *children, *cur;
940 mainwin = (MainWindow *)data;
941 cm_return_if_fail(mainwin != NULL);
943 sel = summary_get_selection(mainwin->summaryview);
946 menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
947 cm_return_if_fail(menu != NULL);
949 Xalloca(items, (N_COLOR_LABELS + 1) * sizeof(GtkWidget *), return);
951 /* NOTE: don't return prematurely because we set the "dont_toggle"
952 * state for check menu items. This would be bad! */
953 g_object_set_data(G_OBJECT(menu), "dont_toggle",
956 /* clear items. get item pointers. */
957 children = gtk_container_get_children(GTK_CONTAINER(menu));
958 for (n = 0, cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
959 if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
960 gtk_check_menu_item_set_active
961 (GTK_CHECK_MENU_ITEM(cur->data), FALSE);
962 items[n] = GTK_CHECK_MENU_ITEM(cur->data);
967 g_list_free(children);
969 if (n == (N_COLOR_LABELS + 1)) {
970 /* iterate all messages and set the state of the appropriate
972 for (; sel != NULL; sel = sel->next) {
976 msginfo = (MsgInfo *)sel->data;
978 clabel = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
979 if (!gtk_check_menu_item_get_active(items[clabel]))
980 gtk_check_menu_item_set_active
981 (items[clabel], TRUE);
985 g_warning("invalid number of color elements (%d)\n", n);
988 /* reset "dont_toggle" state */
989 g_object_set_data(G_OBJECT(menu), "dont_toggle",
993 static void mainwindow_colorlabel_menu_item_activate_cb(GtkWidget *widget,
996 guint color = GPOINTER_TO_UINT(data);
999 mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
1000 cm_return_if_fail(mainwin != NULL);
1002 /* "dont_toggle" state set? */
1003 if (g_object_get_data(G_OBJECT(mainwin->colorlabel_menu),
1007 summary_set_colorlabel(mainwin->summaryview, color, NULL);
1010 static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
1013 MainWindow *mainwin;
1015 GList *children, *cur;
1017 GHashTable *menu_table = g_hash_table_new_full(
1021 GHashTable *menu_allsel_table = g_hash_table_new_full(
1026 mainwin = (MainWindow *)data;
1027 cm_return_if_fail(mainwin != NULL);
1029 sel = summary_get_selection(mainwin->summaryview);
1032 menu = GTK_MENU_SHELL(mainwin->tags_menu);
1033 cm_return_if_fail(menu != NULL);
1035 /* NOTE: don't return prematurely because we set the "dont_toggle"
1036 * state for check menu items */
1037 g_object_set_data(G_OBJECT(menu), "dont_toggle",
1038 GINT_TO_POINTER(1));
1040 /* clear items. get item pointers. */
1041 children = gtk_container_get_children(GTK_CONTAINER(menu));
1042 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
1043 if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
1044 gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cur->data),
1046 gtk_check_menu_item_set_active
1047 (GTK_CHECK_MENU_ITEM(cur->data), FALSE);
1049 g_hash_table_insert(menu_table, GINT_TO_POINTER(id), GTK_CHECK_MENU_ITEM(cur->data));
1050 g_hash_table_insert(menu_allsel_table, GINT_TO_POINTER(id), GINT_TO_POINTER(0));
1054 g_list_free(children);
1056 /* iterate all messages and set the state of the appropriate
1059 for (; sel != NULL; sel = sel->next) {
1061 GSList *tags = NULL;
1062 GtkCheckMenuItem *item;
1063 msginfo = (MsgInfo *)sel->data;
1066 tags = msginfo->tags;
1070 for (; tags; tags = tags->next) {
1071 gint num_checked = GPOINTER_TO_INT(g_hash_table_lookup(menu_allsel_table, tags->data));
1072 item = g_hash_table_lookup(menu_table, GINT_TO_POINTER(tags->data));
1073 if (item && !gtk_check_menu_item_get_active(item)) {
1074 gtk_check_menu_item_set_active
1078 g_hash_table_replace(menu_allsel_table, tags->data, GINT_TO_POINTER(num_checked));
1083 children = gtk_container_get_children(GTK_CONTAINER(menu));
1084 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
1085 if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
1086 gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cur->data),
1088 gint num_checked = GPOINTER_TO_INT(g_hash_table_lookup(menu_allsel_table, GINT_TO_POINTER(id)));
1089 if (num_checked < sel_len && num_checked > 0)
1090 gtk_check_menu_item_set_inconsistent(GTK_CHECK_MENU_ITEM(cur->data), TRUE);
1092 gtk_check_menu_item_set_inconsistent(GTK_CHECK_MENU_ITEM(cur->data), FALSE);
1095 g_list_free(children);
1097 g_hash_table_destroy(menu_table);
1098 g_hash_table_destroy(menu_allsel_table);
1099 /* reset "dont_toggle" state */
1100 g_object_set_data(G_OBJECT(menu), "dont_toggle",
1101 GINT_TO_POINTER(0));
1104 static void mainwindow_tags_menu_item_activate_cb(GtkWidget *widget,
1107 gint id = GPOINTER_TO_INT(data);
1108 gboolean set = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
1109 MainWindow *mainwin;
1111 mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
1112 cm_return_if_fail(mainwin != NULL);
1114 /* "dont_toggle" state set? */
1115 if (g_object_get_data(G_OBJECT(mainwin->tags_menu),
1121 summary_set_tag(mainwin->summaryview, id, NULL);
1124 void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
1125 GClosure *closure, GtkMenuItem *item)
1127 GList *closures = gtk_widget_list_accel_closures(GTK_WIDGET(item));
1129 for (cur = closures; cur; cur = cur->next) {
1130 if (closure == cur->data) {
1131 GtkLabel *label = g_object_get_data(G_OBJECT(item), "accel_label");
1134 if (keyval == GDK_KEY_BackSpace) {
1135 const gchar *accel_path;
1136 accel_path = gtk_menu_item_get_accel_path(item);
1137 keyval = 0; modifier = 0;
1138 gtk_accel_map_change_entry (accel_path, keyval, modifier, TRUE);
1140 new_accel = gtk_accelerator_get_label(keyval, modifier);
1141 gtk_label_set_text(label, new_accel);
1147 static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refresh)
1149 GtkWidget *label_menuitem;
1153 gchar *accel_path = NULL;
1155 label_menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/ColorLabel");
1156 g_signal_connect(G_OBJECT(label_menuitem), "activate",
1157 G_CALLBACK(mainwindow_colorlabel_menu_item_activate_item_cb),
1159 gtk_widget_show(label_menuitem);
1161 menu = gtk_menu_new();
1162 gtk_menu_set_accel_group (GTK_MENU (menu),
1163 gtk_ui_manager_get_accel_group(mainwin->ui_manager));
1165 /* create sub items. for the menu item activation callback we pass the
1166 * index of label_colors[] as data parameter. for the None color we
1167 * pass an invalid (high) value. also we attach a data pointer so we
1168 * can always get back the Mainwindow pointer. */
1170 item = gtk_check_menu_item_new_with_label(_("None"));
1171 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1172 g_signal_connect(G_OBJECT(item), "activate",
1173 G_CALLBACK(mainwindow_colorlabel_menu_item_activate_cb),
1174 GUINT_TO_POINTER(0));
1175 g_object_set_data(G_OBJECT(item), "mainwin", mainwin);
1176 gtk_widget_show(item);
1178 accel_path = g_strdup_printf("<ClawsColorLabels>/None");
1179 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1181 gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_KEY_0, GDK_CONTROL_MASK);
1183 item = gtk_menu_item_new();
1184 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1185 gtk_widget_show(item);
1187 /* create pixmap/label menu items */
1188 for (i = 0; i < N_COLOR_LABELS; i++) {
1189 item = colorlabel_create_check_color_menu_item(
1190 i, refresh, MAINWIN_COLORMENU);
1191 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1192 g_signal_connect(G_OBJECT(item), "activate",
1193 G_CALLBACK(mainwindow_colorlabel_menu_item_activate_cb),
1194 GUINT_TO_POINTER(i + 1));
1195 g_object_set_data(G_OBJECT(item), "mainwin",
1197 gtk_widget_show(item);
1198 accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
1199 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1201 gtk_accel_map_add_entry(accel_path, GDK_KEY_1+i, GDK_CONTROL_MASK);
1203 g_signal_connect (gtk_ui_manager_get_accel_group(mainwin->ui_manager),
1204 "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
1208 gtk_widget_show(menu);
1209 gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
1210 mainwin->colorlabel_menu = menu;
1213 static void mainwindow_tags_menu_item_apply_tags_activate_cb(GtkWidget *widget,
1216 MainWindow *mainwin;
1218 mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
1219 cm_return_if_fail(mainwin != NULL);
1221 /* "dont_toggle" state set? */
1222 if (g_object_get_data(G_OBJECT(mainwin->tags_menu),
1226 tag_apply_open(summary_get_selection(mainwin->summaryview));
1229 static gint mainwin_tag_cmp_list(gconstpointer a, gconstpointer b)
1231 gint id_a = GPOINTER_TO_INT(a);
1232 gint id_b = GPOINTER_TO_INT(b);
1233 const gchar *tag_a = tags_get_tag(id_a);
1234 const gchar *tag_b = tags_get_tag(id_b);
1238 return tag_b == NULL ? 0:1;
1241 return tag_a == NULL ? 0:1;
1243 return g_utf8_collate(tag_a, tag_b);
1246 static void mainwindow_tags_menu_create(MainWindow *mainwin, gboolean refresh)
1248 GtkWidget *label_menuitem;
1251 GSList *cur = tags_get_list();
1252 GSList *orig = NULL;
1253 gboolean existing_tags = FALSE;
1255 cur = orig = g_slist_sort(cur, mainwin_tag_cmp_list);
1257 label_menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Tags");
1258 g_signal_connect(G_OBJECT(label_menuitem), "activate",
1259 G_CALLBACK(mainwindow_tags_menu_item_activate_item_cb),
1262 gtk_widget_show(label_menuitem);
1264 menu = gtk_menu_new();
1265 gtk_menu_set_accel_group (GTK_MENU (menu),
1266 gtk_ui_manager_get_accel_group(mainwin->ui_manager));
1268 /* create tags menu items */
1269 for (; cur; cur = cur->next) {
1270 gint id = GPOINTER_TO_INT(cur->data);
1271 const gchar *tag = tags_get_tag(id);
1273 item = gtk_check_menu_item_new_with_label(tag);
1274 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1275 g_signal_connect(G_OBJECT(item), "activate",
1276 G_CALLBACK(mainwindow_tags_menu_item_activate_cb),
1277 GINT_TO_POINTER(id));
1278 g_object_set_data(G_OBJECT(item), "mainwin",
1280 g_object_set_data(G_OBJECT(item), "tag_id",
1281 GINT_TO_POINTER(id));
1282 gtk_widget_show(item);
1283 accel_path = g_strconcat("<ClawsTags>/",tag, NULL);
1284 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1286 existing_tags = TRUE;
1288 if (existing_tags) {
1290 item = gtk_menu_item_new();
1291 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1292 gtk_widget_show(item);
1295 item = gtk_menu_item_new_with_label(_("Apply tags..."));
1296 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
1297 g_signal_connect(G_OBJECT(item), "activate",
1298 G_CALLBACK(mainwindow_tags_menu_item_apply_tags_activate_cb),
1300 g_object_set_data(G_OBJECT(item), "mainwin",
1302 gtk_widget_show(item);
1303 accel_path = g_strdup_printf("<ClawsTags>/ApplyTags");
1304 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
1306 gtk_accel_map_add_entry("<ClawsTags>/ApplyTags", GDK_KEY_T, GDK_CONTROL_MASK|GDK_SHIFT_MASK);
1309 gtk_widget_show(menu);
1310 gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
1311 mainwin->tags_menu = menu;
1313 #ifndef GENERIC_UMPC
1314 static gboolean warning_icon_pressed(GtkWidget *widget, GdkEventButton *evt,
1315 MainWindow *mainwindow)
1317 if (evt && evt->button == 1) {
1318 log_window_show_error(mainwindow->logwin);
1319 gtk_widget_hide(mainwindow->warning_btn);
1324 static gboolean warning_visi_notify(GtkWidget *widget,
1325 GdkEventVisibility *event,
1326 MainWindow *mainwindow)
1328 gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), hand_cursor);
1332 static gboolean warning_leave_notify(GtkWidget *widget,
1333 GdkEventCrossing *event,
1334 MainWindow *mainwindow)
1336 gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), NULL);
1340 static gboolean warning_enter_notify(GtkWidget *widget,
1341 GdkEventCrossing *event,
1342 MainWindow *mainwindow)
1344 gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), hand_cursor);
1348 void mainwindow_show_error(void)
1350 MainWindow *mainwin = mainwindow_get_mainwindow();
1351 gtk_widget_show(mainwin->warning_btn);
1354 void mainwindow_clear_error(MainWindow *mainwin)
1356 gtk_widget_hide(mainwin->warning_btn);
1359 #define BREAK_ON_MODIFIER_KEY() \
1360 if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
1362 static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
1365 MainWindow *mainwin = (MainWindow*) data;
1367 if (!mainwin || !event)
1370 if (quicksearch_has_focus(mainwin->summaryview->quicksearch))
1372 lastkey = event->keyval;
1376 switch (event->keyval) {
1377 case GDK_KEY_Q: /* Quit */
1379 BREAK_ON_MODIFIER_KEY();
1381 if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
1382 app_exit_cb(NULL, mainwin);
1387 BREAK_ON_MODIFIER_KEY();
1388 if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
1389 if (mainwin->folderview != NULL && mainwin->summaryview != NULL
1390 && ((!mainwin->summaryview->displayed
1391 && !mainwin->summaryview->selected)
1392 || (mainwin->summaryview->folder_item
1393 && mainwin->summaryview->folder_item->total_msgs == 0))) {
1394 g_signal_stop_emission_by_name(G_OBJECT(widget),
1396 folderview_select_next_unread(mainwin->folderview, TRUE);
1403 if (maemo_mainwindow_is_fullscreen(widget)) {
1404 gtk_window_unfullscreen(GTK_WINDOW(widget));
1406 gtk_window_fullscreen(GTK_WINDOW(widget));
1411 PangoFontDescription *font_desc;
1413 font_desc = pango_font_description_from_string(prefs_common.normalfont);
1414 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1416 size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1417 g_free(prefs_common.normalfont);
1418 prefs_common.normalfont = pango_font_description_to_string(font_desc);
1419 main_window_reflect_prefs_all();
1421 pango_font_description_free(font_desc);
1422 font_desc = pango_font_description_from_string(prefs_common.textfont);
1423 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1425 size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1426 g_free(prefs_common.textfont);
1427 prefs_common.textfont = pango_font_description_to_string(font_desc);
1428 main_window_reflect_prefs_all();
1430 pango_font_description_free(font_desc);
1435 PangoFontDescription *font_desc;
1437 font_desc = pango_font_description_from_string(prefs_common.normalfont);
1438 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1440 size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1441 g_free(prefs_common.normalfont);
1442 prefs_common.normalfont = pango_font_description_to_string(font_desc);
1443 main_window_reflect_prefs_all();
1445 pango_font_description_free(font_desc);
1446 font_desc = pango_font_description_from_string(prefs_common.textfont);
1447 size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
1449 size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
1450 g_free(prefs_common.textfont);
1451 prefs_common.textfont = pango_font_description_to_string(font_desc);
1452 main_window_reflect_prefs_all();
1454 pango_font_description_free(font_desc);
1457 case GDK_KEY_Escape:
1458 if (mainwin->summaryview &&
1459 mainwin->summaryview->ext_messageview &&
1460 mainwin->summaryview->ext_messageview->window &&
1461 widget == mainwin->summaryview->ext_messageview->window) {
1462 messageview_destroy(mainwin->summaryview->ext_messageview);
1472 #undef BREAK_ON_MODIFIER_KEY
1475 void mainwindow_maemo_led_set(gboolean state) {
1476 static gint last_state = -1;
1477 if (last_state == state)
1479 last_state = (gint)state;
1480 if (prefs_common.maemo_show_led) {
1482 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1483 "--dest=com.nokia.mce "
1484 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate "
1485 "string:PatternCommunicationEvent", TRUE);
1486 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1487 "--dest=com.nokia.mce "
1488 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate "
1489 "string:PatternCommunicationEmail", TRUE);
1491 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1492 "--dest=com.nokia.mce "
1493 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate "
1494 "string:PatternCommunicationEvent", TRUE);
1495 execute_command_line("/usr/bin/dbus-send --system --type=method_call "
1496 "--dest=com.nokia.mce "
1497 "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate "
1498 "string:PatternCommunicationEmail", TRUE);
1503 static void led_update(FolderItem *removed_item)
1505 guint new, unread, unreadmarked, marked, total, replied;
1506 guint forwarded, locked, ignored, watched;
1508 folder_count_total_msgs(&new, &unread, &unreadmarked, &marked, &total,
1509 &replied, &forwarded, &locked, &ignored,
1512 total -= removed_item->total_msgs;
1513 new -= removed_item->new_msgs;
1514 unread -= removed_item->unread_msgs;
1518 mainwindow_maemo_led_set(TRUE);
1520 mainwindow_maemo_led_set(FALSE);
1523 static gboolean maemo_folder_item_update_hook(gpointer source, gpointer data)
1530 static gboolean maemo_folder_update_hook(gpointer source, gpointer data)
1532 FolderUpdateData *hookdata;
1534 if (hookdata->update_flags & FOLDER_REMOVE_FOLDERITEM)
1535 led_update(hookdata->item);
1542 static void main_window_install_maemo_hooks(MainWindow *mainwin)
1544 gint maemo_item_hook_id, maemo_folder_hook_id;
1546 maemo_item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, maemo_folder_item_update_hook, NULL);
1547 if (maemo_item_hook_id == -1) {
1551 maemo_folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, maemo_folder_update_hook, NULL);
1552 if (maemo_folder_hook_id == -1) {
1553 goto err_out_folder;
1559 hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, maemo_item_hook_id);
1565 MainWindow *main_window_create()
1567 MainWindow *mainwin;
1571 GtkWidget *handlebox;
1572 GtkWidget *vbox_body;
1573 GtkWidget *menuitem;
1574 #ifndef GENERIC_UMPC
1575 GtkWidget *hbox_stat;
1576 GtkWidget *statusbar;
1577 GtkWidget *progressbar;
1578 GtkWidget *statuslabel;
1579 GtkWidget *ac_button;
1580 GtkWidget *ac_label;
1581 GtkWidget *online_pixmap;
1582 GtkWidget *offline_pixmap;
1583 GtkWidget *warning_icon;
1584 GtkWidget *warning_btn;
1586 GtkWidget *online_switch;
1587 GtkWidget *offline_switch;
1588 FolderView *folderview;
1589 SummaryView *summaryview;
1590 MessageView *messageview;
1591 #if !GTK_CHECK_VERSION(3, 0, 0)
1592 GdkColormap *colormap;
1593 gboolean success[4];
1599 static GdkGeometry geometry;
1601 debug_print("Creating main window...\n");
1602 mainwin = g_new0(MainWindow, 1);
1605 window = GTK_WIDGET(gtkut_window_new(GTK_WINDOW_TOPLEVEL, "mainwindow"));
1606 gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
1607 gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
1609 prefs_common.layout_mode = SMALL_LAYOUT;
1611 if (!geometry.min_height) {
1612 geometry.min_width = 320;
1613 geometry.min_height = 200;
1615 gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
1618 g_signal_connect(G_OBJECT(window), "delete_event",
1619 G_CALLBACK(main_window_close_cb), mainwin);
1620 MANAGE_WINDOW_SIGNALS_CONNECT(window);
1621 g_signal_connect(G_OBJECT(window), "focus_in_event",
1622 G_CALLBACK(mainwindow_focus_in_event),
1624 g_signal_connect(G_OBJECT(window), "key_press_event",
1625 G_CALLBACK(mainwindow_key_pressed), mainwin);
1627 gtk_widget_realize(window);
1628 gtk_widget_add_events(window, GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);
1631 gtkut_widget_set_app_icon(window);
1633 vbox = gtk_vbox_new(FALSE, 0);
1634 gtk_widget_show(vbox);
1635 gtk_container_add(GTK_CONTAINER(window), vbox);
1639 mainwin->ui_manager = gtk_ui_manager_new();
1640 mainwin->action_group = cm_menu_create_action_group_full(mainwin->ui_manager,"Menu", mainwin_entries,
1641 G_N_ELEMENTS(mainwin_entries), (gpointer)mainwin);
1642 gtk_action_group_add_toggle_actions(mainwin->action_group, mainwin_toggle_entries,
1643 G_N_ELEMENTS(mainwin_toggle_entries), (gpointer)mainwin);
1644 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_showhide_radio_entries,
1645 G_N_ELEMENTS(mainwin_showhide_radio_entries), C_AUTO, G_CALLBACK(toggle_toolbar_cb), (gpointer)mainwin);
1646 #ifndef GENERIC_UMPC
1647 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_layout_radio_entries,
1648 G_N_ELEMENTS(mainwin_layout_radio_entries), C_AUTO, G_CALLBACK(set_layout_cb), (gpointer)mainwin);
1650 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_sort_radio_entries,
1651 G_N_ELEMENTS(mainwin_sort_radio_entries), C_AUTO, G_CALLBACK(sort_summary_cb), (gpointer)mainwin);
1652 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_sorttype_radio_entries,
1653 G_N_ELEMENTS(mainwin_sorttype_radio_entries), C_AUTO, G_CALLBACK(sort_summary_type_cb), (gpointer)mainwin);
1654 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_radio_enc_entries,
1655 G_N_ELEMENTS(mainwin_radio_enc_entries), C_AUTO, G_CALLBACK(set_charset_cb), (gpointer)mainwin);
1656 gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_radio_dec_entries,
1657 G_N_ELEMENTS(mainwin_radio_dec_entries), C_AUTO, G_CALLBACK(set_decode_cb), (gpointer)mainwin);
1660 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR)
1662 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_POPUP)
1664 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "File", "File", GTK_UI_MANAGER_MENU)
1665 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Edit", "Edit", GTK_UI_MANAGER_MENU)
1666 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "View", "View", GTK_UI_MANAGER_MENU)
1667 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Message", "Message", GTK_UI_MANAGER_MENU)
1668 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Tools", "Tools", GTK_UI_MANAGER_MENU)
1669 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Configuration", "Configuration", GTK_UI_MANAGER_MENU)
1670 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Help", "Help", GTK_UI_MANAGER_MENU)
1673 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "AddMailbox", "File/AddMailbox", GTK_UI_MANAGER_MENU)
1674 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File/AddMailbox", "MH", "File/AddMailbox/MH", GTK_UI_MANAGER_MENUITEM)
1675 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR)
1676 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SortMailboxes", "File/SortMailboxes", GTK_UI_MANAGER_MENUITEM)
1677 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator2", "File/---", GTK_UI_MANAGER_SEPARATOR)
1678 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ImportMbox", "File/ImportMbox", GTK_UI_MANAGER_MENUITEM)
1679 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ExportMbox", "File/ExportMbox", GTK_UI_MANAGER_MENUITEM)
1680 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ExportSelMbox", "File/ExportSelMbox", GTK_UI_MANAGER_MENUITEM)
1681 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator3", "File/---", GTK_UI_MANAGER_SEPARATOR)
1682 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "EmptyTrashes", "File/EmptyTrashes", GTK_UI_MANAGER_MENUITEM)
1683 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator4", "File/---", GTK_UI_MANAGER_SEPARATOR)
1684 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
1685 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SavePartAs", "File/SavePartAs", GTK_UI_MANAGER_MENUITEM)
1686 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
1687 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
1688 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
1689 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
1690 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "OfflineMode", "File/OfflineMode", GTK_UI_MANAGER_MENUITEM)
1691 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SynchroniseFolders", "File/SynchroniseFolders", GTK_UI_MANAGER_MENUITEM)
1692 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator7", "File/---", GTK_UI_MANAGER_SEPARATOR)
1693 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Exit", "File/Exit", GTK_UI_MANAGER_MENUITEM)
1696 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Copy", "Edit/Copy", GTK_UI_MANAGER_MENUITEM)
1697 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectAll", "Edit/SelectAll", GTK_UI_MANAGER_MENUITEM)
1698 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectThread", "Edit/SelectThread", GTK_UI_MANAGER_MENUITEM)
1699 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "DeleteThread", "Edit/DeleteThread", GTK_UI_MANAGER_MENUITEM)
1700 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Separator1", "Edit/---", GTK_UI_MANAGER_SEPARATOR)
1701 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Find", "Edit/Find", GTK_UI_MANAGER_MENUITEM)
1702 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SearchFolder", "Edit/SearchFolder", GTK_UI_MANAGER_MENUITEM)
1703 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "QuickSearch", "Edit/QuickSearch", GTK_UI_MANAGER_MENUITEM)
1706 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ShowHide", "View/ShowHide", GTK_UI_MANAGER_MENU)
1707 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "Toolbar", "View/ShowHide/Toolbar", GTK_UI_MANAGER_MENU)
1708 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBelowIcon", "View/ShowHide/Toolbar/TextBelowIcon", GTK_UI_MANAGER_MENUITEM)
1709 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBesideIcon", "View/ShowHide/Toolbar/TextBesideIcon", GTK_UI_MANAGER_MENUITEM)
1710 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "IconOnly", "View/ShowHide/Toolbar/IconOnly", GTK_UI_MANAGER_MENUITEM)
1711 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextOnly", "View/ShowHide/Toolbar/TextOnly", GTK_UI_MANAGER_MENUITEM)
1712 #ifndef GENERIC_UMPC
1713 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "Hide", "View/ShowHide/Toolbar/Hide", GTK_UI_MANAGER_MENUITEM)
1715 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "MessageView", "View/ShowHide/MessageView", GTK_UI_MANAGER_MENUITEM)
1716 #ifndef GENERIC_UMPC
1717 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "StatusBar", "View/ShowHide/StatusBar", GTK_UI_MANAGER_MENUITEM)
1719 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "ColumnHeaders", "View/ShowHide/ColumnHeaders", GTK_UI_MANAGER_MENUITEM)
1720 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "SetColumns", "View/SetColumns", GTK_UI_MANAGER_MENU)
1721 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Folderlist", "View/SetColumns/Folderlist", GTK_UI_MANAGER_MENUITEM)
1722 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Messagelist", "View/SetColumns/Messagelist", GTK_UI_MANAGER_MENUITEM)
1723 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR)
1726 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "FullScreen", "View/FullScreen", GTK_UI_MANAGER_MENUITEM)
1728 #ifndef GENERIC_UMPC
1729 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Layout", "View/Layout", GTK_UI_MANAGER_MENU)
1730 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "Standard", "View/Layout/Standard", GTK_UI_MANAGER_MENUITEM)
1731 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "ThreeColumns", "View/Layout/ThreeColumns", GTK_UI_MANAGER_MENUITEM)
1732 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "WideMessage", "View/Layout/WideMessage", GTK_UI_MANAGER_MENUITEM)
1733 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "WideMessageList", "View/Layout/WideMessageList", GTK_UI_MANAGER_MENUITEM)
1734 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "SmallScreen", "View/Layout/SmallScreen", GTK_UI_MANAGER_MENUITEM)
1735 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator2", "View/---", GTK_UI_MANAGER_SEPARATOR)
1738 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Sort", "View/Sort", GTK_UI_MANAGER_MENU)
1739 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Number", "View/Sort/Number", GTK_UI_MANAGER_MENUITEM)
1740 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Size", "View/Sort/Size", GTK_UI_MANAGER_MENUITEM)
1741 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Date", "View/Sort/Date", GTK_UI_MANAGER_MENUITEM)
1742 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "ThreadDate", "View/Sort/ThreadDate", GTK_UI_MANAGER_MENUITEM)
1743 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "From", "View/Sort/From", GTK_UI_MANAGER_MENUITEM)
1744 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "To", "View/Sort/To", GTK_UI_MANAGER_MENUITEM)
1745 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Subject", "View/Sort/Subject", GTK_UI_MANAGER_MENUITEM)
1746 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Color", "View/Sort/Color", GTK_UI_MANAGER_MENUITEM)
1747 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Tag", "View/Sort/Tag", GTK_UI_MANAGER_MENUITEM)
1748 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Mark", "View/Sort/Mark", GTK_UI_MANAGER_MENUITEM)
1749 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Status", "View/Sort/Status", GTK_UI_MANAGER_MENUITEM)
1750 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Attachment", "View/Sort/Attachment", GTK_UI_MANAGER_MENUITEM)
1751 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Score", "View/Sort/Score", GTK_UI_MANAGER_MENUITEM)
1752 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Locked", "View/Sort/Locked", GTK_UI_MANAGER_MENUITEM)
1753 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "DontSort", "View/Sort/DontSort", GTK_UI_MANAGER_MENUITEM)
1754 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Separator1", "View/Sort/---", GTK_UI_MANAGER_SEPARATOR)
1755 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Ascending", "View/Sort/Ascending", GTK_UI_MANAGER_MENUITEM)
1756 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Descending", "View/Sort/Descending", GTK_UI_MANAGER_MENUITEM)
1757 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "Separator2", "View/Sort/---", GTK_UI_MANAGER_SEPARATOR)
1758 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Sort", "AttractSubj", "View/Sort/AttractSubj", GTK_UI_MANAGER_MENUITEM)
1760 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ThreadView", "View/ThreadView", GTK_UI_MANAGER_MENUITEM)
1761 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ExpandThreads", "View/ExpandThreads", GTK_UI_MANAGER_MENUITEM)
1762 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "CollapseThreads", "View/CollapseThreads", GTK_UI_MANAGER_MENUITEM)
1763 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadThreads", "View/HideReadThreads", GTK_UI_MANAGER_MENUITEM)
1764 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadMessages", "View/HideReadMessages", GTK_UI_MANAGER_MENUITEM)
1765 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideDelMessages", "View/HideDelMessages", GTK_UI_MANAGER_MENUITEM)
1766 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator3", "View/---", GTK_UI_MANAGER_SEPARATOR)
1768 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Goto", "View/Goto", GTK_UI_MANAGER_MENU)
1769 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Prev", "View/Goto/Prev", GTK_UI_MANAGER_MENUITEM)
1770 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Next", "View/Goto/Next", GTK_UI_MANAGER_MENUITEM)
1771 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator1", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1772 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevUnread", "View/Goto/PrevUnread", GTK_UI_MANAGER_MENUITEM)
1773 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnread", "View/Goto/NextUnread", GTK_UI_MANAGER_MENUITEM)
1774 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator2", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1775 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevNew", "View/Goto/PrevNew", GTK_UI_MANAGER_MENUITEM)
1776 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextNew", "View/Goto/NextNew", GTK_UI_MANAGER_MENUITEM)
1777 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator3", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1778 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevMarked", "View/Goto/PrevMarked", GTK_UI_MANAGER_MENUITEM)
1779 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextMarked", "View/Goto/NextMarked", GTK_UI_MANAGER_MENUITEM)
1780 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator4", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1781 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevLabeled", "View/Goto/PrevLabeled", GTK_UI_MANAGER_MENUITEM)
1782 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextLabeled", "View/Goto/NextLabeled", GTK_UI_MANAGER_MENUITEM)
1783 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1784 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevHistory", "View/Goto/PrevHistory", GTK_UI_MANAGER_MENUITEM)
1785 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextHistory", "View/Goto/NextHistory", GTK_UI_MANAGER_MENUITEM)
1786 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1787 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
1788 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator7", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1789 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
1790 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
1791 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator8", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
1792 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextPart", "View/Goto/NextPart", GTK_UI_MANAGER_MENUITEM)
1793 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevPart", "View/Goto/PrevPart", GTK_UI_MANAGER_MENUITEM)
1794 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
1795 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
1796 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
1797 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevPage", "View/Scroll/PrevPage", GTK_UI_MANAGER_MENUITEM)
1798 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextPage", "View/Scroll/NextPage", GTK_UI_MANAGER_MENUITEM)
1799 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator4", "View/---", GTK_UI_MANAGER_SEPARATOR)
1801 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Encoding", "View/Encoding", GTK_UI_MANAGER_MENU)
1802 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_AUTO, "View/Encoding/"CS_AUTO, GTK_UI_MANAGER_MENUITEM)
1803 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Separator1", "View/Encoding/---", GTK_UI_MANAGER_SEPARATOR)
1804 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_US_ASCII, "View/Encoding/"CS_US_ASCII, GTK_UI_MANAGER_MENUITEM)
1805 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_UTF_8, "View/Encoding/"CS_UTF_8, GTK_UI_MANAGER_MENUITEM)
1806 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Separator2", "View/Encoding/---", GTK_UI_MANAGER_SEPARATOR)
1808 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Western", "View/Encoding/Western", GTK_UI_MANAGER_MENU)
1809 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)
1810 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)
1811 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Western", CS_WINDOWS_1252, "View/Encoding/Western/"CS_WINDOWS_1252, GTK_UI_MANAGER_MENUITEM)
1813 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_2, "View/Encoding/"CS_ISO_8859_2, GTK_UI_MANAGER_MENUITEM)
1815 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Baltic", "View/Encoding/Baltic", GTK_UI_MANAGER_MENU)
1816 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)
1817 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)
1819 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_7, "View/Encoding/"CS_ISO_8859_7, GTK_UI_MANAGER_MENUITEM)
1821 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Hebrew", "View/Encoding/Hebrew", GTK_UI_MANAGER_MENU)
1822 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)
1823 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Hebrew", CS_WINDOWS_1255, "View/Encoding/Hebrew/"CS_WINDOWS_1255, GTK_UI_MANAGER_MENUITEM)
1825 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Arabic", "View/Encoding/Arabic", GTK_UI_MANAGER_MENU)
1826 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)
1827 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Arabic", CS_WINDOWS_1256, "View/Encoding/Arabic/"CS_WINDOWS_1256, GTK_UI_MANAGER_MENUITEM)
1829 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_9, "View/Encoding/"CS_ISO_8859_9, GTK_UI_MANAGER_MENUITEM)
1831 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Cyrillic", "View/Encoding/Cyrillic", GTK_UI_MANAGER_MENU)
1832 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)
1833 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_R, "View/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM)
1834 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_U, "View/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM)
1835 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_WINDOWS_1251, "View/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM)
1837 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Japanese", "View/Encoding/Japanese", GTK_UI_MANAGER_MENU)
1838 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)
1839 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)
1840 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_EUC_JP, "View/Encoding/Japanese/"CS_EUC_JP, GTK_UI_MANAGER_MENUITEM)
1841 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
1843 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU)
1844 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB18030, "View/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
1845 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
1846 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
1847 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
1848 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_EUC_TW, "View/Encoding/Chinese/"CS_EUC_TW, GTK_UI_MANAGER_MENUITEM)
1850 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Korean", "View/Encoding/Korean", GTK_UI_MANAGER_MENU)
1851 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Korean", CS_EUC_KR, "View/Encoding/Korean/"CS_EUC_KR, GTK_UI_MANAGER_MENUITEM)
1852 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)
1854 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Thai", "View/Encoding/Thai", GTK_UI_MANAGER_MENU)
1855 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Thai", CS_TIS_620, "View/Encoding/Thai/"CS_TIS_620, GTK_UI_MANAGER_MENUITEM)
1856 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Thai", CS_WINDOWS_874, "View/Encoding/Thai/"CS_WINDOWS_874, GTK_UI_MANAGER_MENUITEM)
1858 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Decode", "View/Decode", GTK_UI_MANAGER_MENU)
1859 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "AutoDetect", "View/Decode/AutoDetect", GTK_UI_MANAGER_MENUITEM)
1860 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "Separator1", "View/Decode/---", GTK_UI_MANAGER_SEPARATOR)
1861 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "8bit", "View/Decode/8bit", GTK_UI_MANAGER_MENUITEM)
1862 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "QP", "View/Decode/QP", GTK_UI_MANAGER_MENUITEM)
1863 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "B64", "View/Decode/B64", GTK_UI_MANAGER_MENUITEM)
1864 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Decode", "Uuencode", "View/Decode/Uuencode", GTK_UI_MANAGER_MENUITEM)
1865 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator5", "View/---", GTK_UI_MANAGER_SEPARATOR)
1867 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "OpenNewWindow", "View/OpenNewWindow", GTK_UI_MANAGER_MENUITEM)
1868 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "MessageSource", "View/MessageSource", GTK_UI_MANAGER_MENUITEM)
1869 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "AllHeaders", "View/AllHeaders", GTK_UI_MANAGER_MENUITEM)
1870 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Quotes", "View/Quotes", GTK_UI_MANAGER_MENU)
1871 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
1872 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
1873 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
1874 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Part", "View/Part", GTK_UI_MANAGER_MENU)
1875 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "AsText", "View/Part/AsText", GTK_UI_MANAGER_MENUITEM)
1876 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "Open", "View/Part/Open", GTK_UI_MANAGER_MENUITEM)
1878 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "OpenWith", "View/Part/OpenWith", GTK_UI_MANAGER_MENUITEM)
1880 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator8", "View/---", GTK_UI_MANAGER_SEPARATOR)
1881 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "UpdateSummary", "View/UpdateSummary", GTK_UI_MANAGER_MENUITEM)
1884 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Receive", "Message/Receive", GTK_UI_MANAGER_MENU)
1885 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "CurrentAccount", "Message/Receive/CurrentAccount", GTK_UI_MANAGER_MENUITEM)
1886 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "AllAccounts", "Message/Receive/AllAccounts", GTK_UI_MANAGER_MENUITEM)
1887 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "CancelReceiving", "Message/Receive/CancelReceiving", GTK_UI_MANAGER_MENUITEM)
1888 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "Separator1", "Message/Receive/---", GTK_UI_MANAGER_SEPARATOR)
1889 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "PlaceHolder", "Message/Receive/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1890 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "SendQueue", "Message/SendQueue", GTK_UI_MANAGER_MENUITEM)
1891 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator1", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1893 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ComposeEmail", "Message/ComposeEmail", GTK_UI_MANAGER_MENUITEM)
1894 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ComposeNews", "Message/ComposeNews", GTK_UI_MANAGER_MENUITEM)
1895 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reply", "Message/Reply", GTK_UI_MANAGER_MENUITEM)
1896 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ReplyTo", "Message/ReplyTo", GTK_UI_MANAGER_MENU)
1897 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/ReplyTo", "All", "Message/ReplyTo/All", GTK_UI_MANAGER_MENUITEM)
1898 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/ReplyTo", "Sender", "Message/ReplyTo/Sender", GTK_UI_MANAGER_MENUITEM)
1899 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/ReplyTo", "List", "Message/ReplyTo/List", GTK_UI_MANAGER_MENUITEM)
1900 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "FollowupReply", "Message/FollowupReply", GTK_UI_MANAGER_MENUITEM)
1901 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator2", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1903 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Forward", "Message/Forward", GTK_UI_MANAGER_MENUITEM)
1904 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ForwardAtt", "Message/ForwardAtt", GTK_UI_MANAGER_MENUITEM)
1905 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Redirect", "Message/Redirect", GTK_UI_MANAGER_MENUITEM)
1906 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "MailingList", "Message/MailingList", GTK_UI_MANAGER_MENU)
1907 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Post", "Message/MailingList/Post", GTK_UI_MANAGER_MENU)
1908 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Help", "Message/MailingList/Help", GTK_UI_MANAGER_MENU)
1909 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Subscribe", "Message/MailingList/Subscribe", GTK_UI_MANAGER_MENU)
1910 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "Unsubscribe", "Message/MailingList/Unsubscribe", GTK_UI_MANAGER_MENU)
1911 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "ViewArchive", "Message/MailingList/ViewArchive", GTK_UI_MANAGER_MENU)
1912 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList", "ContactOwner", "Message/MailingList/ContactOwner", GTK_UI_MANAGER_MENU)
1913 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Post", "PlaceHolder", "Message/MailingList/Post/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1914 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Help", "PlaceHolder", "Message/MailingList/Help/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1915 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Subscribe", "PlaceHolder", "Message/MailingList/Subscribe/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1916 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/Unsubscribe", "PlaceHolder", "Message/MailingList/Unsubscribe/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1917 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/ViewArchive", "PlaceHolder", "Message/MailingList/ViewArchive/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1918 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/MailingList/ContactOwner", "PlaceHolder", "Message/MailingList/ContactOwner/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1919 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator3", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1921 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Move", "Message/Move", GTK_UI_MANAGER_MENUITEM)
1922 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Copy", "Message/Copy", GTK_UI_MANAGER_MENUITEM)
1923 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Trash", "Message/Trash", GTK_UI_MANAGER_MENUITEM)
1924 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Delete", "Message/Delete", GTK_UI_MANAGER_MENUITEM)
1925 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CancelNews", "Message/CancelNews", GTK_UI_MANAGER_MENUITEM)
1926 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator4", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1928 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Mark", "Message/Mark", GTK_UI_MANAGER_MENU)
1929 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Mark", "Message/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
1930 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unmark", "Message/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
1931 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1932 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
1933 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
1934 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1935 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
1936 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1937 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
1938 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
1939 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "WatchThread", "Message/Mark/WatchThread", GTK_UI_MANAGER_MENUITEM)
1940 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnwatchThread", "Message/Mark/UnwatchThread", GTK_UI_MANAGER_MENUITEM)
1941 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator4", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1942 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkSpam", "Message/Mark/MarkSpam", GTK_UI_MANAGER_MENUITEM)
1943 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkHam", "Message/Mark/MarkHam", GTK_UI_MANAGER_MENUITEM)
1944 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator5", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
1945 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Lock", "Message/Mark/Lock", GTK_UI_MANAGER_MENUITEM)
1946 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unlock", "Message/Mark/Unlock", GTK_UI_MANAGER_MENUITEM)
1947 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ColorLabel", "Message/ColorLabel", GTK_UI_MANAGER_MENUITEM)
1948 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Tags", "Message/Tags", GTK_UI_MANAGER_MENUITEM)
1949 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator5", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1951 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reedit", "Message/Reedit", GTK_UI_MANAGER_MENUITEM)
1952 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator6", "Message/---", GTK_UI_MANAGER_SEPARATOR)
1953 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM)
1956 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
1957 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddSenderToAB", "Tools/AddSenderToAB", GTK_UI_MANAGER_MENUITEM)
1958 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CollectAddresses", "Tools/CollectAddresses", GTK_UI_MANAGER_MENU)
1959 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CollectAddresses", "FromFolder", "Tools/CollectAddresses/FromFolder", GTK_UI_MANAGER_MENUITEM)
1960 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CollectAddresses", "FromSelected", "Tools/CollectAddresses/FromSelected", GTK_UI_MANAGER_MENUITEM)
1961 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator1", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1963 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilterFolder", "Tools/FilterFolder", GTK_UI_MANAGER_MENUITEM)
1964 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilterSelected", "Tools/FilterSelected", GTK_UI_MANAGER_MENUITEM)
1965 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "RunProcessing", "Tools/RunProcessing", GTK_UI_MANAGER_MENUITEM)
1966 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateFilterRule", "Tools/CreateFilterRule", GTK_UI_MANAGER_MENU)
1967 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "Automatically", "Tools/CreateFilterRule/Automatically", GTK_UI_MANAGER_MENUITEM)
1968 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
1969 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
1970 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
1972 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateProcessingRule", "Tools/CreateProcessingRule", GTK_UI_MANAGER_MENU)
1973 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "Automatically", "Tools/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM)
1974 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
1975 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
1976 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
1977 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator2", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1979 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ListUrls", "Tools/ListUrls", GTK_UI_MANAGER_MENUITEM)
1980 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator3", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1982 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Actions", "Tools/Actions", GTK_UI_MANAGER_MENU)
1983 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/Actions", "PlaceHolder", "Tools/Actions/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
1984 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator4", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1986 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CheckNewMessages", "Tools/CheckNewMessages", GTK_UI_MANAGER_MENUITEM)
1987 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "DeleteDuplicates", "Tools/DeleteDuplicates", GTK_UI_MANAGER_MENU)
1988 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/DeleteDuplicates", "SelFolder", "Tools/DeleteDuplicates/SelFolder", GTK_UI_MANAGER_MENUITEM)
1989 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/DeleteDuplicates", "AllFolders", "Tools/DeleteDuplicates/AllFolders", GTK_UI_MANAGER_MENUITEM)
1990 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator5", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1992 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Execute", "Tools/Execute", GTK_UI_MANAGER_MENUITEM)
1993 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Expunge", "Tools/Expunge", GTK_UI_MANAGER_MENUITEM)
1995 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator6", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
1996 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "SSLCertificates", "Tools/SSLCertificates", GTK_UI_MANAGER_MENUITEM)
1998 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator7", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
2000 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilteringLog", "Tools/FilteringLog", GTK_UI_MANAGER_MENUITEM)
2002 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "NetworkLog", "Tools/NetworkLog", GTK_UI_MANAGER_MENUITEM)
2003 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator8", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
2004 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetSessionPasswords", "Tools/ForgetSessionPasswords", GTK_UI_MANAGER_MENUITEM)
2005 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator9", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
2007 /* Configuration menu */
2008 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "ChangeAccount", "Configuration/ChangeAccount", GTK_UI_MANAGER_MENU)
2009 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration/ChangeAccount", "PlaceHolder", "Configuration/ChangeAccount/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
2010 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "AccountPrefs", "Configuration/AccountPrefs", GTK_UI_MANAGER_MENUITEM)
2011 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "CreateAccount", "Configuration/CreateAccount", GTK_UI_MANAGER_MENUITEM)
2012 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "EditAccounts", "Configuration/EditAccounts", GTK_UI_MANAGER_MENUITEM)
2013 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Separator1", "Configuration/---", GTK_UI_MANAGER_SEPARATOR)
2015 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Preferences", "Configuration/Preferences", GTK_UI_MANAGER_MENUITEM)
2016 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "PreProcessing", "Configuration/PreProcessing", GTK_UI_MANAGER_MENUITEM)
2017 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "PostProcessing", "Configuration/PostProcessing", GTK_UI_MANAGER_MENUITEM)
2018 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Filtering", "Configuration/Filtering", GTK_UI_MANAGER_MENUITEM)
2019 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Templates", "Configuration/Templates", GTK_UI_MANAGER_MENUITEM)
2020 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Actions", "Configuration/Actions", GTK_UI_MANAGER_MENUITEM)
2021 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Tags", "Configuration/Tags", GTK_UI_MANAGER_MENUITEM)
2023 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Separator2", "Configuration/---", GTK_UI_MANAGER_SEPARATOR)
2024 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Configuration", "Plugins", "Configuration/Plugins", GTK_UI_MANAGER_MENUITEM)
2027 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Manual", "Help/Manual", GTK_UI_MANAGER_MENUITEM)
2028 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "FAQ", "Help/FAQ", GTK_UI_MANAGER_MENUITEM)
2029 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "IconLegend", "Help/IconLegend", GTK_UI_MANAGER_MENUITEM)
2031 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Separator1", "Help/---", GTK_UI_MANAGER_SEPARATOR)
2032 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "SetDefault", "Help/SetDefault", GTK_UI_MANAGER_MENUITEM)
2034 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Separator2", "Help/---", GTK_UI_MANAGER_SEPARATOR)
2035 MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "About", "Help/About", GTK_UI_MANAGER_MENUITEM)
2038 menubar = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu");
2039 gtk_widget_show_all(menubar);
2040 gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(mainwin->ui_manager));
2043 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
2045 hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar));
2048 if (prefs_common.toolbar_detachable) {
2049 handlebox = gtk_handle_box_new();
2050 gtk_widget_show(handlebox);
2051 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
2052 g_signal_connect(G_OBJECT(handlebox), "child_attached",
2053 G_CALLBACK(toolbar_child_attached), mainwin);
2054 g_signal_connect(G_OBJECT(handlebox), "child_detached",
2055 G_CALLBACK(toolbar_child_detached), mainwin);
2057 handlebox = gtk_hbox_new(FALSE, 0);
2058 gtk_widget_show(handlebox);
2059 gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
2061 /* link window to mainwin->window to avoid gdk warnings */
2062 mainwin->window = window;
2063 mainwin_list = g_list_append(mainwin_list, mainwin);
2066 mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
2070 mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
2074 toolbar_set_learn_button
2078 /* vbox that contains body */
2079 vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH);
2080 gtk_widget_show(vbox_body);
2081 gtk_container_set_border_width(GTK_CONTAINER(vbox_body), BORDER_WIDTH);
2082 gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
2084 #ifndef GENERIC_UMPC
2085 hbox_stat = gtk_hbox_new(FALSE, 2);
2086 gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
2088 warning_icon = gtk_image_new_from_stock
2089 (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
2090 warning_btn = gtk_event_box_new();
2091 gtk_event_box_set_visible_window(GTK_EVENT_BOX(warning_btn), FALSE);
2093 mainwin->warning_btn = warning_btn;
2095 g_signal_connect(G_OBJECT(warning_btn), "button-press-event",
2096 G_CALLBACK(warning_icon_pressed),
2097 (gpointer) mainwin);
2098 g_signal_connect(G_OBJECT(warning_btn), "motion-notify-event",
2099 G_CALLBACK(warning_visi_notify), mainwin);
2100 g_signal_connect(G_OBJECT(warning_btn), "leave-notify-event",
2101 G_CALLBACK(warning_leave_notify), mainwin);
2102 g_signal_connect(G_OBJECT(warning_btn), "enter-notify-event",
2103 G_CALLBACK(warning_enter_notify), mainwin);
2105 gtk_container_add (GTK_CONTAINER(warning_btn), warning_icon);
2107 CLAWS_SET_TIP(warning_btn,
2108 _("Some error(s) happened. Click here to view log."));
2109 gtk_box_pack_start(GTK_BOX(hbox_stat), warning_btn, FALSE, FALSE, 0);
2111 statusbar = statusbar_create();
2112 gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
2114 progressbar = gtk_progress_bar_new();
2115 gtk_widget_set_size_request(progressbar, 120, 1);
2116 gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
2118 online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_ONLINE);
2119 offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_OFFLINE);
2120 online_switch = gtk_button_new ();
2121 gtkut_widget_set_can_focus(online_switch, FALSE);
2122 CLAWS_SET_TIP(online_switch,
2123 _("You are online. Click the icon to go offline"));
2124 offline_switch = gtk_button_new ();
2125 CLAWS_SET_TIP(offline_switch,
2126 _("You are offline. Click the icon to go online"));
2127 gtk_container_add (GTK_CONTAINER(online_switch), online_pixmap);
2128 gtk_button_set_relief (GTK_BUTTON(online_switch), GTK_RELIEF_NONE);
2129 g_signal_connect (G_OBJECT(online_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2130 gtk_box_pack_start (GTK_BOX(hbox_stat), online_switch, FALSE, FALSE, 0);
2131 gtk_container_add (GTK_CONTAINER(offline_switch), offline_pixmap);
2132 gtk_button_set_relief (GTK_BUTTON(offline_switch), GTK_RELIEF_NONE);
2133 g_signal_connect (G_OBJECT(offline_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2134 gtk_box_pack_start (GTK_BOX(hbox_stat), offline_switch, FALSE, FALSE, 0);
2136 statuslabel = gtk_label_new("");
2137 gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
2139 ac_button = gtk_button_new();
2140 CLAWS_SET_TIP(ac_button, _("Select account"));
2141 gtkut_widget_set_can_focus(ac_button, FALSE);
2142 gtk_widget_set_size_request(ac_button, -1, 0);
2143 gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
2144 g_signal_connect(G_OBJECT(ac_button), "button_press_event",
2145 G_CALLBACK(ac_label_button_pressed), mainwin);
2147 ac_label = gtk_label_new("");
2148 gtk_container_add(GTK_CONTAINER(ac_button), ac_label);
2150 gtk_widget_show_all(hbox_stat);
2152 gtk_widget_hide(offline_switch);
2153 gtk_widget_hide(progressbar);
2154 gtk_widget_hide(warning_btn);
2156 online_switch = gtk_button_new ();
2157 offline_switch = gtk_button_new ();
2158 g_signal_connect (G_OBJECT(online_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2159 g_signal_connect (G_OBJECT(offline_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
2162 mainwin->folderview = folderview = folderview_create();
2163 mainwin->summaryview = summaryview = summary_create(mainwin);
2164 mainwin->messageview = messageview = messageview_create(mainwin);
2166 /* init log instances data before creating log views */
2167 set_log_title(LOG_PROTOCOL, _("Network log"));
2168 set_log_prefs(LOG_PROTOCOL,
2169 &prefs_common.logwin_width,
2170 &prefs_common.logwin_height);
2171 set_log_title(LOG_DEBUG_FILTERING, _("Filtering/Processing debug log"));
2172 set_log_prefs(LOG_DEBUG_FILTERING,
2173 &prefs_common.filtering_debugwin_width,
2174 &prefs_common.filtering_debugwin_height);
2176 /* setup log windows */
2177 mainwin->logwin = log_window_create(LOG_PROTOCOL);
2178 log_window_init(mainwin->logwin);
2180 mainwin->filtering_debugwin = log_window_create(LOG_DEBUG_FILTERING);
2181 log_window_set_clipping(mainwin->logwin,
2182 prefs_common.cliplog,
2183 prefs_common.loglength);
2185 log_window_init(mainwin->filtering_debugwin);
2186 log_window_set_clipping(mainwin->filtering_debugwin,
2187 prefs_common.filtering_debug_cliplog,
2188 prefs_common.filtering_debug_loglength);
2189 if (prefs_common.enable_filtering_debug)
2190 log_message(LOG_DEBUG_FILTERING, _("filtering log enabled\n"));
2192 log_message(LOG_DEBUG_FILTERING, _("filtering log disabled\n"));
2194 folderview->mainwin = mainwin;
2195 folderview->summaryview = summaryview;
2197 summaryview->mainwin = mainwin;
2198 summaryview->folderview = folderview;
2199 summaryview->messageview = messageview;
2200 summaryview->window = window;
2202 mainwin->vbox = vbox;
2203 mainwin->menubar = menubar;
2204 mainwin->handlebox = handlebox;
2205 mainwin->vbox_body = vbox_body;
2206 mainwin->online_switch = online_switch;
2207 mainwin->offline_switch = offline_switch;
2208 #ifndef GENERIC_UMPC
2209 messageview->statusbar = statusbar;
2210 mainwin->statusbar = statusbar;
2211 mainwin->hbox_stat = hbox_stat;
2212 mainwin->progressbar = progressbar;
2213 mainwin->statuslabel = statuslabel;
2214 mainwin->online_pixmap = online_pixmap;
2215 mainwin->offline_pixmap = offline_pixmap;
2216 mainwin->ac_button = ac_button;
2217 mainwin->ac_label = ac_label;
2218 /* set context IDs for status bar */
2219 mainwin->mainwin_cid = gtk_statusbar_get_context_id
2220 (GTK_STATUSBAR(statusbar), "Main Window");
2221 mainwin->folderview_cid = gtk_statusbar_get_context_id
2222 (GTK_STATUSBAR(statusbar), "Folder View");
2223 mainwin->summaryview_cid = gtk_statusbar_get_context_id
2224 (GTK_STATUSBAR(statusbar), "Summary View");
2225 mainwin->messageview_cid = gtk_statusbar_get_context_id
2226 (GTK_STATUSBAR(statusbar), "Message View");
2227 messageview->statusbar_cid = mainwin->messageview_cid;
2230 messageview->statusbar = NULL;
2231 mainwin->statusbar = NULL;
2232 mainwin->hbox_stat = NULL;
2233 /* mainwin->progressbar is set in toolbar.c */
2234 mainwin->statuslabel = NULL;
2235 mainwin->online_pixmap = NULL;
2236 mainwin->offline_pixmap = NULL;
2237 mainwin->ac_button = NULL;
2238 mainwin->ac_label = NULL;
2241 /* allocate colors for summary view and folder view */
2242 summaryview->color_marked.red = summaryview->color_marked.green = 0;
2243 summaryview->color_marked.blue = (guint16)65535;
2245 summaryview->color_dim.red = summaryview->color_dim.green =
2246 summaryview->color_dim.blue = COLOR_DIM;
2248 gtkut_convert_int_to_gdk_color(prefs_common.color_new,
2249 &folderview->color_new);
2251 gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
2252 &folderview->color_op);
2254 summaryview->color_important.red = 0;
2255 summaryview->color_important.green = 0;
2256 summaryview->color_important.blue = (guint16)65535;
2258 color[0] = summaryview->color_marked;
2259 color[1] = summaryview->color_dim;
2260 color[2] = folderview->color_new;
2261 color[3] = folderview->color_op;
2263 #if !GTK_CHECK_VERSION(3, 0, 0)
2264 colormap = gdk_drawable_get_colormap(gtk_widget_get_window(window));
2265 gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
2266 for (i = 0; i < 4; i++) {
2267 if (success[i] == FALSE)
2268 g_warning("MainWindow: color allocation %d failed\n", i);
2272 debug_print("done.\n");
2274 messageview->visible = prefs_common.msgview_visible;
2276 main_window_set_widgets(mainwin, prefs_common.layout_mode);
2278 g_signal_connect(G_OBJECT(window), "size_allocate",
2279 G_CALLBACK(main_window_size_allocate_cb),
2282 /* set menu items */
2283 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Encoding/"CS_AUTO, TRUE);
2286 switch (prefs_common.toolbar_style) {
2288 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/Hide");
2291 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/IconOnly");
2294 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/TextOnly");
2297 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/TextBelowIcon");
2299 case TOOLBAR_BOTH_HORIZ:
2300 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar/TextBesideIcon");
2302 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
2304 toolbar_set_style(mainwin->toolbar->toolbar,
2306 prefs_common.toolbar_style);
2307 #ifndef GENERIC_UMPC
2308 gtk_widget_hide(mainwin->hbox_stat);
2309 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/StatusBar");
2310 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
2311 prefs_common.show_statusbar);
2313 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/ColumnHeaders");
2314 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
2315 prefs_common.show_col_headers);
2316 /* set account selection menu */
2317 ac_menu = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Configuration/ChangeAccount");
2318 mainwin->ac_menu = ac_menu;
2320 toolbar_main_set_sensitive(mainwin);
2322 /* create actions menu */
2323 main_window_update_actions_menu(mainwin);
2325 main_create_mailing_list_menu (mainwin, NULL);
2327 /* attach accel groups to main window */
2328 #define ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win) \
2329 gtk_window_add_accel_group \
2331 gtk_ui_manager_get_accel_group(gtkut_ui_manager())); \
2332 g_signal_connect(G_OBJECT(gtk_ui_manager_get_accel_group(gtkut_ui_manager())), \
2334 G_CALLBACK(main_window_accel_activate), mainwin);
2336 ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
2338 g_signal_connect(G_OBJECT(window), "window_state_event",
2339 G_CALLBACK(mainwindow_state_event_cb), mainwin);
2340 g_signal_connect(G_OBJECT(window), "visibility_notify_event",
2341 G_CALLBACK(mainwindow_visibility_event_cb), mainwin);
2342 gtk_widget_add_events(GTK_WIDGET(window), GDK_VISIBILITY_NOTIFY_MASK);
2344 if (prefs_common.layout_mode == VERTICAL_LAYOUT ||
2345 prefs_common.layout_mode == SMALL_LAYOUT) {
2346 summary_relayout(mainwin->summaryview);
2348 summary_update_unread(mainwin->summaryview, NULL);
2350 /* initialize views */
2351 folderview_init(folderview);
2352 summary_init(summaryview);
2353 messageview_init(messageview);
2355 sslcertwindow_register_hook();
2357 mainwin->lock_count = 0;
2358 mainwin->menu_lock_count = 0;
2359 mainwin->cursor_count = 0;
2361 mainwin->progressindicator_hook =
2362 hooks_register_hook(PROGRESSINDICATOR_HOOKLIST, mainwindow_progressindicator_hook, mainwin);
2365 watch_cursor = gdk_cursor_new(GDK_WATCH);
2367 hand_cursor = gdk_cursor_new(GDK_HAND2);
2369 /* init work_offline */
2370 if (prefs_common.work_offline)
2371 online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
2373 mainwindow_colorlabel_menu_create(mainwin, FALSE);
2374 mainwindow_tags_menu_create(mainwin, FALSE);
2377 main_window_install_maemo_hooks(mainwin);
2380 if (prefs_common.mainwin_fullscreen) {
2381 cm_toggle_menu_set_active_full(mainwin->ui_manager,
2382 "Menu/View/FullScreen",
2389 void main_window_update_actions_menu(MainWindow *mainwin)
2391 action_update_mainwin_menu(mainwin->ui_manager, "/Menu/Tools/Actions", mainwin);
2394 void main_window_cursor_wait(MainWindow *mainwin)
2397 if (mainwin->cursor_count == 0) {
2398 gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), watch_cursor);
2399 textview_cursor_wait(mainwin->messageview->mimeview->textview);
2402 mainwin->cursor_count++;
2407 void main_window_cursor_normal(MainWindow *mainwin)
2409 if (mainwin->cursor_count)
2410 mainwin->cursor_count--;
2412 if (mainwin->cursor_count == 0) {
2413 gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), NULL);
2414 textview_cursor_normal(mainwin->messageview->mimeview->textview);
2419 /* lock / unlock the user-interface */
2420 void main_window_lock(MainWindow *mainwin)
2422 if (mainwin->lock_count == 0 && mainwin->ac_button)
2423 gtk_widget_set_sensitive(mainwin->ac_button, FALSE);
2425 mainwin->lock_count++;
2427 main_window_set_menu_sensitive(mainwin);
2428 toolbar_main_set_sensitive(mainwin);
2431 void main_window_unlock(MainWindow *mainwin)
2433 if (mainwin->lock_count)
2434 mainwin->lock_count--;
2436 main_window_set_menu_sensitive(mainwin);
2437 toolbar_main_set_sensitive(mainwin);
2439 if (mainwin->lock_count == 0 && mainwin->ac_button)
2440 gtk_widget_set_sensitive(mainwin->ac_button, TRUE);
2443 static void main_window_menu_callback_block(MainWindow *mainwin)
2445 mainwin->menu_lock_count++;
2448 static void main_window_menu_callback_unblock(MainWindow *mainwin)
2450 if (mainwin->menu_lock_count)
2451 mainwin->menu_lock_count--;
2454 static guint prefs_tag = 0;
2456 void main_window_reflect_prefs_all(void)
2458 main_window_reflect_prefs_all_real(FALSE);
2461 static gboolean reflect_prefs_timeout_cb(gpointer data)
2463 gboolean pixmap_theme_changed = GPOINTER_TO_INT(data);
2465 MainWindow *mainwin;
2466 #ifndef GENERIC_UMPC
2469 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2470 mainwin = (MainWindow *)cur->data;
2472 main_window_show_cur_account(mainwin);
2473 main_window_set_menu_sensitive(mainwin);
2474 toolbar_main_set_sensitive(mainwin);
2477 if (pixmap_theme_changed) {
2478 toolbar_update(TOOLBAR_MAIN, mainwin);
2479 messageview_reflect_prefs_pixmap_theme();
2480 compose_reflect_prefs_pixmap_theme();
2481 folderview_reinit_fonts(mainwin->folderview);
2482 summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
2483 foldersel_reflect_prefs_pixmap_theme();
2484 #ifndef USE_NEW_ADDRBOOK
2485 addressbook_reflect_prefs_pixmap_theme();
2487 #ifndef GENERIC_UMPC
2488 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
2489 gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
2490 mainwin->online_pixmap);
2491 gtk_container_add (GTK_CONTAINER(mainwin->online_switch), pixmap);
2492 gtk_widget_show(pixmap);
2493 mainwin->online_pixmap = pixmap;
2494 pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_OFFLINE);
2495 gtk_container_remove(GTK_CONTAINER(mainwin->offline_switch),
2496 mainwin->offline_pixmap);
2497 gtk_container_add (GTK_CONTAINER(mainwin->offline_switch), pixmap);
2498 gtk_widget_show(pixmap);
2499 mainwin->offline_pixmap = pixmap;
2501 hooks_invoke(THEME_CHANGED_HOOKLIST, NULL);
2504 headerview_set_font(mainwin->messageview->headerview);
2505 headerview_set_visibility(mainwin->messageview->headerview,
2506 prefs_common.display_header_pane);
2507 textview_reflect_prefs(mainwin->messageview->mimeview->textview);
2508 folderview_reflect_prefs();
2509 summary_reflect_prefs();
2510 #ifndef GENERIC_UMPC
2511 summary_redisplay_msg(mainwin->summaryview);
2513 if (prefs_common.layout_mode == SMALL_LAYOUT) {
2514 if (mainwin->in_folder) {
2515 mainwindow_enter_folder(mainwin);
2517 mainwindow_exit_folder(mainwin);
2525 void main_window_reflect_prefs_all_now(void)
2527 reflect_prefs_timeout_cb(GINT_TO_POINTER(FALSE));
2530 void main_window_reflect_prefs_custom_colors(MainWindow *mainwin)
2533 GList *children, *cur;
2535 /* re-create colorlabel submenu */
2536 menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
2537 cm_return_if_fail(menu != NULL);
2539 /* clear items. get item pointers. */
2540 children = gtk_container_get_children(GTK_CONTAINER(menu));
2541 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
2542 g_signal_handlers_disconnect_matched
2543 (gtk_ui_manager_get_accel_group(mainwin->ui_manager),
2544 G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC,
2545 0, 0, NULL, mainwin_accel_changed_cb, cur->data);
2546 gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
2548 g_list_free(children);
2549 mainwindow_colorlabel_menu_create(mainwin, TRUE);
2550 summary_reflect_prefs_custom_colors(mainwin->summaryview);
2551 folderview_reinit_fonts(mainwin->folderview);
2554 static gint tags_tag = 0;
2555 static gboolean main_window_reflect_tags_changes_real(gpointer data)
2558 GList *children, *cur;
2559 MainWindow *mainwin = (MainWindow *)data;
2561 if (summary_is_locked(mainwin->summaryview)) {
2565 /* re-create tags submenu */
2566 menu = GTK_MENU_SHELL(mainwin->tags_menu);
2567 cm_return_val_if_fail(menu != NULL, FALSE);
2569 /* clear items. get item pointers. */
2570 children = gtk_container_get_children(GTK_CONTAINER(menu));
2571 for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
2572 gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
2574 g_list_free(children);
2575 mainwindow_tags_menu_create(mainwin, TRUE);
2576 summary_reflect_tags_changes(mainwin->summaryview);
2582 void main_window_reflect_tags_changes(MainWindow *mainwin)
2584 if (tags_tag == 0) {
2585 tags_tag = g_timeout_add(100, main_window_reflect_tags_changes_real,
2590 void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
2592 if (prefs_tag == 0) {
2593 prefs_tag = g_timeout_add(100, reflect_prefs_timeout_cb,
2594 GINT_TO_POINTER(pixmap_theme_changed));
2598 void main_window_set_summary_column(void)
2601 MainWindow *mainwin;
2603 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2604 mainwin = (MainWindow *)cur->data;
2605 summary_set_column_order(mainwin->summaryview);
2609 void main_window_set_folder_column(void)
2612 MainWindow *mainwin;
2614 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2615 mainwin = (MainWindow *)cur->data;
2616 folderview_set_column_order(mainwin->folderview);
2620 static void main_window_set_account_selector_menu(MainWindow *mainwin,
2621 GList *account_list)
2624 GtkWidget *menuitem;
2625 PrefsAccount *ac_prefs;
2629 menu = gtk_menu_new();
2630 gtk_menu_set_accel_group (GTK_MENU (menu),
2631 gtk_ui_manager_get_accel_group(mainwin->ui_manager));
2633 for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
2634 ac_prefs = (PrefsAccount *)cur_ac->data;
2636 menuitem = gtk_menu_item_new_with_label
2637 (ac_prefs->account_name
2638 ? ac_prefs->account_name : _("Untitled"));
2639 gtk_widget_show(menuitem);
2640 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2641 g_signal_connect(G_OBJECT(menuitem), "activate",
2642 G_CALLBACK(account_selector_menu_cb),
2644 accel_path = g_strconcat("<Actions>/Menu/Configuration/ChangeAccount/",(ac_prefs->account_name
2645 ? ac_prefs->account_name : _("Untitled")), NULL );
2646 gtk_menu_item_set_accel_path(GTK_MENU_ITEM(menuitem), accel_path);
2649 gtk_menu_item_set_submenu(GTK_MENU_ITEM(mainwin->ac_menu), menu);
2652 static void main_window_set_account_receive_menu(MainWindow *mainwin,
2653 GList *account_list)
2655 GList *children, *child;
2657 GtkWidget *menuitem;
2658 PrefsAccount *ac_prefs;
2660 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
2661 gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive")));
2663 /* search for separator */
2664 children = gtk_container_get_children(GTK_CONTAINER(menu));
2665 for (child = children; child != NULL; child = child->next) {
2666 if (child->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
2667 child = child->next;
2672 /* destroy all previous menu item */
2673 while (child != NULL) {
2674 gtk_widget_destroy(GTK_WIDGET(child->data));
2675 child = child->next;
2678 g_list_free(children);
2680 for (child = account_list; child != NULL; child = child->next) {
2681 ac_prefs = (PrefsAccount *)child->data;
2683 if (ac_prefs->protocol == A_NONE)
2686 menuitem = gtk_menu_item_new_with_label
2687 (ac_prefs->account_name ? ac_prefs->account_name
2689 gtk_widget_show(menuitem);
2690 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2691 g_signal_connect(G_OBJECT(menuitem), "activate",
2692 G_CALLBACK(account_receive_menu_cb),
2697 static void main_window_set_toolbar_combo_receive_menu(MainWindow *mainwin,
2698 GList *account_list)
2701 GtkWidget *menuitem;
2702 PrefsAccount *ac_prefs;
2703 GtkWidget *menu = NULL;
2705 if (mainwin->toolbar->getall_btn == NULL) /* button doesn't exist */
2708 menu = gtk_menu_tool_button_get_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->getall_btn));
2710 gtk_widget_destroy(menu);
2711 menu = gtk_menu_new();
2713 for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
2714 ac_prefs = (PrefsAccount *)cur_ac->data;
2716 if (ac_prefs->protocol == A_NONE)
2719 menuitem = gtk_menu_item_new_with_label
2720 (ac_prefs->account_name
2721 ? ac_prefs->account_name : _("Untitled"));
2722 gtk_widget_show(menuitem);
2723 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2724 g_signal_connect(G_OBJECT(menuitem), "activate",
2725 G_CALLBACK(account_receive_menu_cb),
2728 gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->getall_btn), menu);
2731 static void main_window_set_toolbar_combo_compose_menu(MainWindow *mainwin,
2732 GList *account_list)
2734 #ifndef GENERIC_UMPC
2736 GtkWidget *menuitem;
2737 PrefsAccount *ac_prefs;
2738 GtkWidget *menu = NULL;
2740 if (mainwin->toolbar->compose_mail_btn == NULL) /* button doesn't exist */
2743 menu = gtk_menu_tool_button_get_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->compose_mail_btn));
2745 gtk_widget_destroy(menu);
2746 menu = gtk_menu_new();
2748 for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
2749 ac_prefs = (PrefsAccount *)cur_ac->data;
2751 menuitem = gtk_menu_item_new_with_label
2752 (ac_prefs->account_name
2753 ? ac_prefs->account_name : _("Untitled"));
2754 gtk_widget_show(menuitem);
2755 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2756 g_signal_connect(G_OBJECT(menuitem), "activate",
2757 G_CALLBACK(account_compose_menu_cb),
2760 gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(mainwin->toolbar->compose_mail_btn), menu);
2764 void main_window_set_account_menu(GList *account_list)
2767 MainWindow *mainwin;
2769 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2770 mainwin = (MainWindow *)cur->data;
2771 main_window_set_account_selector_menu(mainwin, account_list);
2772 main_window_set_account_receive_menu(mainwin, account_list);
2773 main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
2774 main_window_set_toolbar_combo_compose_menu(mainwin, account_list);
2776 hooks_invoke(ACCOUNT_LIST_CHANGED_HOOKLIST, NULL);
2779 void main_window_set_account_menu_only_toolbar(GList *account_list)
2782 MainWindow *mainwin;
2784 for (cur = mainwin_list; cur != NULL; cur = cur->next) {
2785 mainwin = (MainWindow *)cur->data;
2786 main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
2787 main_window_set_toolbar_combo_compose_menu(mainwin, account_list);
2791 static void main_window_show_cur_account(MainWindow *mainwin)
2796 ac_name = g_strdup(cur_account
2797 ? (cur_account->account_name
2798 ? cur_account->account_name : _("Untitled"))
2802 buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
2804 buf = g_strdup(PROG_VERSION);
2805 gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
2808 if (mainwin->ac_label)
2809 gtk_label_set_text(GTK_LABEL(mainwin->ac_label), ac_name);
2810 if (mainwin->ac_button)
2811 gtk_widget_queue_resize(mainwin->ac_button);
2815 #ifndef GENERIC_UMPC
2816 static void main_window_separation_change(MainWindow *mainwin, LayoutType layout_mode)
2818 GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview);
2819 GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview);
2820 GtkWidget *message_wid = mainwin->messageview->vbox;
2822 if (layout_mode == prefs_common.layout_mode)
2825 debug_print("Changing window separation type from %d to %d\n",
2826 prefs_common.layout_mode, layout_mode);
2828 /* remove widgets from those containers */
2829 g_object_ref(folder_wid);
2830 g_object_ref(summary_wid);
2831 g_object_ref(message_wid);
2832 gtkut_container_remove
2833 (GTK_CONTAINER(gtk_widget_get_parent(folder_wid)), folder_wid);
2834 gtkut_container_remove
2835 (GTK_CONTAINER(gtk_widget_get_parent(summary_wid)), summary_wid);
2836 gtkut_container_remove
2837 (GTK_CONTAINER(gtk_widget_get_parent(message_wid)), message_wid);
2839 gtk_widget_hide(mainwin->window);
2840 main_window_set_widgets(mainwin, layout_mode);
2841 gtk_widget_show(mainwin->window);
2843 g_object_unref(folder_wid);
2844 g_object_unref(summary_wid);
2845 g_object_unref(message_wid);
2848 void mainwindow_reset_paned(GtkPaned *paned)
2852 if (gtk_paned_get_child1(GTK_PANED(paned)))
2853 gtk_widget_show(gtk_paned_get_child1(GTK_PANED(paned)));
2854 if (gtk_paned_get_child2(GTK_PANED(paned)))
2855 gtk_widget_show(gtk_paned_get_child2(GTK_PANED(paned)));
2858 g_object_get (G_OBJECT(paned),
2861 g_object_get (G_OBJECT(paned),
2865 gtk_paned_set_position(GTK_PANED(paned), mid);
2868 static void mainwin_paned_show_first(GtkPaned *paned)
2871 g_object_get (G_OBJECT(paned),
2875 if (gtk_paned_get_child1(GTK_PANED(paned)))
2876 gtk_widget_show(gtk_paned_get_child1(GTK_PANED(paned)));
2877 if (gtk_paned_get_child2(GTK_PANED(paned)))
2878 gtk_widget_hide(gtk_paned_get_child2(GTK_PANED(paned)));
2879 gtk_paned_set_position(GTK_PANED(paned), max);
2882 static void mainwin_paned_show_last(GtkPaned *paned)
2885 g_object_get (G_OBJECT(paned),
2889 if (gtk_paned_get_child1(GTK_PANED(paned)))
2890 gtk_widget_hide(gtk_paned_get_child1(GTK_PANED(paned)));
2891 if (gtk_paned_get_child2(GTK_PANED(paned)))
2892 gtk_widget_show(gtk_paned_get_child2(GTK_PANED(paned)));
2893 gtk_paned_set_position(GTK_PANED(paned), min);
2896 void main_window_toggle_message_view(MainWindow *mainwin)
2898 SummaryView *summaryview = mainwin->summaryview;
2899 GtkWidget *ppaned = NULL;
2900 GtkWidget *container = NULL;
2902 switch (prefs_common.layout_mode) {
2904 case VERTICAL_LAYOUT:
2906 ppaned = mainwin->vpaned;
2907 container = mainwin->hpaned;
2908 if (gtk_widget_get_parent(ppaned) != NULL) {
2909 mainwin->messageview->visible = FALSE;
2910 summaryview->displayed = NULL;
2911 g_object_ref(ppaned);
2912 gtkut_container_remove(GTK_CONTAINER(container), ppaned);
2913 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container);
2915 mainwin->messageview->visible = TRUE;
2916 gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), ppaned);
2917 gtk_container_add(GTK_CONTAINER(container), ppaned);
2918 g_object_unref(ppaned);
2922 container = mainwin->vpaned;
2923 if (gtk_widget_get_parent(mainwin->messageview->vbox) != NULL) {
2924 mainwin->messageview->visible = FALSE;
2925 summaryview->displayed = NULL;
2926 g_object_ref(mainwin->messageview->vbox);
2927 gtkut_container_remove(GTK_CONTAINER(container), mainwin->messageview->vbox);
2929 mainwin->messageview->visible = TRUE;
2930 gtk_container_add(GTK_CONTAINER(container), mainwin->messageview->vbox);
2931 g_object_unref(mainwin->messageview->vbox);
2934 case WIDE_MSGLIST_LAYOUT:
2935 g_warning("can't hide messageview in this wide msglist layout");
2939 if (messageview_is_visible(mainwin->messageview))
2940 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
2941 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
2943 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
2944 GTK_ARROW_UP, GTK_SHADOW_OUT);
2946 if (mainwin->messageview->visible == FALSE)
2947 messageview_clear(mainwin->messageview);
2949 main_window_set_menu_sensitive(mainwin);
2951 prefs_common.msgview_visible = mainwin->messageview->visible;
2953 if (messageview_is_visible(mainwin->messageview)) {
2954 gtk_widget_queue_resize(mainwin->hpaned);
2955 gtk_widget_queue_resize(mainwin->vpaned);
2957 summary_grab_focus(summaryview);
2958 if (!summary_is_list(summaryview)) {
2959 summary_show(summaryview, summaryview->folder_item);
2963 void main_window_get_size(MainWindow *mainwin)
2965 GtkAllocation allocation;
2967 if (mainwin_list == NULL || mainwin->messageview == NULL) {
2968 debug_print("called after messageview "
2969 "has been deallocated!\n");
2973 if (prefs_common.mainwin_fullscreen) {
2974 debug_print("mainwin in full screen state. "
2975 "Keeping original settings\n");
2978 gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->summaryview), &allocation);
2979 if (allocation.width > 1 && allocation.height > 1 && !prefs_common.mainwin_fullscreen) {
2980 prefs_common.summaryview_width = allocation.width;
2982 if (messageview_is_visible(mainwin->messageview))
2983 prefs_common.summaryview_height = allocation.height;
2985 prefs_common.mainview_width = allocation.width;
2988 gtk_widget_get_allocation(mainwin->window, &allocation);
2989 if (allocation.width > 1 && allocation.height > 1 &&
2990 !prefs_common.mainwin_maximised && !prefs_common.mainwin_fullscreen) {
2991 prefs_common.mainview_height = allocation.height;
2992 prefs_common.mainwin_width = allocation.width;
2993 prefs_common.mainwin_height = allocation.height;
2996 gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->folderview), &allocation);
2997 if (allocation.width > 1 && allocation.height > 1 &&
2998 !prefs_common.mainwin_fullscreen) {
2999 prefs_common.folderview_width = allocation.width;
3000 prefs_common.folderview_height = allocation.height;
3003 gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->messageview), &allocation);
3004 if (allocation.width > 1 && allocation.height > 1 &&
3005 !prefs_common.mainwin_fullscreen) {
3006 prefs_common.msgview_width = allocation.width;
3007 prefs_common.msgview_height = allocation.height;
3010 /* debug_print("summaryview size: %d x %d\n",
3011 prefs_common.summaryview_width,
3012 prefs_common.summaryview_height);
3013 debug_print("folderview size: %d x %d\n",
3014 prefs_common.folderview_width,
3015 prefs_common.folderview_height);
3016 debug_print("messageview size: %d x %d\n",
3017 prefs_common.msgview_width,
3018 prefs_common.msgview_height); */
3021 void main_window_get_position(MainWindow *mainwin)
3025 if (prefs_common.mainwin_maximised || prefs_common.mainwin_fullscreen)
3028 gtkut_widget_get_uposition(mainwin->window, &x, &y);
3030 prefs_common.mainview_x = x;
3031 prefs_common.mainview_y = y;
3032 prefs_common.mainwin_x = x;
3033 prefs_common.mainwin_y = y;
3035 debug_print("main window position: %d, %d\n", x, y);
3038 void main_window_progress_on(MainWindow *mainwin)
3040 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mainwin->progressbar), "");
3043 void main_window_progress_off(MainWindow *mainwin)
3045 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(mainwin->progressbar), 0.0);
3046 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mainwin->progressbar), "");
3049 gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean for_quit)
3051 if (confirm && procmsg_have_trashed_mails_fast()) {
3055 val = alertpanel(_("Empty trash"),
3056 _("Delete all messages in trash folders?"),
3057 GTK_STOCK_NO, "+" GTK_STOCK_YES, _("Don't quit"));
3059 val = alertpanel(_("Empty trash"),
3060 _("Delete all messages in trash folders?"),
3061 GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL);
3062 if (val == G_ALERTALTERNATE) {
3063 debug_print("will empty trash\n");
3064 } else if (val == G_ALERTDEFAULT) {
3065 debug_print("will not empty trash\n");
3068 return FALSE; /* cancel exit */
3070 manage_window_focus_in(mainwin->window, NULL, NULL);
3073 procmsg_empty_all_trash();
3075 if (mainwin->summaryview->folder_item &&
3076 mainwin->summaryview->folder_item->stype == F_TRASH)
3077 gtk_widget_grab_focus(mainwin->folderview->ctree);
3081 static void main_window_add_mailbox(MainWindow *mainwin)
3086 path = input_dialog(_("Add mailbox"),
3087 _("Input the location of mailbox.\n"
3088 "If an existing mailbox is specified, it will be\n"
3089 "scanned automatically."),
3092 if (folder_find_from_path(path)) {
3093 alertpanel_error(_("The mailbox '%s' already exists."), path);
3097 folder = folder_new(folder_get_class_from_string("mh"),
3098 !strcmp(path, "Mail") ? _("Mailbox") :
3099 g_path_get_basename(path), path);
3102 if (folder->klass->create_tree(folder) < 0) {
3103 alertpanel_error(_("Creation of the mailbox failed.\n"
3104 "Maybe some files already exist, or you don't have the permission to write there."));
3105 folder_destroy(folder);
3110 folder_set_ui_func(folder, scan_tree_func, mainwin);
3111 folder_scan_tree(folder, TRUE);
3112 folder_set_ui_func(folder, NULL, NULL);
3115 SensitiveCond main_window_get_current_state(MainWindow *mainwin)
3117 SensitiveCond state = 0;
3118 SummarySelection selection;
3119 FolderItem *item = mainwin->summaryview->folder_item;
3120 GList *account_list = account_get_list();
3123 selection = summary_get_selection_type(mainwin->summaryview);
3125 if (mainwin->lock_count == 0 && !claws_is_starting())
3126 state |= M_UNLOCKED;
3127 if (selection != SUMMARY_NONE)
3128 state |= M_MSG_EXIST;
3129 if (item && item->path && folder_item_parent(item) && !item->no_select) {
3131 /* if (item->folder->type != F_NEWS) */
3132 state |= M_ALLOW_DELETE;
3134 if (prefs_common.immediate_exec == 0
3135 && mainwin->lock_count == 0)
3136 state |= M_DELAY_EXEC;
3138 if ((selection == SUMMARY_NONE && item->hide_read_msgs)
3139 || selection != SUMMARY_NONE)
3140 state |= M_HIDE_READ_MSG;
3142 if ((selection == SUMMARY_NONE && item->hide_read_threads)
3143 || selection != SUMMARY_NONE)
3144 state |= M_HIDE_READ_THREADS;
3146 if (mainwin->summaryview->threaded)
3147 state |= M_THREADED;
3149 state |= M_UNTHREADED;
3150 if (selection == SUMMARY_SELECTED_SINGLE ||
3151 selection == SUMMARY_SELECTED_MULTIPLE)
3152 state |= M_TARGET_EXIST;
3153 if (selection == SUMMARY_SELECTED_SINGLE)
3154 state |= M_SINGLE_TARGET_EXIST;
3155 if (mainwin->summaryview->folder_item &&
3156 mainwin->summaryview->folder_item->folder->klass->type == F_NEWS)
3159 state |= M_NOT_NEWS;
3160 if (mainwin->summaryview->folder_item &&
3161 (mainwin->summaryview->folder_item->stype != F_TRASH ||
3162 !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
3163 state |= M_NOT_TRASH;
3165 if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
3166 state |= M_ACTIONS_EXIST;
3168 tmp = tags_get_list();
3169 if (tmp && g_slist_length(tmp))
3170 state |= M_TAGS_EXIST;
3173 if (procmsg_have_queued_mails_fast() && !procmsg_is_sending())
3174 state |= M_HAVE_QUEUED_MAILS;
3176 if (selection == SUMMARY_SELECTED_SINGLE &&
3178 (folder_has_parent_of_type(item, F_DRAFT) ||
3179 folder_has_parent_of_type(item, F_OUTBOX) ||
3180 folder_has_parent_of_type(item, F_QUEUE))))
3181 state |= M_ALLOW_REEDIT;
3183 state |= M_HAVE_ACCOUNT;
3185 if (cur_account && cur_account->protocol != A_NONE)
3186 state |= M_HAVE_RETRIEVABLE_ACCOUNT;
3188 if (any_folder_want_synchronise())
3189 state |= M_WANT_SYNC;
3191 if (item && item->prefs->processing && selection != SUMMARY_NONE)
3192 state |= M_HAVE_PROCESSING;
3194 if (g_list_length(account_list) > 1)
3195 state |= M_HAVE_MULTI_ACCOUNT;
3197 for ( ; account_list != NULL; account_list = account_list->next) {
3198 if (((PrefsAccount*)account_list->data)->protocol != A_NONE) {
3199 state |= M_HAVE_ANY_RETRIEVABLE_ACCOUNT;
3204 for ( ; account_list != NULL; account_list = account_list->next) {
3205 if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
3206 state |= M_HAVE_NEWS_ACCOUNT;
3211 if (procmsg_spam_can_learn() &&
3212 (mainwin->summaryview->folder_item &&
3213 mainwin->summaryview->folder_item->folder->klass->type != F_UNKNOWN &&
3214 mainwin->summaryview->folder_item->folder->klass->type != F_NEWS)) {
3215 state |= M_CAN_LEARN_SPAM;
3218 if (mainwin->summaryview->folder_item) {
3219 state |= M_FOLDER_SELECTED;
3222 if (inc_is_active())
3223 state |= M_INC_ACTIVE;
3224 if (imap_cancel_all_enabled())
3225 state |= M_INC_ACTIVE;
3227 if (mainwin->summaryview->deleted > 0)
3228 state |= M_DELETED_EXISTS;
3230 if (mainwin->summaryview->deleted > 0 ||
3231 mainwin->summaryview->moved > 0 ||
3232 mainwin->summaryview->copied > 0)
3233 state |= M_DELAY_EXEC;
3235 if (summary_is_list(mainwin->summaryview))
3236 state |= M_SUMMARY_ISLIST;
3238 if (prefs_common.layout_mode != SMALL_LAYOUT || mainwin->in_folder)
3239 state |= M_IN_MSGLIST;
3241 for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
3242 PrefsAccount *account = account_list->data;
3243 if (account->session_passwd || account->session_smtp_passwd) {
3244 state |= M_SESSION_PASSWORDS;
3254 void main_window_set_menu_sensitive(MainWindow *mainwin)
3256 SensitiveCond state;
3258 SummaryView *summaryview;
3261 GList *children, *cur_item;
3263 gboolean mimepart_selected = FALSE;
3265 static const struct {
3269 {"Menu/File/SaveAs", M_TARGET_EXIST},
3270 {"Menu/File/SavePartAs", M_SINGLE_TARGET_EXIST},
3271 {"Menu/File/Print" , M_TARGET_EXIST},
3272 {"Menu/File/SynchroniseFolders", M_WANT_SYNC},
3273 {"Menu/File/Exit" , M_UNLOCKED},
3275 {"Menu/Edit/SelectThread" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
3276 {"Menu/Edit/DeleteThread" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
3277 {"Menu/Edit/Find", M_SINGLE_TARGET_EXIST},
3278 {"Menu/Edit/QuickSearch", M_IN_MSGLIST},
3280 {"Menu/View/SetColumns/Folderlist" , M_UNLOCKED|M_SUMMARY_ISLIST},
3281 {"Menu/View/Sort" , M_EXEC|M_SUMMARY_ISLIST},
3282 {"Menu/View/ThreadView" , M_EXEC|M_SUMMARY_ISLIST},
3283 {"Menu/View/ExpandThreads" , M_MSG_EXIST|M_SUMMARY_ISLIST},
3284 {"Menu/View/CollapseThreads" , M_MSG_EXIST|M_SUMMARY_ISLIST},
3285 {"Menu/View/HideReadThreads" , M_HIDE_READ_THREADS|M_SUMMARY_ISLIST},
3286 {"Menu/View/HideReadMessages" , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
3287 {"Menu/View/HideDelMessages" , M_SUMMARY_ISLIST},
3288 {"Menu/View/Goto/Prev" , M_MSG_EXIST},
3289 {"Menu/View/Goto/Next" , M_MSG_EXIST},
3290 {"Menu/View/Goto/PrevUnread" , M_MSG_EXIST},
3291 {"Menu/View/Goto/PrevNew" , M_MSG_EXIST},
3292 {"Menu/View/Goto/PrevMarked" , M_MSG_EXIST},
3293 {"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
3294 {"Menu/View/Goto/NextLabeled", M_MSG_EXIST},
3295 {"Menu/View/Goto/ParentMessage" , M_SINGLE_TARGET_EXIST},
3296 {"Menu/View/Goto/NextPart" , M_SINGLE_TARGET_EXIST},
3297 {"Menu/View/Goto/PrevPart" , M_SINGLE_TARGET_EXIST},
3298 {"Menu/View/OpenNewWindow" , M_SINGLE_TARGET_EXIST},
3299 {"Menu/View/MessageSource" , M_SINGLE_TARGET_EXIST},
3300 {"Menu/View/Part" , M_SINGLE_TARGET_EXIST},
3301 {"Menu/View/AllHeaders" , M_SINGLE_TARGET_EXIST},
3302 {"Menu/View/Quotes" , M_SINGLE_TARGET_EXIST},
3304 {"Menu/Message/Receive/CurrentAccount"
3305 , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT},
3306 {"Menu/Message/Receive/AllAccounts"
3307 , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT},
3308 {"Menu/Message/Receive/CancelReceiving"
3310 {"Menu/Message/SendQueue" , M_HAVE_ACCOUNT|M_HAVE_QUEUED_MAILS},
3311 {"Menu/Message/ComposeEmail", M_HAVE_ACCOUNT},
3312 {"Menu/Message/ComposeNews", M_HAVE_NEWS_ACCOUNT},
3313 {"Menu/Message/Reply" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3314 {"Menu/Message/ReplyTo" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3315 {"Menu/Message/FollowupReply", M_HAVE_ACCOUNT|M_TARGET_EXIST|M_NEWS|M_SUMMARY_ISLIST},
3316 {"Menu/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3317 {"Menu/Message/ForwardAtt" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3318 {"Menu/Message/Redirect" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
3319 {"Menu/Message/Move" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
3320 {"Menu/Message/Copy" , M_TARGET_EXIST|M_EXEC},
3321 {"Menu/Message/Trash" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
3322 {"Menu/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE},
3323 {"Menu/Message/CancelNews" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NEWS},
3324 {"Menu/Message/Mark" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
3325 {"Menu/Message/Mark/MarkSpam" , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
3326 {"Menu/Message/Mark/MarkHam" , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
3327 {"Menu/Message/Mark/IgnoreThread" , M_TARGET_EXIST},
3328 {"Menu/Message/Mark/UnignoreThread" , M_TARGET_EXIST},
3329 {"Menu/Message/Mark/Lock" , M_TARGET_EXIST},
3330 {"Menu/Message/Mark/Unlock" , M_TARGET_EXIST},
3331 {"Menu/Message/ColorLabel" , M_TARGET_EXIST},
3332 {"Menu/Message/Tags" , M_TARGET_EXIST},
3333 {"Menu/Message/Reedit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
3334 {"Menu/Message/CheckSignature" , M_SINGLE_TARGET_EXIST},
3336 {"Menu/Tools/AddSenderToAB" , M_SINGLE_TARGET_EXIST},
3337 {"Menu/Tools/CollectAddresses" , M_FOLDER_SELECTED},
3338 {"Menu/Tools/CollectAddresses/FromFolder"
3339 , M_FOLDER_SELECTED},
3340 {"Menu/Tools/CollectAddresses/FromSelected"
3342 {"Menu/Tools/FilterFolder", M_MSG_EXIST|M_EXEC},
3343 {"Menu/Tools/FilterSelected" , M_TARGET_EXIST|M_EXEC},
3344 {"Menu/Tools/RunProcessing" , M_HAVE_PROCESSING},
3345 {"Menu/Tools/CreateFilterRule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
3346 {"Menu/Tools/CreateProcessingRule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
3347 {"Menu/Tools/ListUrls" , M_TARGET_EXIST},
3348 {"Menu/Tools/Actions" , M_TARGET_EXIST|M_ACTIONS_EXIST},
3349 {"Menu/Tools/Execute" , M_DELAY_EXEC},
3350 {"Menu/Tools/Expunge" , M_DELETED_EXISTS},
3351 {"Menu/Tools/ForgetSessionPasswords" , M_SESSION_PASSWORDS},
3352 {"Menu/Tools/DeleteDuplicates/SelFolder" , M_MSG_EXIST|M_ALLOW_DELETE},
3354 {"Menu/Configuration", M_UNLOCKED},
3355 {"Menu/Configuration/ChangeAccount", M_HAVE_MULTI_ACCOUNT},
3356 {"Menu/Configuration/AccountPrefs", M_UNLOCKED},
3357 {"Menu/Configuration/CreateAccount", M_UNLOCKED},
3358 {"Menu/Configuration/EditAccounts", M_UNLOCKED},
3363 state = main_window_get_current_state(mainwin);
3365 for (i = 0; entry[i].entry != NULL; i++) {
3366 sensitive = ((entry[i].cond & state) == entry[i].cond);
3367 cm_menu_set_sensitive_full(mainwin->ui_manager, entry[i].entry, sensitive);
3370 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
3371 gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive")));
3373 children = gtk_container_get_children(GTK_CONTAINER(menu));
3374 for (cur_item = children; cur_item != NULL; cur_item = cur_item->next) {
3375 if (cur_item->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
3376 cur_item = cur_item->next;
3381 for (; cur_item != NULL; cur_item = cur_item->next) {
3382 gtk_widget_set_sensitive(GTK_WIDGET(cur_item->data),
3383 (M_UNLOCKED & state) != 0);
3386 g_list_free(children);
3388 main_window_menu_callback_block(mainwin);
3390 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
3391 messageview_is_visible(mainwin->messageview));
3393 summaryview = mainwin->summaryview;
3395 switch (summaryview->sort_key) {
3396 case SORT_BY_NUMBER:
3397 menu_path = "Menu/View/Sort/Number"; break;
3399 menu_path = "Menu/View/Sort/Size"; break;
3401 menu_path = "Menu/View/Sort/Date"; break;
3402 case SORT_BY_THREAD_DATE:
3403 menu_path = "Menu/View/Sort/ThreadDate"; break;
3405 menu_path = "Menu/View/Sort/From"; break;
3407 menu_path = "Menu/View/Sort/To"; break;
3408 case SORT_BY_SUBJECT:
3409 menu_path = "Menu/View/Sort/Subject"; break;
3411 menu_path = "Menu/View/Sort/Color"; break;
3413 menu_path = "Menu/View/Sort/Mark"; break;
3414 case SORT_BY_STATUS:
3415 menu_path = "Menu/View/Sort/Status"; break;
3417 menu_path = "Menu/View/Sort/Attachment"; break;
3419 menu_path = "Menu/View/Sort/Score"; break;
3420 case SORT_BY_LOCKED:
3421 menu_path = "Menu/View/Sort/Locked"; break;
3423 menu_path = "Menu/View/Sort/Tag"; break;
3426 menu_path = "Menu/View/Sort/DontSort"; break;
3428 cm_toggle_menu_set_active_full(mainwin->ui_manager, menu_path, TRUE);
3430 if (summaryview->sort_type == SORT_ASCENDING) {
3431 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Sort/Ascending", TRUE);
3433 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Sort/Descending", TRUE);
3436 if (summaryview->sort_key != SORT_BY_NONE) {
3437 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Ascending", TRUE);
3438 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", TRUE);
3440 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Ascending", FALSE);
3441 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", FALSE);
3444 if (mainwin->messageview
3445 && mainwin->messageview->mimeview
3446 && mainwin->messageview->mimeview->textview)
3447 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
3448 prefs_common.show_all_headers);
3449 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & M_THREADED) != 0);
3450 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & M_THREADED) != 0);
3451 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & M_THREADED) != 0);
3452 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & M_THREADED) != 0);
3453 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
3454 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
3455 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
3457 if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs)
3458 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
3459 if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
3460 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
3462 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevHistory",
3463 messageview_nav_has_prev(mainwin->messageview));
3464 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextHistory",
3465 messageview_nav_has_next(mainwin->messageview));
3467 if (mainwin->messageview
3468 && mainwin->messageview->mimeview)
3469 mimepart_selected = !mimeview_tree_is_empty(mainwin->messageview->mimeview);
3471 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/File/SavePartAs", mimepart_selected);
3472 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextPart", mimepart_selected);
3473 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevPart", mimepart_selected);
3474 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part", mimepart_selected);
3475 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature",
3476 mimepart_selected && mainwin->messageview->mimeview->signed_part);
3478 main_window_menu_callback_unblock(mainwin);
3481 void main_create_mailing_list_menu (MainWindow *mainwin, MsgInfo *msginfo)
3486 is_menu = mailing_list_create_submenu (mainwin, msginfo);
3488 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList", TRUE);
3490 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList", FALSE);
3493 static gint mailing_list_create_submenu (MainWindow *mainwin, MsgInfo *msginfo)
3496 GtkWidget *menuitem;
3498 if (!msginfo || !msginfo->extradata) {
3499 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Post", FALSE);
3500 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Help", FALSE);
3501 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Subscribe", FALSE);
3502 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/Unsubscribe", FALSE);
3503 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/ViewArchive", FALSE);
3504 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/MailingList/ContactOwner", FALSE);
3508 /* Mailing list post */
3509 if (!strcmp2 (msginfo->extradata->list_post, "NO")) {
3510 g_free(msginfo->extradata->list_post);
3511 msginfo->extradata->list_post = g_strdup (_("No posting allowed"));
3513 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Post");
3515 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_post);
3517 /* Mailing list help */
3518 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Help");
3520 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_help);
3522 /* Mailing list subscribe */
3523 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Subscribe");
3525 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_subscribe);
3527 /* Mailing list unsubscribe */
3528 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/Unsubscribe");
3530 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_unsubscribe);
3532 /* Mailing list view archive */
3533 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/ViewArchive");
3535 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_archive);
3537 /* Mailing list contact owner */
3538 menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/MailingList/ContactOwner");
3540 menu_nb += mailing_list_populate_submenu (menuitem, msginfo->extradata->list_owner);
3545 static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * list_header)
3547 GtkWidget *item, *menu;
3548 const gchar *url_pt ;
3549 gchar url_decoded[BUFFSIZE];
3550 GList *children, *amenu;
3553 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
3555 /* First delete old submenu */
3556 /* FIXME: we can optimize this, and only change/add/delete necessary items */
3557 children = gtk_container_get_children(GTK_CONTAINER(menu));
3558 for (amenu = children; amenu; amenu = amenu->next) {
3559 item = GTK_WIDGET (amenu->data);
3560 gtk_widget_destroy (item);
3562 g_list_free(children);
3564 for (url_pt = list_header; url_pt && *url_pt;) {
3565 get_url_part (&url_pt, url_decoded);
3567 if (!g_ascii_strncasecmp(url_decoded, "mailto:", 7)) {
3568 item = cm_menu_item_new_label_from_url ((url_decoded));
3569 g_signal_connect(G_OBJECT(item), "activate",
3570 G_CALLBACK(mailing_list_compose),
3573 else if (!g_ascii_strncasecmp(url_decoded, "http:", 5) ||
3574 !g_ascii_strncasecmp(url_decoded, "https:",6)) {
3576 item = cm_menu_item_new_label_from_url ((url_decoded));
3577 g_signal_connect(G_OBJECT(item), "activate",
3578 G_CALLBACK(mailing_list_open_uri),
3582 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
3583 gtk_widget_show (item);
3589 gtk_widget_set_sensitive (menuitem, TRUE);
3591 gtk_widget_set_sensitive (menuitem, FALSE);
3597 static void get_url_part (const gchar **buffer, gchar *url_decoded)
3599 gchar tmp[BUFFSIZE];
3603 gboolean with_plus = TRUE;
3606 *url_decoded = '\0';
3610 /* Ignore spaces, comments and tabs () */
3611 for (;*buf == ' ' || *buf == '(' || *buf == '\t'; buf++)
3613 for (;*buf != ')' && *buf != 0x00; buf++);
3615 /* First non space and non comment must be a < */
3618 if (!strncmp(buf, "mailto:", strlen("mailto:")))
3621 *buf != '>' && *buf != 0x00 && i < BUFFSIZE;
3622 tmp[i++] = *(buf++));
3627 *url_decoded = '\0';
3631 *url_decoded = '\0';
3634 if (i == BUFFSIZE) {
3638 decode_uri_with_plus (url_decoded, (const gchar *)tmp, with_plus);
3640 /* Prepare the work for the next url in the list */
3641 /* after the closing bracket >, ignore space, comments and tabs */
3642 for (;buf && *buf && (*buf == ' ' || *buf == '(' || *buf == '\t'); buf++)
3644 for (;*buf != ')' && *buf != 0x00; buf++);
3646 if (!buf || !*buf) {
3651 /* now first non space, non comment must be a comma */
3653 for (;*buf != 0x00; buf++);
3659 static void mailing_list_compose (GtkWidget *w, gpointer *data)
3661 const gchar *mailto;
3662 PrefsAccount *account = NULL;
3663 FolderItem *folder_item = NULL;
3665 mailto = gtk_label_get_text(GTK_LABEL (gtk_bin_get_child(GTK_BIN((w)))));
3666 if (mainwindow_get_mainwindow()) {
3667 folder_item = mainwindow_get_mainwindow()->summaryview->folder_item;
3668 if (folder_item && folder_item->prefs && folder_item->prefs->enable_default_account)
3669 account = account_find_from_id(folder_item->prefs->default_account);
3670 if (folder_item && !account)
3671 account = account_find_from_item(folder_item);
3674 compose_new_with_folderitem(account, folder_item, mailto+7);
3677 static void mailing_list_open_uri (GtkWidget *w, gpointer *data)
3680 const gchar *mailto;
3682 mailto = gtk_label_get_text(GTK_LABEL (gtk_bin_get_child(GTK_BIN((w)))));
3684 open_uri (mailto, prefs_common_get_uri_cmd());
3687 static void fix_folderview_scroll(MainWindow *mainwin)
3689 static gboolean fix_done = FALSE;
3694 gtk_widget_queue_resize(mainwin->folderview->ctree);
3699 void main_window_popup(MainWindow *mainwin)
3701 static gboolean first_start = TRUE;
3703 if (!gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
3704 main_window_show(mainwin);
3706 if (prefs_common.mainwin_maximised)
3707 gtk_window_maximize(GTK_WINDOW(mainwin->window));
3710 first_start = FALSE;
3712 gtkut_window_popup(mainwin->window);
3715 if (prefs_common.layout_mode == SMALL_LAYOUT) {
3716 if (mainwin->in_folder) {
3717 mainwindow_enter_folder(mainwin);
3719 mainwindow_exit_folder(mainwin);
3722 fix_folderview_scroll(mainwin);
3725 void main_window_show(MainWindow *mainwin)
3727 gtk_widget_show(mainwin->window);
3728 gtk_widget_show(mainwin->vbox_body);
3729 #ifndef GENERIC_UMPC
3730 gtk_window_move(GTK_WINDOW(mainwin->window),
3731 prefs_common.mainwin_x,
3732 prefs_common.mainwin_y);
3734 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
3735 prefs_common.folderview_width,
3736 prefs_common.folderview_height);
3737 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
3738 prefs_common.summaryview_width,
3739 prefs_common.summaryview_height);
3740 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
3741 prefs_common.msgview_width,
3742 prefs_common.msgview_height);
3746 void main_window_hide(MainWindow *mainwin)
3748 main_window_get_size(mainwin);
3749 main_window_get_position(mainwin);
3751 gtk_widget_hide(mainwin->window);
3752 gtk_widget_hide(mainwin->vbox_body);
3755 static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
3757 GtkWidget *folderwin = NULL;
3758 GtkWidget *messagewin = NULL;
3761 GtkWidget *vbox_body = mainwin->vbox_body;
3762 gboolean first_set = (mainwin->hpaned == NULL);
3763 debug_print("Setting widgets... ");
3765 #ifndef GENERIC_UMPC
3766 mainwin->messageview->statusbar = mainwin->statusbar;
3767 mainwin->messageview->statusbar_cid = mainwin->messageview_cid;
3769 /* clean top-most container */
3770 if (mainwin->hpaned) {
3771 if (gtk_widget_get_parent(mainwin->hpaned) == mainwin->vpaned)
3772 gtk_widget_destroy(mainwin->vpaned);
3774 gtk_widget_destroy(mainwin->hpaned);
3777 cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
3778 (layout_mode != WIDE_MSGLIST_LAYOUT && layout_mode != SMALL_LAYOUT));
3779 switch (layout_mode) {
3780 case VERTICAL_LAYOUT:
3783 hpaned = gtk_hpaned_new();
3784 if (layout_mode == VERTICAL_LAYOUT)
3785 vpaned = gtk_hpaned_new();
3787 vpaned = gtk_vpaned_new();
3788 gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
3789 gtk_paned_add1(GTK_PANED(hpaned),
3790 GTK_WIDGET_PTR(mainwin->folderview));
3791 gtk_widget_show(hpaned);
3792 gtk_widget_queue_resize(hpaned);
3794 if (messageview_is_visible(mainwin->messageview)) {
3795 gtk_paned_add2(GTK_PANED(hpaned), vpaned);
3796 gtk_paned_pack1(GTK_PANED(vpaned),
3797 GTK_WIDGET_PTR(mainwin->summaryview), TRUE, TRUE);
3799 gtk_paned_add2(GTK_PANED(hpaned),
3800 GTK_WIDGET_PTR(mainwin->summaryview));
3801 g_object_ref(vpaned);
3803 gtk_paned_add2(GTK_PANED(vpaned),
3804 GTK_WIDGET_PTR(mainwin->messageview));
3805 gtk_widget_show(vpaned);
3806 if (layout_mode == SMALL_LAYOUT && first_set) {
3807 mainwin_paned_show_first(GTK_PANED(hpaned));
3809 gtk_widget_queue_resize(vpaned);
3812 vpaned = gtk_vpaned_new();
3813 hpaned = gtk_hpaned_new();
3814 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned, TRUE, TRUE, 0);
3815 gtk_paned_add1(GTK_PANED(vpaned), hpaned);
3817 gtk_paned_add1(GTK_PANED(hpaned),
3818 GTK_WIDGET_PTR(mainwin->folderview));
3819 gtk_paned_add2(GTK_PANED(hpaned),
3820 GTK_WIDGET_PTR(mainwin->summaryview));
3822 gtk_widget_show(hpaned);
3823 gtk_widget_queue_resize(hpaned);
3825 if (messageview_is_visible(mainwin->messageview)) {
3826 gtk_paned_add2(GTK_PANED(vpaned),
3827 GTK_WIDGET_PTR(mainwin->messageview));
3829 g_object_ref(GTK_WIDGET_PTR(mainwin->messageview));
3831 gtk_widget_show(vpaned);
3832 gtk_widget_queue_resize(vpaned);
3834 case WIDE_MSGLIST_LAYOUT:
3835 vpaned = gtk_vpaned_new();
3836 hpaned = gtk_hpaned_new();
3837 gtk_box_pack_start(GTK_BOX(vbox_body), vpaned, TRUE, TRUE, 0);
3839 gtk_paned_add1(GTK_PANED(vpaned),
3840 GTK_WIDGET_PTR(mainwin->summaryview));
3841 gtk_paned_add1(GTK_PANED(hpaned),
3842 GTK_WIDGET_PTR(mainwin->folderview));
3844 gtk_widget_show(hpaned);
3845 gtk_widget_queue_resize(hpaned);
3847 if (messageview_is_visible(mainwin->messageview)) {
3848 gtk_paned_add2(GTK_PANED(hpaned),
3849 GTK_WIDGET_PTR(mainwin->messageview));
3851 g_object_ref(GTK_WIDGET_PTR(mainwin->messageview));
3853 gtk_paned_add2(GTK_PANED(vpaned), hpaned);
3855 gtk_widget_show(vpaned);
3856 gtk_widget_queue_resize(vpaned);
3859 g_warning("Unknown layout");
3863 mainwin->hpaned = hpaned;
3864 mainwin->vpaned = vpaned;
3866 if (layout_mode == SMALL_LAYOUT) {
3867 if (mainwin->messageview->visible)
3868 main_window_toggle_message_view(mainwin);
3871 if (layout_mode == SMALL_LAYOUT && first_set) {
3872 gtk_widget_realize(mainwin->window);
3873 gtk_widget_realize(mainwin->folderview->ctree);
3874 gtk_widget_realize(mainwin->summaryview->hbox);
3875 gtk_widget_realize(mainwin->summaryview->hbox_l);
3876 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
3877 prefs_common.folderview_width,
3878 prefs_common.folderview_height);
3879 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
3881 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
3883 gtk_widget_set_size_request(GTK_WIDGET(mainwin->window),
3884 prefs_common.mainwin_width,
3885 prefs_common.mainwin_height);
3886 gtk_paned_set_position(GTK_PANED(mainwin->hpaned), 800);
3888 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
3889 prefs_common.folderview_width,
3890 prefs_common.folderview_height);
3891 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
3892 prefs_common.summaryview_width,
3893 prefs_common.summaryview_height);
3894 gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
3895 prefs_common.msgview_width,
3896 prefs_common.msgview_height);
3897 gtk_widget_set_size_request(GTK_WIDGET(mainwin->window),
3898 prefs_common.mainwin_width,
3899 prefs_common.mainwin_height);
3901 /* remove headerview if not in prefs */
3902 headerview_set_visibility(mainwin->messageview->headerview,
3903 prefs_common.display_header_pane);
3905 if (messageview_is_visible(mainwin->messageview))
3906 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
3907 GTK_ARROW_DOWN, GTK_SHADOW_OUT);
3909 gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow),
3910 GTK_ARROW_UP, GTK_SHADOW_OUT);
3912 gtk_window_move(GTK_WINDOW(mainwin->window),
3913 prefs_common.mainwin_x,
3914 prefs_common.mainwin_y);
3916 gtk_widget_queue_resize(vbox_body);
3917 gtk_widget_queue_resize(mainwin->vbox);
3918 gtk_widget_queue_resize(mainwin->window);
3919 /* CLAWS: previous "gtk_widget_show_all" makes noticeview
3920 * and mimeview icon list/ctree lose track of their visibility states */
3921 if (!noticeview_is_visible(mainwin->messageview->noticeview))
3922 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
3923 if (!noticeview_is_visible(mainwin->messageview->mimeview->siginfoview))
3924 gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->mimeview->siginfoview));
3925 if (mainwin->messageview->mimeview->ctree_mode)
3926 gtk_widget_hide(mainwin->messageview->mimeview->icon_mainbox);
3928 gtk_widget_hide(mainwin->messageview->mimeview->ctree_mainbox);
3930 prefs_common.layout_mode = layout_mode;
3932 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
3933 messageview_is_visible(mainwin->messageview));
3935 #ifndef GENERIC_UMPC
3936 switch (prefs_common.layout_mode) {
3938 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/Standard", TRUE);
3940 case VERTICAL_LAYOUT:
3941 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/ThreeColumns", TRUE);
3944 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/WideMessage", TRUE);
3946 case WIDE_MSGLIST_LAYOUT:
3947 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/WideMessageList", TRUE);
3950 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Layout/SmallScreen", TRUE);
3957 (G_OBJECT(folderwin), "size_allocate",
3958 G_CALLBACK(folder_window_size_allocate_cb),
3963 (G_OBJECT(messagewin), "size_allocate",
3964 G_CALLBACK(message_window_size_allocate_cb),
3968 debug_print("done.\n");
3971 void main_window_destroy_all(void)
3973 while (mainwin_list != NULL) {
3974 MainWindow *mainwin = (MainWindow*)mainwin_list->data;
3976 /* free toolbar stuff */
3977 toolbar_clear_list(TOOLBAR_MAIN);
3978 TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
3979 TOOLBAR_DESTROY_ITEMS(mainwin->toolbar->item_list);
3981 summaryview_destroy(mainwin->summaryview);
3982 mainwin->folderview->mainwin = NULL;
3983 mainwin->summaryview->mainwin = NULL;
3984 mainwin->messageview->mainwin = NULL;
3986 g_free(mainwin->toolbar);
3989 mainwin_list = g_list_remove(mainwin_list, mainwin);
3991 g_list_free(mainwin_list);
3992 mainwin_list = NULL;
3995 static void toolbar_child_attached(GtkWidget *widget, GtkWidget *child,
3998 gtk_widget_set_size_request(child, 1, -1);
4001 static void toolbar_child_detached(GtkWidget *widget, GtkWidget *child,
4004 gtk_widget_set_size_request(child, -1, -1);
4006 #ifndef GENERIC_UMPC
4007 static gboolean ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
4010 MainWindow *mainwin = (MainWindow *)data;
4011 GtkWidget *menu = NULL;
4013 if (!event) return FALSE;
4015 gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
4017 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(mainwin->ac_menu));
4019 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
4020 menu_button_position, widget,
4021 event->button, event->time);
4026 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
4029 MainWindow *mainwin = (MainWindow *)data;
4030 gboolean close_allowed = TRUE;
4032 hooks_invoke(MAIN_WINDOW_CLOSE, &close_allowed);
4034 if (close_allowed && mainwin->lock_count == 0)
4035 app_exit_cb(NULL, data);
4040 static void main_window_size_allocate_cb(GtkWidget *widget,
4041 GtkAllocation *allocation,
4044 MainWindow *mainwin = (MainWindow *)data;
4045 main_window_get_size(mainwin);
4048 static void folder_window_size_allocate_cb(GtkWidget *widget,
4049 GtkAllocation *allocation,
4052 MainWindow *mainwin = (MainWindow *)data;
4054 main_window_get_size(mainwin);
4057 static void message_window_size_allocate_cb(GtkWidget *widget,
4058 GtkAllocation *allocation,
4061 MainWindow *mainwin = (MainWindow *)data;
4063 main_window_get_size(mainwin);
4066 static void add_mailbox_cb(GtkAction *action, gpointer data)
4068 MainWindow *mainwin = (MainWindow *)data;
4069 main_window_add_mailbox(mainwin);
4072 static void update_folderview_cb(GtkAction *action, gpointer data)
4074 MainWindow *mainwin = (MainWindow *)data;
4075 summary_show(mainwin->summaryview, NULL);
4076 folderview_check_new_all();
4079 static void foldersort_cb(GtkAction *action, gpointer data)
4084 static void import_mbox_cb(GtkAction *action, gpointer data)
4086 MainWindow *mainwin = (MainWindow *)data;
4087 /* only notify if import has failed */
4088 if (import_mbox(mainwin->summaryview->folder_item) == -1) {
4089 alertpanel_error(_("Mbox import has failed."));
4093 static void export_mbox_cb(GtkAction *action, gpointer data)
4095 MainWindow *mainwin = (MainWindow *)data;
4096 /* only notify if export has failed */
4097 if (export_mbox(mainwin->summaryview->folder_item) == -1) {
4098 alertpanel_error(_("Export to mbox has failed."));
4102 static void export_list_mbox_cb(GtkAction *action, gpointer data)
4104 MainWindow *mainwin = (MainWindow *)data;
4105 /* only notify if export has failed */
4106 if (summaryview_export_mbox_list(mainwin->summaryview) == -1) {
4107 alertpanel_error(_("Export to mbox has failed."));
4111 static void empty_trash_cb(GtkAction *action, gpointer data)
4113 MainWindow *mainwin = (MainWindow *)data;
4114 main_window_empty_trash(mainwin, TRUE, FALSE);
4117 static void save_as_cb(GtkAction *action, gpointer data)
4119 MainWindow *mainwin = (MainWindow *)data;
4120 summary_save_as(mainwin->summaryview);
4123 static void print_cb(GtkAction *action, gpointer data)
4125 MainWindow *mainwin = (MainWindow *)data;
4126 summary_print(mainwin->summaryview);
4129 static void page_setup_cb(GtkAction *action, gpointer data)
4131 MainWindow *mainwin = (MainWindow *)data;
4134 win = (mainwin ? GTK_WINDOW(mainwin->window) : NULL);
4136 printing_page_setup(win);
4139 static void app_exit_cb(GtkAction *action, gpointer data)
4141 MainWindow *mainwin = (MainWindow *)data;
4142 if (prefs_common.clean_on_exit) {
4143 if (!main_window_empty_trash(mainwin, prefs_common.ask_on_clean, TRUE))
4147 if (prefs_common.confirm_on_exit) {
4148 if (alertpanel(_("Exit"), _("Exit Claws Mail?"),
4149 GTK_STOCK_CANCEL, GTK_STOCK_QUIT, NULL)
4150 != G_ALERTALTERNATE)
4152 manage_window_focus_in(mainwin->window, NULL, NULL);
4155 app_will_exit(NULL, mainwin);
4158 static void search_cb(GtkAction *action, gpointer data)
4160 MainWindow *mainwin = (MainWindow *)data;
4161 message_search(mainwin->messageview);
4164 static void search_folder_cb(GtkAction *action, gpointer data)
4166 MainWindow *mainwin = (MainWindow *)data;
4167 summary_search(mainwin->summaryview);
4170 static void mainwindow_quicksearch(GtkAction *action, gpointer data)
4172 MainWindow *mainwin = (MainWindow *)data;
4173 summaryview_activate_quicksearch(mainwin->summaryview, TRUE);
4176 static void toggle_message_cb(GtkAction *action, gpointer data)
4178 MainWindow *mainwin = (MainWindow *)data;
4181 active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
4183 if (active != messageview_is_visible(mainwin->messageview))
4184 summary_toggle_view(mainwin->summaryview);
4187 static void toggle_toolbar_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4189 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4190 MainWindow *mainwin = (MainWindow *)data;
4191 toolbar_toggle(value, mainwin);
4194 static void main_window_reply_cb(GtkAction *gaction, gpointer data)
4196 MainWindow *mainwin = (MainWindow *)data;
4197 MessageView *msgview = (MessageView*)mainwin->messageview;
4198 GSList *msginfo_list = NULL;
4199 gint action = COMPOSE_REPLY;
4200 const gchar *a_name = gtk_action_get_name(gaction);
4202 DO_ACTION("Message/Reply", COMPOSE_REPLY);
4203 DO_ACTION("Message/ReplyTo/All", COMPOSE_REPLY_TO_ALL);
4204 DO_ACTION("Message/ReplyTo/Sender", COMPOSE_REPLY_TO_SENDER);
4205 DO_ACTION("Message/ReplyTo/List", COMPOSE_REPLY_TO_LIST);
4206 DO_ACTION("Message/Forward", COMPOSE_FORWARD_INLINE);
4207 DO_ACTION("Message/ForwardAtt", COMPOSE_FORWARD_AS_ATTACH);
4208 DO_ACTION("Message/Redirect", COMPOSE_REDIRECT);
4209 DO_ACTION("Message/FollowupReply", COMPOSE_FOLLOWUP_AND_REPLY_TO);
4211 cm_return_if_fail(msgview != NULL);
4213 msginfo_list = summary_get_selection(mainwin->summaryview);
4214 cm_return_if_fail(msginfo_list != NULL);
4215 compose_reply_from_messageview(msgview, msginfo_list, action);
4216 g_slist_free(msginfo_list);
4219 static void toggle_col_headers_cb(GtkAction *gaction, gpointer data)
4221 MainWindow *mainwin = (MainWindow *)data;
4222 FolderView *folderview = mainwin->folderview;
4223 SummaryView *summaryview = mainwin->summaryview;
4224 MimeView *mimeview = mainwin->messageview->mimeview;
4226 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (gaction))) {
4227 gtk_cmclist_column_titles_show(GTK_CMCLIST(folderview->ctree));
4228 gtk_cmclist_column_titles_show(GTK_CMCLIST(summaryview->ctree));
4229 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mimeview->ctree), TRUE);
4230 prefs_common.show_col_headers = TRUE;
4232 gtk_cmclist_column_titles_hide(GTK_CMCLIST(folderview->ctree));
4233 gtk_cmclist_column_titles_hide(GTK_CMCLIST(summaryview->ctree));
4234 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mimeview->ctree), FALSE);
4235 prefs_common.show_col_headers = FALSE;
4239 #ifndef GENERIC_UMPC
4240 static void toggle_statusbar_cb(GtkAction *gaction, gpointer data)
4242 MainWindow *mainwin = (MainWindow *)data;
4243 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (gaction))) {
4244 gtk_widget_show(mainwin->hbox_stat);
4245 prefs_common.show_statusbar = TRUE;
4247 gtk_widget_hide(mainwin->hbox_stat);
4248 prefs_common.show_statusbar = FALSE;
4252 static void set_layout_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4254 MainWindow *mainwin = (MainWindow *)data;
4255 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4256 LayoutType layout_mode = value;
4257 LayoutType old_layout_mode = prefs_common.layout_mode;
4258 if (mainwin->menu_lock_count) {
4261 if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
4265 if (layout_mode == prefs_common.layout_mode) {
4269 if (!mainwin->messageview->visible && layout_mode != SMALL_LAYOUT)
4270 main_window_toggle_message_view(mainwin);
4271 else if (mainwin->messageview->visible && layout_mode == SMALL_LAYOUT)
4272 main_window_toggle_message_view(mainwin);
4274 main_window_separation_change(mainwin, layout_mode);
4275 mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
4276 if (old_layout_mode == SMALL_LAYOUT && layout_mode != SMALL_LAYOUT) {
4277 mainwindow_reset_paned(GTK_PANED(mainwin->hpaned));
4279 if (old_layout_mode != SMALL_LAYOUT && layout_mode == SMALL_LAYOUT) {
4280 mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
4281 mainwindow_exit_folder(mainwin);
4283 summary_relayout(mainwin->summaryview);
4284 summary_update_unread(mainwin->summaryview, NULL);
4288 void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
4291 static gboolean switching = FALSE;
4298 offline_ask_sync = ask_sync;
4300 online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
4302 online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
4303 offline_ask_sync = TRUE;
4308 static void toggle_work_offline_cb (GtkAction *action, gpointer data)
4310 MainWindow *mainwin = (MainWindow *)data;
4311 main_window_toggle_work_offline(mainwin, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)), TRUE);
4314 static gboolean any_folder_want_synchronise(void)
4316 GList *folderlist = folder_get_list();
4318 /* see if there are synchronised folders */
4319 for (; folderlist; folderlist = folderlist->next) {
4320 Folder *folder = (Folder *)folderlist->data;
4321 if (folder_want_synchronise(folder)) {
4329 static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
4332 if (!any_folder_want_synchronise())
4335 if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
4336 _("Do you want to synchronise your folders now?"),
4337 GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
4340 if (offline_ask_sync)
4341 folder_synchronise(NULL);
4344 static void online_switch_clicked (GtkButton *btn, gpointer data)
4346 MainWindow *mainwin;
4347 gboolean have_connectivity;
4349 #ifdef HAVE_NETWORKMANAGER_SUPPORT
4350 have_connectivity = networkmanager_is_online(NULL);
4352 have_connectivity = TRUE;
4355 mainwin = (MainWindow *) data;
4357 cm_return_if_fail(mainwin != NULL);
4359 if (btn == GTK_BUTTON(mainwin->online_switch)) {
4360 #ifndef GENERIC_UMPC
4361 gtk_widget_hide (mainwin->online_switch);
4362 gtk_widget_show (mainwin->offline_switch);
4364 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/File/OfflineMode", TRUE);
4366 inc_autocheck_timer_remove();
4369 if (prefs_common.work_offline)
4372 if(have_connectivity)
4373 mainwindow_check_synchronise(mainwin, TRUE);
4374 prefs_common.work_offline = TRUE;
4375 imap_disconnect_all(have_connectivity);
4376 nntp_disconnect_all(have_connectivity);
4377 hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
4380 if (!prefs_common.work_offline)
4382 #ifndef GENERIC_UMPC
4383 gtk_widget_hide (mainwin->offline_switch);
4384 gtk_widget_show (mainwin->online_switch);
4386 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/File/OfflineMode", FALSE);
4387 prefs_common.work_offline = FALSE;
4388 inc_autocheck_timer_set();
4389 refresh_resolvers();
4390 hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
4394 static void addressbook_open_cb(GtkAction *action, gpointer data)
4396 #ifndef USE_NEW_ADDRBOOK
4397 addressbook_open(NULL);
4399 GError* error = NULL;
4401 addressbook_dbus_open(FALSE, &error);
4403 g_warning("Failed to open address book");
4404 g_warning("%s", error->message);
4405 g_error_free(error);
4410 static void log_window_show_cb(GtkAction *action, gpointer data)
4412 MainWindow *mainwin = (MainWindow *)data;
4413 log_window_show(mainwin->logwin);
4416 static void filtering_debug_window_show_cb(GtkAction *action, gpointer data)
4418 MainWindow *mainwin = (MainWindow *)data;
4419 log_window_show(mainwin->filtering_debugwin);
4422 static void inc_cancel_cb(GtkAction *action, gpointer data)
4428 static void move_to_cb(GtkAction *action, gpointer data)
4430 MainWindow *mainwin = (MainWindow *)data;
4431 summary_move_to(mainwin->summaryview);
4434 static void copy_to_cb(GtkAction *action, gpointer data)
4436 MainWindow *mainwin = (MainWindow *)data;
4437 summary_copy_to(mainwin->summaryview);
4440 static void delete_cb(GtkAction *action, gpointer data)
4442 MainWindow *mainwin = (MainWindow *)data;
4443 summary_delete(mainwin->summaryview);
4446 static void delete_trash_cb(GtkAction *action, gpointer data)
4448 MainWindow *mainwin = (MainWindow *)data;
4449 summary_delete_trash(mainwin->summaryview);
4452 static void cancel_cb(GtkAction *action, gpointer data)
4454 MainWindow *mainwin = (MainWindow *)data;
4455 summary_cancel(mainwin->summaryview);
4458 static void open_msg_cb(GtkAction *action, gpointer data)
4460 MainWindow *mainwin = (MainWindow *)data;
4461 summary_open_msg(mainwin->summaryview);
4464 static void view_source_cb(GtkAction *action, gpointer data)
4466 MainWindow *mainwin = (MainWindow *)data;
4467 summary_view_source(mainwin->summaryview);
4470 static void show_all_header_cb(GtkAction *action, gpointer data)
4472 MainWindow *mainwin = (MainWindow *)data;
4473 if (mainwin->menu_lock_count) return;
4474 prefs_common.show_all_headers =
4475 gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
4476 summary_display_msg_selected(mainwin->summaryview,
4477 gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
4480 static void toggle_fullscreen_cb(GtkAction *action, gpointer data)
4482 MainWindow *mainwin = (MainWindow *)data;
4483 if (mainwin->menu_lock_count) return;
4484 if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
4485 gtk_window_unfullscreen(GTK_WINDOW(mainwin->window));
4486 prefs_common.mainwin_fullscreen = FALSE;
4489 prefs_common.mainwin_fullscreen = TRUE;
4490 gtk_window_fullscreen(GTK_WINDOW(mainwin->window));
4494 static void hide_quotes_cb(GtkAction *action, gpointer data)
4496 MainWindow *mainwin = (MainWindow *)data;
4498 if (mainwin->menu_lock_count) return;
4500 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
4501 const gchar *a_name = gtk_action_get_name(GTK_ACTION(action));
4502 if (!strcmp(a_name, "View/Quotes/CollapseAll")) prefs_common.hide_quotes = 1;
4503 else if (!strcmp(a_name, "View/Quotes/Collapse2")) prefs_common.hide_quotes = 2;
4504 else if (!strcmp(a_name, "View/Quotes/Collapse3")) prefs_common.hide_quotes = 3;
4506 prefs_common.hide_quotes = 0;
4508 mainwin->menu_lock_count++;
4509 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
4510 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
4511 cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
4512 mainwin->menu_lock_count--;
4514 summary_redisplay_msg(mainwin->summaryview);
4517 static void mark_cb(GtkAction *action, gpointer data)
4519 MainWindow *mainwin = (MainWindow *)data;
4520 summary_mark(mainwin->summaryview);
4523 static void unmark_cb(GtkAction *action, gpointer data)
4525 MainWindow *mainwin = (MainWindow *)data;
4526 summary_unmark(mainwin->summaryview);
4529 static void mark_as_unread_cb(GtkAction *action, gpointer data)
4531 MainWindow *mainwin = (MainWindow *)data;
4532 summary_mark_as_unread(mainwin->summaryview);
4535 static void mark_as_read_cb(GtkAction *action, gpointer data)
4537 MainWindow *mainwin = (MainWindow *)data;
4538 summary_mark_as_read(mainwin->summaryview);
4541 static void mark_all_read_cb(GtkAction *action, gpointer data)
4543 MainWindow *mainwin = (MainWindow *)data;
4544 summary_mark_all_read(mainwin->summaryview);
4547 static void mark_as_spam_cb(GtkAction *action, gpointer data)
4549 MainWindow *mainwin = (MainWindow *)data;
4550 summary_mark_as_spam(mainwin->summaryview, TRUE, NULL);
4553 static void mark_as_ham_cb(GtkAction *action, gpointer data)
4555 MainWindow *mainwin = (MainWindow *)data;
4556 summary_mark_as_spam(mainwin->summaryview, FALSE, NULL);
4559 static void ignore_thread_cb(GtkAction *action, gpointer data)
4561 MainWindow *mainwin = (MainWindow *)data;
4562 summary_ignore_thread(mainwin->summaryview);
4565 static void unignore_thread_cb(GtkAction *action, gpointer data)
4567 MainWindow *mainwin = (MainWindow *)data;
4568 summary_unignore_thread(mainwin->summaryview);
4571 static void watch_thread_cb(GtkAction *action, gpointer data)
4573 MainWindow *mainwin = (MainWindow *)data;
4574 summary_watch_thread(mainwin->summaryview);
4577 static void unwatch_thread_cb(GtkAction *action, gpointer data)
4579 MainWindow *mainwin = (MainWindow *)data;
4580 summary_unwatch_thread(mainwin->summaryview);
4583 static void lock_msgs_cb(GtkAction *action, gpointer data)
4585 MainWindow *mainwin = (MainWindow *)data;
4586 summary_msgs_lock(mainwin->summaryview);
4589 static void unlock_msgs_cb(GtkAction *action, gpointer data)
4591 MainWindow *mainwin = (MainWindow *)data;
4592 summary_msgs_unlock(mainwin->summaryview);
4596 static void reedit_cb(GtkAction *action, gpointer data)
4598 MainWindow *mainwin = (MainWindow *)data;
4599 summary_reedit(mainwin->summaryview);
4602 static void open_urls_cb(GtkAction *action, gpointer data)
4604 MainWindow *mainwin = (MainWindow *)data;
4605 if (!mainwin->summaryview->displayed && mainwin->summaryview->selected) {
4606 summary_display_msg_selected(mainwin->summaryview,
4607 prefs_common.show_all_headers);
4609 messageview_list_urls(mainwin->messageview);
4612 static void add_address_cb(GtkAction *action, gpointer data)
4614 MainWindow *mainwin = (MainWindow *)data;
4615 summary_add_address(mainwin->summaryview);
4618 static void set_charset_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4620 MainWindow *mainwin = (MainWindow *)data;
4621 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4624 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
4625 str = conv_get_charset_str((CharSet)value);
4627 g_free(mainwin->messageview->forced_charset);
4628 mainwin->messageview->forced_charset = str ? g_strdup(str) : NULL;
4629 procmime_force_charset(str);
4631 summary_redisplay_msg(mainwin->summaryview);
4633 debug_print("forced charset: %s\n", str ? str : "Auto-Detect");
4637 static void set_decode_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4639 MainWindow *mainwin = (MainWindow *)data;
4640 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4641 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
4642 mainwin->messageview->forced_encoding = (EncodingType)value;
4644 summary_redisplay_msg(mainwin->summaryview);
4646 debug_print("forced encoding: %d\n", value);
4650 static void hide_read_messages (GtkAction *action, gpointer data)
4652 MainWindow *mainwin = (MainWindow *)data;
4653 GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideReadMessages");
4654 if (!mainwin->summaryview->folder_item
4655 || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
4657 summary_toggle_show_read_messages(mainwin->summaryview);
4660 static void hide_del_messages (GtkAction *action, gpointer data)
4662 MainWindow *mainwin = (MainWindow *)data;
4663 GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideDelMessages");
4664 if (!mainwin->summaryview->folder_item
4665 || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
4667 summary_toggle_show_del_messages(mainwin->summaryview);
4670 static void hide_read_threads (GtkAction *action, gpointer data)
4672 MainWindow *mainwin = (MainWindow *)data;
4673 GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideReadThreads");
4674 if (!mainwin->summaryview->folder_item
4675 || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
4677 summary_toggle_show_read_threads(mainwin->summaryview);
4680 static void thread_cb(GtkAction *action, gpointer data)
4682 MainWindow *mainwin = (MainWindow *)data;
4683 gboolean threaded = FALSE;
4684 if (mainwin->menu_lock_count) return;
4685 if (!mainwin->summaryview->folder_item) return;
4687 threaded = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
4689 mainwin->summaryview->folder_item->threaded = threaded;
4691 mainwin->summaryview->threaded = threaded;
4693 summary_show(mainwin->summaryview,
4694 mainwin->summaryview->folder_item);
4697 static void expand_threads_cb(GtkAction *action, gpointer data)
4699 MainWindow *mainwin = (MainWindow *)data;
4700 summary_expand_threads(mainwin->summaryview);
4703 static void collapse_threads_cb(GtkAction *action, gpointer data)
4705 MainWindow *mainwin = (MainWindow *)data;
4706 summary_collapse_threads(mainwin->summaryview);
4709 static void set_summary_display_item_cb(GtkAction *action, gpointer data)
4711 prefs_summary_column_open();
4714 static void set_folder_display_item_cb(GtkAction *action, gpointer data)
4716 prefs_folder_column_open();
4719 static void sort_summary_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
4721 MainWindow *mainwin = (MainWindow *)data;
4722 FolderItem *item = mainwin->summaryview->folder_item;
4723 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4725 if (mainwin->menu_lock_count) return;
4727 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)) && item) {
4728 summary_sort(mainwin->summaryview, (FolderSortKey)value,
4730 item->sort_key = value;
4734 static void sort_summary_type_cb(GtkAction *gaction, GtkRadioAction *current, gpointer data)
4736 MainWindow *mainwin = (MainWindow *)data;
4737 FolderItem *item = mainwin->summaryview->folder_item;
4738 gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
4740 if (mainwin->menu_lock_count) return;
4742 if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)) && item)
4743 summary_sort(mainwin->summaryview,
4744 item->sort_key, (FolderSortType)value);
4747 static void attract_by_subject_cb(GtkAction *action, gpointer data)
4749 MainWindow *mainwin = (MainWindow *)data;
4750 summary_attract_by_subject(mainwin->summaryview);
4753 static void delete_duplicated_cb(GtkAction *action, gpointer data)
4755 MainWindow *mainwin = (MainWindow *)data;
4758 item = folderview_get_selected_item(mainwin->folderview);
4760 main_window_cursor_wait(mainwin);
4761 STATUSBAR_PUSH(mainwin, _("Deleting duplicated messages..."));
4763 folderutils_delete_duplicates(item, prefs_common.immediate_exec ?
4764 DELETE_DUPLICATES_REMOVE : DELETE_DUPLICATES_SETFLAG);
4766 STATUSBAR_POP(mainwin);
4767 main_window_cursor_normal(mainwin);
4777 static void deldup_all(FolderItem *item, gpointer _data)
4779 struct DelDupsData *data = _data;
4782 result = folderutils_delete_duplicates(item, DELETE_DUPLICATES_REMOVE);
4784 data->dups += result;
4789 static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
4791 MainWindow *mainwin = (MainWindow *)mw;
4792 struct DelDupsData data = {0, 0};
4794 main_window_cursor_wait(mainwin);
4795 folder_func_to_all_folders(deldup_all, &data);
4796 main_window_cursor_normal(mainwin);
4798 alertpanel_notice(ngettext("Deleted %d duplicate message in %d folders.\n",
4799 "Deleted %d duplicate messages in %d folders.\n",
4801 data.dups, data.folders);
4804 static void filter_cb(GtkAction *action, gpointer data)
4806 MainWindow *mainwin = (MainWindow *)data;
4807 summary_filter(mainwin->summaryview, FALSE);
4810 static void filter_list_cb(GtkAction *action, gpointer data)
4812 MainWindow *mainwin = (MainWindow *)data;
4813 summary_filter(mainwin->summaryview, TRUE);
4816 static void process_cb(GtkAction *action, gpointer data)
4818 MainWindow *mainwin = (MainWindow *)data;
4819 FolderItem *item = mainwin->summaryview->folder_item;
4820 cm_return_if_fail(item != NULL);
4822 item->processing_pending = TRUE;
4823 folder_item_apply_processing(item);
4824 item->processing_pending = FALSE;
4827 static void execute_summary_cb(GtkAction *action, gpointer data)
4829 MainWindow *mainwin = (MainWindow *)data;
4830 summary_execute(mainwin->summaryview);
4833 static void expunge_summary_cb(GtkAction *action, gpointer data)
4835 MainWindow *mainwin = (MainWindow *)data;
4836 summary_expunge(mainwin->summaryview);
4839 static void update_summary_cb(GtkAction *action, gpointer data)
4841 MainWindow *mainwin = (MainWindow *)data;
4843 FolderView *folderview = mainwin->folderview;
4845 if (!mainwin->summaryview->folder_item) return;
4846 if (!folderview->opened) return;
4848 folder_update_op_count();
4850 fitem = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
4851 folderview->opened);
4854 folder_item_scan(fitem);
4855 summary_show(mainwin->summaryview, fitem);
4858 static void prev_cb(GtkAction *action, gpointer data)
4860 MainWindow *mainwin = (MainWindow *)data;
4861 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
4864 static void next_cb(GtkAction *action, gpointer data)
4866 MainWindow *mainwin = (MainWindow *)data;
4867 summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
4870 static void prev_unread_cb(GtkAction *action, gpointer data)
4872 MainWindow *mainwin = (MainWindow *)data;
4873 summary_select_prev_unread(mainwin->summaryview);
4876 static void next_unread_cb(GtkAction *action, gpointer data)
4878 MainWindow *mainwin = (MainWindow *)data;
4879 summary_select_next_unread(mainwin->summaryview);
4882 static void prev_new_cb(GtkAction *action, gpointer data)
4884 MainWindow *mainwin = (MainWindow *)data;
4885 summary_select_prev_new(mainwin->summaryview);
4888 static void next_new_cb(GtkAction *action, gpointer data)
4890 MainWindow *mainwin = (MainWindow *)data;
4891 summary_select_next_new(mainwin->summaryview);
4894 static void prev_marked_cb(GtkAction *action, gpointer data)
4896 MainWindow *mainwin = (MainWindow *)data;
4897 summary_select_prev_marked(mainwin->summaryview);
4900 static void next_marked_cb(GtkAction *action, gpointer data)
4902 MainWindow *mainwin = (MainWindow *)data;
4903 summary_select_next_marked(mainwin->summaryview);
4906 static void prev_labeled_cb(GtkAction *action, gpointer data)
4908 MainWindow *mainwin = (MainWindow *)data;
4909 summary_select_prev_labeled(mainwin->summaryview);
4912 static void next_labeled_cb(GtkAction *action, gpointer data)
4914 MainWindow *mainwin = (MainWindow *)data;
4915 summary_select_next_labeled(mainwin->summaryview);
4918 static void prev_history_cb(GtkAction *action, gpointer data)
4920 MainWindow *mainwin = (MainWindow *)data;
4921 MsgInfo *info = messageview_nav_get_prev(mainwin->messageview);
4923 if (info->folder != mainwin->summaryview->folder_item)
4924 folderview_select(mainwin->folderview, info->folder);
4925 summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
4926 summary_display_msg_selected(mainwin->summaryview, FALSE);
4927 procmsg_msginfo_free(info);
4928 main_window_set_menu_sensitive(mainwindow_get_mainwindow());
4929 toolbar_main_set_sensitive(mainwindow_get_mainwindow());
4933 static void next_history_cb(GtkAction *action, gpointer data)
4935 MainWindow *mainwin = (MainWindow *)data;
4936 MsgInfo *info = messageview_nav_get_next(mainwin->messageview);
4938 if (info->folder != mainwin->summaryview->folder_item)
4939 folderview_select(mainwin->folderview, info->folder);
4940 summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
4941 procmsg_msginfo_free(info);
4942 main_window_set_menu_sensitive(mainwindow_get_mainwindow());
4943 toolbar_main_set_sensitive(mainwindow_get_mainwindow());
4947 static void parent_cb(GtkAction *action, gpointer data)
4949 MainWindow *mainwin = (MainWindow *)data;
4950 summary_select_parent(mainwin->summaryview);
4953 static void goto_folder_cb(GtkAction *action, gpointer data)
4955 MainWindow *mainwin = (MainWindow *)data;
4956 FolderItem *to_folder;
4958 to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
4961 folderview_select(mainwin->folderview, to_folder);
4964 static void goto_unread_folder_cb(GtkAction *action, gpointer data)
4966 MainWindow *mainwin = (MainWindow *)data;
4967 folderview_select_next_unread(mainwin->folderview, FALSE);
4970 static void scroll_prev_line_cb(GtkAction *action, gpointer data)
4972 MainWindow *mainwin = (MainWindow *)data;
4973 mimeview_scroll_one_line(mainwin->messageview->mimeview,TRUE);
4976 static void scroll_next_line_cb(GtkAction *action, gpointer data)
4978 MainWindow *mainwin = (MainWindow *)data;
4979 mimeview_scroll_one_line(mainwin->messageview->mimeview,FALSE);
4982 static void scroll_prev_page_cb(GtkAction *action, gpointer data)
4984 MainWindow *mainwin = (MainWindow *)data;
4985 mimeview_scroll_page(mainwin->messageview->mimeview,TRUE);
4988 static void scroll_next_page_cb(GtkAction *action, gpointer data)
4990 MainWindow *mainwin = (MainWindow *)data;
4991 mimeview_scroll_page(mainwin->messageview->mimeview,FALSE);
4994 static void copy_cb(GtkAction *action, gpointer data)
4996 MainWindow *mainwin = (MainWindow *)data;
4997 messageview_copy_clipboard(mainwin->messageview);
5000 static void allsel_cb(GtkAction *action, gpointer data)
5002 MainWindow *mainwin = (MainWindow *)data;
5003 MessageView *msgview = mainwin->messageview;
5005 if (messageview_is_visible(msgview) &&
5006 (gtk_widget_has_focus(msgview->mimeview->textview->text)))
5007 messageview_select_all(mainwin->messageview);
5009 summary_select_all(mainwin->summaryview);
5012 static void select_thread_cb(GtkAction *action, gpointer data)
5014 MainWindow *mainwin = (MainWindow *)data;
5015 summary_select_thread(mainwin->summaryview, FALSE);
5018 static void delete_thread_cb(GtkAction *action, gpointer data)
5020 MainWindow *mainwin = (MainWindow *)data;
5021 summary_select_thread(mainwin->summaryview, TRUE);
5024 static void create_filter_cb(GtkAction *gaction, gpointer data)
5026 MainWindow *mainwin = (MainWindow *)data;
5027 const gchar *a_name = gtk_action_get_name(gaction);
5030 DO_ACTION("Tools/CreateFilterRule/Automatically", FILTER_BY_AUTO);
5031 DO_ACTION("Tools/CreateFilterRule/ByFrom", FILTER_BY_FROM);
5032 DO_ACTION("Tools/CreateFilterRule/ByTo", FILTER_BY_TO);
5033 DO_ACTION("Tools/CreateFilterRule/BySubject", FILTER_BY_SUBJECT);
5034 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 0);
5037 static void create_processing_cb(GtkAction *gaction, gpointer data)
5039 MainWindow *mainwin = (MainWindow *)data;
5040 const gchar *a_name = gtk_action_get_name(gaction);
5043 DO_ACTION("Tools/CreateProcessingRule/Automatically", FILTER_BY_AUTO);
5044 DO_ACTION("Tools/CreateProcessingRule/ByFrom", FILTER_BY_FROM);
5045 DO_ACTION("Tools/CreateProcessingRule/ByTo", FILTER_BY_TO);
5046 DO_ACTION("Tools/CreateProcessingRule/BySubject", FILTER_BY_SUBJECT);
5047 summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 1);
5050 static void prefs_pre_processing_open_cb(GtkAction *action, gpointer data)
5052 prefs_filtering_open(&pre_global_processing,
5053 _("Processing rules to apply before folder rules"),
5054 MANUAL_ANCHOR_PROCESSING,
5058 static void prefs_post_processing_open_cb(GtkAction *action, gpointer data)
5060 prefs_filtering_open(&post_global_processing,
5061 _("Processing rules to apply after folder rules"),
5062 MANUAL_ANCHOR_PROCESSING,
5066 static void prefs_filtering_open_cb(GtkAction *action, gpointer data)
5068 prefs_filtering_open(&filtering_rules,
5069 _("Filtering configuration"),
5070 MANUAL_ANCHOR_FILTERING,
5074 static void prefs_template_open_cb(GtkAction *action, gpointer data)
5076 prefs_template_open();
5079 static void prefs_actions_open_cb(GtkAction *action, gpointer data)
5081 MainWindow *mainwin = (MainWindow *)data;
5082 prefs_actions_open(mainwin);
5085 static void prefs_tags_open_cb(GtkAction *action, gpointer data)
5087 MainWindow *mainwin = (MainWindow *)data;
5088 GSList * list = summary_get_selected_msg_list(mainwin->summaryview);
5089 tag_apply_open(list);
5092 static void ssl_manager_open_cb(GtkAction *action, gpointer data)
5094 MainWindow *mainwin = (MainWindow *)data;
5095 ssl_manager_open(mainwin);
5098 static void prefs_account_open_cb(GtkAction *action, gpointer data)
5100 MainWindow *mainwin = (MainWindow *)data;
5102 new_account_cb(NULL, mainwin);
5104 account_open(cur_account);
5108 static void new_account_cb(GtkAction *action, gpointer data)
5110 account_edit_open(NULL, NULL);
5111 if (!compose_get_compose_list()) account_add();
5114 static void account_selector_menu_cb(GtkMenuItem *menuitem, gpointer data)
5116 FolderItem *item = NULL;
5117 cur_account = (PrefsAccount *)data;
5119 if (!mainwindow_get_mainwindow())
5121 main_window_show_cur_account(mainwindow_get_mainwindow());
5122 toolbar_update(TOOLBAR_MAIN, mainwindow_get_mainwindow());
5123 main_window_set_menu_sensitive(mainwindow_get_mainwindow());
5124 toolbar_main_set_sensitive(mainwindow_get_mainwindow());
5125 item = folderview_get_selected_item(
5126 mainwindow_get_mainwindow()->folderview);
5128 toolbar_set_compose_button
5129 (mainwindow_get_mainwindow()->toolbar,
5130 FOLDER_TYPE(item->folder) == F_NEWS ?
5131 COMPOSEBUTTON_NEWS : COMPOSEBUTTON_MAIL);
5135 static void account_receive_menu_cb(GtkMenuItem *menuitem, gpointer data)
5137 MainWindow *mainwin = (MainWindow *)mainwin_list->data;
5138 PrefsAccount *account = (PrefsAccount *)data;
5140 inc_account_mail(mainwin, account);
5142 #ifndef GENERIC_UMPC
5143 static void account_compose_menu_cb(GtkMenuItem *menuitem, gpointer data)
5145 PrefsAccount *account = (PrefsAccount *)data;
5147 compose_new_with_folderitem(account, NULL, NULL);
5150 static void prefs_open_cb(GtkAction *action, gpointer data)
5155 static void plugins_open_cb(GtkAction *action, gpointer data)
5157 pluginwindow_create();
5160 static void manual_open_cb(GtkAction *action, gpointer data)
5162 manual_open(MANUAL_MANUAL_CLAWS, NULL);
5165 static void manual_faq_open_cb(GtkAction *action, gpointer data)
5167 manual_open(MANUAL_FAQ_CLAWS, NULL);
5170 static void legend_open_cb(GtkAction *action, gpointer data)
5176 static void set_default_client_cb(GtkAction *action, gpointer data)
5178 char exename[MAX_PATH];
5179 gchar *binary_icon = NULL;
5180 gchar *binary_compose = NULL;
5181 gchar *binary_run = NULL;
5183 if ( !GetModuleFileNameA (0, exename, sizeof (exename)) ) {
5184 alertpanel_error(_("Can not register as default client: impossible to get executable path."));
5187 binary_icon = g_strconcat(exename, ",0", NULL);
5188 binary_compose = g_strconcat(exename, " --compose %1", NULL);
5189 binary_run = g_strconcat(exename, NULL);
5191 /* Try to set the Mail Start menu item to Claws. It may fail if we're not root; we don't care */
5192 r = write_w32_registry_string("HKLM", "Software\\Clients\\Mail",
5195 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail",
5198 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail",
5201 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5202 "", "URL:MailTo-Protocol");
5204 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5205 "URL Protocol", "");
5207 r = write_w32_registry_dword ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5210 r = write_w32_registry_string ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
5211 "FriendlyTypeName", "Claws-Mail URL");
5213 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\DefaultIcon",
5216 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\shell\\open\\command",
5217 "", binary_compose);
5219 r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\shell\\open\\command",
5223 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto",
5224 "", "URL:MailTo-Protocol");
5226 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto",
5227 "URL Protocol", "");
5229 r = write_w32_registry_dword ("HKCU", "Software\\Classes\\mailto",
5232 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto",
5233 "FriendlyTypeName", "Claws-Mail URL");
5235 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\DefaultIcon",
5238 r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\shell\\open\\command",
5239 "", binary_compose);
5242 SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\Mail");
5243 alertpanel_notice(_("Claws Mail has been registered as default client."));
5245 alertpanel_error(_("Can not register as default client: impossible to write to the registry."));
5247 g_free(binary_icon);
5248 g_free(binary_compose);
5253 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
5255 MainWindow *mainwin = (MainWindow *)data;
5259 str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
5260 LOCAL_FOLDER(folder)->rootpath,
5264 str = g_strdup_printf(_("Scanning folder %s ..."),
5265 LOCAL_FOLDER(folder)->rootpath);
5267 STATUSBAR_PUSH(mainwin, str);
5268 STATUSBAR_POP(mainwin);
5272 static gboolean mainwindow_focus_in_event(GtkWidget *widget, GdkEventFocus *focus,
5275 SummaryView *summary;
5277 cm_return_val_if_fail(data, FALSE);
5278 if (!g_list_find(mainwin_list, data))
5280 summary = ((MainWindow *)data)->summaryview;
5281 cm_return_val_if_fail(summary, FALSE);
5283 if (GTK_CMCLIST(summary->ctree)->selection &&
5284 g_list_length(GTK_CMCLIST(summary->ctree)->selection) > 1)
5290 static gboolean mainwindow_visibility_event_cb(GtkWidget *widget, GdkEventVisibility *event,
5293 is_obscured = (event->state == GDK_VISIBILITY_FULLY_OBSCURED);
5297 static gboolean mainwindow_state_event_cb(GtkWidget *widget, GdkEventWindowState *state,
5300 if (!claws_is_starting()
5301 && state->changed_mask&GDK_WINDOW_STATE_ICONIFIED
5302 && state->new_window_state&GDK_WINDOW_STATE_ICONIFIED) {
5304 if (iconified_count > 0)
5305 hooks_invoke(MAIN_WINDOW_GOT_ICONIFIED, NULL);
5307 } else if (!claws_is_starting()) {
5308 prefs_common.mainwin_maximised =
5309 ((state->new_window_state&GDK_WINDOW_STATE_MAXIMIZED) != 0);
5311 if (state->new_window_state == 0)
5312 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(widget), FALSE);
5316 gboolean mainwindow_is_obscured(void)
5322 * Harvest addresses for selected folder.
5324 static void addr_harvest_cb( GtkAction *action, gpointer data)
5326 MainWindow *mainwin = (MainWindow *)data;
5328 addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
5332 * Harvest addresses for selected messages in summary view.
5334 static void addr_harvest_msg_cb( GtkAction *action, gpointer data)
5336 MainWindow *mainwin = (MainWindow *)data;
5337 summary_harvest_address( mainwin->summaryview );
5341 *\brief get a MainWindow
5343 *\return MainWindow * The first mainwindow in the mainwin_list
5345 MainWindow *mainwindow_get_mainwindow(void)
5347 if (mainwin_list && mainwin_list->data)
5348 return (MainWindow *)(mainwin_list->data);
5353 static gboolean mainwindow_progressindicator_hook(gpointer source, gpointer userdata)
5355 ProgressData *data = (ProgressData *) source;
5356 MainWindow *mainwin = (MainWindow *) userdata;
5358 switch (data->cmd) {
5359 case PROGRESS_COMMAND_START:
5360 case PROGRESS_COMMAND_STOP:
5361 gtk_progress_bar_set_fraction
5362 (GTK_PROGRESS_BAR(mainwin->progressbar), 0.0);
5364 case PROGRESS_COMMAND_SET_PERCENTAGE:
5365 gtk_progress_bar_set_fraction
5366 (GTK_PROGRESS_BAR(mainwin->progressbar), data->value);
5369 while (gtk_events_pending()) gtk_main_iteration ();
5374 static void sync_cb(GtkAction *action, gpointer data)
5376 MainWindow *mainwin = (MainWindow *)data;
5377 mainwindow_check_synchronise(mainwin, FALSE);
5380 static void forget_session_passwords_cb(GtkAction *action, gpointer data)
5382 MainWindow *mainwin = (MainWindow *)data;
5387 main_window_lock(mainwin);
5388 for (list = account_get_list(); list != NULL; list = list->next) {
5389 PrefsAccount *account = list->data;
5390 if (account->session_passwd) {
5391 g_free(account->session_passwd);
5392 account->session_passwd = NULL;
5395 if (account->session_smtp_passwd) {
5396 g_free(account->session_smtp_passwd);
5397 account->session_smtp_passwd = NULL;
5402 main_window_unlock(mainwin);
5403 alertpanel_notice(ngettext("Forgotten %d password in %d accounts.\n",
5404 "Forgotten %d passwords in %d accounts.\n",
5408 void mainwindow_learn (MainWindow *mainwin, gboolean is_spam)
5410 summary_mark_as_spam(mainwin->summaryview, is_spam, NULL);
5413 void mainwindow_jump_to(const gchar *target, gboolean popup)
5417 FolderItem *item = NULL;
5419 MainWindow *mainwin = mainwindow_get_mainwindow();
5420 gchar *from_uri = NULL;
5425 g_print("not initialized\n");
5429 if ((from_uri = g_filename_from_uri(target, NULL, NULL)) != NULL)
5432 tmp = g_strdup(target);
5434 if ((p = strstr(tmp, "\r")) != NULL)
5436 if ((p = strstr(tmp, "\n")) != NULL)
5439 if ((item = folder_find_item_from_identifier(tmp))) {
5440 g_print("selecting folder '%s'\n", tmp);
5441 folderview_select(mainwin->folderview, item);
5443 main_window_popup(mainwin);
5448 msg = strrchr(tmp, G_DIR_SEPARATOR);
5451 if ((item = folder_find_item_from_identifier(tmp))) {
5452 g_print("selecting folder '%s'\n", tmp);
5453 folderview_select(mainwin->folderview, item);
5454 } else if ((item = folder_find_item_from_real_path(tmp))) {
5455 g_print("selecting folder '%s'\n", tmp);
5456 folderview_select(mainwin->folderview, item);
5458 g_print("'%s' not found\n", tmp);
5460 if (item && msg && atoi(msg)) {
5461 g_print("selecting message %d\n", atoi(msg));
5462 summary_select_by_msgnum(mainwin->summaryview, atoi(msg));
5463 summary_display_msg_selected(mainwin->summaryview, FALSE);
5465 main_window_popup(mainwin);
5468 } else if (item && msg[0] == '<' && msg[strlen(msg)-1] == '>') {
5469 MsgInfo *msginfo = NULL;
5471 msg[strlen(msg)-1] = '\0';
5472 msginfo = folder_item_get_msginfo_by_msgid(item, msg);
5474 g_print("selecting message %s\n", msg);
5475 summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum);
5476 summary_display_msg_selected(mainwin->summaryview, FALSE);
5478 main_window_popup(mainwin);
5480 procmsg_msginfo_free(msginfo);
5483 g_print("'%s' not found\n", msg);
5486 g_print("'%s' not found\n", msg);
5489 g_print("'%s' not found\n", tmp);
5495 void mainwindow_exit_folder(MainWindow *mainwin) {
5496 if (prefs_common.layout_mode == SMALL_LAYOUT) {
5497 folderview_close_opened(mainwin->folderview);
5498 mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
5499 gtk_widget_grab_focus(mainwin->folderview->ctree);
5501 mainwin->in_folder = FALSE;
5502 main_window_set_menu_sensitive(mainwin);
5505 void mainwindow_enter_folder(MainWindow *mainwin) {
5506 if (prefs_common.layout_mode == SMALL_LAYOUT) {
5507 mainwin_paned_show_last(GTK_PANED(mainwin->hpaned));
5509 mainwin->in_folder = TRUE;
5510 main_window_set_menu_sensitive(mainwin);
5513 static void save_part_as_cb(GtkAction *action, gpointer data)
5515 MainWindow *mainwin = (MainWindow *)data;
5517 if (mainwin->messageview
5518 && mainwin->messageview->mimeview)
5519 mimeview_save_as(mainwin->messageview->mimeview);
5522 static void view_part_as_text_cb(GtkAction *action, gpointer data)
5524 MainWindow *mainwin = (MainWindow *)data;
5526 if (mainwin->messageview
5527 && mainwin->messageview->mimeview)
5528 mimeview_display_as_text(mainwin->messageview->mimeview);
5531 static void open_part_cb(GtkAction *action, gpointer data)
5533 MainWindow *mainwin = (MainWindow *)data;
5535 if (mainwin->messageview
5536 && mainwin->messageview->mimeview)
5537 mimeview_launch(mainwin->messageview->mimeview, NULL);
5540 static void open_part_with_cb(GtkAction *action, gpointer data)
5542 MainWindow *mainwin = (MainWindow *)data;
5544 if (mainwin->messageview
5545 && mainwin->messageview->mimeview)
5546 mimeview_open_with(mainwin->messageview->mimeview);
5549 static void check_signature_cb(GtkAction *action, gpointer data)
5551 MainWindow *mainwin = (MainWindow *)data;
5553 if (mainwin->messageview
5554 && mainwin->messageview->mimeview)
5555 mimeview_check_signature(mainwin->messageview->mimeview);
5558 static void goto_next_part_cb(GtkAction *action, gpointer data)
5560 MainWindow *mainwin = (MainWindow *)data;
5562 if (mainwin->messageview
5563 && mainwin->messageview->mimeview)
5564 mimeview_select_next_part(mainwin->messageview->mimeview);
5567 static void goto_prev_part_cb(GtkAction *action, gpointer data)
5569 MainWindow *mainwin = (MainWindow *)data;
5571 if (mainwin->messageview
5572 && mainwin->messageview->mimeview)
5573 mimeview_select_prev_part(mainwin->messageview->mimeview);
5577 gboolean maemo_mainwindow_is_fullscreen(GtkWidget *widget)
5580 gtk_window_get_size(GTK_WINDOW(widget), &w, &h);
5584 void maemo_window_full_screen_if_needed (GtkWindow *window)
5586 if (maemo_mainwindow_is_fullscreen(mainwindow_get_mainwindow()->window)) {
5587 gtk_window_fullscreen(GTK_WINDOW(window));
5591 void maemo_connect_key_press_to_mainwindow (GtkWindow *window)
5593 g_signal_connect(G_OBJECT(window), "key_press_event",
5594 G_CALLBACK(mainwindow_key_pressed), mainwindow_get_mainwindow());