prefs_common.h (12190B)
1 /* 2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client 3 * Copyright (C) 1999-2024 the Claws Mail team and 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 3 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, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef __PREFS_COMMON_H__ 20 #define __PREFS_COMMON_H__ 21 22 #include <glib.h> 23 24 #include "mainwindow.h" 25 #include "summaryview.h" 26 #include "folderview.h" 27 #include "codeconv.h" 28 #include "textview.h" 29 #include "procmime.h" 30 #include "prefs_summary_open.h" 31 32 #define CLAWS_CONFIG_VERSION 5 33 34 typedef struct _PrefsCommon PrefsCommon; 35 36 typedef enum { 37 COMPOSE_DND_ASK, 38 COMPOSE_DND_INSERT, 39 COMPOSE_DND_ATTACH 40 } ComposeDndInsertOrAttach; 41 42 typedef enum { 43 CTE_AUTO, 44 CTE_BASE64, 45 CTE_QUOTED_PRINTABLE, 46 CTE_8BIT 47 } TransferEncodingMethod; 48 49 typedef enum 50 { 51 /* U = unread, N = new, M = marked */ 52 SELECTONENTRY_NOTHING, 53 SELECTONENTRY_UNM, 54 SELECTONENTRY_UMN, 55 SELECTONENTRY_NUM, 56 SELECTONENTRY_NMU, 57 SELECTONENTRY_MNU, 58 SELECTONENTRY_MUN, 59 SELECTONENTRY_LAST 60 } SelectOnEntry; 61 62 typedef enum 63 { 64 ACTION_UNSET = 0, /* for backward compatibility */ 65 ACTION_OLDEST_MARKED, 66 ACTION_OLDEST_NEW, 67 ACTION_OLDEST_UNREAD, 68 ACTION_LAST_OPENED, 69 ACTION_NEWEST_LIST, 70 ACTION_NOTHING, 71 ACTION_OLDEST_LIST, 72 ACTION_NEWEST_MARKED, 73 ACTION_NEWEST_NEW, 74 ACTION_NEWEST_UNREAD 75 } EntryAction; 76 77 typedef enum 78 { 79 NEXTUNREADMSGDIALOG_ALWAYS, 80 NEXTUNREADMSGDIALOG_ASSUME_YES, 81 NEXTUNREADMSGDIALOG_ASSUME_NO 82 } NextUnreadMsgDialogShow; 83 84 typedef enum 85 { 86 SHOW_NAME, 87 SHOW_ADDR, 88 SHOW_BOTH 89 } SummaryFromShow; 90 91 typedef enum 92 { 93 COL_MISSPELLED, 94 COL_QUOTE_LEVEL1, 95 COL_QUOTE_LEVEL2, 96 COL_QUOTE_LEVEL3, 97 COL_QUOTE_LEVEL1_BG, 98 COL_QUOTE_LEVEL2_BG, 99 COL_QUOTE_LEVEL3_BG, 100 COL_URI, 101 COL_TGT_FOLDER, 102 COL_SIGNATURE, 103 COL_EMPHASIS, 104 COL_DEFAULT_HEADER, 105 COL_DEFAULT_HEADER_BG, 106 COL_TAGS, 107 COL_TAGS_BG, 108 COL_QS_ACTIVE, 109 COL_QS_ACTIVE_BG, 110 COL_QS_ERROR, 111 COL_QS_ERROR_BG, 112 COL_LOG_MSG, 113 COL_LOG_WARN, 114 COL_LOG_ERROR, 115 COL_LOG_IN, 116 COL_LOG_OUT, 117 COL_LOG_STATUS_OK, 118 COL_LOG_STATUS_NOK, 119 COL_LOG_STATUS_SKIP, 120 COL_NEW, 121 COL_DIFF_ADDED, 122 COL_DIFF_DELETED, 123 COL_DIFF_HUNK, 124 COL_LAST_COLOR_INDEX 125 } ColorIndex; 126 127 struct _PrefsCommon 128 { 129 gint config_version; 130 131 /* Receive */ 132 gboolean use_extinc; 133 gchar *extinc_cmd; 134 gboolean newmail_notify_auto; 135 gboolean newmail_notify_manu; 136 gchar *newmail_notify_cmd; 137 gint receivewin_width; 138 gint receivewin_height; 139 140 /* Send */ 141 gboolean savemsg; 142 gboolean confirm_send_queued_messages; 143 gboolean send_dialog_invisible; 144 gint sendwin_width; 145 gint sendwin_height; 146 gchar *outgoing_charset; 147 TransferEncodingMethod encoding_method; 148 gboolean outgoing_fallback_to_ascii; 149 gboolean rewrite_first_from; 150 gboolean warn_empty_subj; 151 gint warn_sending_many_recipients_num; 152 gboolean hide_timezone; 153 gboolean allow_jisx0201_kana; 154 155 /* Compose */ 156 gint undolevels; 157 gint linewrap_len; 158 gboolean linewrap_quote; 159 gboolean primary_paste_unselects; 160 gboolean autowrap; 161 gboolean auto_indent; 162 gboolean auto_exteditor; 163 gboolean reply_account_autosel; 164 gboolean default_reply_list; 165 gboolean forward_account_autosel; 166 gboolean reedit_account_autosel; 167 gboolean autosave; 168 gint autosave_length; 169 gboolean warn_large_insert; 170 gint warn_large_insert_size; 171 gboolean compose_no_markup; 172 ComposeDndInsertOrAttach compose_dnd_mode; 173 gboolean compose_with_format; 174 gchar *compose_subject_format; 175 gchar *compose_body_format; 176 gboolean type_any_header; 177 gboolean notify_pasted_attachments; 178 179 /* Quote */ 180 gboolean reply_with_quote; 181 gchar *quotefmt; 182 gchar *fw_quotefmt; 183 gboolean forward_as_attachment; 184 gboolean redirect_keep_from; 185 gchar *quote_chars; 186 187 /* program colors */ 188 GdkRGBA color[COL_LAST_COLOR_INDEX]; 189 190 gint display_folder_unread; 191 192 gboolean show_searchbar; 193 gboolean swap_from; 194 gboolean use_addr_book; 195 gchar *date_format; 196 gboolean *msgview_date_format; 197 198 gboolean use_stripes_everywhere; 199 gboolean use_stripes_in_summaries; /* overrides if use_stripes_everywhere is set to TRUE */ 200 gint stripes_color_offset; 201 gboolean enable_hscrollbar; 202 gboolean bold_unread; 203 gboolean bold_marked; 204 gboolean next_on_delete; 205 gboolean thread_by_subject; 206 gint thread_by_subject_max_age; /*!< Max. age of a thread which was threaded 207 * by subject (days) */ 208 FolderSortKey default_sort_key; 209 FolderSortType default_sort_type; 210 gboolean folder_default_thread; 211 gboolean folder_default_thread_collapsed; 212 gboolean folder_default_hide_read_threads; 213 gboolean folder_default_hide_read_msgs; 214 gboolean folder_default_hide_del_msgs; 215 216 gchar *startup_folder; 217 gboolean goto_folder_on_startup; 218 219 ToolbarStyle toolbar_style; 220 gboolean show_statusbar; 221 gboolean show_col_headers; 222 223 gint folderview_vscrollbar_policy; 224 225 /* Filtering */ 226 GSList *fltlist; 227 228 gint kill_score; 229 gint important_score; 230 231 /* Actions */ 232 GSList *actions_list; 233 234 /* Summary lock column headers */ 235 gboolean summary_col_lock; 236 237 /* Summary columns visibility, position and size */ 238 gboolean summary_col_visible[N_SUMMARY_COLS]; 239 gint summary_col_pos[N_SUMMARY_COLS]; 240 gint summary_col_size[N_SUMMARY_COLS]; 241 242 gboolean folder_col_visible[N_FOLDER_COLS]; 243 gint folder_col_pos[N_FOLDER_COLS]; 244 gint folder_col_size[N_FOLDER_COLS]; 245 246 /* Widget visibility, position and size */ 247 gint folderwin_x; 248 gint folderwin_y; 249 gint folderview_width; 250 gint folderview_height; 251 gboolean folderview_visible; 252 253 gint summaryview_width; 254 gint summaryview_height; 255 256 gint main_msgwin_x; 257 gint main_msgwin_y; 258 gint msgview_width; 259 gint msgview_height; 260 gboolean msgview_visible; 261 262 gint mainview_x; 263 gint mainview_y; 264 gint mainview_width; 265 gint mainview_height; 266 gint mainwin_x; 267 gint mainwin_y; 268 gint mainwin_width; 269 gint mainwin_height; 270 gint mainwin_maximised; 271 gint mainwin_fullscreen; 272 gint mainwin_menubar; 273 274 gint msgwin_width; 275 gint msgwin_height; 276 277 gint mimeview_tree_height; 278 279 gint sourcewin_width; 280 gint sourcewin_height; 281 282 gint compose_width; 283 gint compose_height; 284 gint compose_notebook_height; 285 gint compose_x; 286 gint compose_y; 287 288 /* Message */ 289 gboolean enable_color; 290 gboolean enable_bgcolor; 291 gboolean recycle_quote_colors; 292 gboolean display_header; 293 gint line_space; 294 gboolean render_html; 295 gboolean hide_quoted; 296 gboolean respect_flowed_format; 297 gboolean show_all_headers; 298 299 gboolean show_other_header; 300 GSList *disphdr_list; 301 302 gboolean attach_desc; 303 304 /* MIME viewer */ 305 gchar *mime_textviewer; 306 gchar *mime_open_cmd; 307 gchar *attach_save_dir; 308 gchar *attach_load_dir; 309 310 GList *mime_open_cmd_history; 311 gboolean show_inline_attachments; 312 313 /* Addressbook */ 314 gboolean addressbook_use_editaddress_dialog; 315 gint addressbook_hpaned_pos; 316 gint addressbook_vpaned_pos; 317 318 /* Interface */ 319 LayoutType layout_mode; 320 321 gint statusbar_update_step; 322 gboolean emulate_emacs; 323 324 gboolean open_selected_on_folder_open; 325 gboolean open_selected_on_search_results; 326 gboolean open_selected_on_prevnext; 327 gboolean open_selected_on_deletemove; 328 gboolean open_selected_on_directional; 329 gboolean always_show_msg; 330 331 gboolean mark_as_read_on_new_window; 332 gboolean mark_as_read_delay; 333 gboolean immediate_exec; 334 SelectOnEntry select_on_entry; 335 gboolean show_tooltips; 336 337 EntryAction summary_select_prio[SUMMARY_OPEN_ACTIONS-1]; 338 339 NextUnreadMsgDialogShow next_unread_msg_dialog; 340 SummaryFromShow summary_from_show; 341 gchar *pixmap_theme_path; 342 343 int hover_timeout; /* msecs mouse hover timeout */ 344 gboolean ask_mark_all_read; 345 346 /* Other */ 347 gchar *uri_cmd; 348 gchar *ext_editor_cmd; 349 gboolean cmds_use_system_default; 350 351 gboolean cliplog; 352 guint loglength; 353 354 gboolean session_passwords; 355 gboolean ask_on_clean; 356 gboolean warn_queued_on_exit; 357 358 gint io_timeout_secs; 359 360 gboolean gtk_enable_accels; 361 362 /* Memory cache*/ 363 gint cache_max_mem_usage; 364 gint cache_min_keep_time; 365 366 /* boolean for work offline 367 stored here for use in inc.c */ 368 gboolean work_offline; 369 370 gint summary_quicksearch_type; 371 gint summary_quicksearch_sticky; 372 gint summary_quicksearch_recurse; 373 gint summary_quicksearch_dynamic; 374 gint summary_quicksearch_autorun; 375 376 GList *message_search_history; 377 GList *compose_save_to_history; 378 379 gint filteringwin_width; 380 gint filteringwin_height; 381 gint filteringactionwin_width; 382 gint filteringactionwin_height; 383 gint matcherwin_width; 384 gint matcherwin_height; 385 gint templateswin_width; 386 gint templateswin_height; 387 gint actionswin_width; 388 gint actionswin_height; 389 gint actionsiodialog_width; 390 gint actionsiodialog_height; 391 gint tagswin_width; 392 gint tagswin_height; 393 gint sslmanwin_width; 394 gint sslmanwin_height; 395 gint uriopenerwin_width; 396 gint uriopenerwin_height; 397 gint foldersortwin_width; 398 gint foldersortwin_height; 399 gint addressbookwin_width; 400 gint addressbookwin_height; 401 gint addressbookeditpersonwin_width; 402 gint addressbookeditpersonwin_height; 403 gint addressbookeditgroupwin_width; 404 gint addressbookeditgroupwin_height; 405 gint prefswin_width; 406 gint prefswin_height; 407 gint folderitemwin_width; 408 gint folderitemwin_height; 409 gchar *zero_replacement; 410 gint editaccountwin_width; 411 gint editaccountwin_height; 412 gint accountswin_width; 413 gint accountswin_height; 414 gint logwin_width; 415 gint logwin_height; 416 gint filtering_debugwin_width; 417 gint filtering_debugwin_height; 418 gint folderselwin_width; 419 gint folderselwin_height; 420 gint addressaddwin_width; 421 gint addressaddwin_height; 422 gint addressbook_folderselwin_width; 423 gint addressbook_folderselwin_height; 424 gint addrgather_width; 425 gint addrgather_height; 426 gint news_subscribe_width; 427 gint news_subscribe_height; 428 429 gint imap_scan_tree_recurs_limit; 430 gint warn_dnd; 431 gint broken_are_utf8; 432 gint skip_ssl_cert_check; 433 gint live_dangerously; 434 gint save_parts_readwrite; 435 gint never_send_retrcpt; 436 gint hide_quotes; 437 gboolean unsafe_ssl_certs; 438 gboolean real_time_sync; 439 gboolean show_save_all_success; 440 gboolean show_save_all_failure; 441 442 gchar *print_paper_type; 443 gint print_paper_orientation; 444 gint print_margin_top; 445 gint print_margin_bottom; 446 gint print_margin_left; 447 gint print_margin_right; 448 449 gint print_use_color; 450 gint print_use_collate; 451 gint print_use_reverse; 452 gint print_use_duplex; 453 gint print_imgs; 454 gint print_previewwin_width; 455 gint print_previewwin_height; 456 457 gboolean two_line_vert; 458 gboolean inherit_folder_props; 459 460 gint nav_history_length; 461 462 gboolean folder_search_wildcard; 463 gboolean address_search_wildcard; 464 465 gboolean use_primary_passphrase; 466 gchar *primary_passphrase; 467 gchar *primary_passphrase_salt; 468 guint primary_passphrase_pbkdf2_rounds; 469 470 gboolean mainwin_toolbar_always_enable_actions; 471 472 /* Quicksearch */ 473 guint qs_press_timeout; 474 }; 475 476 extern PrefsCommon prefs_common; 477 478 PrefsCommon *prefs_common_get_prefs(void); 479 480 GList *prefs_common_read_history_from_dir_with_defaults(const gchar *dirname, const gchar *history, 481 GList *default_list); 482 void prefs_common_read_config (void); 483 void prefs_common_write_config (void); 484 void prefs_common_open (void); 485 void pref_get_unescaped_pref(gchar *out, const gchar *in); 486 void pref_get_escaped_pref(gchar *out, const gchar *in); 487 void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt); 488 void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt); 489 gchar *pref_get_pref_from_textview(GtkTextView *textview); 490 gchar *pref_get_pref_from_entry(GtkEntry *entry); 491 const gchar *prefs_common_get_uri_cmd(void); 492 const gchar *prefs_common_get_ext_editor_cmd(void); 493 494 #define OPEN_SELECTED(when) (prefs_common.always_show_msg || prefs_common.when) 495 496 #define OPEN_SELECTED_ON_FOLDER_OPEN OPEN_SELECTED(open_selected_on_folder_open) 497 #define OPEN_SELECTED_ON_SEARCH_RESULTS OPEN_SELECTED(open_selected_on_search_results) 498 #define OPEN_SELECTED_ON_PREVNEXT OPEN_SELECTED(open_selected_on_prevnext) 499 #define OPEN_SELECTED_ON_DELETEMOVE OPEN_SELECTED(open_selected_on_deletemove) 500 #define OPEN_SELECTED_ON_DIRECTIONAL OPEN_SELECTED(open_selected_on_directional) 501 502 #endif /* __PREFS_COMMON_H__ */