2007-06-12 [wwp] 2.9.2cvs56
[claws.git] / src / prefs_common.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail 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_LAST
75 } SelectOnEntry;
76
77 typedef enum
78 {
79         NEXTUNREADMSGDIALOG_ALWAYS,
80         NEXTUNREADMSGDIALOG_ASSUME_YES,
81         NEXTUNREADMSGDIALOG_ASSUME_NO
82 } NextUnreadMsgDialogShow;
83
84 struct _PrefsCommon
85 {
86         /* Receive */
87         gboolean use_extinc;
88         gchar *extinc_cmd;
89         gboolean scan_all_after_inc;
90         gboolean autochk_newmail;
91         gint autochk_itv;
92         gboolean chk_on_startup;
93         gboolean open_inbox_on_inc;
94         gboolean newmail_notify_auto;
95         gboolean newmail_notify_manu;
96         gchar   *newmail_notify_cmd;
97         RecvDialogMode recv_dialog_mode;
98         gint receivewin_width;
99         gint receivewin_height;
100         gboolean close_recv_dialog;
101         gboolean no_recv_err_panel;
102
103         /* Send */
104         gboolean savemsg;
105         gboolean confirm_send_queued_messages;
106         SendDialogMode send_dialog_mode;
107         gint sendwin_width;
108         gint sendwin_height;
109         gchar *outgoing_charset;
110         TransferEncodingMethod encoding_method;
111
112         gboolean allow_jisx0201_kana;
113
114         /* Compose */
115         gint undolevels;
116         gint linewrap_len;
117         gboolean linewrap_quote;
118         gboolean linewrap_pastes;
119         gboolean autowrap;
120         gboolean auto_exteditor;
121         gboolean reply_account_autosel;
122         gboolean default_reply_list;
123         gboolean forward_account_autosel;
124         gboolean reedit_account_autosel;
125         gboolean show_ruler;
126         gboolean autosave;
127         gint autosave_length;
128         gboolean compose_no_markup;
129         ComposeDndInsertOrAttach compose_dnd_mode;
130         gboolean compose_with_format;
131         gchar *compose_subject_format;
132         gchar *compose_body_format;
133
134         /* Quote */
135         gboolean reply_with_quote;
136         gchar *quotemark;
137         gchar *quotefmt;
138         gchar *fw_quotemark;
139         gchar *fw_quotefmt;
140         gboolean forward_as_attachment;
141         gboolean redirect_keep_from;
142         gboolean block_cursor;
143         gchar *quote_chars;
144         
145 #if USE_ASPELL
146         gboolean enable_aspell;
147         gchar *aspell_path;
148         gchar *dictionary;
149         gchar *alt_dictionary;
150         gulong misspelled_col;
151         gint aspell_sugmode;
152         gboolean check_while_typing;
153         gboolean recheck_when_changing_dict;
154         gboolean use_alternate;
155         gboolean use_both_dicts;
156 #endif
157         
158         /* Display */
159         /* obsolete fonts */
160         gchar *widgetfont_gtk1;
161         gchar *textfont_gtk1;
162         gchar *normalfont_gtk1;
163         gchar *boldfont_gtk1;
164         gchar *smallfont_gtk1;
165
166         /* new fonts */
167         gchar *widgetfont;
168         gchar *textfont;
169         gchar *printfont;
170         gchar *normalfont;
171         gchar *smallfont;
172         gchar *titlefont;
173
174         /* custom colors */
175         ColorlabelPrefs custom_colorlabel[COLORLABELS];
176
177         /* image viewer */
178         gboolean display_img;
179         gboolean resize_img;
180         gboolean inline_img;
181
182         gboolean trans_hdr;
183         gint display_folder_unread;
184         gint ng_abbrev_len;
185
186         gboolean show_searchbar;
187         gboolean expand_thread;
188         gboolean swap_from;
189         gboolean use_addr_book;
190         gchar *date_format;
191
192         gboolean use_stripes_everywhere;
193         gboolean use_stripes_in_summaries; /* overrides if use_stripes_everywhere is set to TRUE */
194         gint stripes_color_offset;
195         gboolean enable_dotted_lines;
196         gboolean enable_hscrollbar;
197         gboolean bold_unread;
198         gboolean enable_thread;
199         gboolean thread_by_subject;
200         gint thread_by_subject_max_age; /*!< Max. age of a thread which was threaded
201                                          *   by subject (days) */
202
203         gchar *last_opened_folder;
204         gboolean goto_last_folder_on_startup;
205
206         ToolbarStyle toolbar_style;
207         gboolean toolbar_detachable;
208         gboolean show_statusbar;
209
210         gint folderview_vscrollbar_policy;
211
212         /* Filtering */
213         GSList *fltlist;
214
215         gint kill_score;
216         gint important_score;
217
218         /* Actions */
219         GSList *actions_list;
220
221         /* Summary columns visibility, position and size */
222         gboolean summary_col_visible[N_SUMMARY_COLS];
223         gint summary_col_pos[N_SUMMARY_COLS];
224         gint summary_col_size[N_SUMMARY_COLS];
225
226         gboolean folder_col_visible[N_FOLDER_COLS];
227         gint folder_col_pos[N_FOLDER_COLS];
228         gint folder_col_size[N_FOLDER_COLS];
229
230         /* Widget visibility, position and size */
231         gint folderwin_x;
232         gint folderwin_y;
233         gint folderview_width;
234         gint folderview_height;
235         gboolean folderview_visible;
236
237         gint summaryview_width;
238         gint summaryview_height;
239
240         gint main_msgwin_x;
241         gint main_msgwin_y;
242         gint msgview_width;
243         gint msgview_height;
244         gboolean msgview_visible;
245
246         gint mainview_x;
247         gint mainview_y;
248         gint mainview_width;
249         gint mainview_height;
250         gint mainwin_x;
251         gint mainwin_y;
252         gint mainwin_width;
253         gint mainwin_height;
254
255         gint msgwin_width;
256         gint msgwin_height;
257
258         gint sourcewin_width;
259         gint sourcewin_height;
260
261         gint compose_width;
262         gint compose_height;
263         gint compose_x;
264         gint compose_y;
265
266         /* Message */
267         gboolean enable_color;
268         gboolean enable_bgcolor;
269         gulong quote_level1_col;
270         gulong quote_level2_col;
271         gulong quote_level3_col;
272         gulong quote_level1_bgcol;
273         gulong quote_level2_bgcol;
274         gulong quote_level3_bgcol;
275         gulong uri_col;
276         gulong tgt_folder_col;
277         gulong signature_col;
278         gboolean recycle_quote_colors;
279         gboolean display_header_pane;
280         gboolean display_header;
281         gboolean display_xface;
282         gint line_space;
283         gboolean render_html;
284         gboolean invoke_plugin_on_html;
285         gboolean textview_cursor_visible;
286         gboolean enable_smooth_scroll;
287         gint scroll_step;
288         gboolean scroll_halfpage;
289         gboolean respect_flowed_format;
290
291         gboolean show_other_header;
292         gboolean use_different_print_font;
293         GSList *disphdr_list;
294
295         gboolean attach_desc;
296
297         /* MIME viewer */
298         gchar *mime_textviewer;
299         gchar *mime_open_cmd;
300         gchar *attach_save_dir;
301         gchar *attach_load_dir;
302
303         GList *mime_open_cmd_history;
304
305 #if USE_GPGME
306         /* Privacy */
307         gboolean auto_check_signatures;
308         gboolean gpg_signature_popup;
309         gboolean store_passphrase;
310         gint store_passphrase_timeout;
311         gboolean passphrase_grab;
312         gboolean gpg_warning;
313 #endif /* USE_GPGME */
314
315         /* Addressbook */
316         gboolean addressbook_use_editaddress_dialog;
317         gint addressbook_hpaned_pos;
318         gint addressbook_vpaned_pos;
319
320         /* Interface */
321         gboolean layout_mode;
322
323         gint statusbar_update_step;
324         gboolean emulate_emacs;
325         gboolean always_show_msg;
326         gboolean mark_as_read_on_new_window;
327         gboolean mark_as_read_delay;
328         gboolean immediate_exec;
329         SelectOnEntry select_on_entry;
330         NextUnreadMsgDialogShow next_unread_msg_dialog;
331         gboolean add_address_by_click;
332         gchar *pixmap_theme_path;
333         int hover_timeout; /* msecs mouse hover timeout */
334         gboolean ask_mark_all_read;
335         gboolean ask_apply_per_account_filtering_rules;
336         gint apply_per_account_filtering_rules;
337
338         /* Other */
339         gchar *uri_cmd;
340         gchar *print_cmd;
341         gchar *ext_editor_cmd;
342
343     gboolean cliplog;
344     guint loglength;
345
346         gulong log_msg_color;
347         gulong log_warn_color;
348         gulong log_error_color;
349         gulong log_in_color;
350         gulong log_out_color;
351         gulong log_status_ok_color;
352         gulong log_status_nok_color;
353         gulong log_status_skip_color;
354
355         gboolean enable_filtering_debug;
356         gint filtering_debug_level;
357         gboolean enable_filtering_debug_inc;
358         gboolean enable_filtering_debug_manual;
359         gboolean enable_filtering_debug_folder_proc;
360         gboolean enable_filtering_debug_pre_proc;
361         gboolean enable_filtering_debug_post_proc;
362     gboolean filtering_debug_cliplog;
363     guint filtering_debug_loglength;
364
365     gboolean confirm_on_exit;
366         gboolean clean_on_exit;
367         gboolean ask_on_clean;
368         gboolean warn_queued_on_exit;
369
370         gint io_timeout_secs;
371
372         gboolean gtk_can_change_accels;
373         
374         /* Memory cache*/
375         gint cache_max_mem_usage;
376         gint cache_min_keep_time;
377         
378         /* boolean for work offline 
379            stored here for use in inc.c */
380         gboolean work_offline;
381         
382         gint summary_quicksearch_type;
383         gint summary_quicksearch_sticky;
384         gint summary_quicksearch_recurse;
385         gint summary_quicksearch_dynamic;
386         gint summary_quicksearch_autorun;
387         gulong color_new;
388         
389         GList *summary_quicksearch_history;
390         GList *summary_search_from_history;
391         GList *summary_search_to_history;
392         GList *summary_search_subject_history;
393         GList *summary_search_body_history;
394         GList *summary_search_adv_condition_history;
395         GList *message_search_history;
396
397         gint filteringwin_width;
398         gint filteringwin_height;
399         gint filteringactionwin_width;
400         gint filteringactionwin_height;
401         gint matcherwin_width;
402         gint matcherwin_height;
403         gint templateswin_width;
404         gint templateswin_height;
405         gint actionswin_width;
406         gint actionswin_height;
407         gint addressbookwin_width;
408         gint addressbookwin_height;
409         gint addressbookeditpersonwin_width;
410         gint addressbookeditpersonwin_height;
411         gint addressbookeditgroupwin_width;
412         gint addressbookeditgroupwin_height;
413         gint pluginswin_width;
414         gint pluginswin_height;
415         gint prefswin_width;
416         gint prefswin_height;
417         gint folderitemwin_width;
418         gint folderitemwin_height;
419         gchar *zero_replacement;
420         gint editaccountwin_width;
421         gint editaccountwin_height;
422         gint accountswin_width;
423         gint accountswin_height;
424         gint logwin_width;
425         gint logwin_height;
426         gint filtering_debugwin_width;
427         gint filtering_debugwin_height;
428         gint folderselwin_width;
429         gint folderselwin_height;
430         gint addressaddwin_width;
431         gint addressaddwin_height;
432         gint addressbook_folderselwin_width;
433         gint addressbook_folderselwin_height;
434
435         gint warn_dnd;
436         gint broken_are_utf8;
437         gint skip_ssl_cert_check;
438         gint live_dangerously;
439         gint never_send_retrcpt;
440         gint hide_quotes;
441         gboolean unsafe_ssl_certs;
442         gboolean real_time_sync;
443 };
444
445 extern PrefsCommon prefs_common;
446
447 void prefs_common_read_config   (void);
448 void prefs_common_write_config  (void);
449 void prefs_common_open          (void);
450 PrefsCommon *prefs_common_get   (void);
451 void pref_get_unescaped_pref(gchar *out, const gchar *in);
452 void pref_get_escaped_pref(gchar *out, const gchar *in);
453 void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt);
454 void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt);
455 gchar *pref_get_pref_from_textview(GtkTextView *textview);
456 gchar *pref_get_pref_from_entry(GtkEntry *entry);
457 const gchar *prefs_common_translated_header_name(const gchar *header_name);
458
459 #endif /* __PREFS_COMMON_H__ */