1 /*
2  * LibSylph -- E-Mail client library
3  * Copyright (C) 1999-2017 Hiroyuki Yamamoto
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef __PREFS_COMMON_H__
21 #define __PREFS_COMMON_H__
22 
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26 
27 #include <glib.h>
28 
29 typedef struct _PrefsCommon	PrefsCommon;
30 
31 #include "enums.h"
32 #include "prefs.h"
33 
34 typedef enum {
35 	RECV_DIALOG_ALWAYS,
36 	RECV_DIALOG_MANUAL,
37 	RECV_DIALOG_NEVER
38 } RecvDialogMode;
39 
40 typedef enum {
41 	CTE_AUTO,
42 	CTE_BASE64,
43 	CTE_QUOTED_PRINTABLE,
44 	CTE_8BIT
45 } TransferEncodingMethod;
46 
47 typedef enum {
48 	FENC_MIME,
49 	FENC_RFC2231,
50 	FENC_NONE
51 } MIMEFilenameEncodingMethod;
52 
53 struct _PrefsCommon
54 {
55 	/* Receive */
56 	gboolean scan_all_after_inc;
57 	gboolean autochk_newmail;
58 	gint autochk_itv;
59 	gboolean chk_on_startup;
60 	gboolean enable_newmsg_notify;
61 	gchar *newmsg_notify_cmd;
62 
63 	gboolean inc_local;
64 	gboolean filter_on_inc;
65 	gchar *spool_path;
66 
67 	/* Send */
68 	gboolean savemsg;
69 	gboolean filter_sent;
70 	TransferEncodingMethod encoding_method;
71 	MIMEFilenameEncodingMethod mime_fencoding_method;
72 
73 	gboolean check_attach;
74 	gchar *check_attach_str;
75 	gboolean check_recipients;
76 	gchar *check_recp_exclude;
77 
78 	gboolean allow_jisx0201_kana;
79 
80 	/* Compose */
81 	gboolean auto_sig;
82 	gchar *sig_sep;
83 	gint undolevels;
84 	gint linewrap_len;
85 	gboolean linewrap_quote;
86 	gboolean autowrap;
87 	gboolean auto_exteditor;
88 	gboolean enable_autosave;
89 	gint autosave_itv;
90 	gboolean reply_account_autosel;
91 	gboolean default_reply_list;
92 	gboolean inherit_recipient_on_self_reply;
93 
94 	gboolean show_ruler;
95 
96 	/* Quote */
97 	gboolean reply_with_quote;
98 	gchar *quotemark;
99 	gchar *quotefmt;
100 	gchar *fw_quotemark;
101 	gchar *fw_quotefmt;
102 
103 	/* Spelling */
104 	gboolean check_spell;
105 	gchar *spell_lang;
106 
107 	/* Display */
108 	gchar *textfont;
109 
110 	gboolean trans_hdr;
111 	gboolean display_folder_unread;
112 	gboolean display_folder_num_columns;
113 	gint ng_abbrev_len;
114 
115 	gboolean swap_from;
116 	gboolean expand_thread;
117 	gchar *date_format;
118 
119 	gboolean enable_rules_hint;
120 	gboolean bold_unread;
121 
122 	gboolean persist_qsearch_filter;
123 
124 	ToolbarStyle toolbar_style;
125 	gboolean show_searchbar;
126 	gboolean show_statusbar;
127 
128 	gchar *main_toolbar_setting;
129 	gchar *compose_toolbar_setting;
130 
131 	LayoutType layout_type;
132 
133 	/* Summary columns visibility, position and size */
134 	gboolean summary_col_visible[N_SUMMARY_COLS];
135 	gint summary_col_pos[N_SUMMARY_COLS];
136 	gboolean summary_sent_col_visible[N_SUMMARY_COLS];
137 	gint summary_sent_col_pos[N_SUMMARY_COLS];
138 	gint summary_col_size[N_SUMMARY_COLS];
139 
140 	/* Widget visibility, position and size */
141 	gint folderwin_x;
142 	gint folderwin_y;
143 	gint folderview_width;
144 	gint folderview_height;
145 	gboolean folderview_visible;
146 
147 	gint folder_col_folder;
148 	gint folder_col_new;
149 	gint folder_col_unread;
150 	gint folder_col_total;
151 
152 	gint summaryview_width;
153 	gint summaryview_height;
154 	gint summaryview_vwidth;
155 	gint summaryview_vheight;
156 
157 	gint main_msgwin_x;
158 	gint main_msgwin_y;
159 	gint msgview_width;
160 	gint msgview_height;
161 	gint msgview_vwidth;
162 	gint msgview_vheight;
163 	gboolean msgview_visible;
164 
165 	gint mainview_x;
166 	gint mainview_y;
167 	gint mainview_width;
168 	gint mainview_height;
169 	gint mainwin_x;
170 	gint mainwin_y;
171 	gint mainwin_width;
172 	gint mainwin_height;
173 
174 	gint msgwin_width;
175 	gint msgwin_height;
176 
177 	gboolean mainwin_maximized;
178 
179 	gint sourcewin_width;
180 	gint sourcewin_height;
181 
182 	gint compose_x;
183 	gint compose_y;
184 	gint compose_width;
185 	gint compose_height;
186 
187 	gboolean compose_maximized;
188 
189 	gint addressbook_x;
190 	gint addressbook_y;
191 	gint addressbook_width;
192 	gint addressbook_height;
193 
194 	/* Message */
195 	gboolean enable_color;
196 	gint quote_level1_col;
197 	gint quote_level2_col;
198 	gint quote_level3_col;
199 	gint uri_col;
200 	gushort sig_col;
201 	gboolean recycle_quote_colors;
202 	gboolean conv_mb_alnum;
203 	gboolean display_header_pane;
204 	gboolean display_header;
205 	gint line_space;
206 	gboolean render_html;
207 	gboolean html_only_as_attach;
208 	gboolean textview_cursor_visible;
209 	gboolean enable_smooth_scroll;
210 	gint scroll_step;
211 	gboolean scroll_halfpage;
212 
213 	gboolean resize_image;
214 	gboolean inline_image;
215 
216 	/* Encoding */
217 	gchar *force_charset;
218 	gchar *default_encoding;
219 	gchar *outgoing_charset;
220 
221 	gboolean show_other_header;
222 	GSList *disphdr_list;
223 
224 	/* MIME viewer */
225 	gchar *mime_image_viewer;
226 	gchar *mime_audio_player;
227 	gchar *mime_open_cmd;
228 	gchar *mime_cmd;
229 
230 	GList *mime_open_cmd_history;
231 
232 	/* Junk Mail */
233 	gboolean enable_junk;
234 	gchar *junk_learncmd;
235 	gchar *nojunk_learncmd;
236 	gchar *junk_classify_cmd;
237 	gchar *junk_folder;
238 	gboolean filter_junk_on_recv;
239 	gboolean filter_junk_before;
240 	gboolean delete_junk_on_recv;
241 	gboolean mark_junk_as_read;
242 
243 	/* Privacy */
244 	gboolean auto_check_signatures;
245 	gboolean gpg_signature_popup;
246 	gboolean store_passphrase;
247 	gint store_passphrase_timeout;
248 	gboolean passphrase_grab;
249 	gboolean gpg_warning;
250 
251 	/* Interface */
252 	gboolean sep_folder;
253 	gboolean sep_msg;
254 	gboolean always_show_msg;
255 	gboolean open_unread_on_enter;
256 	gboolean remember_last_selected;
257 	gboolean mark_as_read_on_new_window;
258 	gboolean open_inbox_on_inc;
259 	gboolean open_inbox_on_startup;
260 	gboolean immediate_exec;
261 	gboolean comply_gnome_hig;
262 	gboolean show_trayicon;
263 	gboolean minimize_to_tray;
264 	gboolean toggle_window_on_trayicon_click;
265 
266 	/* Other */
267 	RecvDialogMode recv_dialog_mode;
268 	gboolean no_recv_err_panel;
269 	gboolean close_recv_dialog;
270 
271 	gboolean add_address_by_click;
272 
273 	gboolean confirm_on_exit;
274 	gboolean clean_on_exit;
275 	gboolean ask_on_clean;
276 	gboolean warn_queued_on_exit;
277 
278 	gint logwin_line_limit;
279 
280 	/* External commands */
281 	gchar *uri_cmd;
282 	gchar *ext_editor_cmd;
283 
284 	gboolean use_print_cmd;
285 	gchar *print_cmd;
286 
287 	gboolean use_extinc;
288 	gchar *extinc_cmd;
289 	gboolean use_extsend;
290 	gchar *extsend_cmd;
291 
292 	/* Update check */
293 	gboolean auto_update_check;
294 	gboolean use_http_proxy;
295 	gchar *http_proxy_host;
296 
297 	/* Advanced */
298 	gboolean strict_cache_check;
299 	gint io_timeout_secs;
300 
301 	/* Filtering */
302 	GSList *fltlist;
303 
304 	/* deprecated: do not use */
305 	GSList *junk_fltlist;
306 	GSList *manual_junk_fltlist;
307 
308 	/* Actions */
309 	GSList *actions_list;
310 
311 	/* Online / Offline */
312 	gboolean online_mode;
313 
314 	/* Append new members here */
315 	gboolean folder_col_visible[4];      /* Display */
316 	gboolean reply_address_only;         /* Compose */
317 	gboolean recipients_autoreg;         /* Send */
318 	gboolean enable_address_completion;  /* Compose */
319 	gboolean fullauto_completion_mode;   /* Compose */
320 
321 	gchar *user_agent_str;
322 
323 	gboolean change_account_on_folder_sel; /* Interface */
324 	gboolean always_mark_read_on_show_msg; /* Interface */
325 
326 	gboolean always_add_address_only;    /* Compose */
327 	gboolean show_send_dialog;           /* Send */
328 
329 	gint addressbook_folder_width;
330 	gint addressbook_col_name;
331 	gint addressbook_col_addr;
332 	gint addressbook_col_rem;
333 
334 	gchar *prev_open_dir;
335 	gchar *prev_save_dir;
336 	gchar *prev_folder_dir;
337 
338 	gboolean enable_newmsg_notify_sound; /* Receive */
339 	gchar *newmsg_notify_sound;          /* Receive */
340 
341 	gboolean show_attach_tab;            /* Message - Attachment */
342 	gboolean show_attached_files_first;  /* Message - Attachment */
343 	gint attach_toolbutton_pos;          /* Message - Attachment */
344 
345 	gboolean enable_newmsg_notify_window; /* Receive */
346 
347 	gboolean nofilter_junk_sender_in_book; /* Junk Mail */
348 
349 	gboolean alt_prefer_html;            /* Message */
350 
351 	gint save_file_type;
352 
353 	gint notify_window_period;           /* Receive */
354 
355 	gint startup_online_mode;            /* Online */
356 
357 	gint addressbook_col_nickname;
358 };
359 
360 extern PrefsCommon prefs_common;
361 
362 PrefsCommon *prefs_common_get		(void);
363 
364 PrefParam *prefs_common_get_params	(void);
365 
366 void prefs_common_read_config		(void);
367 void prefs_common_write_config		(void);
368 
369 /* deprecated */
370 void prefs_common_junk_filter_list_set		(void);
371 
372 void prefs_common_junk_folder_rename_path	(const gchar	*old_path,
373 						 const gchar	*new_path);
374 
375 #endif /* __PREFS_COMMON_H__ */
376