2006-10-30 [wwp] 2.5.6cvs11
[claws.git] / src / prefs_common.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
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., 51 Franklin Street, 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 #include "mainwindow.h"
30 #include "summaryview.h"
31 #include "folderview.h"
32 #include "codeconv.h"
33 #include "textview.h"
34 #include "procmime.h"
35 #include "prefs_msg_colors.h"
36
37 typedef struct _PrefsCommon     PrefsCommon;
38
39 typedef enum {
40         RECV_DIALOG_ALWAYS,
41         RECV_DIALOG_MANUAL,
42         RECV_DIALOG_NEVER
43 } RecvDialogMode;
44
45 typedef enum {
46         COMPOSE_DND_ASK,
47         COMPOSE_DND_INSERT,
48         COMPOSE_DND_ATTACH
49 } ComposeDndInsertOrAttach;
50
51 typedef enum {
52         CTE_AUTO,
53         CTE_BASE64,
54         CTE_QUOTED_PRINTABLE,
55         CTE_8BIT
56 } TransferEncodingMethod;
57
58 typedef enum {
59         SEND_DIALOG_ALWAYS,
60         /* SEND_DIALOG_ACTIVE would be irrelevant */
61         SEND_DIALOG_NEVER
62 } SendDialogMode;
63
64 typedef enum
65 {
66 /* U = unread, N = new, M = marked */
67         SELECTONENTRY_NOTHING,
68         SELECTONENTRY_UNM,
69         SELECTONENTRY_UMN,
70         SELECTONENTRY_NUM,
71         SELECTONENTRY_NMU,
72         SELECTONENTRY_MNU,
73         SELECTONENTRY_MUN
74 } SelectOnEntry;
75
76 typedef enum
77 {
78         NEXTUNREADMSGDIALOG_ALWAYS,
79         NEXTUNREADMSGDIALOG_ASSUME_YES,
80         NEXTUNREADMSGDIALOG_ASSUME_NO
81 } NextUnreadMsgDialogShow;
82
83 struct _PrefsCommon
84 {
85         /* Receive */
86         gboolean use_extinc;
87         gchar *extinc_cmd;
88         gboolean scan_all_after_inc;
89         gboolean autochk_newmail;
90         gint autochk_itv;
91         gboolean chk_on_startup;
92         gboolean open_inbox_on_inc;
93         gboolean newmail_notify_auto;
94         gboolean newmail_notify_manu;
95         gchar   *newmail_notify_cmd;
96         RecvDialogMode recv_dialog_mode;
97         gint receivewin_width;
98         gint receivewin_height;
99         gboolean close_recv_dialog;
100         gboolean no_recv_err_panel;
101
102         /* Send */
103         gboolean savemsg;
104         gboolean confirm_send_queued_messages;
105         SendDialogMode send_dialog_mode;
106         gint sendwin_width;
107         gint sendwin_height;
108         gchar *outgoing_charset;
109         TransferEncodingMethod encoding_method;
110
111         gboolean allow_jisx0201_kana;
112
113         /* Compose */
114         gint undolevels;
115         gint linewrap_len;
116         gboolean linewrap_quote;
117         gboolean linewrap_pastes;
118         gboolean autowrap;
119         gboolean auto_exteditor;
120         gboolean reply_account_autosel;
121         gboolean default_reply_list;
122         gboolean forward_account_autosel;
123         gboolean reedit_account_autosel;
124         gboolean show_ruler;
125         gboolean autosave;
126         gint autosave_length;
127         gboolean compose_no_markup;
128         ComposeDndInsertOrAttach compose_dnd_mode;
129
130         /* Quote */
131         gboolean reply_with_quote;
132         gchar *quotemark;
133         gchar *quotefmt;
134         gchar *fw_quotemark;
135         gchar *fw_quotefmt;
136         gboolean forward_as_attachment;
137         gboolean redirect_keep_from;
138         gboolean block_cursor;
139         gchar *quote_chars;
140         
141 #if USE_ASPELL
142         gboolean enable_aspell;
143         gchar *aspell_path;
144         gchar *dictionary;
145         gulong misspelled_col;
146         gint aspell_sugmode;
147         gboolean check_while_typing;
148         gboolean recheck_when_changing_dict;
149         gboolean use_alternate;
150 #endif
151         
152         /* Display */
153         /* obsolete fonts */
154         gchar *widgetfont_gtk1;
155         gchar *textfont_gtk1;
156         gchar *normalfont_gtk1;
157         gchar *boldfont_gtk1;
158         gchar *smallfont_gtk1;
159
160         /* new fonts */
161         gchar *widgetfont;
162         gchar *textfont;
163         gchar *printfont;
164         gchar *normalfont;
165         gchar *smallfont;
166         gchar *titlefont;
167
168         /* custom colors */
169         ColorlabelPrefs custom_colorlabel[COLORLABELS];
170
171         /* image viewer */
172         gboolean display_img;
173         gboolean resize_img;
174         gboolean inline_img;
175
176         gboolean trans_hdr;
177         gboolean display_folder_unread;
178         gint ng_abbrev_len;
179
180         gboolean show_searchbar;
181         gboolean expand_thread;
182         gboolean swap_from;
183         gboolean use_addr_book;
184         gchar *date_format;
185
186         gboolean use_stripes_everywhere;
187         gboolean use_stripes_in_summaries; /* overrides if use_stripes_everywhere is set to TRUE */
188         gint stripes_color_offset;
189         gboolean enable_dotted_lines;
190         gboolean enable_hscrollbar;
191         gboolean bold_unread;
192         gboolean enable_thread;
193         gboolean thread_by_subject;
194         gint thread_by_subject_max_age; /*!< Max. age of a thread which was threaded
195                                          *   by subject (days) */
196
197         ToolbarStyle toolbar_style;
198         gboolean toolbar_detachable;
199         gboolean show_statusbar;
200
201         gint folderview_vscrollbar_policy;
202
203         /* Filtering */
204         GSList *fltlist;
205
206         gint kill_score;
207         gint important_score;
208
209         /* Actions */
210         GSList *actions_list;
211
212         /* Summary columns visibility, position and size */
213         gboolean summary_col_visible[N_SUMMARY_COLS];
214         gint summary_col_pos[N_SUMMARY_COLS];
215         gint summary_col_size[N_SUMMARY_COLS];
216
217         gboolean folder_col_visible[N_FOLDER_COLS];
218         gint folder_col_pos[N_FOLDER_COLS];
219         gint folder_col_size[N_FOLDER_COLS];
220
221         /* Widget visibility, position and size */
222         gint folderwin_x;
223         gint folderwin_y;
224         gint folderview_width;
225         gint folderview_height;
226         gboolean folderview_visible;
227
228         gint summaryview_width;
229         gint summaryview_height;
230
231         gint main_msgwin_x;
232         gint main_msgwin_y;
233         gint msgview_width;
234         gint msgview_height;
235         gboolean msgview_visible;
236
237         gint mainview_x;
238         gint mainview_y;
239         gint mainview_width;
240         gint mainview_height;
241         gint mainwin_x;
242         gint mainwin_y;
243         gint mainwin_width;
244         gint mainwin_height;
245
246         gint msgwin_width;
247         gint msgwin_height;
248
249         gint sourcewin_width;
250         gint sourcewin_height;
251
252         gint compose_width;
253         gint compose_height;
254         gint compose_x;
255         gint compose_y;
256
257         /* Message */
258         gboolean enable_color;
259         gboolean enable_bgcolor;
260         gulong quote_level1_col;
261         gulong quote_level2_col;
262         gulong quote_level3_col;
263         gulong quote_level1_bgcol;
264         gulong quote_level2_bgcol;
265         gulong quote_level3_bgcol;
266         gulong uri_col;
267         gulong tgt_folder_col;
268         gulong signature_col;
269         gboolean recycle_quote_colors;
270         gboolean display_header_pane;
271         gboolean display_header;
272         gboolean display_xface;
273         gint line_space;
274         gboolean render_html;
275         gboolean invoke_plugin_on_html;
276         gboolean textview_cursor_visible;
277         gboolean enable_smooth_scroll;
278         gint scroll_step;
279         gboolean scroll_halfpage;
280         gboolean respect_flowed_format;
281
282         gboolean show_other_header;
283         gboolean use_different_print_font;
284         GSList *disphdr_list;
285
286         gboolean attach_desc;
287
288         /* MIME viewer */
289         gchar *mime_textviewer;
290         gchar *mime_open_cmd;
291         gchar *attach_save_dir;
292         gchar *attach_load_dir;
293
294         GList *mime_open_cmd_history;
295
296 #if USE_GPGME
297         /* Privacy */
298         gboolean auto_check_signatures;
299         gboolean gpg_signature_popup;
300         gboolean store_passphrase;
301         gint store_passphrase_timeout;
302         gboolean passphrase_grab;
303         gboolean gpg_warning;
304 #endif /* USE_GPGME */
305
306         /* Interface */
307         gboolean sep_folder;
308         gboolean sep_msg;
309         gint statusbar_update_step;
310         gboolean emulate_emacs;
311         gboolean always_show_msg;
312         gboolean mark_as_read_on_new_window;
313         gboolean mark_as_read_delay;
314         gboolean immediate_exec;
315         SelectOnEntry select_on_entry;
316         NextUnreadMsgDialogShow next_unread_msg_dialog;
317         gboolean add_address_by_click;
318         gchar *pixmap_theme_path;
319         int hover_timeout; /* msecs mouse hover timeout */
320         gboolean ask_mark_all_read;
321         gboolean ask_apply_per_account_filtering_rules;
322         gint apply_per_account_filtering_rules;
323
324         /* Other */
325         gchar *uri_cmd;
326         gchar *print_cmd;
327         gchar *ext_editor_cmd;
328
329     gboolean cliplog;
330     guint loglength;
331         gulong log_msg_color;
332         gulong log_warn_color;
333         gulong log_error_color;
334         gulong log_in_color;
335         gulong log_out_color;
336
337     gboolean confirm_on_exit;
338         gboolean clean_on_exit;
339         gboolean ask_on_clean;
340         gboolean warn_queued_on_exit;
341
342         gint io_timeout_secs;
343         
344         /* Memory cache*/
345         gint cache_max_mem_usage;
346         gint cache_min_keep_time;
347         
348         /* boolean for work offline 
349            stored here for use in inc.c */
350         gboolean work_offline;
351         
352         gint summary_quicksearch_type;
353         gint summary_quicksearch_sticky;
354         gint summary_quicksearch_recurse;
355         gint summary_quicksearch_dynamic;
356         gulong color_new;
357         
358         GList *summary_quicksearch_history;
359
360         gint filteringwin_width;
361         gint filteringwin_height;
362         gint filteringactionwin_width;
363         gint filteringactionwin_height;
364         gint matcherwin_width;
365         gint matcherwin_height;
366         gint templateswin_width;
367         gint templateswin_height;
368         gint actionswin_width;
369         gint actionswin_height;
370         gint addressbookwin_width;
371         gint addressbookwin_height;
372         gint addressbookeditpersonwin_width;
373         gint addressbookeditpersonwin_height;
374         gint addressbookeditgroupwin_width;
375         gint addressbookeditgroupwin_height;
376         gint pluginswin_width;
377         gint pluginswin_height;
378         gint prefswin_width;
379         gint prefswin_height;
380         gint folderitemwin_width;
381         gint folderitemwin_height;
382         gint editaccountwin_width;
383         gint editaccountwin_height;
384         gint accountswin_width;
385         gint accountswin_height;
386         gint logwin_width;
387         gint logwin_height;
388         gint folderselwin_width;
389         gint folderselwin_height;
390         gint addressaddwin_width;
391         gint addressaddwin_height;
392         gint addressbook_folderselwin_width;
393         gint addressbook_folderselwin_height;
394
395         gint warn_dnd;
396         gint broken_are_utf8;
397         gint skip_ssl_cert_check;
398         gint live_dangerously;
399         gint never_send_retrcpt;
400         gint hide_quotes;
401 };
402
403 extern PrefsCommon prefs_common;
404
405 void prefs_common_read_config   (void);
406 void prefs_common_write_config  (void);
407 void prefs_common_open          (void);
408 PrefsCommon *prefs_common_get   (void);
409 void pref_get_unescaped_pref(gchar *out, const gchar *in);
410 void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt);
411 gchar *pref_get_pref_from_textview(GtkTextView *textview);
412
413 #endif /* __PREFS_COMMON_H__ */