Use custom get_default_font_size() and _name()
[claws.git] / src / prefs_common.h
blob30e15c424a7654e25c4481591314a7d69c4f47ce
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2023 the Claws Mail team and Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __PREFS_COMMON_H__
20 #define __PREFS_COMMON_H__
22 #ifdef HAVE_CONFIG_H
23 #include "claws-features.h"
24 #endif
26 #include <glib.h>
28 #include "mainwindow.h"
29 #include "summaryview.h"
30 #include "folderview.h"
31 #include "codeconv.h"
32 #include "textview.h"
33 #include "procmime.h"
34 #include "prefs_msg_colors.h"
35 #include "prefs_summary_open.h"
37 #define CLAWS_CONFIG_VERSION 4
39 typedef struct _PrefsCommon PrefsCommon;
41 typedef enum {
42 RECV_DIALOG_ALWAYS,
43 RECV_DIALOG_MANUAL,
44 RECV_DIALOG_NEVER
45 } RecvDialogMode;
47 typedef enum {
48 COMPOSE_DND_ASK,
49 COMPOSE_DND_INSERT,
50 COMPOSE_DND_ATTACH
51 } ComposeDndInsertOrAttach;
53 typedef enum {
54 CTE_AUTO,
55 CTE_BASE64,
56 CTE_QUOTED_PRINTABLE,
57 CTE_8BIT
58 } TransferEncodingMethod;
60 typedef enum
62 /* U = unread, N = new, M = marked */
63 SELECTONENTRY_NOTHING,
64 SELECTONENTRY_UNM,
65 SELECTONENTRY_UMN,
66 SELECTONENTRY_NUM,
67 SELECTONENTRY_NMU,
68 SELECTONENTRY_MNU,
69 SELECTONENTRY_MUN,
70 SELECTONENTRY_LAST
71 } SelectOnEntry;
73 typedef enum
75 ACTION_UNSET = 0, /* for backward compatibility */
76 ACTION_OLDEST_MARKED,
77 ACTION_OLDEST_NEW,
78 ACTION_OLDEST_UNREAD,
79 ACTION_LAST_OPENED,
80 ACTION_NEWEST_LIST,
81 ACTION_NOTHING,
82 ACTION_OLDEST_LIST,
83 ACTION_NEWEST_MARKED,
84 ACTION_NEWEST_NEW,
85 ACTION_NEWEST_UNREAD
86 } EntryAction;
88 typedef enum
90 NEXTUNREADMSGDIALOG_ALWAYS,
91 NEXTUNREADMSGDIALOG_ASSUME_YES,
92 NEXTUNREADMSGDIALOG_ASSUME_NO
93 } NextUnreadMsgDialogShow;
95 typedef enum
97 SHOW_NAME,
98 SHOW_ADDR,
99 SHOW_BOTH
100 } SummaryFromShow;
102 typedef enum
104 AVATARS_DISABLE = 0,
105 AVATARS_ENABLE_CAPTURE = 1,
106 AVATARS_ENABLE_RENDER = 2,
107 AVATARS_ENABLE_BOTH = 3
108 } EnableAvatars;
110 typedef enum
112 COL_MISSPELLED,
113 COL_QUOTE_LEVEL1,
114 COL_QUOTE_LEVEL2,
115 COL_QUOTE_LEVEL3,
116 COL_QUOTE_LEVEL1_BG,
117 COL_QUOTE_LEVEL2_BG,
118 COL_QUOTE_LEVEL3_BG,
119 COL_URI,
120 COL_TGT_FOLDER,
121 COL_SIGNATURE,
122 COL_EMPHASIS,
123 COL_DEFAULT_HEADER,
124 COL_DEFAULT_HEADER_BG,
125 COL_TAGS,
126 COL_TAGS_BG,
127 COL_QS_ACTIVE,
128 COL_QS_ACTIVE_BG,
129 COL_QS_ERROR,
130 COL_QS_ERROR_BG,
131 COL_LOG_MSG,
132 COL_LOG_WARN,
133 COL_LOG_ERROR,
134 COL_LOG_IN,
135 COL_LOG_OUT,
136 COL_LOG_STATUS_OK,
137 COL_LOG_STATUS_NOK,
138 COL_LOG_STATUS_SKIP,
139 COL_NEW,
140 COL_DIFF_ADDED,
141 COL_DIFF_DELETED,
142 COL_DIFF_HUNK,
143 COL_LAST_COLOR_INDEX
144 } ColorIndex;
146 struct _PrefsCommon
148 gint config_version;
150 /* Receive */
151 gboolean use_extinc;
152 gchar *extinc_cmd;
153 gboolean scan_all_after_inc;
154 gboolean autochk_newmail;
155 gint autochk_itv;
156 gboolean chk_on_startup;
157 gboolean open_inbox_on_inc;
158 gboolean newmail_notify_auto;
159 gboolean newmail_notify_manu;
160 gchar *newmail_notify_cmd;
161 RecvDialogMode recv_dialog_mode;
162 gint receivewin_width;
163 gint receivewin_height;
164 gboolean close_recv_dialog;
165 gboolean no_recv_err_panel;
167 /* Send */
168 gboolean savemsg;
169 gboolean confirm_send_queued_messages;
170 gboolean send_dialog_invisible;
171 gint sendwin_width;
172 gint sendwin_height;
173 gchar *outgoing_charset;
174 TransferEncodingMethod encoding_method;
175 gboolean outgoing_fallback_to_ascii;
176 gboolean rewrite_first_from;
177 gboolean warn_empty_subj;
178 gint warn_sending_many_recipients_num;
179 gboolean hide_timezone;
180 gboolean allow_jisx0201_kana;
182 /* Compose */
183 gint undolevels;
184 gint linewrap_len;
185 gboolean linewrap_quote;
186 gboolean linewrap_pastes;
187 gboolean primary_paste_unselects;
188 gboolean autowrap;
189 gboolean auto_indent;
190 gboolean auto_exteditor;
191 gboolean reply_account_autosel;
192 gboolean default_reply_list;
193 gboolean forward_account_autosel;
194 gboolean reedit_account_autosel;
195 gboolean show_ruler;
196 gboolean autosave;
197 gint autosave_length;
198 gboolean autosave_encrypted;
199 gboolean warn_large_insert;
200 gint warn_large_insert_size;
201 gboolean compose_no_markup;
202 ComposeDndInsertOrAttach compose_dnd_mode;
203 gboolean compose_with_format;
204 gchar *compose_subject_format;
205 gchar *compose_body_format;
206 gboolean show_compose_margin;
207 gboolean type_any_header;
209 /* Quote */
210 gboolean reply_with_quote;
211 gchar *quotemark;
212 gchar *quotefmt;
213 gchar *fw_quotemark;
214 gchar *fw_quotefmt;
215 gboolean forward_as_attachment;
216 gboolean redirect_keep_from;
217 gchar *quote_chars;
219 gboolean enable_aspell;
220 gchar *dictionary;
221 gchar *alt_dictionary;
222 gboolean check_while_typing;
223 gboolean recheck_when_changing_dict;
224 gboolean use_alternate;
225 gboolean use_both_dicts;
227 /* Display */
228 /* fonts */
229 gchar *textfont;
230 gchar *printfont;
231 gchar *boldfont;
232 gchar *normalfont;
233 gchar *smallfont;
234 gchar *titlefont;
235 gboolean use_different_print_font;
236 gboolean derive_from_normal_font;
238 /* custom colors */
239 ColorlabelPrefs custom_colorlabel[COLORLABELS];
241 /* program colors */
242 GdkRGBA color[COL_LAST_COLOR_INDEX];
244 /* image viewer */
245 gboolean display_img;
246 gboolean resize_img;
247 gboolean inline_img;
248 gboolean fit_img_height;
250 gboolean trans_hdr;
251 gint display_folder_unread;
252 gint ng_abbrev_len;
254 gboolean show_searchbar;
255 gboolean swap_from;
256 gboolean use_addr_book;
257 gchar *date_format;
258 gboolean *msgview_date_format;
260 gboolean use_stripes_everywhere;
261 gboolean use_stripes_in_summaries; /* overrides if use_stripes_everywhere is set to TRUE */
262 gint stripes_color_offset;
263 gboolean enable_hscrollbar;
264 gboolean bold_unread;
265 gboolean bold_marked;
266 gboolean next_on_delete;
267 gboolean thread_by_subject;
268 gint thread_by_subject_max_age; /*!< Max. age of a thread which was threaded
269 * by subject (days) */
270 FolderSortKey default_sort_key;
271 FolderSortType default_sort_type;
272 gboolean folder_default_thread;
273 gboolean folder_default_thread_collapsed;
274 gboolean folder_default_hide_read_threads;
275 gboolean folder_default_hide_read_msgs;
276 gboolean folder_default_hide_del_msgs;
278 gchar *last_opened_folder;
279 gboolean goto_last_folder_on_startup;
280 gchar *startup_folder;
281 gboolean goto_folder_on_startup;
283 ToolbarStyle toolbar_style;
284 gboolean show_statusbar;
285 gboolean show_col_headers;
287 gint folderview_vscrollbar_policy;
289 /* Filtering */
290 GSList *fltlist;
292 gint kill_score;
293 gint important_score;
295 /* Actions */
296 GSList *actions_list;
298 /* Summary lock column headers */
299 gboolean summary_col_lock;
301 /* Summary columns visibility, position and size */
302 gboolean summary_col_visible[N_SUMMARY_COLS];
303 gint summary_col_pos[N_SUMMARY_COLS];
304 gint summary_col_size[N_SUMMARY_COLS];
306 gboolean folder_col_visible[N_FOLDER_COLS];
307 gint folder_col_pos[N_FOLDER_COLS];
308 gint folder_col_size[N_FOLDER_COLS];
310 /* Widget visibility, position and size */
311 gint folderwin_x;
312 gint folderwin_y;
313 gint folderview_width;
314 gint folderview_height;
315 gboolean folderview_visible;
317 gint summaryview_width;
318 gint summaryview_height;
320 gint main_msgwin_x;
321 gint main_msgwin_y;
322 gint msgview_width;
323 gint msgview_height;
324 gboolean msgview_visible;
326 gint mainview_x;
327 gint mainview_y;
328 gint mainview_width;
329 gint mainview_height;
330 gint mainwin_x;
331 gint mainwin_y;
332 gint mainwin_width;
333 gint mainwin_height;
334 gint mainwin_maximised;
335 gint mainwin_fullscreen;
336 gint mainwin_menubar;
338 gint msgwin_width;
339 gint msgwin_height;
341 gint mimeview_tree_height;
343 gint sourcewin_width;
344 gint sourcewin_height;
346 gint compose_width;
347 gint compose_height;
348 gint compose_notebook_height;
349 gint compose_x;
350 gint compose_y;
352 /* Message */
353 gboolean enable_color;
354 gboolean enable_bgcolor;
355 gboolean recycle_quote_colors;
356 gboolean display_header_pane;
357 gboolean display_header;
358 gboolean display_xface;
359 gboolean save_xface;
360 gint line_space;
361 gboolean render_html;
362 gboolean invoke_plugin_on_html;
363 gboolean promote_html_part;
364 gboolean textview_cursor_visible;
365 gboolean enable_smooth_scroll;
366 gint scroll_step;
367 gboolean scroll_halfpage;
368 gboolean hide_quoted;
369 gboolean respect_flowed_format;
370 gboolean show_all_headers;
372 gboolean show_other_header;
373 GSList *disphdr_list;
375 gboolean attach_desc;
377 /* MIME viewer */
378 gchar *mime_textviewer;
379 gchar *mime_open_cmd;
380 gchar *attach_save_dir;
381 gchar *attach_load_dir;
383 GList *mime_open_cmd_history;
384 gboolean show_inline_attachments;
386 /* Addressbook */
387 gboolean addressbook_use_editaddress_dialog;
388 gint addressbook_hpaned_pos;
389 gint addressbook_vpaned_pos;
390 GList *addressbook_custom_attributes;
392 /* Interface */
393 LayoutType layout_mode;
395 gint statusbar_update_step;
396 gboolean emulate_emacs;
398 gboolean open_selected_on_folder_open;
399 gboolean open_selected_on_search_results;
400 gboolean open_selected_on_prevnext;
401 gboolean open_selected_on_deletemove;
402 gboolean open_selected_on_directional;
403 gboolean always_show_msg;
405 gboolean mark_as_read_on_new_window;
406 gboolean mark_as_read_delay;
407 gboolean immediate_exec;
408 SelectOnEntry select_on_entry;
409 gboolean show_tooltips;
411 EntryAction summary_select_prio[SUMMARY_OPEN_ACTIONS-1];
413 NextUnreadMsgDialogShow next_unread_msg_dialog;
414 SummaryFromShow summary_from_show;
415 gboolean add_address_by_click;
416 gchar *pixmap_theme_path;
417 #ifdef HAVE_SVG
418 gboolean enable_alpha_svg;
419 gboolean enable_pixmap_scaling;
420 gboolean pixmap_scaling_auto;
421 gint pixmap_scaling_ppi;
422 #endif
423 int hover_timeout; /* msecs mouse hover timeout */
424 gboolean ask_mark_all_read;
425 gboolean run_processingrules_before_mark_all;
426 gboolean ask_override_colorlabel;
427 gboolean ask_apply_per_account_filtering_rules;
428 gint apply_per_account_filtering_rules;
430 /* Other */
431 #ifndef G_OS_WIN32
432 gchar *uri_cmd;
433 #else
434 gchar *gtk_theme;
435 #endif
436 gchar *ext_editor_cmd;
437 gboolean cmds_use_system_default;
439 gboolean cliplog;
440 guint loglength;
441 gboolean enable_log_standard;
442 gboolean enable_log_warning;
443 gboolean enable_log_error;
444 gboolean enable_log_status;
446 gboolean enable_filtering_debug;
447 gint filtering_debug_level;
448 gboolean enable_filtering_debug_inc;
449 gboolean enable_filtering_debug_manual;
450 gboolean enable_filtering_debug_folder_proc;
451 gboolean enable_filtering_debug_pre_proc;
452 gboolean enable_filtering_debug_post_proc;
453 gboolean filtering_debug_cliplog;
454 guint filtering_debug_loglength;
456 gboolean confirm_on_exit;
457 gboolean session_passwords;
458 gboolean clean_on_exit;
459 gboolean ask_on_clean;
460 gboolean warn_queued_on_exit;
462 gint io_timeout_secs;
464 gboolean gtk_enable_accels;
466 /* Memory cache*/
467 gint cache_max_mem_usage;
468 gint cache_min_keep_time;
470 /* boolean for work offline
471 stored here for use in inc.c */
472 gboolean work_offline;
474 gint summary_quicksearch_type;
475 gint summary_quicksearch_sticky;
476 gint summary_quicksearch_recurse;
477 gint summary_quicksearch_dynamic;
478 gint summary_quicksearch_autorun;
480 GList *summary_quicksearch_history;
481 GList *summary_search_from_history;
482 GList *summary_search_to_history;
483 GList *summary_search_subject_history;
484 GList *summary_search_body_history;
485 GList *summary_search_adv_condition_history;
486 GList *message_search_history;
487 GList *compose_save_to_history;
489 gint filteringwin_width;
490 gint filteringwin_height;
491 gint filteringactionwin_width;
492 gint filteringactionwin_height;
493 gint matcherwin_width;
494 gint matcherwin_height;
495 gint templateswin_width;
496 gint templateswin_height;
497 gint actionswin_width;
498 gint actionswin_height;
499 gint actionsiodialog_width;
500 gint actionsiodialog_height;
501 gint tagswin_width;
502 gint tagswin_height;
503 gint sslmanwin_width;
504 gint sslmanwin_height;
505 gint uriopenerwin_width;
506 gint uriopenerwin_height;
507 gint foldersortwin_width;
508 gint foldersortwin_height;
509 gint addressbookwin_width;
510 gint addressbookwin_height;
511 gint addressbookeditpersonwin_width;
512 gint addressbookeditpersonwin_height;
513 gint addressbookeditgroupwin_width;
514 gint addressbookeditgroupwin_height;
515 gint pluginswin_width;
516 gint pluginswin_height;
517 gint prefswin_width;
518 gint prefswin_height;
519 gint folderitemwin_width;
520 gint folderitemwin_height;
521 gchar *zero_replacement;
522 gint editaccountwin_width;
523 gint editaccountwin_height;
524 gint accountswin_width;
525 gint accountswin_height;
526 gint logwin_width;
527 gint logwin_height;
528 gint filtering_debugwin_width;
529 gint filtering_debugwin_height;
530 gint folderselwin_width;
531 gint folderselwin_height;
532 gint addressaddwin_width;
533 gint addressaddwin_height;
534 gint addressbook_folderselwin_width;
535 gint addressbook_folderselwin_height;
536 gint aboutwin_width;
537 gint aboutwin_height;
538 gint addrgather_width;
539 gint addrgather_height;
540 gint news_subscribe_width;
541 gint news_subscribe_height;
543 gint imap_scan_tree_recurs_limit;
544 gint warn_dnd;
545 gint broken_are_utf8;
546 gint skip_ssl_cert_check;
547 gint live_dangerously;
548 gint save_parts_readwrite;
549 gint never_send_retrcpt;
550 gint hide_quotes;
551 gboolean unsafe_ssl_certs;
552 gboolean real_time_sync;
553 gboolean show_save_all_success;
554 gboolean show_save_all_failure;
556 gchar *print_paper_type;
557 gint print_paper_orientation;
558 gint print_margin_top;
559 gint print_margin_bottom;
560 gint print_margin_left;
561 gint print_margin_right;
563 gint print_use_color;
564 gint print_use_collate;
565 gint print_use_reverse;
566 gint print_use_duplex;
567 gint print_imgs;
568 gint print_previewwin_width;
569 gint print_previewwin_height;
571 gboolean use_networkmanager;
572 gboolean use_shred;
573 gboolean two_line_vert;
574 gboolean inherit_folder_props;
575 gboolean flush_metadata;
577 gint nav_history_length;
579 gboolean folder_search_wildcard;
580 gboolean address_search_wildcard;
582 guint enable_avatars;
584 #ifndef PASSWORD_CRYPTO_OLD
585 gboolean use_primary_passphrase;
586 gchar *primary_passphrase;
587 gchar *primary_passphrase_salt;
588 guint primary_passphrase_pbkdf2_rounds;
589 #endif
591 /* Proxy */
592 gboolean use_proxy;
593 ProxyInfo proxy_info;
595 /* Quicksearch */
596 guint qs_press_timeout;
599 extern PrefsCommon prefs_common;
601 PrefsCommon *prefs_common_get_prefs(void);
603 GList *prefs_common_read_history_from_dir_with_defaults(const gchar *dirname, const gchar *history,
604 GList *default_list);
605 void prefs_common_read_config (void);
606 void prefs_common_write_config (void);
607 void prefs_common_open (void);
608 void pref_get_unescaped_pref(gchar *out, const gchar *in);
609 void pref_get_escaped_pref(gchar *out, const gchar *in);
610 void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt);
611 void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt);
612 gchar *pref_get_pref_from_textview(GtkTextView *textview);
613 gchar *pref_get_pref_from_entry(GtkEntry *entry);
614 const gchar *prefs_common_translated_header_name(const gchar *header_name);
615 const gchar *prefs_common_get_uri_cmd(void);
616 const gchar *prefs_common_get_ext_editor_cmd(void);
618 #define OPEN_SELECTED(when) (prefs_common.always_show_msg || prefs_common.when)
620 #define OPEN_SELECTED_ON_FOLDER_OPEN OPEN_SELECTED(open_selected_on_folder_open)
621 #define OPEN_SELECTED_ON_SEARCH_RESULTS OPEN_SELECTED(open_selected_on_search_results)
622 #define OPEN_SELECTED_ON_PREVNEXT OPEN_SELECTED(open_selected_on_prevnext)
623 #define OPEN_SELECTED_ON_DELETEMOVE OPEN_SELECTED(open_selected_on_deletemove)
624 #define OPEN_SELECTED_ON_DIRECTIONAL OPEN_SELECTED(open_selected_on_directional)
626 #endif /* __PREFS_COMMON_H__ */