root / src / mainwindow.c @ 3204
History | View | Annotate | Download (126.6 kB)
| 1 | /*
|
|---|---|
| 2 | * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 | * Copyright (C) 1999-2012 Hiroyuki Yamamoto |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 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. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | #include "defs.h" |
| 21 | |
| 22 | #include <glib.h> |
| 23 | #include <glib/gi18n.h> |
| 24 | #include <gdk/gdkkeysyms.h> |
| 25 | #include <gtk/gtkmain.h> |
| 26 | #include <gtk/gtkversion.h> |
| 27 | #include <gtk/gtkwindow.h> |
| 28 | #include <gtk/gtkwidget.h> |
| 29 | #include <gtk/gtksignal.h> |
| 30 | #include <gtk/gtkvbox.h> |
| 31 | #include <gtk/gtkcontainer.h> |
| 32 | #include <gtk/gtkstatusbar.h> |
| 33 | #include <gtk/gtkprogressbar.h> |
| 34 | #include <gtk/gtkhpaned.h> |
| 35 | #include <gtk/gtkvpaned.h> |
| 36 | #include <gtk/gtkcheckmenuitem.h> |
| 37 | #include <gtk/gtkitemfactory.h> |
| 38 | #include <gtk/gtkeditable.h> |
| 39 | #include <gtk/gtkmenu.h> |
| 40 | #include <gtk/gtkmenuitem.h> |
| 41 | #include <gtk/gtktoolbar.h> |
| 42 | #include <gtk/gtktoolitem.h> |
| 43 | #include <gtk/gtktoolbutton.h> |
| 44 | #include <gtk/gtkseparatortoolitem.h> |
| 45 | #include <gtk/gtkbutton.h> |
| 46 | #include <gtk/gtktooltips.h> |
| 47 | #include <gtk/gtkarrow.h> |
| 48 | #include <gtk/gtkstock.h> |
| 49 | #include <gtk/gtkimage.h> |
| 50 | #include <string.h> |
| 51 | |
| 52 | #include "main.h" |
| 53 | #include "mainwindow.h" |
| 54 | #include "folderview.h" |
| 55 | #include "foldersel.h" |
| 56 | #include "summaryview.h" |
| 57 | #include "quick_search.h" |
| 58 | #include "query_search.h" |
| 59 | #include "messageview.h" |
| 60 | #include "mimeview.h" |
| 61 | #include "message_search.h" |
| 62 | #include "headerview.h" |
| 63 | #include "menu.h" |
| 64 | #include "stock_pixmap.h" |
| 65 | #include "folder.h" |
| 66 | #include "inc.h" |
| 67 | #include "rpop3.h" |
| 68 | #include "compose.h" |
| 69 | #include "procmsg.h" |
| 70 | #include "send_message.h" |
| 71 | #include "import.h" |
| 72 | #include "export.h" |
| 73 | #include "prefs_common.h" |
| 74 | #include "prefs_common_dialog.h" |
| 75 | #include "prefs_filter.h" |
| 76 | #include "prefs_actions.h" |
| 77 | #include "prefs_account.h" |
| 78 | #include "prefs_summary_column.h" |
| 79 | #include "prefs_template.h" |
| 80 | #include "prefs_search_folder.h" |
| 81 | #include "prefs_toolbar.h" |
| 82 | #include "plugin_manager.h" |
| 83 | #include "action.h" |
| 84 | #include "account.h" |
| 85 | #include "account_dialog.h" |
| 86 | #include "addressbook.h" |
| 87 | #include "logwindow.h" |
| 88 | #include "manage_window.h" |
| 89 | #include "alertpanel.h" |
| 90 | #include "statusbar.h" |
| 91 | #include "inputdialog.h" |
| 92 | #include "trayicon.h" |
| 93 | #include "printing.h" |
| 94 | #include "utils.h" |
| 95 | #include "gtkutils.h" |
| 96 | #include "codeconv.h" |
| 97 | #include "about.h" |
| 98 | #include "manual.h" |
| 99 | #include "update_check.h" |
| 100 | #include "setup.h" |
| 101 | #include "version.h" |
| 102 | |
| 103 | #define AC_LABEL_WIDTH 240 |
| 104 | |
| 105 | #define STATUSBAR_PUSH(mainwin, str) \
|
| 106 | { \
|
| 107 | gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar), \ |
| 108 | mainwin->mainwin_cid, str); \ |
| 109 | gtkut_widget_draw_now(mainwin->statusbar); \ |
| 110 | } |
| 111 | |
| 112 | #define STATUSBAR_POP(mainwin) \
|
| 113 | { \
|
| 114 | gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar), \ |
| 115 | mainwin->mainwin_cid); \ |
| 116 | } |
| 117 | |
| 118 | /* list of all instantiated MainWindow */
|
| 119 | static GList *mainwin_list = NULL; |
| 120 | |
| 121 | static GdkCursor *watch_cursor;
|
| 122 | |
| 123 | static void main_window_menu_callback_block (MainWindow *mainwin); |
| 124 | static void main_window_menu_callback_unblock (MainWindow *mainwin); |
| 125 | |
| 126 | static void main_window_show_cur_account (MainWindow *mainwin); |
| 127 | |
| 128 | static void main_window_set_toolbar_button_visibility |
| 129 | (MainWindow *mainwin); |
| 130 | |
| 131 | static void main_window_set_widgets (MainWindow *mainwin, |
| 132 | LayoutType layout, |
| 133 | SeparateType type); |
| 134 | static GtkWidget *main_window_toolbar_create (MainWindow *mainwin);
|
| 135 | static GtkWidget *main_window_toolbar_create_from_list
|
| 136 | (MainWindow *mainwin, |
| 137 | GList *item_list); |
| 138 | static void main_window_toolbar_toggle_menu_set_active |
| 139 | (MainWindow *mainwin, |
| 140 | ToolbarStyle style); |
| 141 | |
| 142 | /* callback functions */
|
| 143 | static void toolbar_inc_cb (GtkWidget *widget, |
| 144 | gpointer data); |
| 145 | static void toolbar_inc_all_cb (GtkWidget *widget, |
| 146 | gpointer data); |
| 147 | static void toolbar_rpop3_cb (GtkWidget *widget, |
| 148 | gpointer data); |
| 149 | static void toolbar_send_cb (GtkWidget *widget, |
| 150 | gpointer data); |
| 151 | |
| 152 | static void toolbar_compose_cb (GtkWidget *widget, |
| 153 | gpointer data); |
| 154 | static void toolbar_reply_cb (GtkWidget *widget, |
| 155 | gpointer data); |
| 156 | static void toolbar_reply_to_all_cb (GtkWidget *widget, |
| 157 | gpointer data); |
| 158 | static void toolbar_forward_cb (GtkWidget *widget, |
| 159 | gpointer data); |
| 160 | |
| 161 | static void toolbar_delete_cb (GtkWidget *widget, |
| 162 | gpointer data); |
| 163 | static void toolbar_junk_cb (GtkWidget *widget, |
| 164 | gpointer data); |
| 165 | static void toolbar_notjunk_cb (GtkWidget *widget, |
| 166 | gpointer data); |
| 167 | static void toolbar_exec_cb (GtkWidget *widget, |
| 168 | gpointer data); |
| 169 | |
| 170 | static void toolbar_next_unread_cb (GtkWidget *widget, |
| 171 | gpointer data); |
| 172 | static void toolbar_prev_unread_cb (GtkWidget *widget, |
| 173 | gpointer data); |
| 174 | static void toolbar_address_cb (GtkWidget *widget, |
| 175 | gpointer data); |
| 176 | static void toolbar_search_cb (GtkWidget *widget, |
| 177 | gpointer data); |
| 178 | static void toolbar_print_cb (GtkWidget *widget, |
| 179 | gpointer data); |
| 180 | static void toolbar_stop_cb (GtkWidget *widget, |
| 181 | gpointer data); |
| 182 | static void toolbar_prefs_common_cb (GtkWidget *widget, |
| 183 | gpointer data); |
| 184 | static void toolbar_prefs_account_cb (GtkWidget *widget, |
| 185 | gpointer data); |
| 186 | |
| 187 | static gboolean toolbar_button_pressed (GtkWidget *widget,
|
| 188 | GdkEventButton *event, |
| 189 | gpointer data); |
| 190 | |
| 191 | static void online_switch_clicked (GtkWidget *widget, |
| 192 | gpointer data); |
| 193 | static gboolean ac_label_button_pressed (GtkWidget *widget,
|
| 194 | GdkEventButton *event, |
| 195 | gpointer data); |
| 196 | static void ac_menu_popup_closed (GtkMenuShell *menu_shell, |
| 197 | gpointer data); |
| 198 | |
| 199 | static gboolean main_window_key_pressed (GtkWidget *widget,
|
| 200 | GdkEventKey *event, |
| 201 | gpointer data); |
| 202 | |
| 203 | static gint main_window_close_cb (GtkWidget *widget,
|
| 204 | GdkEventAny *event, |
| 205 | gpointer data); |
| 206 | static gint folder_window_close_cb (GtkWidget *widget,
|
| 207 | GdkEventAny *event, |
| 208 | gpointer data); |
| 209 | static gint message_window_close_cb (GtkWidget *widget,
|
| 210 | GdkEventAny *event, |
| 211 | gpointer data); |
| 212 | |
| 213 | static void main_window_size_allocate_cb (GtkWidget *widget, |
| 214 | GtkAllocation *allocation, |
| 215 | gpointer data); |
| 216 | static void folder_window_size_allocate_cb (GtkWidget *widget, |
| 217 | GtkAllocation *allocation, |
| 218 | gpointer data); |
| 219 | static void message_window_size_allocate_cb (GtkWidget *widget, |
| 220 | GtkAllocation *allocation, |
| 221 | gpointer data); |
| 222 | |
| 223 | static gboolean main_window_window_state_cb (GtkWidget *widget,
|
| 224 | GdkEventWindowState *event, |
| 225 | gpointer data); |
| 226 | static gboolean main_window_visibility_notify_cb(GtkWidget *widget,
|
| 227 | GdkEventVisibility *event, |
| 228 | gpointer data); |
| 229 | |
| 230 | static void new_folder_cb (MainWindow *mainwin, |
| 231 | guint action, |
| 232 | GtkWidget *widget); |
| 233 | static void rename_folder_cb (MainWindow *mainwin, |
| 234 | guint action, |
| 235 | GtkWidget *widget); |
| 236 | static void move_folder_cb (MainWindow *mainwin, |
| 237 | guint action, |
| 238 | GtkWidget *widget); |
| 239 | static void delete_folder_cb (MainWindow *mainwin, |
| 240 | guint action, |
| 241 | GtkWidget *widget); |
| 242 | static void update_folderview_cb (MainWindow *mainwin, |
| 243 | guint action, |
| 244 | GtkWidget *widget); |
| 245 | |
| 246 | static void add_mailbox_cb (MainWindow *mainwin, |
| 247 | guint action, |
| 248 | GtkWidget *widget); |
| 249 | static void remove_mailbox_cb (MainWindow *mainwin, |
| 250 | guint action, |
| 251 | GtkWidget *widget); |
| 252 | static void rebuild_tree_cb (MainWindow *mainwin, |
| 253 | guint action, |
| 254 | GtkWidget *widget); |
| 255 | |
| 256 | static void import_mail_cb (MainWindow *mainwin, |
| 257 | guint action, |
| 258 | GtkWidget *widget); |
| 259 | static void export_mail_cb (MainWindow *mainwin, |
| 260 | guint action, |
| 261 | GtkWidget *widget); |
| 262 | static void empty_trash_cb (MainWindow *mainwin, |
| 263 | guint action, |
| 264 | GtkWidget *widget); |
| 265 | |
| 266 | static void save_as_cb (MainWindow *mainwin, |
| 267 | guint action, |
| 268 | GtkWidget *widget); |
| 269 | #if GTK_CHECK_VERSION(2, 10, 0) |
| 270 | static void page_setup_cb (MainWindow *mainwin, |
| 271 | guint action, |
| 272 | GtkWidget *widget); |
| 273 | #endif
|
| 274 | static void print_cb (MainWindow *mainwin, |
| 275 | guint action, |
| 276 | GtkWidget *widget); |
| 277 | static void toggle_offline_cb (MainWindow *mainwin, |
| 278 | guint action, |
| 279 | GtkWidget *widget); |
| 280 | static void app_exit_cb (MainWindow *mainwin, |
| 281 | guint action, |
| 282 | GtkWidget *widget); |
| 283 | |
| 284 | static void search_cb (MainWindow *mainwin, |
| 285 | guint action, |
| 286 | GtkWidget *widget); |
| 287 | |
| 288 | static void toggle_folder_cb (MainWindow *mainwin, |
| 289 | guint action, |
| 290 | GtkWidget *widget); |
| 291 | static void toggle_message_cb (MainWindow *mainwin, |
| 292 | guint action, |
| 293 | GtkWidget *widget); |
| 294 | static void toggle_toolbar_cb (MainWindow *mainwin, |
| 295 | guint action, |
| 296 | GtkWidget *widget); |
| 297 | static void toggle_searchbar_cb (MainWindow *mainwin, |
| 298 | guint action, |
| 299 | GtkWidget *widget); |
| 300 | static void toggle_statusbar_cb (MainWindow *mainwin, |
| 301 | guint action, |
| 302 | GtkWidget *widget); |
| 303 | static void toolbar_customize_cb (MainWindow *mainwin, |
| 304 | guint action, |
| 305 | GtkWidget *widget); |
| 306 | static void change_layout_cb (MainWindow *mainwin, |
| 307 | guint action, |
| 308 | GtkWidget *widget); |
| 309 | static void separate_widget_cb (MainWindow *mainwin, |
| 310 | guint action, |
| 311 | GtkWidget *widget); |
| 312 | |
| 313 | static void addressbook_open_cb (MainWindow *mainwin, |
| 314 | guint action, |
| 315 | GtkWidget *widget); |
| 316 | static void log_window_show_cb (MainWindow *mainwin, |
| 317 | guint action, |
| 318 | GtkWidget *widget); |
| 319 | |
| 320 | static void inc_mail_cb (MainWindow *mainwin, |
| 321 | guint action, |
| 322 | GtkWidget *widget); |
| 323 | static void inc_all_account_mail_cb (MainWindow *mainwin, |
| 324 | guint action, |
| 325 | GtkWidget *widget); |
| 326 | static void inc_stop_cb (MainWindow *mainwin, |
| 327 | guint action, |
| 328 | GtkWidget *widget); |
| 329 | |
| 330 | static void rpop3_cb (MainWindow *mainwin, |
| 331 | guint action, |
| 332 | GtkWidget *widget); |
| 333 | |
| 334 | static void send_queue_cb (MainWindow *mainwin, |
| 335 | guint action, |
| 336 | GtkWidget *widget); |
| 337 | |
| 338 | static void compose_cb (MainWindow *mainwin, |
| 339 | guint action, |
| 340 | GtkWidget *widget); |
| 341 | static void reply_cb (MainWindow *mainwin, |
| 342 | guint action, |
| 343 | GtkWidget *widget); |
| 344 | |
| 345 | static void open_msg_cb (MainWindow *mainwin, |
| 346 | guint action, |
| 347 | GtkWidget *widget); |
| 348 | |
| 349 | static void view_source_cb (MainWindow *mainwin, |
| 350 | guint action, |
| 351 | GtkWidget *widget); |
| 352 | |
| 353 | static void show_all_header_cb (MainWindow *mainwin, |
| 354 | guint action, |
| 355 | GtkWidget *widget); |
| 356 | |
| 357 | static void move_to_cb (MainWindow *mainwin, |
| 358 | guint action, |
| 359 | GtkWidget *widget); |
| 360 | static void copy_to_cb (MainWindow *mainwin, |
| 361 | guint action, |
| 362 | GtkWidget *widget); |
| 363 | static void delete_cb (MainWindow *mainwin, |
| 364 | guint action, |
| 365 | GtkWidget *widget); |
| 366 | |
| 367 | static void mark_cb (MainWindow *mainwin, |
| 368 | guint action, |
| 369 | GtkWidget *widget); |
| 370 | static void unmark_cb (MainWindow *mainwin, |
| 371 | guint action, |
| 372 | GtkWidget *widget); |
| 373 | |
| 374 | static void mark_as_unread_cb (MainWindow *mainwin, |
| 375 | guint action, |
| 376 | GtkWidget *widget); |
| 377 | static void mark_as_read_cb (MainWindow *mainwin, |
| 378 | guint action, |
| 379 | GtkWidget *widget); |
| 380 | static void mark_thread_as_read_cb (MainWindow *mainwin, |
| 381 | guint action, |
| 382 | GtkWidget *widget); |
| 383 | static void mark_all_read_cb (MainWindow *mainwin, |
| 384 | guint action, |
| 385 | GtkWidget *widget); |
| 386 | |
| 387 | static void junk_cb (MainWindow *mainwin, |
| 388 | guint action, |
| 389 | GtkWidget *widget); |
| 390 | |
| 391 | static void reedit_cb (MainWindow *mainwin, |
| 392 | guint action, |
| 393 | GtkWidget *widget); |
| 394 | |
| 395 | static void add_address_cb (MainWindow *mainwin, |
| 396 | guint action, |
| 397 | GtkWidget *widget); |
| 398 | |
| 399 | static void set_charset_cb (MainWindow *mainwin, |
| 400 | guint action, |
| 401 | GtkWidget *widget); |
| 402 | |
| 403 | static void thread_cb (MainWindow *mainwin, |
| 404 | guint action, |
| 405 | GtkWidget *widget); |
| 406 | static void expand_threads_cb (MainWindow *mainwin, |
| 407 | guint action, |
| 408 | GtkWidget *widget); |
| 409 | static void collapse_threads_cb (MainWindow *mainwin, |
| 410 | guint action, |
| 411 | GtkWidget *widget); |
| 412 | |
| 413 | static void set_display_item_cb (MainWindow *mainwin, |
| 414 | guint action, |
| 415 | GtkWidget *widget); |
| 416 | static void sort_summary_cb (MainWindow *mainwin, |
| 417 | guint action, |
| 418 | GtkWidget *widget); |
| 419 | static void sort_summary_type_cb (MainWindow *mainwin, |
| 420 | guint action, |
| 421 | GtkWidget *widget); |
| 422 | static void attract_by_subject_cb(MainWindow *mainwin, |
| 423 | guint action, |
| 424 | GtkWidget *widget); |
| 425 | |
| 426 | static void delete_duplicated_cb (MainWindow *mainwin, |
| 427 | guint action, |
| 428 | GtkWidget *widget); |
| 429 | static void concat_partial_cb (MainWindow *mainwin, |
| 430 | guint action, |
| 431 | GtkWidget *widget); |
| 432 | static void filter_cb (MainWindow *mainwin, |
| 433 | guint action, |
| 434 | GtkWidget *widget); |
| 435 | static void filter_junk_cb (MainWindow *mainwin, |
| 436 | guint action, |
| 437 | GtkWidget *widget); |
| 438 | static void execute_summary_cb (MainWindow *mainwin, |
| 439 | guint action, |
| 440 | GtkWidget *widget); |
| 441 | static void update_summary_cb (MainWindow *mainwin, |
| 442 | guint action, |
| 443 | GtkWidget *widget); |
| 444 | |
| 445 | static void prev_cb (MainWindow *mainwin, |
| 446 | guint action, |
| 447 | GtkWidget *widget); |
| 448 | static void next_cb (MainWindow *mainwin, |
| 449 | guint action, |
| 450 | GtkWidget *widget); |
| 451 | |
| 452 | static void prev_unread_cb (MainWindow *mainwin, |
| 453 | guint action, |
| 454 | GtkWidget *widget); |
| 455 | static void next_unread_cb (MainWindow *mainwin, |
| 456 | guint action, |
| 457 | GtkWidget *widget); |
| 458 | static void prev_new_cb (MainWindow *mainwin, |
| 459 | guint action, |
| 460 | GtkWidget *widget); |
| 461 | static void next_new_cb (MainWindow *mainwin, |
| 462 | guint action, |
| 463 | GtkWidget *widget); |
| 464 | static void prev_marked_cb (MainWindow *mainwin, |
| 465 | guint action, |
| 466 | GtkWidget *widget); |
| 467 | static void next_marked_cb (MainWindow *mainwin, |
| 468 | guint action, |
| 469 | GtkWidget *widget); |
| 470 | static void prev_labeled_cb (MainWindow *mainwin, |
| 471 | guint action, |
| 472 | GtkWidget *widget); |
| 473 | static void next_labeled_cb (MainWindow *mainwin, |
| 474 | guint action, |
| 475 | GtkWidget *widget); |
| 476 | |
| 477 | static void goto_folder_cb (MainWindow *mainwin, |
| 478 | guint action, |
| 479 | GtkWidget *widget); |
| 480 | |
| 481 | static void copy_cb (MainWindow *mainwin, |
| 482 | guint action, |
| 483 | GtkWidget *widget); |
| 484 | static void allsel_cb (MainWindow *mainwin, |
| 485 | guint action, |
| 486 | GtkWidget *widget); |
| 487 | static void select_thread_cb (MainWindow *mainwin, |
| 488 | guint action, |
| 489 | GtkWidget *widget); |
| 490 | |
| 491 | static void create_filter_cb (MainWindow *mainwin, |
| 492 | guint action, |
| 493 | GtkWidget *widget); |
| 494 | |
| 495 | static void prefs_common_open_cb (MainWindow *mainwin, |
| 496 | guint action, |
| 497 | GtkWidget *widget); |
| 498 | static void prefs_filter_open_cb (MainWindow *mainwin, |
| 499 | guint action, |
| 500 | GtkWidget *widget); |
| 501 | static void prefs_template_open_cb (MainWindow *mainwin, |
| 502 | guint action, |
| 503 | GtkWidget *widget); |
| 504 | static void plugin_manager_open_cb (MainWindow *mainwin, |
| 505 | guint action, |
| 506 | GtkWidget *widget); |
| 507 | #ifndef G_OS_WIN32
|
| 508 | static void prefs_actions_open_cb (MainWindow *mainwin, |
| 509 | guint action, |
| 510 | GtkWidget *widget); |
| 511 | #endif
|
| 512 | static void prefs_account_open_cb (MainWindow *mainwin, |
| 513 | guint action, |
| 514 | GtkWidget *widget); |
| 515 | |
| 516 | static void new_account_cb (MainWindow *mainwin, |
| 517 | guint action, |
| 518 | GtkWidget *widget); |
| 519 | |
| 520 | static void account_selector_menu_cb (GtkMenuItem *menuitem, |
| 521 | gpointer data); |
| 522 | static void account_receive_menu_cb (GtkMenuItem *menuitem, |
| 523 | gpointer data); |
| 524 | |
| 525 | static void manual_open_cb (MainWindow *mainwin, |
| 526 | guint action, |
| 527 | GtkWidget *widget); |
| 528 | static void faq_open_cb (MainWindow *mainwin, |
| 529 | guint action, |
| 530 | GtkWidget *widget); |
| 531 | static void help_cmdline_cb (MainWindow *mainwin, |
| 532 | guint action, |
| 533 | GtkWidget *widget); |
| 534 | #if USE_UPDATE_CHECK
|
| 535 | static void update_check_cb (MainWindow *mainwin, |
| 536 | guint action, |
| 537 | GtkWidget *widget); |
| 538 | #ifdef USE_UPDATE_CHECK_PLUGIN
|
| 539 | static void update_check_plugin_cb(MainWindow *mainwin, guint action, |
| 540 | GtkWidget *widget); |
| 541 | #endif
|
| 542 | #endif
|
| 543 | |
| 544 | static void scan_tree_func (Folder *folder, |
| 545 | FolderItem *item, |
| 546 | gpointer data); |
| 547 | |
| 548 | static GtkItemFactoryEntry mainwin_entries[] =
|
| 549 | {
|
| 550 | {N_("/_File"), NULL, NULL, 0, "<Branch>"},
|
| 551 | {N_("/_File/_Folder"), NULL, NULL, 0, "<Branch>"},
|
| 552 | {N_("/_File/_Folder/Create _new folder..."),
|
| 553 | NULL, new_folder_cb, 0, NULL}, |
| 554 | {N_("/_File/_Folder/_Rename folder..."),NULL, rename_folder_cb, 0, NULL},
|
| 555 | {N_("/_File/_Folder/_Move folder..."), NULL, move_folder_cb, 0, NULL},
|
| 556 | {N_("/_File/_Folder/_Delete folder"), NULL, delete_folder_cb, 0, NULL},
|
| 557 | {N_("/_File/_Mailbox"), NULL, NULL, 0, "<Branch>"},
|
| 558 | {N_("/_File/_Mailbox/Add _mailbox..."), NULL, add_mailbox_cb, 0, NULL},
|
| 559 | {N_("/_File/_Mailbox/_Remove mailbox"), NULL, remove_mailbox_cb, 0, NULL},
|
| 560 | {N_("/_File/_Mailbox/---"), NULL, NULL, 0, "<Separator>"},
|
| 561 | {N_("/_File/_Mailbox/_Check for new messages"),
|
| 562 | NULL, update_folderview_cb, 0, NULL}, |
| 563 | {N_("/_File/_Mailbox/Check for new messages in _all mailboxes"),
|
| 564 | NULL, update_folderview_cb, 1, NULL}, |
| 565 | {N_("/_File/_Mailbox/---"), NULL, NULL, 0, "<Separator>"},
|
| 566 | {N_("/_File/_Mailbox/R_ebuild folder tree"),
|
| 567 | NULL, rebuild_tree_cb, 0, NULL}, |
| 568 | {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
|
| 569 | {N_("/_File/_Import mail data..."), NULL, import_mail_cb, 0, NULL},
|
| 570 | {N_("/_File/_Export mail data..."), NULL, export_mail_cb, 0, NULL},
|
| 571 | {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
|
| 572 | {N_("/_File/Empty all _trash"), NULL, empty_trash_cb, 0, NULL},
|
| 573 | {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
|
| 574 | {N_("/_File/_Save as..."), "<control>S", save_as_cb, 0, NULL},
|
| 575 | {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
|
| 576 | #if GTK_CHECK_VERSION(2, 10, 0) |
| 577 | {N_("/_File/Page set_up..."), NULL, page_setup_cb, 0, NULL},
|
| 578 | #endif
|
| 579 | {N_("/_File/_Print..."), NULL, print_cb, 0, NULL},
|
| 580 | {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
|
| 581 | {N_("/_File/_Work offline"), NULL, toggle_offline_cb, 0, "<ToggleItem>"},
|
| 582 | {N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
|
| 583 | /* {N_("/_File/_Close"), "<alt>W", app_exit_cb, 0, NULL}, */
|
| 584 | {N_("/_File/E_xit"), "<control>Q", app_exit_cb, 0, NULL},
|
| 585 | |
| 586 | {N_("/_Edit"), NULL, NULL, 0, "<Branch>"},
|
| 587 | {N_("/_Edit/_Copy"), "<control>C", copy_cb, 0, NULL},
|
| 588 | {N_("/_Edit/Select _all"), "<control>A", allsel_cb, 0, NULL},
|
| 589 | {N_("/_Edit/Select _thread"), NULL, select_thread_cb, 0, NULL},
|
| 590 | {N_("/_Edit/---"), NULL, NULL, 0, "<Separator>"},
|
| 591 | {N_("/_Edit/_Find in current message..."),
|
| 592 | "<control>F", search_cb, 0, NULL}, |
| 593 | {N_("/_Edit/_Search messages..."), "<shift><control>F", search_cb, 1, NULL},
|
| 594 | {N_("/_Edit/_Quick search"), "<shift><control>S", search_cb, 2, NULL},
|
| 595 | |
| 596 | {N_("/_View"), NULL, NULL, 0, "<Branch>"},
|
| 597 | {N_("/_View/Show or hi_de"), NULL, NULL, 0, "<Branch>"},
|
| 598 | {N_("/_View/Show or hi_de/_Folder tree"),
|
| 599 | NULL, toggle_folder_cb, 0, "<ToggleItem>"}, |
| 600 | {N_("/_View/Show or hi_de/_Message view"),
|
| 601 | "V", toggle_message_cb, 0, "<ToggleItem>"}, |
| 602 | {N_("/_View/Show or hi_de/_Toolbar"),
|
| 603 | NULL, NULL, 0, "<Branch>"}, |
| 604 | {N_("/_View/Show or hi_de/_Toolbar/Icon _and text"),
|
| 605 | NULL, toggle_toolbar_cb, TOOLBAR_BOTH, "<RadioItem>"}, |
| 606 | {N_("/_View/Show or hi_de/_Toolbar/Text at the _right of icon"),
|
| 607 | NULL, toggle_toolbar_cb, TOOLBAR_BOTH_HORIZ, "/View/Show or hide/Toolbar/Icon and text"}, |
| 608 | {N_("/_View/Show or hi_de/_Toolbar/_Icon"),
|
| 609 | NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Icon and text"}, |
| 610 | {N_("/_View/Show or hi_de/_Toolbar/_Text"),
|
| 611 | NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Icon and text"}, |
| 612 | {N_("/_View/Show or hi_de/_Toolbar/_None"),
|
| 613 | NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Icon and text"}, |
| 614 | {N_("/_View/Show or hi_de/_Search bar"),
|
| 615 | NULL, toggle_searchbar_cb, 0, "<ToggleItem>"}, |
| 616 | {N_("/_View/Show or hi_de/Status _bar"),
|
| 617 | NULL, toggle_statusbar_cb, 0, "<ToggleItem>"}, |
| 618 | {N_("/_View/_Customize toolbar..."), NULL, toolbar_customize_cb, 0, NULL},
|
| 619 | {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
|
| 620 | {N_("/_View/Layou_t"), NULL, NULL, 0, "<Branch>"},
|
| 621 | {N_("/_View/Layou_t/_Normal"), NULL, change_layout_cb, LAYOUT_NORMAL, "<RadioItem>"},
|
| 622 | {N_("/_View/Layou_t/_Vertical"), NULL, change_layout_cb, LAYOUT_VERTICAL, "/View/Layout/Normal"},
|
| 623 | {N_("/_View/Separate f_older tree"), NULL, separate_widget_cb, SEPARATE_FOLDER, "<ToggleItem>"},
|
| 624 | {N_("/_View/Separate _message view"), NULL, separate_widget_cb, SEPARATE_MESSAGE, "<ToggleItem>"},
|
| 625 | {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
|
| 626 | {N_("/_View/_Sort"), NULL, NULL, 0, "<Branch>"},
|
| 627 | {N_("/_View/_Sort/by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, "<RadioItem>"},
|
| 628 | {N_("/_View/_Sort/by s_ize"), NULL, sort_summary_cb, SORT_BY_SIZE, "/View/Sort/by number"},
|
| 629 | {N_("/_View/_Sort/by _date"), NULL, sort_summary_cb, SORT_BY_DATE, "/View/Sort/by number"},
|
| 630 | {N_("/_View/_Sort/by t_hread date"), NULL, sort_summary_cb, SORT_BY_TDATE, "/View/Sort/by number"},
|
| 631 | {N_("/_View/_Sort/by _from"), NULL, sort_summary_cb, SORT_BY_FROM, "/View/Sort/by number"},
|
| 632 | {N_("/_View/_Sort/by _recipient"), NULL, sort_summary_cb, SORT_BY_TO, "/View/Sort/by number"},
|
| 633 | {N_("/_View/_Sort/by _subject"), NULL, sort_summary_cb, SORT_BY_SUBJECT, "/View/Sort/by number"},
|
| 634 | {N_("/_View/_Sort/by _color label"),
|
| 635 | NULL, sort_summary_cb, SORT_BY_LABEL, "/View/Sort/by number"}, |
| 636 | {N_("/_View/_Sort/by _mark"), NULL, sort_summary_cb, SORT_BY_MARK, "/View/Sort/by number"},
|
| 637 | {N_("/_View/_Sort/by _unread"), NULL, sort_summary_cb, SORT_BY_UNREAD, "/View/Sort/by number"},
|
| 638 | {N_("/_View/_Sort/by a_ttachment"),
|
| 639 | NULL, sort_summary_cb, SORT_BY_MIME, "/View/Sort/by number"}, |
| 640 | {N_("/_View/_Sort/D_on't sort"), NULL, sort_summary_cb, SORT_BY_NONE, "/View/Sort/by number"},
|
| 641 | {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
|
| 642 | {N_("/_View/_Sort/Ascending"), NULL, sort_summary_type_cb, SORT_ASCENDING, "<RadioItem>"},
|
| 643 | {N_("/_View/_Sort/Descending"), NULL, sort_summary_type_cb, SORT_DESCENDING, "/View/Sort/Ascending"},
|
| 644 | {N_("/_View/_Sort/---"), NULL, NULL, 0, "<Separator>"},
|
| 645 | {N_("/_View/_Sort/_Attract by subject"),
|
| 646 | NULL, attract_by_subject_cb, 0, NULL}, |
| 647 | {N_("/_View/Th_read view"), "<control>T", thread_cb, 0, "<ToggleItem>"},
|
| 648 | {N_("/_View/E_xpand all threads"), NULL, expand_threads_cb, 0, NULL},
|
| 649 | {N_("/_View/Co_llapse all threads"), NULL, collapse_threads_cb, 0, NULL},
|
| 650 | {N_("/_View/Set display _item..."), NULL, set_display_item_cb, 0, NULL},
|
| 651 | |
| 652 | {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
|
| 653 | {N_("/_View/_Go to"), NULL, NULL, 0, "<Branch>"},
|
| 654 | {N_("/_View/_Go to/_Prev message"), "P", prev_cb, 0, NULL},
|
| 655 | {N_("/_View/_Go to/_Next message"), "N", next_cb, 0, NULL},
|
| 656 | {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
|
| 657 | {N_("/_View/_Go to/P_rev unread message"),
|
| 658 | "<shift>P", prev_unread_cb, 0, NULL}, |
| 659 | {N_("/_View/_Go to/N_ext unread message"),
|
| 660 | "<shift>N", next_unread_cb, 0, NULL}, |
| 661 | {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
|
| 662 | {N_("/_View/_Go to/Prev ne_w message"), NULL, prev_new_cb, 0, NULL},
|
| 663 | {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL},
|
| 664 | {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
|
| 665 | {N_("/_View/_Go to/Prev _marked message"),
|
| 666 | NULL, prev_marked_cb, 0, NULL}, |
| 667 | {N_("/_View/_Go to/Next m_arked message"),
|
| 668 | NULL, next_marked_cb, 0, NULL}, |
| 669 | {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
|
| 670 | {N_("/_View/_Go to/Prev _labeled message"),
|
| 671 | NULL, prev_labeled_cb, 0, NULL}, |
| 672 | {N_("/_View/_Go to/Next la_beled message"),
|
| 673 | NULL, next_labeled_cb, 0, NULL}, |
| 674 | {N_("/_View/_Go to/---"), NULL, NULL, 0, "<Separator>"},
|
| 675 | {N_("/_View/_Go to/Other _folder..."), "G", goto_folder_cb, 0, NULL},
|
| 676 | {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
|
| 677 | |
| 678 | #define ENC_SEPARATOR \
|
| 679 | {N_("/_View/Character _encoding/---"), NULL, NULL, 0, "<Separator>"}
|
| 680 | #define ENC_ACTION(action) \
|
| 681 | NULL, set_charset_cb, action, "/View/Character encoding/Auto detect" |
| 682 | |
| 683 | {N_("/_View/Character _encoding"), NULL, NULL, 0, "<Branch>"},
|
| 684 | {N_("/_View/Character _encoding/_Auto detect"),
|
| 685 | NULL, set_charset_cb, C_AUTO, "<RadioItem>"}, |
| 686 | {N_("/_View/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
|
| 687 | {N_("/_View/Character _encoding/7bit ascii (US-ASC_II)"),
|
| 688 | ENC_ACTION(C_US_ASCII)}, |
| 689 | {N_("/_View/Character _encoding/Unicode (_UTF-8)"),
|
| 690 | ENC_ACTION(C_UTF_8)}, |
| 691 | ENC_SEPARATOR, |
| 692 | |
| 693 | {N_("/_View/Character _encoding/Western European (ISO-8859-_1)"),
|
| 694 | ENC_ACTION(C_ISO_8859_1)}, |
| 695 | {N_("/_View/Character _encoding/Western European (ISO-8859-15)"),
|
| 696 | ENC_ACTION(C_ISO_8859_15)}, |
| 697 | {N_("/_View/Character _encoding/Western European (Windows-1252)"),
|
| 698 | ENC_ACTION(C_WINDOWS_1252)}, |
| 699 | ENC_SEPARATOR, |
| 700 | |
| 701 | {N_("/_View/Character _encoding/Central European (ISO-8859-_2)"),
|
| 702 | ENC_ACTION(C_ISO_8859_2)}, |
| 703 | ENC_SEPARATOR, |
| 704 | |
| 705 | {N_("/_View/Character _encoding/_Baltic (ISO-8859-13)"),
|
| 706 | ENC_ACTION(C_ISO_8859_13)}, |
| 707 | {N_("/_View/Character _encoding/Baltic (ISO-8859-_4)"),
|
| 708 | ENC_ACTION(C_ISO_8859_4)}, |
| 709 | {N_("/_View/Character _encoding/Baltic (Windows-1257)"),
|
| 710 | ENC_ACTION(C_WINDOWS_1257)}, |
| 711 | ENC_SEPARATOR, |
| 712 | |
| 713 | {N_("/_View/Character _encoding/Greek (ISO-8859-_7)"),
|
| 714 | ENC_ACTION(C_ISO_8859_7)}, |
| 715 | ENC_SEPARATOR, |
| 716 | |
| 717 | {N_("/_View/Character _encoding/Arabic (ISO-8859-_6)"),
|
| 718 | ENC_ACTION(C_ISO_8859_6)}, |
| 719 | {N_("/_View/Character _encoding/Arabic (Windows-1256)"),
|
| 720 | ENC_ACTION(C_CP1256)}, |
| 721 | ENC_SEPARATOR, |
| 722 | |
| 723 | {N_("/_View/Character _encoding/Hebrew (ISO-8859-_8)"),
|
| 724 | ENC_ACTION(C_ISO_8859_8)}, |
| 725 | {N_("/_View/Character _encoding/Hebrew (Windows-1255)"),
|
| 726 | ENC_ACTION(C_CP1255)}, |
| 727 | ENC_SEPARATOR, |
| 728 | |
| 729 | {N_("/_View/Character _encoding/Turkish (ISO-8859-_9)"),
|
| 730 | ENC_ACTION(C_ISO_8859_9)}, |
| 731 | ENC_SEPARATOR, |
| 732 | |
| 733 | {N_("/_View/Character _encoding/Cyrillic (ISO-8859-_5)"),
|
| 734 | ENC_ACTION(C_ISO_8859_5)}, |
| 735 | {N_("/_View/Character _encoding/Cyrillic (KOI8-_R)"),
|
| 736 | ENC_ACTION(C_KOI8_R)}, |
| 737 | {N_("/_View/Character _encoding/Cyrillic (KOI8-U)"),
|
| 738 | ENC_ACTION(C_KOI8_U)}, |
| 739 | {N_("/_View/Character _encoding/Cyrillic (Windows-1251)"),
|
| 740 | ENC_ACTION(C_CP1251)}, |
| 741 | ENC_SEPARATOR, |
| 742 | |
| 743 | {N_("/_View/Character _encoding/Japanese (ISO-2022-_JP)"),
|
| 744 | ENC_ACTION(C_ISO_2022_JP)}, |
| 745 | {N_("/_View/Character _encoding/Japanese (ISO-2022-JP-2)"),
|
| 746 | ENC_ACTION(C_ISO_2022_JP_2)}, |
| 747 | {N_("/_View/Character _encoding/Japanese (_EUC-JP)"),
|
| 748 | ENC_ACTION(C_EUC_JP)}, |
| 749 | {N_("/_View/Character _encoding/Japanese (_Shift__JIS)"),
|
| 750 | ENC_ACTION(C_SHIFT_JIS)}, |
| 751 | ENC_SEPARATOR, |
| 752 | |
| 753 | {N_("/_View/Character _encoding/Simplified Chinese (_GB2312)"),
|
| 754 | ENC_ACTION(C_GB2312)}, |
| 755 | {N_("/_View/Character _encoding/Simplified Chinese (GBK)"),
|
| 756 | ENC_ACTION(C_GBK)}, |
| 757 | {N_("/_View/Character _encoding/Traditional Chinese (_Big5)"),
|
| 758 | ENC_ACTION(C_BIG5)}, |
| 759 | {N_("/_View/Character _encoding/Traditional Chinese (EUC-_TW)"),
|
| 760 | ENC_ACTION(C_EUC_TW)}, |
| 761 | {N_("/_View/Character _encoding/Chinese (ISO-2022-_CN)"),
|
| 762 | ENC_ACTION(C_ISO_2022_CN)}, |
| 763 | ENC_SEPARATOR, |
| 764 | |
| 765 | {N_("/_View/Character _encoding/Korean (EUC-_KR)"),
|
| 766 | ENC_ACTION(C_EUC_KR)}, |
| 767 | {N_("/_View/Character _encoding/Korean (ISO-2022-KR)"),
|
| 768 | ENC_ACTION(C_ISO_2022_KR)}, |
| 769 | ENC_SEPARATOR, |
| 770 | |
| 771 | {N_("/_View/Character _encoding/Thai (TIS-620)"),
|
| 772 | ENC_ACTION(C_TIS_620)}, |
| 773 | {N_("/_View/Character _encoding/Thai (Windows-874)"),
|
| 774 | ENC_ACTION(C_WINDOWS_874)}, |
| 775 | |
| 776 | #undef CODESET_SEPARATOR
|
| 777 | #undef CODESET_ACTION
|
| 778 | |
| 779 | {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
|
| 780 | {N_("/_View/Open in new _window"), "<control><alt>N", open_msg_cb, 0, NULL},
|
| 781 | {N_("/_View/Mess_age source"), "<control>U", view_source_cb, 0, NULL},
|
| 782 | {N_("/_View/All _headers"), "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
|
| 783 | {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
|
| 784 | {N_("/_View/_Update summary"), "<control><alt>U", update_summary_cb, 0, NULL},
|
| 785 | |
| 786 | {N_("/_Message"), NULL, NULL, 0, "<Branch>"},
|
| 787 | {N_("/_Message/Recei_ve"), NULL, NULL, 0, "<Branch>"},
|
| 788 | {N_("/_Message/Recei_ve/Get from _current account"),
|
| 789 | "<control>I", inc_mail_cb, 0, NULL}, |
| 790 | {N_("/_Message/Recei_ve/Get from _all accounts"),
|
| 791 | "<shift><control>I", inc_all_account_mail_cb, 0, NULL}, |
| 792 | {N_("/_Message/Recei_ve/Stop receivin_g"),
|
| 793 | NULL, inc_stop_cb, 0, NULL}, |
| 794 | {N_("/_Message/Recei_ve/_Remote mailbox..."),
|
| 795 | NULL, rpop3_cb, 0, NULL}, |
| 796 | {N_("/_Message/Recei_ve/---"), NULL, NULL, 0, "<Separator>"},
|
| 797 | {N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
|
| 798 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 799 | {N_("/_Message/Compose _new message"), "<control>M", compose_cb, 0, NULL},
|
| 800 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 801 | {N_("/_Message/_Reply"), "<control>R", reply_cb, COMPOSE_REPLY, NULL},
|
| 802 | {N_("/_Message/Repl_y to"), NULL, NULL, 0, "<Branch>"},
|
| 803 | {N_("/_Message/Repl_y to/_all"), "<shift><control>R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
|
| 804 | {N_("/_Message/Repl_y to/_sender"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
|
| 805 | {N_("/_Message/Repl_y to/mailing _list"),
|
| 806 | "<control>L", reply_cb, COMPOSE_REPLY_TO_LIST, NULL}, |
| 807 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 808 | {N_("/_Message/_Forward"), "<control><alt>F", reply_cb, COMPOSE_FORWARD, NULL},
|
| 809 | {N_("/_Message/For_ward as attachment"),
|
| 810 | "<shift><control><alt>F", reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}, |
| 811 | {N_("/_Message/Redirec_t"), NULL, reply_cb, COMPOSE_REDIRECT, NULL},
|
| 812 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 813 | {N_("/_Message/M_ove..."), "<control>O", move_to_cb, 0, NULL},
|
| 814 | {N_("/_Message/_Copy..."), "<shift><control>O", copy_to_cb, 0, NULL},
|
| 815 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 816 | {N_("/_Message/_Mark"), NULL, NULL, 0, "<Branch>"},
|
| 817 | {N_("/_Message/_Mark/Set _flag"), "<shift>asterisk", mark_cb, 0, NULL},
|
| 818 | {N_("/_Message/_Mark/_Unset flag"), "U", unmark_cb, 0, NULL},
|
| 819 | {N_("/_Message/_Mark/---"), NULL, NULL, 0, "<Separator>"},
|
| 820 | {N_("/_Message/_Mark/Mark as unr_ead"), "<shift>exclam", mark_as_unread_cb, 0, NULL},
|
| 821 | {N_("/_Message/_Mark/Mark as rea_d"),
|
| 822 | NULL, mark_as_read_cb, 0, NULL}, |
| 823 | {N_("/_Message/_Mark/Mark _thread as read"),
|
| 824 | NULL, mark_thread_as_read_cb, 0, NULL}, |
| 825 | {N_("/_Message/_Mark/Mark all _read"), NULL, mark_all_read_cb, 0, NULL},
|
| 826 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 827 | {N_("/_Message/_Delete"), "<control>D", delete_cb, 0, NULL},
|
| 828 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 829 | {N_("/_Message/Set as _junk mail"), "<control>J", junk_cb, 0, NULL},
|
| 830 | {N_("/_Message/Set as not j_unk mail"), "<shift><control>J", junk_cb, 1, NULL},
|
| 831 | {N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
|
| 832 | {N_("/_Message/Re-_edit"), NULL, reedit_cb, 0, NULL},
|
| 833 | |
| 834 | {N_("/_Tools"), NULL, NULL, 0, "<Branch>"},
|
| 835 | {N_("/_Tools/_Address book"), "<shift><control>A", addressbook_open_cb, 0, NULL},
|
| 836 | {N_("/_Tools/Add sender to address boo_k..."),
|
| 837 | NULL, add_address_cb, 0, NULL}, |
| 838 | {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
|
| 839 | {N_("/_Tools/_Filter all messages in folder"),
|
| 840 | NULL, filter_cb, 0, NULL}, |
| 841 | {N_("/_Tools/Filter _selected messages"),
|
| 842 | NULL, filter_cb, 1, NULL}, |
| 843 | {N_("/_Tools/_Create filter rule"), NULL, NULL, 0, "<Branch>"},
|
| 844 | {N_("/_Tools/_Create filter rule/_Automatically"),
|
| 845 | NULL, create_filter_cb, FLT_BY_AUTO, NULL}, |
| 846 | {N_("/_Tools/_Create filter rule/by _From"),
|
| 847 | NULL, create_filter_cb, FLT_BY_FROM, NULL}, |
| 848 | {N_("/_Tools/_Create filter rule/by _To"),
|
| 849 | NULL, create_filter_cb, FLT_BY_TO, NULL}, |
| 850 | {N_("/_Tools/_Create filter rule/by _Subject"),
|
| 851 | NULL, create_filter_cb, FLT_BY_SUBJECT, NULL}, |
| 852 | {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
|
| 853 | {N_("/_Tools/Filter _junk mails in folder"),
|
| 854 | NULL, filter_junk_cb, 0, NULL}, |
| 855 | {N_("/_Tools/Filter junk _mails in selected messages"),
|
| 856 | NULL, filter_junk_cb, 1, NULL}, |
| 857 | {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
|
| 858 | #ifndef G_OS_WIN32
|
| 859 | {N_("/_Tools/Actio_ns"), NULL, NULL, 0, "<Branch>"},
|
| 860 | {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
|
| 861 | #endif
|
| 862 | {N_("/_Tools/Delete du_plicated messages"),
|
| 863 | NULL, delete_duplicated_cb, 0, NULL}, |
| 864 | {N_("/_Tools/C_oncatenate separated messages"),
|
| 865 | NULL, concat_partial_cb, 0, NULL}, |
| 866 | {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
|
| 867 | {N_("/_Tools/E_xecute marked process"), "X", execute_summary_cb, 0, NULL},
|
| 868 | {N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
|
| 869 | {N_("/_Tools/_Log window"), "<shift><control>L", log_window_show_cb, 0, NULL},
|
| 870 | |
| 871 | {N_("/_Configuration"), NULL, NULL, 0, "<Branch>"},
|
| 872 | {N_("/_Configuration/_Common preferences..."),
|
| 873 | NULL, prefs_common_open_cb, 0, NULL}, |
| 874 | {N_("/_Configuration/_Filter settings..."),
|
| 875 | NULL, prefs_filter_open_cb, 0, NULL}, |
| 876 | {N_("/_Configuration/_Template..."), NULL, prefs_template_open_cb, 0, NULL},
|
| 877 | #ifndef G_OS_WIN32
|
| 878 | {N_("/_Configuration/_Actions..."), NULL, prefs_actions_open_cb, 0, NULL},
|
| 879 | #endif
|
| 880 | {N_("/_Configuration/Plug-in _manager..."),
|
| 881 | NULL, plugin_manager_open_cb, 0, NULL}, |
| 882 | {N_("/_Configuration/---"), NULL, NULL, 0, "<Separator>"},
|
| 883 | {N_("/_Configuration/_Preferences for current account..."),
|
| 884 | NULL, prefs_account_open_cb, 0, NULL}, |
| 885 | {N_("/_Configuration/Create _new account..."),
|
| 886 | NULL, new_account_cb, 0, NULL}, |
| 887 | {N_("/_Configuration/_Edit accounts..."),
|
| 888 | NULL, account_edit_open, 0, NULL}, |
| 889 | {N_("/_Configuration/C_hange current account"),
|
| 890 | NULL, NULL, 0, "<Branch>"}, |
| 891 | |
| 892 | {N_("/_Help"), NULL, NULL, 0, "<Branch>"},
|
| 893 | {N_("/_Help/_Manual"), NULL, NULL, 0, "<Branch>"},
|
| 894 | {N_("/_Help/_Manual/_English"), NULL, manual_open_cb, MANUAL_LANG_EN, NULL},
|
| 895 | {N_("/_Help/_Manual/_Japanese"), NULL, manual_open_cb, MANUAL_LANG_JA, NULL},
|
| 896 | {N_("/_Help/_FAQ"), NULL, NULL, 0, "<Branch>"},
|
| 897 | {N_("/_Help/_FAQ/_English"), NULL, faq_open_cb, MANUAL_LANG_EN, NULL},
|
| 898 | {N_("/_Help/_FAQ/_German"), NULL, faq_open_cb, MANUAL_LANG_DE, NULL},
|
| 899 | {N_("/_Help/_FAQ/_Spanish"), NULL, faq_open_cb, MANUAL_LANG_ES, NULL},
|
| 900 | {N_("/_Help/_FAQ/_French"), NULL, faq_open_cb, MANUAL_LANG_FR, NULL},
|
| 901 | {N_("/_Help/_FAQ/_Italian"), NULL, faq_open_cb, MANUAL_LANG_IT, NULL},
|
| 902 | {N_("/_Help/_Command line options"), NULL, help_cmdline_cb, 0, NULL},
|
| 903 | #if USE_UPDATE_CHECK
|
| 904 | {N_("/_Help/---"), NULL, NULL, 0, "<Separator>"},
|
| 905 | {N_("/_Help/_Update check..."), NULL, update_check_cb, 0, NULL},
|
| 906 | #ifdef USE_UPDATE_CHECK_PLUGIN
|
| 907 | {N_("/_Help/Update check of _plug-ins..."),
|
| 908 | NULL, update_check_plugin_cb, 0, NULL}, |
| 909 | #endif
|
| 910 | #endif
|
| 911 | {N_("/_Help/---"), NULL, NULL, 0, "<Separator>"},
|
| 912 | {N_("/_Help/_About"), NULL, about_show, 0, NULL}
|
| 913 | }; |
| 914 | |
| 915 | MainWindow *main_window_create(SeparateType type) |
| 916 | {
|
| 917 | MainWindow *mainwin; |
| 918 | GtkWidget *window; |
| 919 | GtkWidget *vbox; |
| 920 | GtkWidget *menubar; |
| 921 | GtkWidget *toolbar; |
| 922 | GtkWidget *hbox_spc; |
| 923 | GtkWidget *vbox_body; |
| 924 | GtkWidget *statusbar; |
| 925 | GtkWidget *progressbar; |
| 926 | GtkWidget *statuslabel; |
| 927 | GtkWidget *online_hbox; |
| 928 | GtkWidget *online_switch; |
| 929 | GtkWidget *online_pixmap; |
| 930 | GtkWidget *offline_pixmap; |
| 931 | GtkTooltips *online_tip; |
| 932 | #if !GTK_CHECK_VERSION(2, 6, 0) |
| 933 | GtkWidget *spacer_hbox; |
| 934 | #endif
|
| 935 | GtkWidget *ac_button; |
| 936 | GtkWidget *ac_label; |
| 937 | |
| 938 | TrayIcon *tray_icon; |
| 939 | |
| 940 | FolderView *folderview; |
| 941 | SummaryView *summaryview; |
| 942 | MessageView *messageview; |
| 943 | GdkColormap *colormap; |
| 944 | GdkColor color[3];
|
| 945 | gboolean success[3];
|
| 946 | guint n_menu_entries; |
| 947 | GtkItemFactory *ifactory; |
| 948 | GtkWidget *ac_menu; |
| 949 | GtkWidget *menuitem; |
| 950 | gint i; |
| 951 | |
| 952 | static GdkGeometry geometry;
|
| 953 | |
| 954 | debug_print(_("Creating main window...\n"));
|
| 955 | mainwin = g_new0(MainWindow, 1);
|
| 956 | |
| 957 | /* main window */
|
| 958 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 959 | gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION); |
| 960 | gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE); |
| 961 | gtk_window_set_wmclass(GTK_WINDOW(window), "main_window", "Sylpheed"); |
| 962 | gtk_widget_add_events(window, GDK_VISIBILITY_NOTIFY_MASK); |
| 963 | g_signal_connect(G_OBJECT(window), "key_press_event",
|
| 964 | G_CALLBACK(main_window_key_pressed), mainwin); |
| 965 | |
| 966 | if (!geometry.min_height) {
|
| 967 | geometry.min_width = 320;
|
| 968 | geometry.min_height = 200;
|
| 969 | } |
| 970 | gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
|
| 971 | GDK_HINT_MIN_SIZE); |
| 972 | |
| 973 | g_signal_connect(G_OBJECT(window), "delete_event",
|
| 974 | G_CALLBACK(main_window_close_cb), mainwin); |
| 975 | MANAGE_WINDOW_SIGNALS_CONNECT(window); |
| 976 | gtk_widget_realize(window); |
| 977 | |
| 978 | vbox = gtk_vbox_new(FALSE, 0);
|
| 979 | gtk_widget_show(vbox); |
| 980 | gtk_container_add(GTK_CONTAINER(window), vbox); |
| 981 | |
| 982 | /* menu bar */
|
| 983 | n_menu_entries = sizeof(mainwin_entries) / sizeof(mainwin_entries[0]); |
| 984 | menubar = menubar_create(window, mainwin_entries, |
| 985 | n_menu_entries, "<Main>", mainwin);
|
| 986 | gtk_widget_show(menubar); |
| 987 | gtk_widget_set_size_request(menubar, 300, -1); |
| 988 | gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
|
| 989 | ifactory = gtk_item_factory_from_widget(menubar); |
| 990 | |
| 991 | /* toolbar */
|
| 992 | mainwin->toolbar_tip = gtk_tooltips_new(); |
| 993 | toolbar = main_window_toolbar_create(mainwin); |
| 994 | gtk_widget_set_size_request(toolbar, 300, -1); |
| 995 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
|
| 996 | |
| 997 | hbox_spc = gtk_hbox_new(FALSE, 0);
|
| 998 | gtk_widget_show(hbox_spc); |
| 999 | gtk_widget_set_size_request(hbox_spc, -1, BORDER_WIDTH);
|
| 1000 | gtk_box_pack_start(GTK_BOX(vbox), hbox_spc, FALSE, FALSE, 0);
|
| 1001 | |
| 1002 | /* vbox that contains body */
|
| 1003 | vbox_body = gtk_vbox_new(FALSE, BORDER_WIDTH); |
| 1004 | gtk_widget_show(vbox_body); |
| 1005 | gtk_container_set_border_width(GTK_CONTAINER(vbox_body), 0);
|
| 1006 | gtk_box_pack_start(GTK_BOX(vbox), vbox_body, TRUE, TRUE, 0);
|
| 1007 | |
| 1008 | statusbar = statusbar_create(); |
| 1009 | gtk_box_pack_end(GTK_BOX(vbox_body), statusbar, FALSE, FALSE, 0);
|
| 1010 | |
| 1011 | progressbar = gtk_progress_bar_new(); |
| 1012 | gtk_widget_set_size_request(progressbar, 120, 1); |
| 1013 | gtk_box_pack_start(GTK_BOX(statusbar), progressbar, FALSE, FALSE, 0);
|
| 1014 | |
| 1015 | statuslabel = gtk_label_new("");
|
| 1016 | gtk_box_pack_start(GTK_BOX(statusbar), statuslabel, FALSE, FALSE, 0);
|
| 1017 | |
| 1018 | online_hbox = gtk_hbox_new(FALSE, 0);
|
| 1019 | |
| 1020 | online_pixmap = stock_pixbuf_widget(statusbar, STOCK_PIXMAP_ONLINE); |
| 1021 | offline_pixmap = stock_pixbuf_widget(statusbar, STOCK_PIXMAP_OFFLINE); |
| 1022 | gtk_box_pack_start(GTK_BOX(online_hbox), online_pixmap, |
| 1023 | FALSE, FALSE, 0);
|
| 1024 | gtk_box_pack_start(GTK_BOX(online_hbox), offline_pixmap, |
| 1025 | FALSE, FALSE, 0);
|
| 1026 | |
| 1027 | online_switch = gtk_button_new(); |
| 1028 | gtk_button_set_relief(GTK_BUTTON(online_switch), GTK_RELIEF_NONE); |
| 1029 | GTK_WIDGET_UNSET_FLAGS(online_switch, GTK_CAN_FOCUS); |
| 1030 | #ifdef G_OS_WIN32
|
| 1031 | gtk_widget_set_size_request(online_switch, 34, 20); |
| 1032 | #else
|
| 1033 | gtk_widget_set_size_request(online_switch, 34, 24); |
| 1034 | #endif
|
| 1035 | gtk_container_add(GTK_CONTAINER(online_switch), online_hbox); |
| 1036 | g_signal_connect(G_OBJECT(online_switch), "clicked",
|
| 1037 | G_CALLBACK(online_switch_clicked), mainwin); |
| 1038 | gtk_box_pack_start(GTK_BOX(statusbar), online_switch, FALSE, FALSE, 0);
|
| 1039 | |
| 1040 | online_tip = gtk_tooltips_new(); |
| 1041 | |
| 1042 | #if !GTK_CHECK_VERSION(2, 6, 0) |
| 1043 | spacer_hbox = gtk_hbox_new(FALSE, 0);
|
| 1044 | gtk_box_pack_end(GTK_BOX(statusbar), spacer_hbox, FALSE, FALSE, 0);
|
| 1045 | #endif
|
| 1046 | |
| 1047 | ac_button = gtk_button_new(); |
| 1048 | gtk_button_set_relief(GTK_BUTTON(ac_button), GTK_RELIEF_NONE); |
| 1049 | GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS); |
| 1050 | gtk_widget_set_size_request(ac_button, -1, 1); |
| 1051 | gtk_box_pack_end(GTK_BOX(statusbar), ac_button, FALSE, FALSE, 0);
|
| 1052 | g_signal_connect(G_OBJECT(ac_button), "button_press_event",
|
| 1053 | G_CALLBACK(ac_label_button_pressed), mainwin); |
| 1054 | |
| 1055 | ac_label = gtk_label_new("");
|
| 1056 | gtk_container_add(GTK_CONTAINER(ac_button), ac_label); |
| 1057 | |
| 1058 | gtk_widget_show_all(statusbar); |
| 1059 | |
| 1060 | tray_icon = trayicon_create(mainwin); |
| 1061 | if (tray_icon && prefs_common.show_trayicon)
|
| 1062 | trayicon_show(tray_icon); |
| 1063 | |
| 1064 | /* create views */
|
| 1065 | mainwin->folderview = folderview = folderview_create(); |
| 1066 | mainwin->summaryview = summaryview = summary_create(); |
| 1067 | mainwin->messageview = messageview = messageview_create(); |
| 1068 | mainwin->logwin = log_window_create(); |
| 1069 | |
| 1070 | quick_search_create(summaryview); |
| 1071 | |
| 1072 | folderview->mainwin = mainwin; |
| 1073 | folderview->summaryview = summaryview; |
| 1074 | |
| 1075 | summaryview->mainwin = mainwin; |
| 1076 | summaryview->folderview = folderview; |
| 1077 | summaryview->messageview = messageview; |
| 1078 | summaryview->window = window; |
| 1079 | |
| 1080 | messageview->statusbar = statusbar; |
| 1081 | messageview->mainwin = mainwin; |
| 1082 | |
| 1083 | mainwin->window = window; |
| 1084 | mainwin->vbox = vbox; |
| 1085 | mainwin->menubar = menubar; |
| 1086 | mainwin->menu_factory = ifactory; |
| 1087 | mainwin->toolbar = toolbar; |
| 1088 | mainwin->vbox_body = vbox_body; |
| 1089 | mainwin->statusbar = statusbar; |
| 1090 | mainwin->progressbar = progressbar; |
| 1091 | mainwin->statuslabel = statuslabel; |
| 1092 | mainwin->online_switch = online_switch; |
| 1093 | mainwin->online_pixmap = online_pixmap; |
| 1094 | mainwin->offline_pixmap = offline_pixmap; |
| 1095 | mainwin->online_tip = online_tip; |
| 1096 | mainwin->ac_button = ac_button; |
| 1097 | mainwin->ac_label = ac_label; |
| 1098 | |
| 1099 | mainwin->tray_icon = tray_icon; |
| 1100 | |
| 1101 | /* set context IDs for status bar */
|
| 1102 | mainwin->mainwin_cid = gtk_statusbar_get_context_id |
| 1103 | (GTK_STATUSBAR(statusbar), "Main Window");
|
| 1104 | mainwin->folderview_cid = gtk_statusbar_get_context_id |
| 1105 | (GTK_STATUSBAR(statusbar), "Folder View");
|
| 1106 | mainwin->summaryview_cid = gtk_statusbar_get_context_id |
| 1107 | (GTK_STATUSBAR(statusbar), "Summary View");
|
| 1108 | mainwin->messageview_cid = gtk_statusbar_get_context_id |
| 1109 | (GTK_STATUSBAR(statusbar), "Message View");
|
| 1110 | |
| 1111 | messageview->statusbar_cid = mainwin->messageview_cid; |
| 1112 | |
| 1113 | /* allocate colors for summary view and folder view */
|
| 1114 | summaryview->color_marked.red = summaryview->color_marked.green = 0;
|
| 1115 | summaryview->color_marked.blue = (guint16)65535;
|
| 1116 | |
| 1117 | summaryview->color_dim.red = summaryview->color_dim.green = |
| 1118 | summaryview->color_dim.blue = COLOR_DIM; |
| 1119 | |
| 1120 | folderview->color_new.red = (guint16)55000;
|
| 1121 | folderview->color_new.green = folderview->color_new.blue = 15000;
|
| 1122 | |
| 1123 | folderview->color_noselect.red = folderview->color_noselect.green = |
| 1124 | folderview->color_noselect.blue = COLOR_DIM; |
| 1125 | |
| 1126 | color[0] = summaryview->color_marked;
|
| 1127 | color[1] = summaryview->color_dim;
|
| 1128 | color[2] = folderview->color_new;
|
| 1129 | |
| 1130 | colormap = gdk_window_get_colormap(window->window); |
| 1131 | gdk_colormap_alloc_colors(colormap, color, 3, FALSE, TRUE, success);
|
| 1132 | for (i = 0; i < 3; i++) { |
| 1133 | if (success[i] == FALSE)
|
| 1134 | g_warning(_("MainWindow: color allocation %d failed\n"), i);
|
| 1135 | } |
| 1136 | |
| 1137 | if (prefs_common.layout_type == LAYOUT_VERTICAL)
|
| 1138 | messageview->visible = TRUE; |
| 1139 | else
|
| 1140 | messageview->visible = prefs_common.msgview_visible; |
| 1141 | |
| 1142 | main_window_set_widgets(mainwin, prefs_common.layout_type, type); |
| 1143 | |
| 1144 | if (prefs_common.mainwin_maximized)
|
| 1145 | gtk_window_maximize(GTK_WINDOW(window)); |
| 1146 | |
| 1147 | g_signal_connect(G_OBJECT(window), "size_allocate",
|
| 1148 | G_CALLBACK(main_window_size_allocate_cb), mainwin); |
| 1149 | g_signal_connect(G_OBJECT(window), "window_state_event",
|
| 1150 | G_CALLBACK(main_window_window_state_cb), mainwin); |
| 1151 | g_signal_connect(G_OBJECT(window), "visibility_notify_event",
|
| 1152 | G_CALLBACK(main_window_visibility_notify_cb), mainwin); |
| 1153 | |
| 1154 | /* set menu items */
|
| 1155 | menuitem = gtk_item_factory_get_item |
| 1156 | (ifactory, "/View/Character encoding/Auto detect");
|
| 1157 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); |
| 1158 | |
| 1159 | main_window_toolbar_toggle_menu_set_active |
| 1160 | (mainwin, prefs_common.toolbar_style); |
| 1161 | |
| 1162 | gtk_widget_hide(GTK_WIDGET_PTR(summaryview->qsearch)); |
| 1163 | menuitem = gtk_item_factory_get_item |
| 1164 | (ifactory, "/View/Show or hide/Search bar");
|
| 1165 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 1166 | prefs_common.show_searchbar); |
| 1167 | |
| 1168 | gtk_widget_hide(mainwin->statusbar); |
| 1169 | menuitem = gtk_item_factory_get_item |
| 1170 | (ifactory, "/View/Show or hide/Status bar");
|
| 1171 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 1172 | prefs_common.show_statusbar); |
| 1173 | |
| 1174 | /* set account selection menu */
|
| 1175 | ac_menu = gtk_item_factory_get_widget |
| 1176 | (ifactory, "/Configuration/Change current account");
|
| 1177 | g_signal_connect(G_OBJECT(ac_menu), "selection_done",
|
| 1178 | G_CALLBACK(ac_menu_popup_closed), mainwin); |
| 1179 | mainwin->ac_menu = ac_menu; |
| 1180 | |
| 1181 | main_window_set_toolbar_sensitive(mainwin); |
| 1182 | main_window_set_toolbar_button_visibility(mainwin); |
| 1183 | |
| 1184 | /* create actions menu */
|
| 1185 | #ifndef G_OS_WIN32
|
| 1186 | action_update_mainwin_menu(ifactory, mainwin); |
| 1187 | #endif
|
| 1188 | |
| 1189 | /* initialize online switch */
|
| 1190 | prefs_common.online_mode = !prefs_common.online_mode; |
| 1191 | online_switch_clicked(online_switch, mainwin); |
| 1192 | |
| 1193 | /* show main window */
|
| 1194 | gtk_widget_show(mainwin->window); |
| 1195 | |
| 1196 | #if !GTK_CHECK_VERSION(2, 6, 0) |
| 1197 | {
|
| 1198 | gint w, h; |
| 1199 | gdk_drawable_get_size |
| 1200 | (GDK_DRAWABLE(GTK_STATUSBAR(statusbar)->grip_window), |
| 1201 | &w, &h); |
| 1202 | gtk_widget_set_size_request(spacer_hbox, w, -1);
|
| 1203 | } |
| 1204 | #endif
|
| 1205 | |
| 1206 | /* initialize views */
|
| 1207 | folderview_init(folderview); |
| 1208 | summary_init(summaryview); |
| 1209 | messageview_init(messageview); |
| 1210 | log_window_init(mainwin->logwin); |
| 1211 | |
| 1212 | mainwin->lock_count = 0;
|
| 1213 | mainwin->menu_lock_count = 0;
|
| 1214 | mainwin->cursor_count = 0;
|
| 1215 | |
| 1216 | mainwin->window_hidden = FALSE; |
| 1217 | mainwin->window_obscured = FALSE; |
| 1218 | |
| 1219 | if (!watch_cursor)
|
| 1220 | watch_cursor = gdk_cursor_new(GDK_WATCH); |
| 1221 | |
| 1222 | mainwin_list = g_list_append(mainwin_list, mainwin); |
| 1223 | |
| 1224 | debug_print(_("done.\n"));
|
| 1225 | |
| 1226 | return mainwin;
|
| 1227 | } |
| 1228 | |
| 1229 | void main_window_cursor_wait(MainWindow *mainwin)
|
| 1230 | {
|
| 1231 | |
| 1232 | if (mainwin->cursor_count == 0) |
| 1233 | gdk_window_set_cursor(mainwin->window->window, watch_cursor); |
| 1234 | |
| 1235 | mainwin->cursor_count++; |
| 1236 | |
| 1237 | gdk_flush(); |
| 1238 | } |
| 1239 | |
| 1240 | void main_window_cursor_normal(MainWindow *mainwin)
|
| 1241 | {
|
| 1242 | if (mainwin->cursor_count)
|
| 1243 | mainwin->cursor_count--; |
| 1244 | |
| 1245 | if (mainwin->cursor_count == 0) |
| 1246 | gdk_window_set_cursor(mainwin->window->window, NULL);
|
| 1247 | |
| 1248 | gdk_flush(); |
| 1249 | } |
| 1250 | |
| 1251 | /* lock / unlock the user-interface */
|
| 1252 | void main_window_lock(MainWindow *mainwin)
|
| 1253 | {
|
| 1254 | if (mainwin->lock_count == 0) |
| 1255 | gtk_widget_set_sensitive(mainwin->ac_button, FALSE); |
| 1256 | |
| 1257 | mainwin->lock_count++; |
| 1258 | |
| 1259 | main_window_set_menu_sensitive(mainwin); |
| 1260 | main_window_set_toolbar_sensitive(mainwin); |
| 1261 | } |
| 1262 | |
| 1263 | void main_window_unlock(MainWindow *mainwin)
|
| 1264 | {
|
| 1265 | if (mainwin->lock_count)
|
| 1266 | mainwin->lock_count--; |
| 1267 | |
| 1268 | main_window_set_menu_sensitive(mainwin); |
| 1269 | main_window_set_toolbar_sensitive(mainwin); |
| 1270 | |
| 1271 | if (mainwin->lock_count == 0) |
| 1272 | gtk_widget_set_sensitive(mainwin->ac_button, TRUE); |
| 1273 | } |
| 1274 | |
| 1275 | static void main_window_menu_callback_block(MainWindow *mainwin) |
| 1276 | {
|
| 1277 | mainwin->menu_lock_count++; |
| 1278 | } |
| 1279 | |
| 1280 | static void main_window_menu_callback_unblock(MainWindow *mainwin) |
| 1281 | {
|
| 1282 | if (mainwin->menu_lock_count)
|
| 1283 | mainwin->menu_lock_count--; |
| 1284 | } |
| 1285 | |
| 1286 | void main_window_reflect_prefs_all(void) |
| 1287 | {
|
| 1288 | MainWindow *mainwin; |
| 1289 | |
| 1290 | mainwin = main_window_get(); |
| 1291 | |
| 1292 | main_window_show_cur_account(mainwin); |
| 1293 | main_window_set_menu_sensitive(mainwin); |
| 1294 | main_window_set_toolbar_sensitive(mainwin); |
| 1295 | main_window_set_toolbar_button_visibility(mainwin); |
| 1296 | |
| 1297 | if (mainwin->tray_icon) {
|
| 1298 | if (prefs_common.show_trayicon)
|
| 1299 | trayicon_show(mainwin->tray_icon); |
| 1300 | else {
|
| 1301 | /* trayicon is automatically replaced by new one */
|
| 1302 | trayicon_hide(mainwin->tray_icon); |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | folderview_reflect_prefs(mainwin->folderview); |
| 1307 | |
| 1308 | messageview_reflect_prefs(mainwin->messageview); |
| 1309 | |
| 1310 | headerview_set_visibility(mainwin->messageview->headerview, |
| 1311 | prefs_common.display_header_pane); |
| 1312 | |
| 1313 | textview_reflect_prefs(mainwin->messageview->textview); |
| 1314 | textview_reflect_prefs(mainwin->messageview->mimeview->textview); |
| 1315 | |
| 1316 | summary_redisplay_msg(mainwin->summaryview); |
| 1317 | } |
| 1318 | |
| 1319 | void main_window_set_summary_column(void) |
| 1320 | {
|
| 1321 | summary_set_column_order(main_window_get()->summaryview); |
| 1322 | } |
| 1323 | |
| 1324 | static void main_window_set_account_selector_menu(MainWindow *mainwin, |
| 1325 | GList *account_list) |
| 1326 | {
|
| 1327 | GList *cur_ac, *cur_item; |
| 1328 | GtkWidget *menuitem; |
| 1329 | PrefsAccount *ac_prefs; |
| 1330 | |
| 1331 | /* destroy all previous menu item */
|
| 1332 | cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children; |
| 1333 | while (cur_item != NULL) { |
| 1334 | GList *next = cur_item->next; |
| 1335 | gtk_widget_destroy(GTK_WIDGET(cur_item->data)); |
| 1336 | cur_item = next; |
| 1337 | } |
| 1338 | |
| 1339 | for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) { |
| 1340 | ac_prefs = (PrefsAccount *)cur_ac->data; |
| 1341 | |
| 1342 | menuitem = gtk_menu_item_new_with_label |
| 1343 | (ac_prefs->account_name |
| 1344 | ? ac_prefs->account_name : _("Untitled"));
|
| 1345 | gtk_widget_show(menuitem); |
| 1346 | gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem); |
| 1347 | g_signal_connect(G_OBJECT(menuitem), "activate",
|
| 1348 | G_CALLBACK(account_selector_menu_cb), |
| 1349 | ac_prefs); |
| 1350 | } |
| 1351 | } |
| 1352 | |
| 1353 | static void main_window_set_account_receive_menu(MainWindow *mainwin, |
| 1354 | GList *account_list) |
| 1355 | {
|
| 1356 | GList *cur_ac, *cur_item; |
| 1357 | GtkWidget *menu; |
| 1358 | GtkWidget *menuitem; |
| 1359 | PrefsAccount *ac_prefs; |
| 1360 | |
| 1361 | menu = gtk_item_factory_get_widget(mainwin->menu_factory, |
| 1362 | "/Message/Receive");
|
| 1363 | |
| 1364 | /* search for separator */
|
| 1365 | for (cur_item = GTK_MENU_SHELL(menu)->children; cur_item != NULL; |
| 1366 | cur_item = cur_item->next) {
|
| 1367 | if (GTK_BIN(cur_item->data)->child == NULL) { |
| 1368 | cur_item = cur_item->next; |
| 1369 | break;
|
| 1370 | } |
| 1371 | } |
| 1372 | |
| 1373 | /* destroy all previous menu item */
|
| 1374 | while (cur_item != NULL) { |
| 1375 | GList *next = cur_item->next; |
| 1376 | gtk_widget_destroy(GTK_WIDGET(cur_item->data)); |
| 1377 | cur_item = next; |
| 1378 | } |
| 1379 | |
| 1380 | for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) { |
| 1381 | ac_prefs = (PrefsAccount *)cur_ac->data; |
| 1382 | |
| 1383 | menuitem = gtk_menu_item_new_with_label |
| 1384 | (ac_prefs->account_name ? ac_prefs->account_name |
| 1385 | : _("Untitled"));
|
| 1386 | gtk_widget_show(menuitem); |
| 1387 | gtk_menu_append(GTK_MENU(menu), menuitem); |
| 1388 | g_signal_connect(G_OBJECT(menuitem), "activate",
|
| 1389 | G_CALLBACK(account_receive_menu_cb), |
| 1390 | ac_prefs); |
| 1391 | } |
| 1392 | } |
| 1393 | |
| 1394 | void main_window_set_account_menu(GList *account_list)
|
| 1395 | {
|
| 1396 | MainWindow *mainwin; |
| 1397 | |
| 1398 | mainwin = main_window_get(); |
| 1399 | main_window_set_account_selector_menu(mainwin, account_list); |
| 1400 | main_window_set_account_receive_menu(mainwin, account_list); |
| 1401 | } |
| 1402 | |
| 1403 | static void main_window_show_cur_account(MainWindow *mainwin) |
| 1404 | {
|
| 1405 | gchar *buf; |
| 1406 | gchar *ac_name; |
| 1407 | |
| 1408 | ac_name = g_strdup(cur_account |
| 1409 | ? (cur_account->account_name |
| 1410 | ? cur_account->account_name : _("Untitled"))
|
| 1411 | : _("none"));
|
| 1412 | |
| 1413 | if (cur_account)
|
| 1414 | buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
|
| 1415 | else
|
| 1416 | buf = g_strdup(PROG_VERSION); |
| 1417 | gtk_window_set_title(GTK_WINDOW(mainwin->window), buf); |
| 1418 | g_free(buf); |
| 1419 | |
| 1420 | gtk_label_set_text(GTK_LABEL(mainwin->ac_label), ac_name); |
| 1421 | gtk_widget_queue_resize(mainwin->ac_button); |
| 1422 | |
| 1423 | g_free(ac_name); |
| 1424 | } |
| 1425 | |
| 1426 | void main_window_change_cur_account(void) |
| 1427 | {
|
| 1428 | MainWindow *mainwin; |
| 1429 | |
| 1430 | mainwin = main_window_get(); |
| 1431 | main_window_show_cur_account(mainwin); |
| 1432 | main_window_set_menu_sensitive(mainwin); |
| 1433 | main_window_set_toolbar_sensitive(mainwin); |
| 1434 | } |
| 1435 | |
| 1436 | MainWindow *main_window_get(void)
|
| 1437 | {
|
| 1438 | if (mainwin_list)
|
| 1439 | return (MainWindow *)mainwin_list->data;
|
| 1440 | else
|
| 1441 | return NULL; |
| 1442 | } |
| 1443 | |
| 1444 | GtkWidget *main_window_get_folder_window(MainWindow *mainwin) |
| 1445 | {
|
| 1446 | switch (mainwin->type) {
|
| 1447 | case SEPARATE_FOLDER:
|
| 1448 | return mainwin->win.sep_folder.folderwin;
|
| 1449 | case SEPARATE_BOTH:
|
| 1450 | return mainwin->win.sep_both.folderwin;
|
| 1451 | default:
|
| 1452 | return NULL; |
| 1453 | } |
| 1454 | } |
| 1455 | |
| 1456 | GtkWidget *main_window_get_message_window(MainWindow *mainwin) |
| 1457 | {
|
| 1458 | switch (mainwin->type) {
|
| 1459 | case SEPARATE_MESSAGE:
|
| 1460 | return mainwin->win.sep_message.messagewin;
|
| 1461 | case SEPARATE_BOTH:
|
| 1462 | return mainwin->win.sep_both.messagewin;
|
| 1463 | default:
|
| 1464 | return NULL; |
| 1465 | } |
| 1466 | } |
| 1467 | |
| 1468 | void main_window_hide(MainWindow *mainwin)
|
| 1469 | {
|
| 1470 | GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview); |
| 1471 | GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview); |
| 1472 | GtkWidget *message_wid = GTK_WIDGET_PTR(mainwin->messageview); |
| 1473 | GtkWidget *qsearch_wid = GTK_WIDGET_PTR(mainwin->summaryview->qsearch); |
| 1474 | GtkWidget *vbox_summary = qsearch_wid->parent; |
| 1475 | |
| 1476 | /* remove widgets from those containers */
|
| 1477 | gtkut_container_remove |
| 1478 | (GTK_CONTAINER(folder_wid->parent), folder_wid); |
| 1479 | gtkut_container_remove |
| 1480 | (GTK_CONTAINER(summary_wid->parent), summary_wid); |
| 1481 | gtkut_container_remove |
| 1482 | (GTK_CONTAINER(message_wid->parent), message_wid); |
| 1483 | gtkut_container_remove |
| 1484 | (GTK_CONTAINER(qsearch_wid->parent), qsearch_wid); |
| 1485 | |
| 1486 | /* clean containers */
|
| 1487 | switch (mainwin->type) {
|
| 1488 | case SEPARATE_NONE:
|
| 1489 | if (!mainwin->win.sep_none.vpaned->parent)
|
| 1490 | gtk_widget_destroy(mainwin->win.sep_none.vpaned); |
| 1491 | gtk_widget_destroy(mainwin->win.sep_none.hpaned); |
| 1492 | mainwin->win.sep_none.hpaned = NULL;
|
| 1493 | mainwin->win.sep_none.vpaned = NULL;
|
| 1494 | break;
|
| 1495 | case SEPARATE_FOLDER:
|
| 1496 | gtk_widget_destroy(mainwin->win.sep_folder.folderwin); |
| 1497 | if (!mainwin->win.sep_folder.vpaned->parent)
|
| 1498 | gtk_widget_destroy(mainwin->win.sep_folder.vpaned); |
| 1499 | gtk_widget_destroy(vbox_summary); |
| 1500 | mainwin->win.sep_folder.folderwin = NULL;
|
| 1501 | mainwin->win.sep_folder.vpaned = NULL;
|
| 1502 | break;
|
| 1503 | case SEPARATE_MESSAGE:
|
| 1504 | gtk_widget_destroy(mainwin->win.sep_message.messagewin); |
| 1505 | gtk_widget_destroy(mainwin->win.sep_message.hpaned); |
| 1506 | mainwin->win.sep_message.messagewin = NULL;
|
| 1507 | mainwin->win.sep_message.hpaned = NULL;
|
| 1508 | break;
|
| 1509 | case SEPARATE_BOTH:
|
| 1510 | gtk_widget_destroy(vbox_summary); |
| 1511 | gtk_widget_destroy(mainwin->win.sep_both.folderwin); |
| 1512 | gtk_widget_destroy(mainwin->win.sep_both.messagewin); |
| 1513 | mainwin->win.sep_both.folderwin = NULL;
|
| 1514 | mainwin->win.sep_both.messagewin = NULL;
|
| 1515 | break;
|
| 1516 | } |
| 1517 | |
| 1518 | gtk_widget_hide(mainwin->window); |
| 1519 | } |
| 1520 | |
| 1521 | void main_window_change_layout(MainWindow *mainwin, LayoutType layout,
|
| 1522 | SeparateType type) |
| 1523 | {
|
| 1524 | GtkWidget *folder_wid = GTK_WIDGET_PTR(mainwin->folderview); |
| 1525 | GtkWidget *summary_wid = GTK_WIDGET_PTR(mainwin->summaryview); |
| 1526 | GtkWidget *message_wid = GTK_WIDGET_PTR(mainwin->messageview); |
| 1527 | GtkWidget *qsearch_wid = GTK_WIDGET_PTR(mainwin->summaryview->qsearch); |
| 1528 | GtkWidget *focus_widget; |
| 1529 | |
| 1530 | debug_print("Changing window layout type (layout: %d -> %d, separation: %d -> %d)\n", prefs_common.layout_type, layout, mainwin->type, type);
|
| 1531 | |
| 1532 | if (prefs_common.layout_type == layout && mainwin->type == type)
|
| 1533 | return;
|
| 1534 | |
| 1535 | /* keep previous focus */
|
| 1536 | focus_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window)); |
| 1537 | |
| 1538 | gtk_widget_ref(folder_wid); |
| 1539 | gtk_widget_ref(summary_wid); |
| 1540 | gtk_widget_ref(message_wid); |
| 1541 | gtk_widget_ref(qsearch_wid); |
| 1542 | |
| 1543 | main_window_hide(mainwin); |
| 1544 | main_window_set_widgets(mainwin, layout, type); |
| 1545 | gtk_widget_show(mainwin->window); |
| 1546 | if (focus_widget)
|
| 1547 | gtk_widget_grab_focus(focus_widget); |
| 1548 | |
| 1549 | gtk_widget_unref(folder_wid); |
| 1550 | gtk_widget_unref(summary_wid); |
| 1551 | gtk_widget_unref(message_wid); |
| 1552 | gtk_widget_unref(qsearch_wid); |
| 1553 | } |
| 1554 | |
| 1555 | void main_window_toggle_message_view(MainWindow *mainwin)
|
| 1556 | {
|
| 1557 | SummaryView *summaryview = mainwin->summaryview; |
| 1558 | union CompositeWin *cwin = &mainwin->win;
|
| 1559 | GtkWidget *vpaned = NULL;
|
| 1560 | GtkWidget *container = NULL;
|
| 1561 | GtkWidget *msgwin = NULL;
|
| 1562 | gboolean use_vlayout = (prefs_common.layout_type == LAYOUT_VERTICAL); |
| 1563 | |
| 1564 | switch (mainwin->type) {
|
| 1565 | case SEPARATE_NONE:
|
| 1566 | vpaned = cwin->sep_none.vpaned; |
| 1567 | container = GTK_WIDGET_PTR(summaryview->qsearch)->parent; |
| 1568 | break;
|
| 1569 | case SEPARATE_FOLDER:
|
| 1570 | vpaned = cwin->sep_folder.vpaned; |
| 1571 | container = GTK_WIDGET_PTR(summaryview->qsearch)->parent; |
| 1572 | break;
|
| 1573 | case SEPARATE_MESSAGE:
|
| 1574 | msgwin = mainwin->win.sep_message.messagewin; |
| 1575 | break;
|
| 1576 | case SEPARATE_BOTH:
|
| 1577 | msgwin = mainwin->win.sep_both.messagewin; |
| 1578 | break;
|
| 1579 | } |
| 1580 | |
| 1581 | if (msgwin) {
|
| 1582 | /* separate message view */
|
| 1583 | if (GTK_WIDGET_VISIBLE(msgwin)) {
|
| 1584 | gtk_widget_hide(msgwin); |
| 1585 | mainwin->messageview->visible = FALSE; |
| 1586 | summaryview->displayed = NULL;
|
| 1587 | } else {
|
| 1588 | gtk_widget_show(msgwin); |
| 1589 | mainwin->messageview->visible = TRUE; |
| 1590 | } |
| 1591 | } else if (vpaned->parent != NULL) { |
| 1592 | /* hide message view */
|
| 1593 | mainwin->messageview->visible = FALSE; |
| 1594 | summaryview->displayed = NULL;
|
| 1595 | gtk_widget_ref(vpaned); |
| 1596 | gtkut_container_remove(GTK_CONTAINER(container), vpaned); |
| 1597 | gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container); |
| 1598 | if (!use_vlayout)
|
| 1599 | gtk_widget_hide(summaryview->hseparator); |
| 1600 | } else {
|
| 1601 | /* show message view */
|
| 1602 | mainwin->messageview->visible = TRUE; |
| 1603 | gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), vpaned); |
| 1604 | gtk_container_add(GTK_CONTAINER(container), vpaned); |
| 1605 | gtk_widget_unref(vpaned); |
| 1606 | if (!use_vlayout)
|
| 1607 | gtk_widget_show(summaryview->hseparator); |
| 1608 | } |
| 1609 | |
| 1610 | if (messageview_is_visible(mainwin->messageview))
|
| 1611 | gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), |
| 1612 | use_vlayout ? GTK_ARROW_RIGHT : GTK_ARROW_DOWN, |
| 1613 | GTK_SHADOW_OUT); |
| 1614 | else
|
| 1615 | gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), |
| 1616 | use_vlayout ? GTK_ARROW_LEFT : GTK_ARROW_UP, |
| 1617 | GTK_SHADOW_OUT); |
| 1618 | |
| 1619 | if (mainwin->messageview->visible == FALSE)
|
| 1620 | messageview_clear(mainwin->messageview); |
| 1621 | |
| 1622 | main_window_set_menu_sensitive(mainwin); |
| 1623 | |
| 1624 | prefs_common.msgview_visible = mainwin->messageview->visible; |
| 1625 | |
| 1626 | gtk_widget_grab_focus(summaryview->treeview); |
| 1627 | } |
| 1628 | |
| 1629 | void main_window_get_size(MainWindow *mainwin)
|
| 1630 | {
|
| 1631 | GtkAllocation *allocation; |
| 1632 | gboolean vlayout = (prefs_common.layout_type == LAYOUT_VERTICAL); |
| 1633 | |
| 1634 | allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation); |
| 1635 | if (allocation->width > 1 && allocation->height > 1) { |
| 1636 | if (vlayout) {
|
| 1637 | if (!(mainwin->type & SEPARATE_MESSAGE) &&
|
| 1638 | messageview_is_visible(mainwin->messageview)) |
| 1639 | prefs_common.summaryview_vwidth = allocation->width; |
| 1640 | prefs_common.summaryview_vheight = allocation->height; |
| 1641 | } else {
|
| 1642 | if (!prefs_common.mainwin_maximized) {
|
| 1643 | prefs_common.summaryview_width = allocation->width; |
| 1644 | prefs_common.mainview_width = allocation->width; |
| 1645 | } |
| 1646 | if ((mainwin->type == SEPARATE_NONE ||
|
| 1647 | mainwin->type == SEPARATE_FOLDER) && |
| 1648 | messageview_is_visible(mainwin->messageview)) |
| 1649 | prefs_common.summaryview_height = allocation->height; |
| 1650 | } |
| 1651 | } |
| 1652 | |
| 1653 | if (prefs_common.mainwin_maximized) {
|
| 1654 | allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation); |
| 1655 | if (allocation->width > 1 && allocation->height > 1) |
| 1656 | prefs_common.folderview_width = allocation->width; |
| 1657 | return;
|
| 1658 | } |
| 1659 | |
| 1660 | allocation = &mainwin->window->allocation; |
| 1661 | if (allocation->width > 1 && allocation->height > 1) { |
| 1662 | prefs_common.mainview_height = allocation->height; |
| 1663 | prefs_common.mainwin_width = allocation->width; |
| 1664 | prefs_common.mainwin_height = allocation->height; |
| 1665 | } |
| 1666 | |
| 1667 | allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation); |
| 1668 | if (allocation->width > 1 && allocation->height > 1) { |
| 1669 | prefs_common.folderview_width = allocation->width; |
| 1670 | prefs_common.folderview_height = allocation->height; |
| 1671 | } |
| 1672 | |
| 1673 | allocation = &(GTK_WIDGET_PTR(mainwin->messageview)->allocation); |
| 1674 | if (allocation->width > 1 && allocation->height > 1) { |
| 1675 | if (vlayout) {
|
| 1676 | prefs_common.msgview_vwidth = allocation->width; |
| 1677 | prefs_common.msgview_vheight = allocation->height; |
| 1678 | } else {
|
| 1679 | prefs_common.msgview_width = allocation->width; |
| 1680 | prefs_common.msgview_height = allocation->height; |
| 1681 | } |
| 1682 | } |
| 1683 | |
| 1684 | #if 0
|
| 1685 | debug_print("summaryview size: %d x %d\n",
|
| 1686 | prefs_common.summaryview_width, |
| 1687 | prefs_common.summaryview_height); |
| 1688 | debug_print("mainwin size: %d x %d\n",
|
| 1689 | prefs_common.mainwin_width, |
| 1690 | prefs_common.mainwin_height); |
| 1691 | debug_print("folderview size: %d x %d\n",
|
| 1692 | prefs_common.folderview_width, |
| 1693 | prefs_common.folderview_height); |
| 1694 | debug_print("messageview size: %d x %d\n",
|
| 1695 | prefs_common.msgview_width, |
| 1696 | prefs_common.msgview_height); |
| 1697 | #endif |
| 1698 | } |
| 1699 | |
| 1700 | void main_window_get_position(MainWindow *mainwin)
|
| 1701 | {
|
| 1702 | gint x, y; |
| 1703 | GtkWidget *window; |
| 1704 | |
| 1705 | if (prefs_common.mainwin_maximized || mainwin->window_hidden)
|
| 1706 | return;
|
| 1707 | |
| 1708 | gtkut_widget_get_uposition(mainwin->window, &x, &y); |
| 1709 | |
| 1710 | prefs_common.mainview_x = x; |
| 1711 | prefs_common.mainview_y = y; |
| 1712 | prefs_common.mainwin_x = x; |
| 1713 | prefs_common.mainwin_y = y; |
| 1714 | |
| 1715 | debug_print("main window position: %d, %d\n", x, y);
|
| 1716 | |
| 1717 | window = main_window_get_folder_window(mainwin); |
| 1718 | if (window) {
|
| 1719 | gtkut_widget_get_uposition(window, &x, &y); |
| 1720 | prefs_common.folderwin_x = x; |
| 1721 | prefs_common.folderwin_y = y; |
| 1722 | debug_print("folder window position: %d, %d\n", x, y);
|
| 1723 | } |
| 1724 | window = main_window_get_message_window(mainwin); |
| 1725 | if (window) {
|
| 1726 | gtkut_widget_get_uposition(window, &x, &y); |
| 1727 | prefs_common.main_msgwin_x = x; |
| 1728 | prefs_common.main_msgwin_y = y; |
| 1729 | debug_print("message window position: %d, %d\n", x, y);
|
| 1730 | } |
| 1731 | } |
| 1732 | |
| 1733 | void main_window_progress_on(MainWindow *mainwin)
|
| 1734 | {
|
| 1735 | gtk_progress_set_show_text(GTK_PROGRESS(mainwin->progressbar), TRUE); |
| 1736 | gtk_progress_set_format_string(GTK_PROGRESS(mainwin->progressbar), "");
|
| 1737 | } |
| 1738 | |
| 1739 | void main_window_progress_off(MainWindow *mainwin)
|
| 1740 | {
|
| 1741 | gtk_progress_set_show_text(GTK_PROGRESS(mainwin->progressbar), FALSE); |
| 1742 | gtk_progress_bar_update(GTK_PROGRESS_BAR(mainwin->progressbar), 0.0); |
| 1743 | gtk_progress_set_format_string(GTK_PROGRESS(mainwin->progressbar), "");
|
| 1744 | } |
| 1745 | |
| 1746 | void main_window_progress_set(MainWindow *mainwin, gint cur, gint total)
|
| 1747 | {
|
| 1748 | gchar buf[32];
|
| 1749 | |
| 1750 | g_snprintf(buf, sizeof(buf), "%d / %d", cur, total); |
| 1751 | gtk_progress_set_format_string(GTK_PROGRESS(mainwin->progressbar), buf); |
| 1752 | gtk_progress_bar_update(GTK_PROGRESS_BAR(mainwin->progressbar), |
| 1753 | (cur == 0 && total == 0) ? 0 : |
| 1754 | (gfloat)cur / (gfloat)total); |
| 1755 | } |
| 1756 | |
| 1757 | void main_window_progress_show(gint cur, gint total)
|
| 1758 | {
|
| 1759 | MainWindow *mainwin; |
| 1760 | |
| 1761 | mainwin = main_window_get(); |
| 1762 | |
| 1763 | if (total > 0) { |
| 1764 | gtk_progress_set_show_text(GTK_PROGRESS(mainwin->progressbar), |
| 1765 | TRUE); |
| 1766 | main_window_progress_set(mainwin, cur, total); |
| 1767 | } else
|
| 1768 | main_window_progress_off(mainwin); |
| 1769 | } |
| 1770 | |
| 1771 | void main_window_toggle_online(MainWindow *mainwin, gboolean online)
|
| 1772 | {
|
| 1773 | if (prefs_common.online_mode != online)
|
| 1774 | online_switch_clicked(mainwin->online_switch, mainwin); |
| 1775 | } |
| 1776 | |
| 1777 | gboolean main_window_toggle_online_if_offline(MainWindow *mainwin) |
| 1778 | {
|
| 1779 | if (!prefs_common.online_mode) {
|
| 1780 | if (alertpanel(_("Offline"), |
| 1781 | _("You are offline. Go online?"),
|
| 1782 | GTK_STOCK_YES, GTK_STOCK_NO, NULL)
|
| 1783 | == G_ALERTDEFAULT) |
| 1784 | main_window_toggle_online(mainwin, TRUE); |
| 1785 | } |
| 1786 | |
| 1787 | return prefs_common.online_mode;
|
| 1788 | } |
| 1789 | |
| 1790 | void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
|
| 1791 | {
|
| 1792 | GList *list; |
| 1793 | |
| 1794 | if (!procmsg_trash_messages_exist())
|
| 1795 | return;
|
| 1796 | |
| 1797 | if (confirm) {
|
| 1798 | if (alertpanel(_("Empty all trash"), |
| 1799 | _("Delete all messages in trash folders?"),
|
| 1800 | GTK_STOCK_YES, GTK_STOCK_NO, NULL)
|
| 1801 | != G_ALERTDEFAULT) |
| 1802 | return;
|
| 1803 | manage_window_focus_in(mainwin->window, NULL, NULL); |
| 1804 | } |
| 1805 | |
| 1806 | procmsg_empty_all_trash(); |
| 1807 | statusbar_pop_all(); |
| 1808 | trayicon_set_tooltip(NULL);
|
| 1809 | trayicon_set_notify(FALSE); |
| 1810 | |
| 1811 | for (list = folder_get_list(); list != NULL; list = list->next) { |
| 1812 | Folder *folder; |
| 1813 | |
| 1814 | folder = list->data; |
| 1815 | if (folder->trash)
|
| 1816 | folderview_update_item(folder->trash, TRUE); |
| 1817 | } |
| 1818 | |
| 1819 | if (mainwin->summaryview->folder_item &&
|
| 1820 | mainwin->summaryview->folder_item->stype == F_TRASH) |
| 1821 | gtk_widget_grab_focus(mainwin->folderview->treeview); |
| 1822 | } |
| 1823 | |
| 1824 | void main_window_add_mailbox(MainWindow *mainwin)
|
| 1825 | {
|
| 1826 | gchar *path; |
| 1827 | Folder *folder; |
| 1828 | |
| 1829 | path = input_dialog_with_filesel |
| 1830 | (_("Add mailbox"),
|
| 1831 | _("Specify the location of mailbox.\n"
|
| 1832 | "If the existing mailbox is specified, it will be\n"
|
| 1833 | "scanned automatically."),
|
| 1834 | "Mail", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
| 1835 | if (!path) return; |
| 1836 | if (folder_find_from_path(path)) {
|
| 1837 | alertpanel_error(_("The mailbox `%s' already exists."), path);
|
| 1838 | g_free(path); |
| 1839 | return;
|
| 1840 | } |
| 1841 | if (!strcmp(path, "Mail")) |
| 1842 | folder = folder_new(F_MH, _("Mailbox"), path);
|
| 1843 | else
|
| 1844 | folder = folder_new(F_MH, g_basename(path), path); |
| 1845 | g_free(path); |
| 1846 | |
| 1847 | if (folder->klass->create_tree(folder) < 0) { |
| 1848 | alertpanel_error(_("Creation of the mailbox failed.\n"
|
| 1849 | "Maybe some files already exist, or you don't have the permission to write there."));
|
| 1850 | folder_destroy(folder); |
| 1851 | return;
|
| 1852 | } |
| 1853 | |
| 1854 | folder_add(folder); |
| 1855 | folder_set_ui_func(folder, scan_tree_func, mainwin); |
| 1856 | folder->klass->scan_tree(folder); |
| 1857 | folder_set_ui_func(folder, NULL, NULL); |
| 1858 | |
| 1859 | folderview_set(mainwin->folderview); |
| 1860 | } |
| 1861 | |
| 1862 | void main_window_send_queue(MainWindow *mainwin)
|
| 1863 | {
|
| 1864 | GList *list; |
| 1865 | |
| 1866 | if (inc_is_active())
|
| 1867 | return;
|
| 1868 | if (!main_window_toggle_online_if_offline(mainwin))
|
| 1869 | return;
|
| 1870 | |
| 1871 | for (list = folder_get_list(); list != NULL; list = list->next) { |
| 1872 | Folder *folder = list->data; |
| 1873 | |
| 1874 | if (folder->queue) {
|
| 1875 | gint ret; |
| 1876 | |
| 1877 | ret = send_message_queue_all(folder->queue, |
| 1878 | prefs_common.savemsg, |
| 1879 | prefs_common.filter_sent); |
| 1880 | statusbar_pop_all(); |
| 1881 | if (ret > 0) |
| 1882 | folder_item_scan(folder->queue); |
| 1883 | } |
| 1884 | } |
| 1885 | |
| 1886 | folderview_update_all_updated(TRUE); |
| 1887 | main_window_set_menu_sensitive(mainwin); |
| 1888 | main_window_set_toolbar_sensitive(mainwin); |
| 1889 | } |
| 1890 | |
| 1891 | typedef enum |
| 1892 | {
|
| 1893 | M_UNLOCKED = 1 << 0, |
| 1894 | M_MSG_EXIST = 1 << 1, |
| 1895 | M_TARGET_EXIST = 1 << 2, |
| 1896 | M_SINGLE_TARGET_EXIST = 1 << 3, |
| 1897 | M_EXEC = 1 << 4, |
| 1898 | M_ALLOW_REEDIT = 1 << 5, |
| 1899 | M_HAVE_ACCOUNT = 1 << 6, |
| 1900 | M_THREADED = 1 << 7, |
| 1901 | M_UNTHREADED = 1 << 8, |
| 1902 | M_ALLOW_DELETE = 1 << 9, |
| 1903 | M_INC_ACTIVE = 1 << 10, |
| 1904 | M_ENABLE_JUNK = 1 << 11, |
| 1905 | M_HAVE_QUEUED_MSG = 1 << 12, |
| 1906 | M_POP3_ACCOUNT = 1 << 13, |
| 1907 | |
| 1908 | M_FOLDER_NEWOK = 1 << 17, |
| 1909 | M_FOLDER_RENOK = 1 << 18, |
| 1910 | M_FOLDER_MOVEOK = 1 << 19, |
| 1911 | M_FOLDER_DELOK = 1 << 20, |
| 1912 | M_MBOX_ADDOK = 1 << 21, |
| 1913 | M_MBOX_RMOK = 1 << 22, |
| 1914 | M_MBOX_CHKOK = 1 << 23, |
| 1915 | M_MBOX_CHKALLOK = 1 << 24, |
| 1916 | M_MBOX_REBUILDOK = 1 << 25 |
| 1917 | } SensitiveCond; |
| 1918 | |
| 1919 | static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
|
| 1920 | {
|
| 1921 | SensitiveCond state = 0;
|
| 1922 | SummarySelection selection; |
| 1923 | GList *list; |
| 1924 | FolderItem *item = mainwin->summaryview->folder_item; |
| 1925 | |
| 1926 | selection = summary_get_selection_type(mainwin->summaryview); |
| 1927 | |
| 1928 | if (mainwin->lock_count == 0) |
| 1929 | state |= M_UNLOCKED; |
| 1930 | if (selection != SUMMARY_NONE)
|
| 1931 | state |= M_MSG_EXIST; |
| 1932 | if (item && item->path && item->parent && !item->no_select) {
|
| 1933 | state |= M_EXEC; |
| 1934 | if (item->threaded)
|
| 1935 | state |= M_THREADED; |
| 1936 | else
|
| 1937 | state |= M_UNTHREADED; |
| 1938 | if (FOLDER_TYPE(item->folder) != F_NEWS)
|
| 1939 | state |= M_ALLOW_DELETE; |
| 1940 | } |
| 1941 | if (selection == SUMMARY_SELECTED_SINGLE ||
|
| 1942 | selection == SUMMARY_SELECTED_MULTIPLE) |
| 1943 | state |= M_TARGET_EXIST; |
| 1944 | if (selection == SUMMARY_SELECTED_SINGLE)
|
| 1945 | state |= M_SINGLE_TARGET_EXIST; |
| 1946 | if (selection == SUMMARY_SELECTED_SINGLE &&
|
| 1947 | FOLDER_ITEM_IS_SENT_FOLDER(item)) |
| 1948 | state |= M_ALLOW_REEDIT; |
| 1949 | if (cur_account) {
|
| 1950 | state |= M_HAVE_ACCOUNT; |
| 1951 | if (cur_account->protocol == A_POP3)
|
| 1952 | state |= M_POP3_ACCOUNT; |
| 1953 | } |
| 1954 | |
| 1955 | if (inc_is_active())
|
| 1956 | state |= M_INC_ACTIVE; |
| 1957 | |
| 1958 | if (prefs_common.enable_junk)
|
| 1959 | state |= M_ENABLE_JUNK; |
| 1960 | |
| 1961 | for (list = folder_get_list(); list != NULL; list = list->next) { |
| 1962 | Folder *folder = list->data; |
| 1963 | if (folder->queue && folder->queue->total > 0) { |
| 1964 | state |= M_HAVE_QUEUED_MSG; |
| 1965 | break;
|
| 1966 | } |
| 1967 | } |
| 1968 | |
| 1969 | item = folderview_get_selected_item(mainwin->folderview); |
| 1970 | if (item) {
|
| 1971 | state |= M_FOLDER_NEWOK; |
| 1972 | if (item->parent == NULL) { |
| 1973 | state |= M_MBOX_RMOK; |
| 1974 | state |= M_MBOX_CHKOK; |
| 1975 | } |
| 1976 | if (FOLDER_IS_LOCAL(item->folder) ||
|
| 1977 | FOLDER_TYPE(item->folder) == F_IMAP) {
|
| 1978 | if (item->parent == NULL) |
| 1979 | state |= M_MBOX_REBUILDOK; |
| 1980 | else if (item->stype == F_NORMAL) { |
| 1981 | state |= M_FOLDER_RENOK; |
| 1982 | state |= M_FOLDER_DELOK; |
| 1983 | if (item->folder->klass->move_folder)
|
| 1984 | state |= M_FOLDER_MOVEOK; |
| 1985 | } |
| 1986 | } else if (FOLDER_TYPE(item->folder) == F_NEWS) { |
| 1987 | if (item->parent != NULL) |
| 1988 | state |= M_FOLDER_DELOK; |
| 1989 | } |
| 1990 | } |
| 1991 | state |= M_MBOX_ADDOK; |
| 1992 | state |= M_MBOX_CHKALLOK; |
| 1993 | |
| 1994 | return state;
|
| 1995 | } |
| 1996 | |
| 1997 | void main_window_set_toolbar_sensitive(MainWindow *mainwin)
|
| 1998 | {
|
| 1999 | SensitiveCond state; |
| 2000 | gboolean sensitive, prev_sensitive; |
| 2001 | gint n; |
| 2002 | gint i = 0;
|
| 2003 | |
| 2004 | struct {
|
| 2005 | GtkWidget *widget; |
| 2006 | SensitiveCond cond; |
| 2007 | } entry[20];
|
| 2008 | |
| 2009 | #define SET_WIDGET_COND(w, c) \
|
| 2010 | { \
|
| 2011 | entry[i].widget = w; \ |
| 2012 | entry[i].cond = c; \ |
| 2013 | i++; \ |
| 2014 | } |
| 2015 | |
| 2016 | SET_WIDGET_COND(mainwin->get_btn, M_HAVE_ACCOUNT|M_UNLOCKED); |
| 2017 | SET_WIDGET_COND(mainwin->getall_btn, M_HAVE_ACCOUNT|M_UNLOCKED); |
| 2018 | SET_WIDGET_COND(mainwin->rpop3_btn, |
| 2019 | M_HAVE_ACCOUNT|M_UNLOCKED|M_POP3_ACCOUNT); |
| 2020 | SET_WIDGET_COND(mainwin->send_btn, |
| 2021 | M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_QUEUED_MSG); |
| 2022 | SET_WIDGET_COND(mainwin->compose_btn, M_HAVE_ACCOUNT); |
| 2023 | SET_WIDGET_COND(mainwin->reply_btn, |
| 2024 | M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST); |
| 2025 | SET_WIDGET_COND(mainwin->reply_combo ? |
| 2026 | GTK_WIDGET_PTR(mainwin->reply_combo) : NULL,
|
| 2027 | M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST); |
| 2028 | SET_WIDGET_COND(mainwin->replyall_btn, |
| 2029 | M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST); |
| 2030 | SET_WIDGET_COND(mainwin->fwd_btn, M_HAVE_ACCOUNT|M_TARGET_EXIST); |
| 2031 | SET_WIDGET_COND(mainwin->fwd_combo ? GTK_WIDGET_PTR(mainwin->fwd_combo) |
| 2032 | : NULL,
|
| 2033 | M_HAVE_ACCOUNT|M_TARGET_EXIST); |
| 2034 | SET_WIDGET_COND(mainwin->delete_btn, |
| 2035 | M_TARGET_EXIST|M_ALLOW_DELETE); |
| 2036 | SET_WIDGET_COND(mainwin->junk_btn, |
| 2037 | M_TARGET_EXIST|M_ALLOW_DELETE|M_ENABLE_JUNK); |
| 2038 | SET_WIDGET_COND(mainwin->notjunk_btn, |
| 2039 | M_TARGET_EXIST|M_ALLOW_DELETE|M_ENABLE_JUNK); |
| 2040 | SET_WIDGET_COND(mainwin->exec_btn, M_MSG_EXIST|M_EXEC); |
| 2041 | SET_WIDGET_COND(mainwin->next_btn, M_MSG_EXIST); |
| 2042 | SET_WIDGET_COND(mainwin->prev_btn, M_MSG_EXIST); |
| 2043 | SET_WIDGET_COND(mainwin->print_btn, M_TARGET_EXIST); |
| 2044 | SET_WIDGET_COND(mainwin->stop_btn, M_INC_ACTIVE); |
| 2045 | SET_WIDGET_COND(mainwin->prefs_common_btn, M_UNLOCKED); |
| 2046 | SET_WIDGET_COND(mainwin->prefs_account_btn, M_HAVE_ACCOUNT|M_UNLOCKED); |
| 2047 | |
| 2048 | #undef SET_WIDGET_COND
|
| 2049 | |
| 2050 | state = main_window_get_current_state(mainwin); |
| 2051 | |
| 2052 | n = sizeof(entry) / sizeof(entry[0]); |
| 2053 | for (i = 0; i < n; i++) { |
| 2054 | if (entry[i].widget) {
|
| 2055 | prev_sensitive = |
| 2056 | GTK_WIDGET_IS_SENSITIVE(entry[i].widget); |
| 2057 | sensitive = ((entry[i].cond & state) == entry[i].cond); |
| 2058 | if (prev_sensitive != sensitive) {
|
| 2059 | /* workaround for GTK+ bug (#56070) */
|
| 2060 | if (!prev_sensitive)
|
| 2061 | gtk_widget_hide(entry[i].widget); |
| 2062 | gtk_widget_set_sensitive(entry[i].widget, |
| 2063 | sensitive); |
| 2064 | if (!prev_sensitive)
|
| 2065 | gtk_widget_show(entry[i].widget); |
| 2066 | } |
| 2067 | } |
| 2068 | } |
| 2069 | } |
| 2070 | |
| 2071 | static void main_window_set_toolbar_button_visibility(MainWindow *mainwin) |
| 2072 | {
|
| 2073 | GtkToolbarStyle style = GTK_TOOLBAR_BOTH_HORIZ; |
| 2074 | |
| 2075 | if (prefs_common.toolbar_style == TOOLBAR_NONE)
|
| 2076 | style = -1;
|
| 2077 | else if (prefs_common.toolbar_style == TOOLBAR_ICON) |
| 2078 | style = GTK_TOOLBAR_ICONS; |
| 2079 | else if (prefs_common.toolbar_style == TOOLBAR_TEXT) |
| 2080 | style = GTK_TOOLBAR_TEXT; |
| 2081 | else if (prefs_common.toolbar_style == TOOLBAR_BOTH) |
| 2082 | style = GTK_TOOLBAR_BOTH; |
| 2083 | else if (prefs_common.toolbar_style == TOOLBAR_BOTH_HORIZ) |
| 2084 | style = GTK_TOOLBAR_BOTH_HORIZ; |
| 2085 | |
| 2086 | if (style != -1) { |
| 2087 | gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar), style); |
| 2088 | gtk_widget_show(mainwin->toolbar); |
| 2089 | gtk_widget_queue_resize(mainwin->toolbar); |
| 2090 | } else
|
| 2091 | gtk_widget_hide(mainwin->toolbar); |
| 2092 | |
| 2093 | #if 0
|
| 2094 | if (mainwin->junk_btn) {
|
| 2095 | if (prefs_common.enable_junk) |
| 2096 | gtk_widget_show(mainwin->junk_btn); |
| 2097 | else |
| 2098 | gtk_widget_hide(mainwin->junk_btn); |
| 2099 | } |
| 2100 | |
| 2101 | if (mainwin->exec_btn) {
|
| 2102 | if (prefs_common.immediate_exec) |
| 2103 | gtk_widget_hide(mainwin->exec_btn); |
| 2104 | else |
| 2105 | gtk_widget_show(mainwin->exec_btn); |
| 2106 | } |
| 2107 | #endif |
| 2108 | } |
| 2109 | |
| 2110 | void main_window_set_menu_sensitive(MainWindow *mainwin)
|
| 2111 | {
|
| 2112 | GtkItemFactory *ifactory = mainwin->menu_factory; |
| 2113 | SensitiveCond state; |
| 2114 | gboolean sensitive; |
| 2115 | GtkWidget *menu; |
| 2116 | GtkWidget *menuitem; |
| 2117 | FolderItem *item; |
| 2118 | gchar *menu_path; |
| 2119 | gint i; |
| 2120 | GList *cur_item; |
| 2121 | |
| 2122 | static const struct { |
| 2123 | gchar *const entry;
|
| 2124 | SensitiveCond cond; |
| 2125 | } entry[] = {
|
| 2126 | {"/File/Folder/Create new folder...", M_UNLOCKED|M_FOLDER_NEWOK},
|
| 2127 | {"/File/Folder/Rename folder..." , M_UNLOCKED|M_FOLDER_RENOK},
|
| 2128 | {"/File/Folder/Move folder..." , M_UNLOCKED|M_FOLDER_MOVEOK},
|
| 2129 | {"/File/Folder/Delete folder" , M_UNLOCKED|M_FOLDER_DELOK},
|
| 2130 | {"/File/Mailbox/Add mailbox..." , M_UNLOCKED|M_MBOX_ADDOK},
|
| 2131 | {"/File/Mailbox/Remove mailbox" , M_UNLOCKED|M_MBOX_RMOK},
|
| 2132 | {"/File/Mailbox/Check for new messages"
|
| 2133 | , M_UNLOCKED|M_MBOX_CHKOK}, |
| 2134 | {"/File/Mailbox/Check for new messages in all mailboxes"
|
| 2135 | , M_UNLOCKED|M_MBOX_CHKALLOK}, |
| 2136 | {"/File/Mailbox/Rebuild folder tree", M_UNLOCKED|M_MBOX_REBUILDOK},
|
| 2137 | {"/File/Import mail data..." , M_UNLOCKED},
|
| 2138 | {"/File/Export mail data..." , M_UNLOCKED},
|
| 2139 | {"/File/Empty all trash" , M_UNLOCKED},
|
| 2140 | |
| 2141 | {"/File/Save as..." , M_SINGLE_TARGET_EXIST},
|
| 2142 | {"/File/Print..." , M_TARGET_EXIST},
|
| 2143 | {"/File/Work offline", M_UNLOCKED},
|
| 2144 | /* {"/File/Close" , M_UNLOCKED}, */
|
| 2145 | {"/File/Exit" , M_UNLOCKED},
|
| 2146 | |
| 2147 | {"/Edit/Select thread" , M_SINGLE_TARGET_EXIST},
|
| 2148 | |
| 2149 | {"/View/Sort" , M_EXEC},
|
| 2150 | {"/View/Thread view" , M_EXEC},
|
| 2151 | {"/View/Expand all threads" , M_MSG_EXIST},
|
| 2152 | {"/View/Collapse all threads" , M_MSG_EXIST},
|
| 2153 | {"/View/Go to/Prev message" , M_MSG_EXIST},
|
| 2154 | {"/View/Go to/Next message" , M_MSG_EXIST},
|
| 2155 | {"/View/Go to/Prev unread message" , M_MSG_EXIST},
|
| 2156 | {"/View/Go to/Next unread message" , M_MSG_EXIST},
|
| 2157 | {"/View/Go to/Prev new message" , M_MSG_EXIST},
|
| 2158 | {"/View/Go to/Next new message" , M_MSG_EXIST},
|
| 2159 | {"/View/Go to/Prev marked message" , M_MSG_EXIST},
|
| 2160 | {"/View/Go to/Next marked message" , M_MSG_EXIST},
|
| 2161 | {"/View/Go to/Prev labeled message", M_MSG_EXIST},
|
| 2162 | {"/View/Go to/Next labeled message", M_MSG_EXIST},
|
| 2163 | {"/View/Open in new window" , M_SINGLE_TARGET_EXIST},
|
| 2164 | {"/View/All headers" , M_SINGLE_TARGET_EXIST},
|
| 2165 | {"/View/Message source" , M_SINGLE_TARGET_EXIST},
|
| 2166 | |
| 2167 | {"/Message/Receive/Get from current account"
|
| 2168 | , M_HAVE_ACCOUNT|M_UNLOCKED}, |
| 2169 | {"/Message/Receive/Get from all accounts"
|
| 2170 | , M_HAVE_ACCOUNT|M_UNLOCKED}, |
| 2171 | {"/Message/Receive/Stop receiving"
|
| 2172 | , M_INC_ACTIVE}, |
| 2173 | {"/Message/Receive/Remote mailbox..."
|
| 2174 | , M_HAVE_ACCOUNT|M_UNLOCKED|M_POP3_ACCOUNT}, |
| 2175 | {"/Message/Send queued messages" , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_QUEUED_MSG},
|
| 2176 | |
| 2177 | {"/Message/Compose new message" , M_HAVE_ACCOUNT},
|
| 2178 | {"/Message/Reply" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
|
| 2179 | {"/Message/Reply to" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
|
| 2180 | {"/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST},
|
| 2181 | {"/Message/Forward as attachment", M_HAVE_ACCOUNT|M_TARGET_EXIST},
|
| 2182 | {"/Message/Redirect" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
|
| 2183 | {"/Message/Move..." , M_TARGET_EXIST|M_ALLOW_DELETE},
|
| 2184 | {"/Message/Copy..." , M_TARGET_EXIST|M_EXEC},
|
| 2185 | {"/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE},
|
| 2186 | {"/Message/Mark" , M_TARGET_EXIST},
|
| 2187 | {"/Message/Set as junk mail" , M_TARGET_EXIST|M_ALLOW_DELETE|M_ENABLE_JUNK},
|
| 2188 | {"/Message/Set as not junk mail" , M_TARGET_EXIST|M_ALLOW_DELETE|M_ENABLE_JUNK},
|
| 2189 | {"/Message/Re-edit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
|
| 2190 | |
| 2191 | {"/Tools/Add sender to address book...", M_SINGLE_TARGET_EXIST},
|
| 2192 | {"/Tools/Filter all messages in folder", M_MSG_EXIST|M_EXEC},
|
| 2193 | {"/Tools/Filter selected messages" , M_TARGET_EXIST|M_EXEC},
|
| 2194 | {"/Tools/Create filter rule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
|
| 2195 | {"/Tools/Filter junk mails in folder" , M_MSG_EXIST|M_EXEC|M_ENABLE_JUNK},
|
| 2196 | {"/Tools/Filter junk mails in selected messages", M_TARGET_EXIST|M_EXEC|M_ENABLE_JUNK},
|
| 2197 | #ifndef G_OS_WIN32
|
| 2198 | {"/Tools/Actions" , M_TARGET_EXIST|M_UNLOCKED},
|
| 2199 | #endif
|
| 2200 | {"/Tools/Execute marked process" , M_MSG_EXIST|M_EXEC},
|
| 2201 | {"/Tools/Delete duplicated messages" , M_MSG_EXIST|M_ALLOW_DELETE},
|
| 2202 | {"/Tools/Concatenate separated messages"
|
| 2203 | , M_TARGET_EXIST|M_UNLOCKED|M_ALLOW_DELETE}, |
| 2204 | |
| 2205 | {"/Configuration/Common preferences...", M_UNLOCKED},
|
| 2206 | {"/Configuration/Filter settings...", M_UNLOCKED},
|
| 2207 | {"/Configuration/Preferences for current account...", M_UNLOCKED},
|
| 2208 | {"/Configuration/Create new account...", M_UNLOCKED},
|
| 2209 | {"/Configuration/Edit accounts...", M_UNLOCKED},
|
| 2210 | {"/Configuration/Change current account", M_UNLOCKED},
|
| 2211 | |
| 2212 | {NULL, 0}
|
| 2213 | }; |
| 2214 | |
| 2215 | state = main_window_get_current_state(mainwin); |
| 2216 | |
| 2217 | for (i = 0; entry[i].entry != NULL; i++) { |
| 2218 | sensitive = ((entry[i].cond & state) == entry[i].cond); |
| 2219 | menu_set_sensitive(ifactory, entry[i].entry, sensitive); |
| 2220 | } |
| 2221 | |
| 2222 | menu = gtk_item_factory_get_widget(ifactory, "/Message/Receive");
|
| 2223 | |
| 2224 | /* search for separator */
|
| 2225 | for (cur_item = GTK_MENU_SHELL(menu)->children; cur_item != NULL; |
| 2226 | cur_item = cur_item->next) {
|
| 2227 | if (GTK_BIN(cur_item->data)->child == NULL) { |
| 2228 | cur_item = cur_item->next; |
| 2229 | break;
|
| 2230 | } |
| 2231 | } |
| 2232 | |
| 2233 | for (; cur_item != NULL; cur_item = cur_item->next) { |
| 2234 | gtk_widget_set_sensitive(GTK_WIDGET(cur_item->data), |
| 2235 | (M_UNLOCKED & state) != 0);
|
| 2236 | } |
| 2237 | |
| 2238 | main_window_menu_callback_block(mainwin); |
| 2239 | |
| 2240 | #define SET_CHECK_MENU_ACTIVE(path, active) \
|
| 2241 | { \
|
| 2242 | menuitem = gtk_item_factory_get_widget(ifactory, path); \ |
| 2243 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active); \ |
| 2244 | } |
| 2245 | |
| 2246 | SET_CHECK_MENU_ACTIVE("/View/Show or hide/Message view",
|
| 2247 | messageview_is_visible(mainwin->messageview)); |
| 2248 | |
| 2249 | item = mainwin->summaryview->folder_item; |
| 2250 | menu_path = "/View/Sort/Don't sort";
|
| 2251 | if (item) {
|
| 2252 | switch (item->sort_key) {
|
| 2253 | case SORT_BY_NUMBER:
|
| 2254 | menu_path = "/View/Sort/by number"; break; |
| 2255 | case SORT_BY_SIZE:
|
| 2256 | menu_path = "/View/Sort/by size"; break; |
| 2257 | case SORT_BY_DATE:
|
| 2258 | menu_path = "/View/Sort/by date"; break; |
| 2259 | case SORT_BY_TDATE:
|
| 2260 | menu_path = "/View/Sort/by thread date"; break; |
| 2261 | case SORT_BY_FROM:
|
| 2262 | menu_path = "/View/Sort/by from"; break; |
| 2263 | case SORT_BY_TO:
|
| 2264 | menu_path = "/View/Sort/by recipient"; break; |
| 2265 | case SORT_BY_SUBJECT:
|
| 2266 | menu_path = "/View/Sort/by subject"; break; |
| 2267 | case SORT_BY_LABEL:
|
| 2268 | menu_path = "/View/Sort/by color label"; break; |
| 2269 | case SORT_BY_MARK:
|
| 2270 | menu_path = "/View/Sort/by mark"; break; |
| 2271 | case SORT_BY_UNREAD:
|
| 2272 | menu_path = "/View/Sort/by unread"; break; |
| 2273 | case SORT_BY_MIME:
|
| 2274 | menu_path = "/View/Sort/by attachment"; break; |
| 2275 | case SORT_BY_NONE:
|
| 2276 | default:
|
| 2277 | menu_path = "/View/Sort/Don't sort"; break; |
| 2278 | } |
| 2279 | } |
| 2280 | SET_CHECK_MENU_ACTIVE(menu_path, TRUE); |
| 2281 | |
| 2282 | if (!item || item->sort_type == SORT_ASCENDING) {
|
| 2283 | SET_CHECK_MENU_ACTIVE("/View/Sort/Ascending", TRUE);
|
| 2284 | } else {
|
| 2285 | SET_CHECK_MENU_ACTIVE("/View/Sort/Descending", TRUE);
|
| 2286 | } |
| 2287 | |
| 2288 | if (item && item->sort_key != SORT_BY_NONE) {
|
| 2289 | menu_set_sensitive(ifactory, "/View/Sort/Ascending", TRUE);
|
| 2290 | menu_set_sensitive(ifactory, "/View/Sort/Descending", TRUE);
|
| 2291 | menu_set_sensitive(ifactory, "/View/Sort/Attract by subject",
|
| 2292 | FALSE); |
| 2293 | } else {
|
| 2294 | menu_set_sensitive(ifactory, "/View/Sort/Ascending", FALSE);
|
| 2295 | menu_set_sensitive(ifactory, "/View/Sort/Descending", FALSE);
|
| 2296 | menu_set_sensitive(ifactory, "/View/Sort/Attract by subject",
|
| 2297 | (item != NULL));
|
| 2298 | } |
| 2299 | |
| 2300 | SET_CHECK_MENU_ACTIVE("/View/All headers",
|
| 2301 | mainwin->messageview->textview->show_all_headers); |
| 2302 | SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0); |
| 2303 | |
| 2304 | #undef SET_CHECK_MENU_ACTIVE
|
| 2305 | |
| 2306 | main_window_menu_callback_unblock(mainwin); |
| 2307 | } |
| 2308 | |
| 2309 | void main_window_popup(MainWindow *mainwin)
|
| 2310 | {
|
| 2311 | gtkut_window_popup(mainwin->window); |
| 2312 | |
| 2313 | switch (mainwin->type) {
|
| 2314 | case SEPARATE_FOLDER:
|
| 2315 | if (prefs_common.folderview_visible)
|
| 2316 | gtkut_window_popup(mainwin->win.sep_folder.folderwin); |
| 2317 | break;
|
| 2318 | case SEPARATE_MESSAGE:
|
| 2319 | if (messageview_is_visible(mainwin->messageview))
|
| 2320 | gtkut_window_popup(mainwin->win.sep_message.messagewin); |
| 2321 | break;
|
| 2322 | case SEPARATE_BOTH:
|
| 2323 | if (prefs_common.folderview_visible)
|
| 2324 | gtkut_window_popup(mainwin->win.sep_both.folderwin); |
| 2325 | if (messageview_is_visible(mainwin->messageview))
|
| 2326 | gtkut_window_popup(mainwin->win.sep_both.messagewin); |
| 2327 | break;
|
| 2328 | default:
|
| 2329 | break;
|
| 2330 | } |
| 2331 | } |
| 2332 | |
| 2333 | static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout, |
| 2334 | SeparateType type) |
| 2335 | {
|
| 2336 | GtkWidget *folderwin = NULL;
|
| 2337 | GtkWidget *messagewin = NULL;
|
| 2338 | GtkWidget *hpaned; |
| 2339 | GtkWidget *vpaned; |
| 2340 | GtkWidget *vbox_body = mainwin->vbox_body; |
| 2341 | GtkWidget *vbox_summary; |
| 2342 | GtkItemFactory *ifactory = mainwin->menu_factory; |
| 2343 | GtkWidget *menuitem; |
| 2344 | gboolean use_vlayout = (layout == LAYOUT_VERTICAL); |
| 2345 | |
| 2346 | debug_print("Setting main window widgets...\n");
|
| 2347 | |
| 2348 | gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview), |
| 2349 | prefs_common.folderview_width, |
| 2350 | prefs_common.folderview_height); |
| 2351 | if (use_vlayout) {
|
| 2352 | gtk_widget_set_size_request |
| 2353 | (GTK_WIDGET_PTR(mainwin->summaryview), |
| 2354 | prefs_common.summaryview_vwidth, |
| 2355 | prefs_common.summaryview_vheight); |
| 2356 | gtk_widget_set_size_request |
| 2357 | (GTK_WIDGET_PTR(mainwin->messageview), |
| 2358 | prefs_common.msgview_vwidth, |
| 2359 | prefs_common.msgview_vheight); |
| 2360 | } else {
|
| 2361 | gtk_widget_set_size_request |
| 2362 | (GTK_WIDGET_PTR(mainwin->summaryview), |
| 2363 | prefs_common.summaryview_width, |
| 2364 | prefs_common.summaryview_height); |
| 2365 | gtk_widget_set_size_request |
| 2366 | (GTK_WIDGET_PTR(mainwin->messageview), |
| 2367 | prefs_common.msgview_width, |
| 2368 | prefs_common.msgview_height); |
| 2369 | } |
| 2370 | |
| 2371 | /* create separated window(s) if needed */
|
| 2372 | if (type & SEPARATE_FOLDER) {
|
| 2373 | folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 2374 | gtk_window_set_title(GTK_WINDOW(folderwin), |
| 2375 | _("Sylpheed - Folder View"));
|
| 2376 | gtk_window_set_wmclass(GTK_WINDOW(folderwin), |
| 2377 | "folder_view", "Sylpheed"); |
| 2378 | gtk_window_set_policy(GTK_WINDOW(folderwin), |
| 2379 | TRUE, TRUE, FALSE); |
| 2380 | gtkut_window_move(GTK_WINDOW(folderwin), |
| 2381 | prefs_common.folderwin_x, |
| 2382 | prefs_common.folderwin_y); |
| 2383 | gtk_container_set_border_width(GTK_CONTAINER(folderwin), 0);
|
| 2384 | g_signal_connect(G_OBJECT(folderwin), "delete_event",
|
| 2385 | G_CALLBACK(folder_window_close_cb), mainwin); |
| 2386 | gtk_container_add(GTK_CONTAINER(folderwin), |
| 2387 | GTK_WIDGET_PTR(mainwin->folderview)); |
| 2388 | gtk_widget_realize(folderwin); |
| 2389 | if (prefs_common.folderview_visible)
|
| 2390 | gtk_widget_show(folderwin); |
| 2391 | } |
| 2392 | if (type & SEPARATE_MESSAGE) {
|
| 2393 | messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 2394 | gtk_window_set_title(GTK_WINDOW(messagewin), |
| 2395 | _("Sylpheed - Message View"));
|
| 2396 | gtk_window_set_wmclass(GTK_WINDOW(messagewin), |
| 2397 | "message_view", "Sylpheed"); |
| 2398 | gtk_window_set_policy(GTK_WINDOW(messagewin), |
| 2399 | TRUE, TRUE, FALSE); |
| 2400 | gtkut_window_move(GTK_WINDOW(messagewin), |
| 2401 | prefs_common.main_msgwin_x, |
| 2402 | prefs_common.main_msgwin_y); |
| 2403 | gtk_container_set_border_width(GTK_CONTAINER(messagewin), 0);
|
| 2404 | g_signal_connect(G_OBJECT(messagewin), "delete_event",
|
| 2405 | G_CALLBACK(message_window_close_cb), mainwin); |
| 2406 | gtk_container_add(GTK_CONTAINER(messagewin), |
| 2407 | GTK_WIDGET_PTR(mainwin->messageview)); |
| 2408 | gtk_widget_realize(messagewin); |
| 2409 | if (messageview_is_visible(mainwin->messageview))
|
| 2410 | gtk_widget_show(messagewin); |
| 2411 | } |
| 2412 | |
| 2413 | vbox_summary = gtk_vbox_new(FALSE, 1);
|
| 2414 | gtk_box_pack_start(GTK_BOX(vbox_summary), |
| 2415 | GTK_WIDGET_PTR(mainwin->summaryview->qsearch), |
| 2416 | FALSE, FALSE, 0);
|
| 2417 | gtk_widget_show(vbox_summary); |
| 2418 | |
| 2419 | switch (type) {
|
| 2420 | case SEPARATE_NONE:
|
| 2421 | hpaned = gtk_hpaned_new(); |
| 2422 | gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
|
| 2423 | gtk_paned_add1(GTK_PANED(hpaned), |
| 2424 | GTK_WIDGET_PTR(mainwin->folderview)); |
| 2425 | gtk_paned_add2(GTK_PANED(hpaned), vbox_summary); |
| 2426 | gtk_widget_show(hpaned); |
| 2427 | gtk_widget_queue_resize(hpaned); |
| 2428 | |
| 2429 | if (use_vlayout) {
|
| 2430 | vpaned = gtk_hpaned_new(); |
| 2431 | gtk_widget_hide(mainwin->summaryview->hseparator); |
| 2432 | } else
|
| 2433 | vpaned = gtk_vpaned_new(); |
| 2434 | if (messageview_is_visible(mainwin->messageview)) {
|
| 2435 | gtk_paned_add1(GTK_PANED(vpaned), |
| 2436 | GTK_WIDGET_PTR(mainwin->summaryview)); |
| 2437 | gtk_box_pack_start(GTK_BOX(vbox_summary), vpaned, |
| 2438 | TRUE, TRUE, 0);
|
| 2439 | if (!use_vlayout)
|
| 2440 | gtk_widget_show |
| 2441 | (mainwin->summaryview->hseparator); |
| 2442 | } else {
|
| 2443 | gtk_box_pack_start(GTK_BOX(vbox_summary), |
| 2444 | GTK_WIDGET_PTR(mainwin->summaryview), |
| 2445 | TRUE, TRUE, 0);
|
| 2446 | gtk_widget_ref(vpaned); |
| 2447 | gtk_widget_hide(mainwin->summaryview->hseparator); |
| 2448 | } |
| 2449 | gtk_paned_add2(GTK_PANED(vpaned), |
| 2450 | GTK_WIDGET_PTR(mainwin->messageview)); |
| 2451 | gtk_widget_show(vpaned); |
| 2452 | gtk_widget_queue_resize(vpaned); |
| 2453 | |
| 2454 | mainwin->win.sep_none.hpaned = hpaned; |
| 2455 | mainwin->win.sep_none.vpaned = vpaned; |
| 2456 | |
| 2457 | break;
|
| 2458 | case SEPARATE_FOLDER:
|
| 2459 | gtk_box_pack_start(GTK_BOX(vbox_body), vbox_summary, |
| 2460 | TRUE, TRUE, 0);
|
| 2461 | |
| 2462 | if (use_vlayout) {
|
| 2463 | vpaned = gtk_hpaned_new(); |
| 2464 | gtk_widget_hide(mainwin->summaryview->hseparator); |
| 2465 | } else
|
| 2466 | vpaned = gtk_vpaned_new(); |
| 2467 | if (messageview_is_visible(mainwin->messageview)) {
|
| 2468 | gtk_paned_add1(GTK_PANED(vpaned), |
| 2469 | GTK_WIDGET_PTR(mainwin->summaryview)); |
| 2470 | gtk_box_pack_start(GTK_BOX(vbox_summary), vpaned, |
| 2471 | TRUE, TRUE, 0);
|
| 2472 | if (!use_vlayout)
|
| 2473 | gtk_widget_show |
| 2474 | (mainwin->summaryview->hseparator); |
| 2475 | } else {
|
| 2476 | gtk_box_pack_start(GTK_BOX(vbox_summary), |
| 2477 | GTK_WIDGET_PTR(mainwin->summaryview), |
| 2478 | TRUE, TRUE, 0);
|
| 2479 | gtk_widget_ref(vpaned); |
| 2480 | gtk_widget_hide(mainwin->summaryview->hseparator); |
| 2481 | } |
| 2482 | gtk_paned_add2(GTK_PANED(vpaned), |
| 2483 | GTK_WIDGET_PTR(mainwin->messageview)); |
| 2484 | gtk_widget_show(vpaned); |
| 2485 | gtk_widget_queue_resize(vpaned); |
| 2486 | |
| 2487 | mainwin->win.sep_folder.folderwin = folderwin; |
| 2488 | mainwin->win.sep_folder.vpaned = vpaned; |
| 2489 | |
| 2490 | break;
|
| 2491 | case SEPARATE_MESSAGE:
|
| 2492 | hpaned = gtk_hpaned_new(); |
| 2493 | gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
|
| 2494 | gtk_paned_add1(GTK_PANED(hpaned), |
| 2495 | GTK_WIDGET_PTR(mainwin->folderview)); |
| 2496 | gtk_paned_add2(GTK_PANED(hpaned), vbox_summary); |
| 2497 | gtk_box_pack_start(GTK_BOX(vbox_summary), |
| 2498 | GTK_WIDGET_PTR(mainwin->summaryview), |
| 2499 | TRUE, TRUE, 0);
|
| 2500 | gtk_widget_hide(mainwin->summaryview->hseparator); |
| 2501 | gtk_widget_show(hpaned); |
| 2502 | gtk_widget_queue_resize(hpaned); |
| 2503 | |
| 2504 | mainwin->win.sep_message.messagewin = messagewin; |
| 2505 | mainwin->win.sep_message.hpaned = hpaned; |
| 2506 | |
| 2507 | break;
|
| 2508 | case SEPARATE_BOTH:
|
| 2509 | gtk_box_pack_start(GTK_BOX(vbox_body), vbox_summary, |
| 2510 | TRUE, TRUE, 0);
|
| 2511 | gtk_box_pack_start(GTK_BOX(vbox_summary), |
| 2512 | GTK_WIDGET_PTR(mainwin->summaryview), |
| 2513 | TRUE, TRUE, 0);
|
| 2514 | gtk_widget_hide(mainwin->summaryview->hseparator); |
| 2515 | |
| 2516 | mainwin->win.sep_both.folderwin = folderwin; |
| 2517 | mainwin->win.sep_both.messagewin = messagewin; |
| 2518 | |
| 2519 | break;
|
| 2520 | } |
| 2521 | |
| 2522 | if (messageview_is_visible(mainwin->messageview))
|
| 2523 | gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), |
| 2524 | use_vlayout ? GTK_ARROW_RIGHT : GTK_ARROW_DOWN, |
| 2525 | GTK_SHADOW_OUT); |
| 2526 | else
|
| 2527 | gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), |
| 2528 | use_vlayout ? GTK_ARROW_LEFT : GTK_ARROW_UP, |
| 2529 | GTK_SHADOW_OUT); |
| 2530 | |
| 2531 | gtkut_window_move(GTK_WINDOW(mainwin->window), |
| 2532 | prefs_common.mainwin_x, prefs_common.mainwin_y); |
| 2533 | |
| 2534 | gtk_widget_queue_resize(vbox_body); |
| 2535 | gtk_widget_queue_resize(mainwin->vbox); |
| 2536 | gtk_widget_queue_resize(mainwin->window); |
| 2537 | |
| 2538 | mainwin->type = type; |
| 2539 | prefs_common.layout_type = layout; |
| 2540 | |
| 2541 | /* toggle menu state */
|
| 2542 | menuitem = gtk_item_factory_get_item |
| 2543 | (ifactory, "/View/Show or hide/Folder tree");
|
| 2544 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 2545 | (type & SEPARATE_FOLDER) == 0 ? TRUE :
|
| 2546 | prefs_common.folderview_visible); |
| 2547 | gtk_widget_set_sensitive(menuitem, ((type & SEPARATE_FOLDER) != 0));
|
| 2548 | menuitem = gtk_item_factory_get_item |
| 2549 | (ifactory, "/View/Show or hide/Message view");
|
| 2550 | gtk_check_menu_item_set_active |
| 2551 | (GTK_CHECK_MENU_ITEM(menuitem), |
| 2552 | messageview_is_visible(mainwin->messageview)); |
| 2553 | |
| 2554 | if (layout == LAYOUT_NORMAL) {
|
| 2555 | menuitem = gtk_item_factory_get_item |
| 2556 | (ifactory, "/View/Layout/Normal");
|
| 2557 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 2558 | TRUE); |
| 2559 | } else if (layout == LAYOUT_VERTICAL) { |
| 2560 | menuitem = gtk_item_factory_get_item |
| 2561 | (ifactory, "/View/Layout/Vertical");
|
| 2562 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 2563 | TRUE); |
| 2564 | } |
| 2565 | |
| 2566 | menuitem = gtk_item_factory_get_item |
| 2567 | (ifactory, "/View/Separate folder tree");
|
| 2568 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 2569 | ((type & SEPARATE_FOLDER) != 0));
|
| 2570 | menuitem = gtk_item_factory_get_item |
| 2571 | (ifactory, "/View/Separate message view");
|
| 2572 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 2573 | ((type & SEPARATE_MESSAGE) != 0));
|
| 2574 | |
| 2575 | if (folderwin) {
|
| 2576 | g_signal_connect |
| 2577 | (G_OBJECT(folderwin), "size_allocate",
|
| 2578 | G_CALLBACK(folder_window_size_allocate_cb), mainwin); |
| 2579 | } |
| 2580 | if (messagewin) {
|
| 2581 | g_signal_connect |
| 2582 | (G_OBJECT(messagewin), "size_allocate",
|
| 2583 | G_CALLBACK(message_window_size_allocate_cb), mainwin); |
| 2584 | } |
| 2585 | |
| 2586 | debug_print("done.\n");
|
| 2587 | } |
| 2588 | |
| 2589 | static GtkItemFactoryEntry reply_entries[] =
|
| 2590 | {
|
| 2591 | {N_("/_Reply"), NULL, reply_cb, COMPOSE_REPLY, NULL},
|
| 2592 | {N_("/Reply to _all"), NULL, reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
|
| 2593 | {N_("/Reply to _sender"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
|
| 2594 | {N_("/Reply to mailing _list"), NULL, reply_cb, COMPOSE_REPLY_TO_LIST, NULL}
|
| 2595 | }; |
| 2596 | |
| 2597 | static GtkItemFactoryEntry forward_entries[] =
|
| 2598 | {
|
| 2599 | {N_("/_Forward"), NULL, reply_cb, COMPOSE_FORWARD, NULL},
|
| 2600 | {N_("/For_ward as attachment"), NULL, reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL},
|
| 2601 | {N_("/Redirec_t"), NULL, reply_cb, COMPOSE_REDIRECT, NULL}
|
| 2602 | }; |
| 2603 | |
| 2604 | static PrefsToolbarItem items[] =
|
| 2605 | {
|
| 2606 | {T_GET, TRUE, toolbar_inc_cb},
|
| 2607 | {T_GET_ALL, TRUE, toolbar_inc_all_cb},
|
| 2608 | {T_SEND_QUEUE, TRUE, toolbar_send_cb},
|
| 2609 | {T_COMPOSE, TRUE, toolbar_compose_cb},
|
| 2610 | {T_REPLY, TRUE, toolbar_reply_cb},
|
| 2611 | {T_REPLY_ALL, TRUE, toolbar_reply_to_all_cb},
|
| 2612 | {T_FORWARD, TRUE, toolbar_forward_cb},
|
| 2613 | {T_DELETE, FALSE, toolbar_delete_cb},
|
| 2614 | {T_JUNK, TRUE, toolbar_junk_cb},
|
| 2615 | {T_NOTJUNK, FALSE, toolbar_notjunk_cb},
|
| 2616 | {T_NEXT, FALSE, toolbar_next_unread_cb},
|
| 2617 | {T_PREV, FALSE, toolbar_prev_unread_cb},
|
| 2618 | {T_SEARCH, FALSE, toolbar_search_cb},
|
| 2619 | {T_PRINT, FALSE, toolbar_print_cb},
|
| 2620 | {T_STOP, FALSE, toolbar_stop_cb},
|
| 2621 | {T_ADDRESS_BOOK, FALSE, toolbar_address_cb},
|
| 2622 | {T_EXECUTE, FALSE, toolbar_exec_cb},
|
| 2623 | {T_COMMON_PREFS, FALSE, toolbar_prefs_common_cb},
|
| 2624 | {T_ACCOUNT_PREFS, FALSE, toolbar_prefs_account_cb},
|
| 2625 | {T_REMOTE_MAILBOX, FALSE, toolbar_rpop3_cb},
|
| 2626 | |
| 2627 | {-1, FALSE, NULL}
|
| 2628 | }; |
| 2629 | |
| 2630 | static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
|
| 2631 | {
|
| 2632 | GtkWidget *toolbar; |
| 2633 | const gchar *setting;
|
| 2634 | GList *item_list; |
| 2635 | |
| 2636 | if (prefs_common.main_toolbar_setting &&
|
| 2637 | *prefs_common.main_toolbar_setting != '\0')
|
| 2638 | setting = prefs_common.main_toolbar_setting; |
| 2639 | else
|
| 2640 | setting = prefs_toolbar_get_default_main_setting_name_list(); |
| 2641 | |
| 2642 | item_list = prefs_toolbar_get_item_list_from_name_list(setting); |
| 2643 | toolbar = main_window_toolbar_create_from_list(mainwin, item_list); |
| 2644 | g_list_free(item_list); |
| 2645 | |
| 2646 | return toolbar;
|
| 2647 | } |
| 2648 | |
| 2649 | static GtkWidget *main_window_toolbar_create_from_list(MainWindow *mainwin,
|
| 2650 | GList *item_list) |
| 2651 | {
|
| 2652 | GtkWidget *toolbar; |
| 2653 | GtkWidget *icon_wid; |
| 2654 | GtkToolItem *toolitem; |
| 2655 | GtkToolItem *comboitem; |
| 2656 | ComboButton *combo; |
| 2657 | gint n_entries; |
| 2658 | gint i; |
| 2659 | GList *cur; |
| 2660 | |
| 2661 | toolbar = gtk_toolbar_new(); |
| 2662 | gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), |
| 2663 | GTK_ORIENTATION_HORIZONTAL); |
| 2664 | gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH); |
| 2665 | g_signal_connect(G_OBJECT(toolbar), "button_press_event",
|
| 2666 | G_CALLBACK(toolbar_button_pressed), mainwin); |
| 2667 | |
| 2668 | items[0].data = &mainwin->get_btn;
|
| 2669 | items[1].data = &mainwin->getall_btn;
|
| 2670 | items[2].data = &mainwin->send_btn;
|
| 2671 | items[3].data = &mainwin->compose_btn;
|
| 2672 | items[4].data = &mainwin->reply_btn;
|
| 2673 | items[5].data = &mainwin->replyall_btn;
|
| 2674 | items[6].data = &mainwin->fwd_btn;
|
| 2675 | items[7].data = &mainwin->delete_btn;
|
| 2676 | items[8].data = &mainwin->junk_btn;
|
| 2677 | items[9].data = &mainwin->notjunk_btn;
|
| 2678 | items[10].data = &mainwin->next_btn;
|
| 2679 | items[11].data = &mainwin->prev_btn;
|
| 2680 | items[12].data = &mainwin->search_btn;
|
| 2681 | items[13].data = &mainwin->print_btn;
|
| 2682 | items[14].data = &mainwin->stop_btn;
|
| 2683 | items[15].data = &mainwin->address_btn;
|
| 2684 | items[16].data = &mainwin->exec_btn;
|
| 2685 | items[17].data = &mainwin->prefs_common_btn;
|
| 2686 | items[18].data = &mainwin->prefs_account_btn;
|
| 2687 | items[19].data = &mainwin->rpop3_btn;
|
| 2688 | for (i = 0; i <= 19; i++) |
| 2689 | *(GtkWidget **)items[i].data = NULL;
|
| 2690 | mainwin->reply_combo = NULL;
|
| 2691 | mainwin->fwd_combo = NULL;
|
| 2692 | |
| 2693 | for (cur = item_list; cur != NULL; cur = cur->next) { |
| 2694 | const PrefsDisplayItem *ditem = cur->data;
|
| 2695 | PrefsToolbarItem *item; |
| 2696 | gint width; |
| 2697 | |
| 2698 | if (ditem->id == T_SEPARATOR) {
|
| 2699 | toolitem = gtk_separator_tool_item_new(); |
| 2700 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
|
| 2701 | continue;
|
| 2702 | } |
| 2703 | |
| 2704 | for (item = items; item->id != -1; item++) { |
| 2705 | if (ditem->id == item->id)
|
| 2706 | break;
|
| 2707 | } |
| 2708 | if (item->id == -1) |
| 2709 | continue;
|
| 2710 | |
| 2711 | if (ditem->stock_id) {
|
| 2712 | icon_wid = gtk_image_new_from_stock |
| 2713 | (ditem->stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR); |
| 2714 | } else
|
| 2715 | icon_wid = stock_pixbuf_widget(NULL, ditem->icon);
|
| 2716 | |
| 2717 | toolitem = gtk_tool_button_new(icon_wid, gettext(ditem->label)); |
| 2718 | if (ditem->description) {
|
| 2719 | gtk_tool_item_set_tooltip(toolitem, |
| 2720 | mainwin->toolbar_tip, |
| 2721 | gettext(ditem->description), |
| 2722 | ditem->name); |
| 2723 | } |
| 2724 | |
| 2725 | gtkut_get_str_size(GTK_WIDGET(toolitem), gettext(ditem->label), |
| 2726 | &width, NULL);
|
| 2727 | gtk_tool_item_set_homogeneous |
| 2728 | (toolitem, width < 52 ? TRUE : FALSE);
|
| 2729 | gtk_tool_item_set_is_important(toolitem, item->is_important); |
| 2730 | |
| 2731 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
|
| 2732 | |
| 2733 | g_signal_connect(G_OBJECT(toolitem), "clicked",
|
| 2734 | G_CALLBACK(item->callback), mainwin); |
| 2735 | g_signal_connect(G_OBJECT(GTK_BIN(toolitem)->child), |
| 2736 | "button_press_event",
|
| 2737 | G_CALLBACK(toolbar_button_pressed), mainwin); |
| 2738 | |
| 2739 | if (ditem->id == T_REPLY) {
|
| 2740 | n_entries = sizeof(reply_entries) /
|
| 2741 | sizeof(reply_entries[0]); |
| 2742 | combo = gtkut_combo_button_create |
| 2743 | (GTK_WIDGET(toolitem), |
| 2744 | reply_entries, n_entries, "<Reply>", mainwin);
|
| 2745 | gtk_button_set_relief(GTK_BUTTON(combo->arrow), |
| 2746 | GTK_RELIEF_NONE); |
| 2747 | |
| 2748 | comboitem = gtk_tool_item_new(); |
| 2749 | gtk_tool_item_set_homogeneous(comboitem, FALSE); |
| 2750 | gtk_container_add(GTK_CONTAINER(comboitem), |
| 2751 | GTK_WIDGET_PTR(combo)); |
| 2752 | if (ditem->description) {
|
| 2753 | gtk_tool_item_set_tooltip |
| 2754 | (comboitem, mainwin->toolbar_tip, |
| 2755 | gettext(ditem->description), |
| 2756 | ditem->name); |
| 2757 | } |
| 2758 | |
| 2759 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), comboitem, -1);
|
| 2760 | |
| 2761 | mainwin->reply_combo = combo; |
| 2762 | } else if (ditem->id == T_FORWARD) { |
| 2763 | n_entries = sizeof(forward_entries) /
|
| 2764 | sizeof(forward_entries[0]); |
| 2765 | combo = gtkut_combo_button_create |
| 2766 | (GTK_WIDGET(toolitem), |
| 2767 | forward_entries, n_entries, "<Forward>",
|
| 2768 | mainwin); |
| 2769 | gtk_button_set_relief(GTK_BUTTON(combo->arrow), |
| 2770 | GTK_RELIEF_NONE); |
| 2771 | |
| 2772 | comboitem = gtk_tool_item_new(); |
| 2773 | gtk_tool_item_set_homogeneous(comboitem, FALSE); |
| 2774 | gtk_container_add(GTK_CONTAINER(comboitem), |
| 2775 | GTK_WIDGET_PTR(combo)); |
| 2776 | if (ditem->description) {
|
| 2777 | gtk_tool_item_set_tooltip |
| 2778 | (comboitem, mainwin->toolbar_tip, |
| 2779 | gettext(ditem->description), |
| 2780 | ditem->name); |
| 2781 | } |
| 2782 | |
| 2783 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar), comboitem, -1);
|
| 2784 | |
| 2785 | mainwin->fwd_combo = combo; |
| 2786 | } |
| 2787 | |
| 2788 | *(GtkWidget **)item->data = GTK_WIDGET(toolitem); |
| 2789 | } |
| 2790 | |
| 2791 | gtk_widget_show_all(toolbar); |
| 2792 | |
| 2793 | return toolbar;
|
| 2794 | } |
| 2795 | |
| 2796 | static void main_window_toolbar_toggle_menu_set_active(MainWindow *mainwin, |
| 2797 | ToolbarStyle style) |
| 2798 | {
|
| 2799 | GtkWidget *menuitem = NULL;
|
| 2800 | GtkItemFactory *ifactory = mainwin->menu_factory; |
| 2801 | |
| 2802 | switch (style) {
|
| 2803 | case TOOLBAR_NONE:
|
| 2804 | menuitem = gtk_item_factory_get_item |
| 2805 | (ifactory, "/View/Show or hide/Toolbar/None");
|
| 2806 | break;
|
| 2807 | case TOOLBAR_ICON:
|
| 2808 | menuitem = gtk_item_factory_get_item |
| 2809 | (ifactory, "/View/Show or hide/Toolbar/Icon");
|
| 2810 | break;
|
| 2811 | case TOOLBAR_TEXT:
|
| 2812 | menuitem = gtk_item_factory_get_item |
| 2813 | (ifactory, "/View/Show or hide/Toolbar/Text");
|
| 2814 | break;
|
| 2815 | case TOOLBAR_BOTH:
|
| 2816 | menuitem = gtk_item_factory_get_item |
| 2817 | (ifactory, "/View/Show or hide/Toolbar/Icon and text");
|
| 2818 | break;
|
| 2819 | case TOOLBAR_BOTH_HORIZ:
|
| 2820 | menuitem = gtk_item_factory_get_item |
| 2821 | (ifactory, "/View/Show or hide/Toolbar/Text at the right of icon");
|
| 2822 | break;
|
| 2823 | } |
| 2824 | |
| 2825 | if (menuitem)
|
| 2826 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 2827 | TRUE); |
| 2828 | } |
| 2829 | |
| 2830 | /* callback functions */
|
| 2831 | |
| 2832 | static void toolbar_inc_cb (GtkWidget *widget, |
| 2833 | gpointer data) |
| 2834 | {
|
| 2835 | MainWindow *mainwin = (MainWindow *)data; |
| 2836 | |
| 2837 | inc_mail_cb(mainwin, 0, NULL); |
| 2838 | } |
| 2839 | |
| 2840 | static void toolbar_inc_all_cb (GtkWidget *widget, |
| 2841 | gpointer data) |
| 2842 | {
|
| 2843 | MainWindow *mainwin = (MainWindow *)data; |
| 2844 | |
| 2845 | inc_all_account_mail_cb(mainwin, 0, NULL); |
| 2846 | } |
| 2847 | |
| 2848 | static void toolbar_rpop3_cb (GtkWidget *widget, |
| 2849 | gpointer data) |
| 2850 | {
|
| 2851 | MainWindow *mainwin = (MainWindow *)data; |
| 2852 | |
| 2853 | rpop3_cb(mainwin, 0, NULL); |
| 2854 | } |
| 2855 | |
| 2856 | static void toolbar_send_cb (GtkWidget *widget, |
| 2857 | gpointer data) |
| 2858 | {
|
| 2859 | MainWindow *mainwin = (MainWindow *)data; |
| 2860 | |
| 2861 | send_queue_cb(mainwin, 0, NULL); |
| 2862 | } |
| 2863 | |
| 2864 | static void toolbar_compose_cb (GtkWidget *widget, |
| 2865 | gpointer data) |
| 2866 | {
|
| 2867 | MainWindow *mainwin = (MainWindow *)data; |
| 2868 | |
| 2869 | compose_cb(mainwin, 0, NULL); |
| 2870 | } |
| 2871 | |
| 2872 | static void toolbar_reply_cb (GtkWidget *widget, |
| 2873 | gpointer data) |
| 2874 | {
|
| 2875 | MainWindow *mainwin = (MainWindow *)data; |
| 2876 | |
| 2877 | if (prefs_common.default_reply_list)
|
| 2878 | reply_cb(mainwin, COMPOSE_REPLY_TO_LIST, NULL);
|
| 2879 | else
|
| 2880 | reply_cb(mainwin, COMPOSE_REPLY, NULL);
|
| 2881 | } |
| 2882 | |
| 2883 | static void toolbar_reply_to_all_cb (GtkWidget *widget, |
| 2884 | gpointer data) |
| 2885 | {
|
| 2886 | MainWindow *mainwin = (MainWindow *)data; |
| 2887 | |
| 2888 | reply_cb(mainwin, COMPOSE_REPLY_TO_ALL, NULL);
|
| 2889 | } |
| 2890 | |
| 2891 | static void toolbar_forward_cb (GtkWidget *widget, |
| 2892 | gpointer data) |
| 2893 | {
|
| 2894 | MainWindow *mainwin = (MainWindow *)data; |
| 2895 | |
| 2896 | reply_cb(mainwin, COMPOSE_FORWARD, NULL);
|
| 2897 | } |
| 2898 | |
| 2899 | static void toolbar_delete_cb (GtkWidget *widget, |
| 2900 | gpointer data) |
| 2901 | {
|
| 2902 | MainWindow *mainwin = (MainWindow *)data; |
| 2903 | |
| 2904 | summary_delete(mainwin->summaryview); |
| 2905 | } |
| 2906 | |
| 2907 | static void toolbar_junk_cb (GtkWidget *widget, |
| 2908 | gpointer data) |
| 2909 | {
|
| 2910 | MainWindow *mainwin = (MainWindow *)data; |
| 2911 | |
| 2912 | summary_junk(mainwin->summaryview); |
| 2913 | } |
| 2914 | |
| 2915 | static void toolbar_notjunk_cb (GtkWidget *widget, |
| 2916 | gpointer data) |
| 2917 | {
|
| 2918 | MainWindow *mainwin = (MainWindow *)data; |
| 2919 | |
| 2920 | summary_not_junk(mainwin->summaryview); |
| 2921 | } |
| 2922 | |
| 2923 | static void toolbar_exec_cb (GtkWidget *widget, |
| 2924 | gpointer data) |
| 2925 | {
|
| 2926 | MainWindow *mainwin = (MainWindow *)data; |
| 2927 | |
| 2928 | summary_execute(mainwin->summaryview); |
| 2929 | } |
| 2930 | |
| 2931 | static void toolbar_next_unread_cb (GtkWidget *widget, |
| 2932 | gpointer data) |
| 2933 | {
|
| 2934 | MainWindow *mainwin = (MainWindow *)data; |
| 2935 | |
| 2936 | next_unread_cb(mainwin, 0, NULL); |
| 2937 | } |
| 2938 | |
| 2939 | static void toolbar_prev_unread_cb(GtkWidget *widget, gpointer data) |
| 2940 | {
|
| 2941 | MainWindow *mainwin = (MainWindow *)data; |
| 2942 | |
| 2943 | prev_unread_cb(mainwin, 0, NULL); |
| 2944 | } |
| 2945 | |
| 2946 | static void toolbar_address_cb(GtkWidget *widget, gpointer data) |
| 2947 | {
|
| 2948 | MainWindow *mainwin = (MainWindow *)data; |
| 2949 | |
| 2950 | addressbook_open_cb(mainwin, 0, NULL); |
| 2951 | } |
| 2952 | |
| 2953 | static void toolbar_search_cb(GtkWidget *widget, gpointer data) |
| 2954 | {
|
| 2955 | MainWindow *mainwin = (MainWindow *)data; |
| 2956 | |
| 2957 | search_cb(mainwin, 1, NULL); |
| 2958 | } |
| 2959 | |
| 2960 | static void toolbar_print_cb(GtkWidget *widget, gpointer data) |
| 2961 | {
|
| 2962 | MainWindow *mainwin = (MainWindow *)data; |
| 2963 | |
| 2964 | print_cb(mainwin, 0, NULL); |
| 2965 | } |
| 2966 | |
| 2967 | static void toolbar_stop_cb(GtkWidget *widget, gpointer data) |
| 2968 | {
|
| 2969 | MainWindow *mainwin = (MainWindow *)data; |
| 2970 | |
| 2971 | inc_stop_cb(mainwin, 0, NULL); |
| 2972 | } |
| 2973 | |
| 2974 | static void toolbar_prefs_common_cb(GtkWidget *widget, gpointer data) |
| 2975 | {
|
| 2976 | MainWindow *mainwin = (MainWindow *)data; |
| 2977 | |
| 2978 | prefs_common_open_cb(mainwin, 0, NULL); |
| 2979 | } |
| 2980 | |
| 2981 | static void toolbar_prefs_account_cb(GtkWidget *widget, gpointer data) |
| 2982 | {
|
| 2983 | MainWindow *mainwin = (MainWindow *)data; |
| 2984 | |
| 2985 | prefs_account_open_cb(mainwin, 0, NULL); |
| 2986 | } |
| 2987 | |
| 2988 | static void toolbar_toggle(GtkWidget *widget, gpointer data) |
| 2989 | {
|
| 2990 | MainWindow *mainwin = (MainWindow *)data; |
| 2991 | ToolbarStyle style; |
| 2992 | |
| 2993 | if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
| 2994 | return;
|
| 2995 | |
| 2996 | style = (ToolbarStyle)g_object_get_data(G_OBJECT(widget), MENU_VAL_ID); |
| 2997 | main_window_toolbar_toggle_menu_set_active(mainwin, style); |
| 2998 | } |
| 2999 | |
| 3000 | static void toolbar_customize(GtkWidget *widget, gpointer data) |
| 3001 | {
|
| 3002 | MainWindow *mainwin = (MainWindow *)data; |
| 3003 | gint *visible_items; |
| 3004 | GList *item_list = NULL;
|
| 3005 | GtkWidget *toolbar; |
| 3006 | gint ret; |
| 3007 | const gchar *setting;
|
| 3008 | |
| 3009 | if (prefs_common.main_toolbar_setting &&
|
| 3010 | *prefs_common.main_toolbar_setting != '\0')
|
| 3011 | setting = prefs_common.main_toolbar_setting; |
| 3012 | else
|
| 3013 | setting = prefs_toolbar_get_default_main_setting_name_list(); |
| 3014 | visible_items = prefs_toolbar_get_id_list_from_name_list(setting); |
| 3015 | ret = prefs_toolbar_open(TOOLBAR_MAIN, visible_items, &item_list); |
| 3016 | g_free(visible_items); |
| 3017 | |
| 3018 | if (ret == 0) { |
| 3019 | gtk_widget_destroy(mainwin->toolbar); |
| 3020 | toolbar = main_window_toolbar_create_from_list(mainwin, |
| 3021 | item_list); |
| 3022 | gtk_widget_set_size_request(toolbar, 300, -1); |
| 3023 | gtk_box_pack_start(GTK_BOX(mainwin->vbox), toolbar, |
| 3024 | FALSE, FALSE, 0);
|
| 3025 | gtk_box_reorder_child(GTK_BOX(mainwin->vbox), toolbar, 1);
|
| 3026 | mainwin->toolbar = toolbar; |
| 3027 | main_window_set_toolbar_sensitive(mainwin); |
| 3028 | main_window_set_toolbar_button_visibility(mainwin); |
| 3029 | g_free(prefs_common.main_toolbar_setting); |
| 3030 | prefs_common.main_toolbar_setting = |
| 3031 | prefs_toolbar_get_name_list_from_item_list(item_list); |
| 3032 | g_list_free(item_list); |
| 3033 | prefs_common_write_config(); |
| 3034 | } |
| 3035 | } |
| 3036 | |
| 3037 | static gboolean toolbar_button_pressed(GtkWidget *widget, GdkEventButton *event,
|
| 3038 | gpointer data) |
| 3039 | {
|
| 3040 | MainWindow *mainwin = (MainWindow *)data; |
| 3041 | GtkWidget *menu; |
| 3042 | GtkWidget *menuitem; |
| 3043 | |
| 3044 | if (!event) return FALSE; |
| 3045 | if (event->button != 3) return FALSE; |
| 3046 | |
| 3047 | menu = gtk_menu_new(); |
| 3048 | gtk_widget_show(menu); |
| 3049 | |
| 3050 | #define SET_TOOLBAR_MENU(text, style, widget) \
|
| 3051 | { \
|
| 3052 | MENUITEM_ADD_RADIO(menu, menuitem, widget, text, style); \ |
| 3053 | if (prefs_common.toolbar_style == style) \
|
| 3054 | gtk_check_menu_item_set_active \ |
| 3055 | (GTK_CHECK_MENU_ITEM(menuitem), TRUE); \ |
| 3056 | g_signal_connect(G_OBJECT(menuitem), "activate", \
|
| 3057 | G_CALLBACK(toolbar_toggle), mainwin); \ |
| 3058 | } |
| 3059 | |
| 3060 | SET_TOOLBAR_MENU(_("Icon _and text"), TOOLBAR_BOTH, NULL); |
| 3061 | SET_TOOLBAR_MENU(_("Text at the _right of icon"), TOOLBAR_BOTH_HORIZ,
|
| 3062 | menuitem); |
| 3063 | SET_TOOLBAR_MENU(_("_Icon"), TOOLBAR_ICON, menuitem);
|
| 3064 | SET_TOOLBAR_MENU(_("_Text"), TOOLBAR_TEXT, menuitem);
|
| 3065 | SET_TOOLBAR_MENU(_("_None"), TOOLBAR_NONE, menuitem);
|
| 3066 | MENUITEM_ADD(menu, menuitem, NULL, NULL); |
| 3067 | MENUITEM_ADD_WITH_MNEMONIC(menu, menuitem, _("_Customize toolbar..."),
|
| 3068 | 0);
|
| 3069 | g_signal_connect(G_OBJECT(menuitem), "activate",
|
| 3070 | G_CALLBACK(toolbar_customize), mainwin); |
| 3071 | |
| 3072 | g_signal_connect(G_OBJECT(menu), "selection_done",
|
| 3073 | G_CALLBACK(gtk_widget_destroy), NULL);
|
| 3074 | |
| 3075 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
| 3076 | event->button, event->time); |
| 3077 | |
| 3078 | return TRUE;
|
| 3079 | } |
| 3080 | |
| 3081 | static void online_switch_clicked(GtkWidget *widget, gpointer data) |
| 3082 | {
|
| 3083 | MainWindow *mainwin = (MainWindow *)data; |
| 3084 | GtkWidget *menuitem; |
| 3085 | |
| 3086 | debug_print("Toggle online mode: %d -> %d\n", prefs_common.online_mode,
|
| 3087 | !prefs_common.online_mode); |
| 3088 | |
| 3089 | menuitem = gtk_item_factory_get_item(mainwin->menu_factory, |
| 3090 | "/File/Work offline");
|
| 3091 | |
| 3092 | if (prefs_common.online_mode == TRUE) {
|
| 3093 | if (folder_remote_folder_active_session_exist()) {
|
| 3094 | debug_print("Active session exist. Cancelling online switch.\n");
|
| 3095 | return;
|
| 3096 | } |
| 3097 | |
| 3098 | prefs_common.online_mode = FALSE; |
| 3099 | gtk_widget_hide(mainwin->online_pixmap); |
| 3100 | gtk_widget_show(mainwin->offline_pixmap); |
| 3101 | gtk_tooltips_set_tip |
| 3102 | (mainwin->online_tip, mainwin->online_switch, |
| 3103 | _("You are offline. Click the icon to go online."),
|
| 3104 | NULL);
|
| 3105 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 3106 | TRUE); |
| 3107 | inc_autocheck_timer_remove(); |
| 3108 | folder_remote_folder_destroy_all_sessions(); |
| 3109 | } else {
|
| 3110 | prefs_common.online_mode = TRUE; |
| 3111 | gtk_widget_hide(mainwin->offline_pixmap); |
| 3112 | gtk_widget_show(mainwin->online_pixmap); |
| 3113 | gtk_tooltips_set_tip |
| 3114 | (mainwin->online_tip, mainwin->online_switch, |
| 3115 | _("You are online. Click the icon to go offline."),
|
| 3116 | NULL);
|
| 3117 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), |
| 3118 | FALSE); |
| 3119 | inc_autocheck_timer_set(); |
| 3120 | } |
| 3121 | } |
| 3122 | |
| 3123 | static gboolean ac_label_button_pressed(GtkWidget *widget,
|
| 3124 | GdkEventButton *event, gpointer data) |
| 3125 | {
|
| 3126 | MainWindow *mainwin = (MainWindow *)data; |
| 3127 | |
| 3128 | if (!event) return FALSE; |
| 3129 | |
| 3130 | gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL); |
| 3131 | g_object_set_data(G_OBJECT(mainwin->ac_menu), "menu_button", widget);
|
| 3132 | |
| 3133 | gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL, |
| 3134 | menu_button_position, widget, |
| 3135 | event->button, event->time); |
| 3136 | |
| 3137 | return TRUE;
|
| 3138 | } |
| 3139 | |
| 3140 | static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data) |
| 3141 | {
|
| 3142 | MainWindow *mainwin = (MainWindow *)data; |
| 3143 | GtkWidget *button; |
| 3144 | |
| 3145 | button = g_object_get_data(G_OBJECT(menu_shell), "menu_button");
|
| 3146 | if (!button) return; |
| 3147 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
| 3148 | g_object_set_data(G_OBJECT(mainwin->ac_menu), "menu_button", NULL); |
| 3149 | manage_window_focus_in(mainwin->window, NULL, NULL); |
| 3150 | } |
| 3151 | |
| 3152 | static gboolean main_window_key_pressed(GtkWidget *widget, GdkEventKey *event,
|
| 3153 | gpointer data) |
| 3154 | {
|
| 3155 | MainWindow *mainwin = (MainWindow *)data; |
| 3156 | |
| 3157 | if (!mainwin)
|
| 3158 | return FALSE;
|
| 3159 | |
| 3160 | if (!GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->qsearch->entry))
|
| 3161 | return FALSE;
|
| 3162 | |
| 3163 | /* g_print("keyval: %d, state: %d\n", event->keyval, event->state); */
|
| 3164 | if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) |
| 3165 | return FALSE;
|
| 3166 | if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab ||
|
| 3167 | event->keyval == GDK_ISO_Left_Tab) |
| 3168 | return FALSE;
|
| 3169 | |
| 3170 | gtk_window_propagate_key_event(GTK_WINDOW(widget), event); |
| 3171 | |
| 3172 | return TRUE;
|
| 3173 | } |
| 3174 | |
| 3175 | static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
|
| 3176 | gpointer data) |
| 3177 | {
|
| 3178 | MainWindow *mainwin = (MainWindow *)data; |
| 3179 | |
| 3180 | if (mainwin->lock_count == 0) |
| 3181 | app_exit_cb(data, 0, widget);
|
| 3182 | |
| 3183 | return TRUE;
|
| 3184 | } |
| 3185 | |
| 3186 | static gint folder_window_close_cb(GtkWidget *widget, GdkEventAny *event,
|
| 3187 | gpointer data) |
| 3188 | {
|
| 3189 | MainWindow *mainwin = (MainWindow *)data; |
| 3190 | GtkWidget *menuitem; |
| 3191 | |
| 3192 | menuitem = gtk_item_factory_get_item |
| 3193 | (mainwin->menu_factory, "/View/Show or hide/Folder tree");
|
| 3194 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE); |
| 3195 | |
| 3196 | return TRUE;
|
| 3197 | } |
| 3198 | |
| 3199 | static gint message_window_close_cb(GtkWidget *widget, GdkEventAny *event,
|
| 3200 | gpointer data) |
| 3201 | {
|
| 3202 | MainWindow *mainwin = (MainWindow *)data; |
| 3203 | GtkWidget *menuitem; |
| 3204 | |
| 3205 | menuitem = gtk_item_factory_get_item |
| 3206 | (mainwin->menu_factory, "/View/Show or hide/Message view");
|
| 3207 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE); |
| 3208 | |
| 3209 | return TRUE;
|
| 3210 | } |
| 3211 | |
| 3212 | static void main_window_size_allocate_cb(GtkWidget *widget, |
| 3213 | GtkAllocation *allocation, |
| 3214 | gpointer data) |
| 3215 | {
|
| 3216 | MainWindow *mainwin = (MainWindow *)data; |
| 3217 | |
| 3218 | main_window_get_size(mainwin); |
| 3219 | } |
| 3220 | |
| 3221 | static void folder_window_size_allocate_cb(GtkWidget *widget, |
| 3222 | GtkAllocation *allocation, |
| 3223 | gpointer data) |
| 3224 | {
|
| 3225 | MainWindow *mainwin = (MainWindow *)data; |
| 3226 | |
| 3227 | main_window_get_size(mainwin); |
| 3228 | } |
| 3229 | |
| 3230 | static void message_window_size_allocate_cb(GtkWidget *widget, |
| 3231 | GtkAllocation *allocation, |
| 3232 | gpointer data) |
| 3233 | {
|
| 3234 | MainWindow *mainwin = (MainWindow *)data; |
| 3235 | |
| 3236 | main_window_get_size(mainwin); |
| 3237 | } |
| 3238 | |
| 3239 | static gboolean main_window_window_state_cb(GtkWidget *widget,
|
| 3240 | GdkEventWindowState *event, |
| 3241 | gpointer data) |
| 3242 | {
|
| 3243 | MainWindow *mainwin = (MainWindow *)data; |
| 3244 | |
| 3245 | if ((event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) != 0) { |
| 3246 | if ((event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0) |
| 3247 | prefs_common.mainwin_maximized = TRUE; |
| 3248 | else
|
| 3249 | prefs_common.mainwin_maximized = FALSE; |
| 3250 | } |
| 3251 | if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) != 0) { |
| 3252 | if ((event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) != 0) |
| 3253 | mainwin->window_hidden = TRUE; |
| 3254 | else
|
| 3255 | mainwin->window_hidden = FALSE; |
| 3256 | } |
| 3257 | if ((event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) != 0) { |
| 3258 | if ((event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN) != 0) |
| 3259 | mainwin->window_hidden = TRUE; |
| 3260 | else
|
| 3261 | mainwin->window_hidden = FALSE; |
| 3262 | } |
| 3263 | |
| 3264 | if (mainwin->window_hidden &&
|
| 3265 | prefs_common.show_trayicon && prefs_common.minimize_to_tray) |
| 3266 | gtk_window_set_skip_taskbar_hint(GTK_WINDOW(widget), TRUE); |
| 3267 | else if (!mainwin->window_hidden) |
| 3268 | gtk_window_set_skip_taskbar_hint(GTK_WINDOW(widget), FALSE); |
| 3269 | |
| 3270 | return FALSE;
|
| 3271 | } |
| 3272 | |
| 3273 | static gboolean main_window_visibility_notify_cb(GtkWidget *widget,
|
| 3274 | GdkEventVisibility *event, |
| 3275 | gpointer data) |
| 3276 | {
|
| 3277 | MainWindow *mainwin = (MainWindow *)data; |
| 3278 | |
| 3279 | mainwin->window_obscured = |
| 3280 | (event->state == GDK_VISIBILITY_FULLY_OBSCURED || |
| 3281 | event->state == GDK_VISIBILITY_PARTIAL) ? TRUE : FALSE; |
| 3282 | |
| 3283 | return FALSE;
|
| 3284 | } |
| 3285 | |
| 3286 | static void new_folder_cb(MainWindow *mainwin, guint action, |
| 3287 | GtkWidget *widget) |
| 3288 | {
|
| 3289 | folderview_new_folder(mainwin->folderview); |
| 3290 | } |
| 3291 | |
| 3292 | static void rename_folder_cb(MainWindow *mainwin, guint action, |
| 3293 | GtkWidget *widget) |
| 3294 | {
|
| 3295 | folderview_rename_folder(mainwin->folderview); |
| 3296 | } |
| 3297 | |
| 3298 | static void move_folder_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3299 | {
|
| 3300 | folderview_move_folder(mainwin->folderview); |
| 3301 | } |
| 3302 | |
| 3303 | static void delete_folder_cb(MainWindow *mainwin, guint action, |
| 3304 | GtkWidget *widget) |
| 3305 | {
|
| 3306 | folderview_delete_folder(mainwin->folderview); |
| 3307 | } |
| 3308 | |
| 3309 | static void add_mailbox_cb(MainWindow *mainwin, guint action, |
| 3310 | GtkWidget *widget) |
| 3311 | {
|
| 3312 | main_window_add_mailbox(mainwin); |
| 3313 | } |
| 3314 | |
| 3315 | static void remove_mailbox_cb(MainWindow *mainwin, guint action, |
| 3316 | GtkWidget *widget) |
| 3317 | {
|
| 3318 | folderview_remove_mailbox(mainwin->folderview); |
| 3319 | } |
| 3320 | |
| 3321 | static void update_folderview_cb(MainWindow *mainwin, guint action, |
| 3322 | GtkWidget *widget) |
| 3323 | {
|
| 3324 | if (action == 0) |
| 3325 | folderview_check_new_selected(mainwin->folderview); |
| 3326 | else
|
| 3327 | folderview_check_new_all(); |
| 3328 | } |
| 3329 | |
| 3330 | static void rebuild_tree_cb(MainWindow *mainwin, guint action, |
| 3331 | GtkWidget *widget) |
| 3332 | {
|
| 3333 | folderview_rebuild_tree(mainwin->folderview); |
| 3334 | } |
| 3335 | |
| 3336 | static void import_mail_cb(MainWindow *mainwin, guint action, |
| 3337 | GtkWidget *widget) |
| 3338 | {
|
| 3339 | import_mail(mainwin->summaryview->folder_item); |
| 3340 | main_window_popup(mainwin); |
| 3341 | } |
| 3342 | |
| 3343 | static void export_mail_cb(MainWindow *mainwin, guint action, |
| 3344 | GtkWidget *widget) |
| 3345 | {
|
| 3346 | export_mail(mainwin->summaryview->folder_item); |
| 3347 | main_window_popup(mainwin); |
| 3348 | } |
| 3349 | |
| 3350 | static void empty_trash_cb(MainWindow *mainwin, guint action, |
| 3351 | GtkWidget *widget) |
| 3352 | {
|
| 3353 | main_window_empty_trash(mainwin, TRUE); |
| 3354 | } |
| 3355 | |
| 3356 | static void save_as_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3357 | {
|
| 3358 | MessageView *messageview = mainwin->messageview; |
| 3359 | |
| 3360 | if (messageview_get_selected_mime_part(messageview) &&
|
| 3361 | GTK_WIDGET_HAS_FOCUS(messageview->mimeview->treeview)) |
| 3362 | mimeview_save_as(messageview->mimeview); |
| 3363 | else
|
| 3364 | summary_save_as(mainwin->summaryview); |
| 3365 | } |
| 3366 | |
| 3367 | #if GTK_CHECK_VERSION(2, 10, 0) |
| 3368 | static void page_setup_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3369 | {
|
| 3370 | printing_page_setup_gtk(); |
| 3371 | } |
| 3372 | #endif
|
| 3373 | |
| 3374 | static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3375 | {
|
| 3376 | summary_print(mainwin->summaryview); |
| 3377 | } |
| 3378 | |
| 3379 | static void toggle_offline_cb(MainWindow *mainwin, guint action, |
| 3380 | GtkWidget *widget) |
| 3381 | {
|
| 3382 | if (GTK_CHECK_MENU_ITEM(widget)->active &&
|
| 3383 | folder_remote_folder_active_session_exist()) {
|
| 3384 | debug_print("Active session exist. Cancelling online switch.\n");
|
| 3385 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), |
| 3386 | FALSE); |
| 3387 | return;
|
| 3388 | } |
| 3389 | |
| 3390 | main_window_toggle_online |
| 3391 | (mainwin, !GTK_CHECK_MENU_ITEM(widget)->active); |
| 3392 | } |
| 3393 | |
| 3394 | static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3395 | {
|
| 3396 | if (prefs_common.confirm_on_exit) {
|
| 3397 | if (alertpanel(_("Exit"), _("Exit this program?"), |
| 3398 | GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL)
|
| 3399 | != G_ALERTDEFAULT) |
| 3400 | return;
|
| 3401 | manage_window_focus_in(mainwin->window, NULL, NULL); |
| 3402 | } |
| 3403 | |
| 3404 | app_will_exit(FALSE); |
| 3405 | } |
| 3406 | |
| 3407 | static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3408 | {
|
| 3409 | if (action == 1) { |
| 3410 | FolderItem *item; |
| 3411 | |
| 3412 | item = folderview_get_selected_item(mainwin->folderview); |
| 3413 | if (item && item->stype == F_VIRTUAL)
|
| 3414 | prefs_search_folder_open(item); |
| 3415 | else
|
| 3416 | query_search(item); |
| 3417 | } else if (action == 2) { |
| 3418 | if (!prefs_common.show_searchbar) {
|
| 3419 | GtkWidget *menuitem; |
| 3420 | |
| 3421 | menuitem = gtk_item_factory_get_item |
| 3422 | (mainwin->menu_factory, |
| 3423 | "/View/Show or hide/Search bar");
|
| 3424 | gtk_check_menu_item_set_active |
| 3425 | (GTK_CHECK_MENU_ITEM(menuitem), TRUE); |
| 3426 | } |
| 3427 | gtk_widget_grab_focus(mainwin->summaryview->qsearch->entry); |
| 3428 | } else
|
| 3429 | message_search(mainwin->messageview); |
| 3430 | } |
| 3431 | |
| 3432 | static void toggle_folder_cb(MainWindow *mainwin, guint action, |
| 3433 | GtkWidget *widget) |
| 3434 | {
|
| 3435 | gboolean active; |
| 3436 | |
| 3437 | active = GTK_CHECK_MENU_ITEM(widget)->active; |
| 3438 | |
| 3439 | switch (mainwin->type) {
|
| 3440 | case SEPARATE_NONE:
|
| 3441 | case SEPARATE_MESSAGE:
|
| 3442 | #if 0
|
| 3443 | if (active) |
| 3444 | gtk_widget_show(GTK_WIDGET_PTR(mainwin->folderview)); |
| 3445 | else |
| 3446 | gtk_widget_hide(GTK_WIDGET_PTR(mainwin->folderview)); |
| 3447 | #endif |
| 3448 | break;
|
| 3449 | case SEPARATE_FOLDER:
|
| 3450 | if (active)
|
| 3451 | gtk_widget_show(mainwin->win.sep_folder.folderwin); |
| 3452 | else
|
| 3453 | gtk_widget_hide(mainwin->win.sep_folder.folderwin); |
| 3454 | break;
|
| 3455 | case SEPARATE_BOTH:
|
| 3456 | if (active)
|
| 3457 | gtk_widget_show(mainwin->win.sep_both.folderwin); |
| 3458 | else
|
| 3459 | gtk_widget_hide(mainwin->win.sep_both.folderwin); |
| 3460 | break;
|
| 3461 | } |
| 3462 | |
| 3463 | prefs_common.folderview_visible = active; |
| 3464 | } |
| 3465 | |
| 3466 | static void toggle_message_cb(MainWindow *mainwin, guint action, |
| 3467 | GtkWidget *widget) |
| 3468 | {
|
| 3469 | gboolean active; |
| 3470 | |
| 3471 | active = GTK_CHECK_MENU_ITEM(widget)->active; |
| 3472 | |
| 3473 | if (active != messageview_is_visible(mainwin->messageview))
|
| 3474 | summary_toggle_view(mainwin->summaryview); |
| 3475 | } |
| 3476 | |
| 3477 | static void toggle_toolbar_cb(MainWindow *mainwin, guint action, |
| 3478 | GtkWidget *widget) |
| 3479 | {
|
| 3480 | mainwin->toolbar_style = (ToolbarStyle)action; |
| 3481 | prefs_common.toolbar_style = (ToolbarStyle)action; |
| 3482 | |
| 3483 | main_window_set_toolbar_button_visibility(mainwin); |
| 3484 | } |
| 3485 | |
| 3486 | static void toggle_searchbar_cb(MainWindow *mainwin, guint action, |
| 3487 | GtkWidget *widget) |
| 3488 | {
|
| 3489 | if (GTK_CHECK_MENU_ITEM(widget)->active) {
|
| 3490 | gtk_widget_show(mainwin->summaryview->qsearch->hbox); |
| 3491 | prefs_common.show_searchbar = TRUE; |
| 3492 | } else {
|
| 3493 | gtk_widget_hide(mainwin->summaryview->qsearch->hbox); |
| 3494 | summary_qsearch_reset(mainwin->summaryview); |
| 3495 | prefs_common.show_searchbar = FALSE; |
| 3496 | } |
| 3497 | } |
| 3498 | |
| 3499 | static void toggle_statusbar_cb(MainWindow *mainwin, guint action, |
| 3500 | GtkWidget *widget) |
| 3501 | {
|
| 3502 | if (GTK_CHECK_MENU_ITEM(widget)->active) {
|
| 3503 | gtk_widget_show(mainwin->statusbar); |
| 3504 | prefs_common.show_statusbar = TRUE; |
| 3505 | } else {
|
| 3506 | gtk_widget_hide(mainwin->statusbar); |
| 3507 | prefs_common.show_statusbar = FALSE; |
| 3508 | } |
| 3509 | } |
| 3510 | |
| 3511 | static void toolbar_customize_cb(MainWindow *mainwin, guint action, |
| 3512 | GtkWidget *widget) |
| 3513 | {
|
| 3514 | toolbar_customize(widget, mainwin); |
| 3515 | } |
| 3516 | |
| 3517 | static void change_layout_cb(MainWindow *mainwin, guint action, |
| 3518 | GtkWidget *widget) |
| 3519 | {
|
| 3520 | LayoutType type = action; |
| 3521 | |
| 3522 | if (GTK_CHECK_MENU_ITEM(widget)->active)
|
| 3523 | main_window_change_layout(mainwin, type, mainwin->type); |
| 3524 | } |
| 3525 | |
| 3526 | static void separate_widget_cb(MainWindow *mainwin, guint action, |
| 3527 | GtkWidget *widget) |
| 3528 | {
|
| 3529 | SeparateType type; |
| 3530 | |
| 3531 | if (GTK_CHECK_MENU_ITEM(widget)->active)
|
| 3532 | type = mainwin->type | action; |
| 3533 | else
|
| 3534 | type = mainwin->type & ~action; |
| 3535 | |
| 3536 | main_window_change_layout(mainwin, prefs_common.layout_type, type); |
| 3537 | |
| 3538 | prefs_common.sep_folder = (type & SEPARATE_FOLDER) != 0;
|
| 3539 | prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
|
| 3540 | } |
| 3541 | |
| 3542 | static void addressbook_open_cb(MainWindow *mainwin, guint action, |
| 3543 | GtkWidget *widget) |
| 3544 | {
|
| 3545 | addressbook_open(NULL);
|
| 3546 | } |
| 3547 | |
| 3548 | static void log_window_show_cb(MainWindow *mainwin, guint action, |
| 3549 | GtkWidget *widget) |
| 3550 | {
|
| 3551 | log_window_show(mainwin->logwin); |
| 3552 | } |
| 3553 | |
| 3554 | static void inc_mail_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3555 | {
|
| 3556 | inc_mail(mainwin); |
| 3557 | } |
| 3558 | |
| 3559 | static void inc_all_account_mail_cb(MainWindow *mainwin, guint action, |
| 3560 | GtkWidget *widget) |
| 3561 | {
|
| 3562 | inc_all_account_mail(mainwin, FALSE); |
| 3563 | } |
| 3564 | |
| 3565 | static void inc_stop_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3566 | {
|
| 3567 | inc_cancel_all(); |
| 3568 | } |
| 3569 | |
| 3570 | static void rpop3_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3571 | {
|
| 3572 | rpop3_account(cur_account); |
| 3573 | } |
| 3574 | |
| 3575 | static void send_queue_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3576 | {
|
| 3577 | main_window_send_queue(mainwin); |
| 3578 | } |
| 3579 | |
| 3580 | static void compose_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3581 | {
|
| 3582 | PrefsAccount *ac = NULL;
|
| 3583 | FolderItem *item = mainwin->summaryview->folder_item; |
| 3584 | |
| 3585 | if (item) {
|
| 3586 | ac = account_find_from_item(item); |
| 3587 | if (ac && ac->protocol == A_NNTP &&
|
| 3588 | FOLDER_TYPE(item->folder) == F_NEWS) {
|
| 3589 | compose_new(ac, item, item->path, NULL);
|
| 3590 | return;
|
| 3591 | } |
| 3592 | } |
| 3593 | |
| 3594 | compose_new(ac, item, NULL, NULL); |
| 3595 | } |
| 3596 | |
| 3597 | static void reply_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3598 | {
|
| 3599 | summary_reply(mainwin->summaryview, (ComposeMode)action); |
| 3600 | } |
| 3601 | |
| 3602 | static void move_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3603 | {
|
| 3604 | summary_move_to(mainwin->summaryview); |
| 3605 | } |
| 3606 | |
| 3607 | static void copy_to_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3608 | {
|
| 3609 | summary_copy_to(mainwin->summaryview); |
| 3610 | } |
| 3611 | |
| 3612 | static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3613 | {
|
| 3614 | summary_delete(mainwin->summaryview); |
| 3615 | } |
| 3616 | |
| 3617 | static void open_msg_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3618 | {
|
| 3619 | summary_open_msg(mainwin->summaryview); |
| 3620 | } |
| 3621 | |
| 3622 | static void view_source_cb(MainWindow *mainwin, guint action, |
| 3623 | GtkWidget *widget) |
| 3624 | {
|
| 3625 | summary_view_source(mainwin->summaryview); |
| 3626 | } |
| 3627 | |
| 3628 | static void show_all_header_cb(MainWindow *mainwin, guint action, |
| 3629 | GtkWidget *widget) |
| 3630 | {
|
| 3631 | if (mainwin->menu_lock_count) return; |
| 3632 | summary_display_msg_selected(mainwin->summaryview, FALSE, |
| 3633 | GTK_CHECK_MENU_ITEM(widget)->active); |
| 3634 | } |
| 3635 | |
| 3636 | static void mark_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3637 | {
|
| 3638 | summary_mark(mainwin->summaryview); |
| 3639 | } |
| 3640 | |
| 3641 | static void unmark_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3642 | {
|
| 3643 | summary_unmark(mainwin->summaryview); |
| 3644 | } |
| 3645 | |
| 3646 | static void mark_as_unread_cb(MainWindow *mainwin, guint action, |
| 3647 | GtkWidget *widget) |
| 3648 | {
|
| 3649 | summary_mark_as_unread(mainwin->summaryview); |
| 3650 | } |
| 3651 | |
| 3652 | static void mark_as_read_cb(MainWindow *mainwin, guint action, |
| 3653 | GtkWidget *widget) |
| 3654 | {
|
| 3655 | summary_mark_as_read(mainwin->summaryview); |
| 3656 | } |
| 3657 | |
| 3658 | static void mark_thread_as_read_cb(MainWindow *mainwin, guint action, |
| 3659 | GtkWidget *widget) |
| 3660 | {
|
| 3661 | summary_mark_thread_as_read(mainwin->summaryview); |
| 3662 | } |
| 3663 | |
| 3664 | static void mark_all_read_cb(MainWindow *mainwin, guint action, |
| 3665 | GtkWidget *widget) |
| 3666 | {
|
| 3667 | summary_mark_all_read(mainwin->summaryview); |
| 3668 | } |
| 3669 | |
| 3670 | static void junk_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3671 | {
|
| 3672 | if (action == 0) |
| 3673 | summary_junk(mainwin->summaryview); |
| 3674 | else
|
| 3675 | summary_not_junk(mainwin->summaryview); |
| 3676 | } |
| 3677 | |
| 3678 | static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3679 | {
|
| 3680 | summary_reedit(mainwin->summaryview); |
| 3681 | } |
| 3682 | |
| 3683 | static void add_address_cb(MainWindow *mainwin, guint action, |
| 3684 | GtkWidget *widget) |
| 3685 | {
|
| 3686 | summary_add_address(mainwin->summaryview); |
| 3687 | } |
| 3688 | |
| 3689 | static void set_charset_cb(MainWindow *mainwin, guint action, |
| 3690 | GtkWidget *widget) |
| 3691 | {
|
| 3692 | const gchar *str;
|
| 3693 | |
| 3694 | if (GTK_CHECK_MENU_ITEM(widget)->active) {
|
| 3695 | str = conv_get_charset_str((CharSet)action); |
| 3696 | g_free(prefs_common.force_charset); |
| 3697 | prefs_common.force_charset = str ? g_strdup(str) : NULL;
|
| 3698 | |
| 3699 | summary_redisplay_msg(mainwin->summaryview); |
| 3700 | |
| 3701 | debug_print("forced charset: %s\n",
|
| 3702 | str ? str : "Auto-Detect");
|
| 3703 | } |
| 3704 | } |
| 3705 | |
| 3706 | static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3707 | {
|
| 3708 | if (mainwin->menu_lock_count) return; |
| 3709 | if (!mainwin->summaryview->folder_item) return; |
| 3710 | |
| 3711 | if (GTK_CHECK_MENU_ITEM(widget)->active)
|
| 3712 | summary_thread_build(mainwin->summaryview); |
| 3713 | else
|
| 3714 | summary_unthread(mainwin->summaryview); |
| 3715 | } |
| 3716 | |
| 3717 | static void expand_threads_cb(MainWindow *mainwin, guint action, |
| 3718 | GtkWidget *widget) |
| 3719 | {
|
| 3720 | summary_expand_threads(mainwin->summaryview); |
| 3721 | } |
| 3722 | |
| 3723 | static void collapse_threads_cb(MainWindow *mainwin, guint action, |
| 3724 | GtkWidget *widget) |
| 3725 | {
|
| 3726 | summary_collapse_threads(mainwin->summaryview); |
| 3727 | } |
| 3728 | |
| 3729 | static void set_display_item_cb(MainWindow *mainwin, guint action, |
| 3730 | GtkWidget *widget) |
| 3731 | {
|
| 3732 | prefs_summary_column_open |
| 3733 | (FOLDER_ITEM_IS_SENT_FOLDER(mainwin->summaryview->folder_item)); |
| 3734 | } |
| 3735 | |
| 3736 | static void sort_summary_cb(MainWindow *mainwin, guint action, |
| 3737 | GtkWidget *widget) |
| 3738 | {
|
| 3739 | FolderItem *item = mainwin->summaryview->folder_item; |
| 3740 | GtkWidget *menuitem; |
| 3741 | |
| 3742 | if (mainwin->menu_lock_count) return; |
| 3743 | |
| 3744 | if (GTK_CHECK_MENU_ITEM(widget)->active && item) {
|
| 3745 | menuitem = gtk_item_factory_get_item |
| 3746 | (mainwin->menu_factory, "/View/Sort/Ascending");
|
| 3747 | summary_sort(mainwin->summaryview, (FolderSortKey)action, |
| 3748 | GTK_CHECK_MENU_ITEM(menuitem)->active |
| 3749 | ? SORT_ASCENDING : SORT_DESCENDING); |
| 3750 | } |
| 3751 | } |
| 3752 | |
| 3753 | static void sort_summary_type_cb(MainWindow *mainwin, guint action, |
| 3754 | GtkWidget *widget) |
| 3755 | {
|
| 3756 | FolderItem *item = mainwin->summaryview->folder_item; |
| 3757 | |
| 3758 | if (mainwin->menu_lock_count) return; |
| 3759 | |
| 3760 | if (GTK_CHECK_MENU_ITEM(widget)->active && item)
|
| 3761 | summary_sort(mainwin->summaryview, |
| 3762 | item->sort_key, (FolderSortType)action); |
| 3763 | } |
| 3764 | |
| 3765 | static void attract_by_subject_cb(MainWindow *mainwin, guint action, |
| 3766 | GtkWidget *widget) |
| 3767 | {
|
| 3768 | summary_attract_by_subject(mainwin->summaryview); |
| 3769 | } |
| 3770 | |
| 3771 | static void delete_duplicated_cb(MainWindow *mainwin, guint action, |
| 3772 | GtkWidget *widget) |
| 3773 | {
|
| 3774 | summary_delete_duplicated(mainwin->summaryview); |
| 3775 | } |
| 3776 | |
| 3777 | static void concat_partial_cb(MainWindow *mainwin, guint action, |
| 3778 | GtkWidget *widget) |
| 3779 | {
|
| 3780 | GSList *mlist; |
| 3781 | gchar *file; |
| 3782 | FolderItem *item; |
| 3783 | |
| 3784 | if (summary_is_locked(mainwin->summaryview))
|
| 3785 | return;
|
| 3786 | |
| 3787 | item = mainwin->summaryview->folder_item; |
| 3788 | if (!item)
|
| 3789 | return;
|
| 3790 | mlist = summary_get_selected_msg_list(mainwin->summaryview); |
| 3791 | if (!mlist)
|
| 3792 | return;
|
| 3793 | |
| 3794 | file = get_tmp_file(); |
| 3795 | if (procmsg_concat_partial_messages(mlist, file) == 0) { |
| 3796 | folder_item_add_msg(item, file, NULL, TRUE);
|
| 3797 | summary_show_queued_msgs(mainwin->summaryview); |
| 3798 | } else {
|
| 3799 | alertpanel_error |
| 3800 | (_("The selected messages could not be combined."));
|
| 3801 | } |
| 3802 | g_free(file); |
| 3803 | |
| 3804 | g_slist_free(mlist); |
| 3805 | } |
| 3806 | |
| 3807 | static void filter_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3808 | {
|
| 3809 | summary_filter(mainwin->summaryview, (gboolean)action); |
| 3810 | } |
| 3811 | |
| 3812 | static void filter_junk_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3813 | {
|
| 3814 | summary_filter_junk(mainwin->summaryview, (gboolean)action); |
| 3815 | } |
| 3816 | |
| 3817 | static void execute_summary_cb(MainWindow *mainwin, guint action, |
| 3818 | GtkWidget *widget) |
| 3819 | {
|
| 3820 | summary_execute(mainwin->summaryview); |
| 3821 | } |
| 3822 | |
| 3823 | static void update_summary_cb(MainWindow *mainwin, guint action, |
| 3824 | GtkWidget *widget) |
| 3825 | {
|
| 3826 | if (!mainwin->summaryview->folder_item) return; |
| 3827 | |
| 3828 | summary_show(mainwin->summaryview, mainwin->summaryview->folder_item, |
| 3829 | TRUE); |
| 3830 | } |
| 3831 | |
| 3832 | static void prev_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3833 | {
|
| 3834 | MessageView *messageview = mainwin->messageview; |
| 3835 | |
| 3836 | if (messageview_get_selected_mime_part(messageview) &&
|
| 3837 | GTK_WIDGET_HAS_FOCUS(messageview->mimeview->treeview) && |
| 3838 | mimeview_step(messageview->mimeview, GTK_SCROLL_STEP_BACKWARD)) |
| 3839 | return;
|
| 3840 | |
| 3841 | if (summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD))
|
| 3842 | summary_mark_displayed_read(mainwin->summaryview, NULL);
|
| 3843 | } |
| 3844 | |
| 3845 | static void next_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3846 | {
|
| 3847 | MessageView *messageview = mainwin->messageview; |
| 3848 | |
| 3849 | if (messageview_get_selected_mime_part(messageview) &&
|
| 3850 | GTK_WIDGET_HAS_FOCUS(messageview->mimeview->treeview) && |
| 3851 | mimeview_step(messageview->mimeview, GTK_SCROLL_STEP_FORWARD)) |
| 3852 | return;
|
| 3853 | |
| 3854 | if (summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD))
|
| 3855 | summary_mark_displayed_read(mainwin->summaryview, NULL);
|
| 3856 | } |
| 3857 | |
| 3858 | static void prev_unread_cb(MainWindow *mainwin, guint action, |
| 3859 | GtkWidget *widget) |
| 3860 | {
|
| 3861 | summary_select_prev_unread(mainwin->summaryview); |
| 3862 | } |
| 3863 | |
| 3864 | static void next_unread_cb(MainWindow *mainwin, guint action, |
| 3865 | GtkWidget *widget) |
| 3866 | {
|
| 3867 | summary_select_next_unread(mainwin->summaryview); |
| 3868 | } |
| 3869 | |
| 3870 | static void prev_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3871 | {
|
| 3872 | summary_select_prev_new(mainwin->summaryview); |
| 3873 | } |
| 3874 | |
| 3875 | static void next_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3876 | {
|
| 3877 | summary_select_next_new(mainwin->summaryview); |
| 3878 | } |
| 3879 | |
| 3880 | static void prev_marked_cb(MainWindow *mainwin, guint action, |
| 3881 | GtkWidget *widget) |
| 3882 | {
|
| 3883 | summary_select_prev_marked(mainwin->summaryview); |
| 3884 | } |
| 3885 | |
| 3886 | static void next_marked_cb(MainWindow *mainwin, guint action, |
| 3887 | GtkWidget *widget) |
| 3888 | {
|
| 3889 | summary_select_next_marked(mainwin->summaryview); |
| 3890 | } |
| 3891 | |
| 3892 | static void prev_labeled_cb(MainWindow *mainwin, guint action, |
| 3893 | GtkWidget *widget) |
| 3894 | {
|
| 3895 | summary_select_prev_labeled(mainwin->summaryview); |
| 3896 | } |
| 3897 | |
| 3898 | static void next_labeled_cb(MainWindow *mainwin, guint action, |
| 3899 | GtkWidget *widget) |
| 3900 | {
|
| 3901 | summary_select_next_labeled(mainwin->summaryview); |
| 3902 | } |
| 3903 | |
| 3904 | static void goto_folder_cb(MainWindow *mainwin, guint action, |
| 3905 | GtkWidget *widget) |
| 3906 | {
|
| 3907 | FolderItem *to_folder; |
| 3908 | |
| 3909 | to_folder = foldersel_folder_sel_full(NULL, FOLDER_SEL_ALL, NULL, |
| 3910 | _("Select folder to open"));
|
| 3911 | |
| 3912 | if (to_folder)
|
| 3913 | folderview_select(mainwin->folderview, to_folder); |
| 3914 | } |
| 3915 | |
| 3916 | static void copy_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3917 | {
|
| 3918 | messageview_copy_clipboard(mainwin->messageview); |
| 3919 | } |
| 3920 | |
| 3921 | static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 3922 | {
|
| 3923 | MessageView *msgview = mainwin->messageview; |
| 3924 | |
| 3925 | if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->treeview))
|
| 3926 | summary_select_all(mainwin->summaryview); |
| 3927 | else if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->qsearch->entry)) |
| 3928 | gtk_editable_select_region |
| 3929 | (GTK_EDITABLE(mainwin->summaryview->qsearch->entry), |
| 3930 | 0, -1); |
| 3931 | else if (messageview_is_visible(msgview) && |
| 3932 | (GTK_WIDGET_HAS_FOCUS(msgview->textview->text) || |
| 3933 | GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text))) |
| 3934 | messageview_select_all(msgview); |
| 3935 | } |
| 3936 | |
| 3937 | static void select_thread_cb(MainWindow *mainwin, guint action, |
| 3938 | GtkWidget *widget) |
| 3939 | {
|
| 3940 | summary_select_thread(mainwin->summaryview); |
| 3941 | } |
| 3942 | |
| 3943 | static void create_filter_cb(MainWindow *mainwin, guint action, |
| 3944 | GtkWidget *widget) |
| 3945 | {
|
| 3946 | summary_filter_open(mainwin->summaryview, (FilterCreateType)action); |
| 3947 | } |
| 3948 | |
| 3949 | static void prefs_common_open_cb(MainWindow *mainwin, guint action, |
| 3950 | GtkWidget *widget) |
| 3951 | {
|
| 3952 | prefs_common_open(); |
| 3953 | } |
| 3954 | |
| 3955 | static void prefs_filter_open_cb(MainWindow *mainwin, guint action, |
| 3956 | GtkWidget *widget) |
| 3957 | {
|
| 3958 | prefs_filter_open(NULL, NULL, NULL); |
| 3959 | } |
| 3960 | |
| 3961 | static void prefs_template_open_cb(MainWindow *mainwin, guint action, |
| 3962 | GtkWidget *widget) |
| 3963 | {
|
| 3964 | prefs_template_open(); |
| 3965 | } |
| 3966 | |
| 3967 | static void plugin_manager_open_cb(MainWindow *mainwin, guint action, |
| 3968 | GtkWidget *widget) |
| 3969 | {
|
| 3970 | plugin_manager_open(); |
| 3971 | } |
| 3972 | |
| 3973 | #ifndef G_OS_WIN32
|
| 3974 | static void prefs_actions_open_cb(MainWindow *mainwin, guint action, |
| 3975 | GtkWidget *widget) |
| 3976 | {
|
| 3977 | prefs_actions_open(mainwin); |
| 3978 | } |
| 3979 | #endif
|
| 3980 | |
| 3981 | static void prefs_account_open_cb(MainWindow *mainwin, guint action, |
| 3982 | GtkWidget *widget) |
| 3983 | {
|
| 3984 | if (!cur_account) {
|
| 3985 | new_account_cb(mainwin, 0, widget);
|
| 3986 | } else {
|
| 3987 | account_open(cur_account); |
| 3988 | } |
| 3989 | } |
| 3990 | |
| 3991 | static void new_account_cb(MainWindow *mainwin, guint action, |
| 3992 | GtkWidget *widget) |
| 3993 | {
|
| 3994 | PrefsAccount *ac; |
| 3995 | |
| 3996 | if (compose_get_compose_list()) {
|
| 3997 | alertpanel_notice(_("Some composing windows are open.\n"
|
| 3998 | "Please close all the composing windows before editing the accounts."));
|
| 3999 | return;
|
| 4000 | } |
| 4001 | |
| 4002 | if ((ac = setup_account())) {
|
| 4003 | account_set_menu(); |
| 4004 | main_window_reflect_prefs_all(); |
| 4005 | account_set_missing_folder(); |
| 4006 | folderview_set(mainwin->folderview); |
| 4007 | if (ac->folder)
|
| 4008 | folder_write_list(); |
| 4009 | } |
| 4010 | } |
| 4011 | |
| 4012 | static void account_selector_menu_cb(GtkMenuItem *menuitem, gpointer data) |
| 4013 | {
|
| 4014 | cur_account = (PrefsAccount *)data; |
| 4015 | main_window_change_cur_account(); |
| 4016 | } |
| 4017 | |
| 4018 | static void account_receive_menu_cb(GtkMenuItem *menuitem, gpointer data) |
| 4019 | {
|
| 4020 | PrefsAccount *account = (PrefsAccount *)data; |
| 4021 | |
| 4022 | inc_account_mail(main_window_get(), account); |
| 4023 | } |
| 4024 | |
| 4025 | static void manual_open_cb(MainWindow *mainwin, guint action, |
| 4026 | GtkWidget *widget) |
| 4027 | {
|
| 4028 | manual_open((ManualLang)action); |
| 4029 | } |
| 4030 | |
| 4031 | static void faq_open_cb(MainWindow *mainwin, guint action, GtkWidget *widget) |
| 4032 | {
|
| 4033 | faq_open((ManualLang)action); |
| 4034 | } |
| 4035 | |
| 4036 | static GtkWidget *help_cmdline_window;
|
| 4037 | |
| 4038 | static void help_cmdline_ok(GtkWidget *button) |
| 4039 | {
|
| 4040 | gtk_widget_destroy(gtk_widget_get_toplevel(button)); |
| 4041 | } |
| 4042 | |
| 4043 | static gboolean help_cmdline_key_pressed(GtkWidget *widget, GdkEventKey *event,
|
| 4044 | gpointer data) |
| 4045 | {
|
| 4046 | if (event && event->keyval == GDK_Escape) {
|
| 4047 | gtk_widget_destroy(widget); |
| 4048 | return TRUE;
|
| 4049 | } |
| 4050 | return FALSE;
|
| 4051 | } |
| 4052 | |
| 4053 | static gboolean help_cmdline_deleted(GtkWidget *widget, GdkEventAny *event,
|
| 4054 | gpointer data) |
| 4055 | {
|
| 4056 | return FALSE;
|
| 4057 | } |
| 4058 | |
| 4059 | static void help_cmdline_destroyed(GtkWidget *widget, gpointer data) |
| 4060 | {
|
| 4061 | help_cmdline_window = NULL;
|
| 4062 | } |
| 4063 | |
| 4064 | static void help_command_line_show(void) |
| 4065 | {
|
| 4066 | GtkWidget *window; |
| 4067 | GtkWidget *vbox; |
| 4068 | GtkWidget *vbox2; |
| 4069 | GtkWidget *hbox; |
| 4070 | GtkWidget *label; |
| 4071 | GtkWidget *hbbox; |
| 4072 | GtkWidget *ok_btn; |
| 4073 | |
| 4074 | if (help_cmdline_window) {
|
| 4075 | gtk_window_present(GTK_WINDOW(help_cmdline_window)); |
| 4076 | return;
|
| 4077 | } |
| 4078 | |
| 4079 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 4080 | gtk_window_set_title(GTK_WINDOW(window), _("Command line options"));
|
| 4081 | gtk_container_set_border_width(GTK_CONTAINER(window), 8);
|
| 4082 | gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); |
| 4083 | gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); |
| 4084 | help_cmdline_window = window; |
| 4085 | |
| 4086 | vbox = gtk_vbox_new(FALSE, 8);
|
| 4087 | gtk_container_add(GTK_CONTAINER(window), vbox); |
| 4088 | |
| 4089 | vbox2 = gtk_vbox_new(FALSE, 8);
|
| 4090 | gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);
|
| 4091 | gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0);
|
| 4092 | |
| 4093 | label = gtk_label_new(_("Usage: sylpheed [OPTION]..."));
|
| 4094 | gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0);
|
| 4095 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| 4096 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 4097 | |
| 4098 | hbox = gtk_hbox_new(FALSE, 16);
|
| 4099 | gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
|
| 4100 | |
| 4101 | label = gtk_label_new(_("--compose [address]\n"
|
| 4102 | "--attach file1 [file2]...\n"
|
| 4103 | "--receive\n"
|
| 4104 | "--receive-all\n"
|
| 4105 | "--send\n"
|
| 4106 | "--status [folder]...\n"
|
| 4107 | "--status-full [folder]...\n"
|
| 4108 | "--open folderid/msgnum\n"
|
| 4109 | "--open <file URL>\n"
|
| 4110 | "--configdir dirname\n"
|
| 4111 | "--exit\n"
|
| 4112 | "--debug\n"
|
| 4113 | "--safe-mode\n"
|
| 4114 | "--help\n"
|
| 4115 | "--version"));
|
| 4116 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
| 4117 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| 4118 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 4119 | |
| 4120 | label = gtk_label_new(_("open composition window\n"
|
| 4121 | "open composition window with specified files attached\n"
|
| 4122 | "receive new messages\n"
|
| 4123 | "receive new messages of all accounts\n"
|
| 4124 | "send all queued messages\n"
|
| 4125 | "show the total number of messages\n"
|
| 4126 | "show the status of each folder\n"
|
| 4127 | "open message in new window\n"
|
| 4128 | "open an rfc822 message file in a new window\n"
|
| 4129 | "specify directory which stores configuration files\n"
|
| 4130 | "exit Sylpheed\n"
|
| 4131 | "debug mode\n"
|
| 4132 | "safe mode\n"
|
| 4133 | "display this help and exit\n"
|
| 4134 | "output version information and exit"));
|
| 4135 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
| 4136 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| 4137 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 4138 | |
| 4139 | #ifdef G_OS_WIN32
|
| 4140 | label = gtk_label_new(_("Windows-only option:"));
|
| 4141 | gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0);
|
| 4142 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| 4143 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 4144 | |
| 4145 | hbox = gtk_hbox_new(FALSE, 32);
|
| 4146 | gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
|
| 4147 | |
| 4148 | label = gtk_label_new(_("--ipcport portnum"));
|
| 4149 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
| 4150 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| 4151 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 4152 | |
| 4153 | label = gtk_label_new(_("specify port for IPC remote commands"));
|
| 4154 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
| 4155 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| 4156 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 4157 | #endif
|
| 4158 | |
| 4159 | gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, |
| 4160 | NULL, NULL, NULL, NULL); |
| 4161 | gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
|
| 4162 | gtk_widget_grab_default(ok_btn); |
| 4163 | |
| 4164 | g_signal_connect(G_OBJECT(ok_btn), "clicked",
|
| 4165 | G_CALLBACK(help_cmdline_ok), NULL);
|
| 4166 | g_signal_connect(G_OBJECT(window), "key_press_event",
|
| 4167 | G_CALLBACK(help_cmdline_key_pressed), NULL);
|
| 4168 | g_signal_connect(G_OBJECT(window), "delete_event",
|
| 4169 | G_CALLBACK(help_cmdline_deleted), NULL);
|
| 4170 | g_signal_connect(G_OBJECT(window), "destroy",
|
| 4171 | G_CALLBACK(help_cmdline_destroyed), NULL);
|
| 4172 | |
| 4173 | gtk_widget_show_all(window); |
| 4174 | } |
| 4175 | |
| 4176 | static void help_cmdline_cb(MainWindow *mainwin, guint action, |
| 4177 | GtkWidget *widget) |
| 4178 | {
|
| 4179 | help_command_line_show(); |
| 4180 | } |
| 4181 | |
| 4182 | #if USE_UPDATE_CHECK
|
| 4183 | static void update_check_cb(MainWindow *mainwin, guint action, |
| 4184 | GtkWidget *widget) |
| 4185 | {
|
| 4186 | update_check(TRUE); |
| 4187 | } |
| 4188 | |
| 4189 | #ifdef USE_UPDATE_CHECK_PLUGIN
|
| 4190 | static void update_check_plugin_cb(MainWindow *mainwin, guint action, |
| 4191 | GtkWidget *widget) |
| 4192 | {
|
| 4193 | update_check_plugin(TRUE); |
| 4194 | } |
| 4195 | #endif
|
| 4196 | #endif
|
| 4197 | |
| 4198 | static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data) |
| 4199 | {
|
| 4200 | MainWindow *mainwin = (MainWindow *)data; |
| 4201 | gchar *str; |
| 4202 | |
| 4203 | if (item->path)
|
| 4204 | str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
|
| 4205 | LOCAL_FOLDER(folder)->rootpath, |
| 4206 | G_DIR_SEPARATOR, |
| 4207 | item->path); |
| 4208 | else
|
| 4209 | str = g_strdup_printf(_("Scanning folder %s ..."),
|
| 4210 | LOCAL_FOLDER(folder)->rootpath); |
| 4211 | |
| 4212 | STATUSBAR_PUSH(mainwin, str); |
| 4213 | STATUSBAR_POP(mainwin); |
| 4214 | g_free(str); |
| 4215 | } |