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