2007-02-21 [wwp] 2.7.2cvs59
[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;
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         gboolean compose_with_format;
130         gchar *compose_subject_format;
131         gchar *compose_body_format;
132
133         /* Quote */
134         gboolean reply_with_quote;
135         gchar *quotemark;
136         gchar *quotefmt;
137         gchar *fw_quotemark;
138         gchar *fw_quotefmt;
139         gboolean forward_as_attachment;
140         gboolean redirect_keep_from;
141         gboolean block_cursor;
142         gchar *quote_chars;
143         
144 #if USE_ASPELL
145         gboolean enable_aspell;
146         gchar *aspell_path;
147         gchar *dictionary;
148         gchar *alt_dictionary;
149         gulong misspelled_col;
150         gint aspell_sugmode;
151         gboolean check_while_typing;
152         gboolean recheck_when_changing_dict;
153         gboolean use_alternate;
154         gboolean use_both_dicts;
155 #endif
156         
157         /* Display */
158         /* obsolete fonts */
159         gchar *widgetfont_gtk1;
160         gchar *textfont_gtk1;
161         gchar *normalfont_gtk1;
162         gchar *boldfont_gtk1;
163         gchar *smallfont_gtk1;
164
165         /* new fonts */
166         gchar *widgetfont;
167         gchar *textfont;
168         gchar *printfont;
169         gchar *normalfont;
170         gchar *smallfont;
171         gchar *titlefont;
172
173         /* custom colors */
174         ColorlabelPrefs custom_colorlabel[COLORLABELS];
175
176         /* image viewer */
177         gboolean display_img;
178         gboolean resize_img;
179         gboolean inline_img;
180
181         gboolean trans_hdr;
182         gboolean display_folder_unread;
183         gint ng_abbrev_len;
184
185         gboolean show_searchbar;
186         gboolean expand_thread;
187         gboolean swap_from;
188         gboolean use_addr_book;
189         gchar *date_format;
190
191         gboolean use_stripes_everywhere;
192         gboolean use_stripes_in_summaries; /* overrides if use_stripes_everywhere is set to TRUE */
193         gint stripes_color_offset;
194         gboolean enable_dotted_lines;
195         gboolean enable_hscrollbar;
196         gboolean bold_unread;
197         gboolean enable_thread;
198         gboolean thread_by_subject;
199         gint thread_by_subject_max_age; /*!< Max. age of a thread which was threaded
200                                          *   by subject (days) */
201
202         ToolbarStyle toolbar_style;
203         gboolean toolbar_detachable;
204         gboolean show_statusbar;
205
206         gint folderview_vscrollbar_policy;
207
208         /* Filtering */
209         GSList *fltlist;
210
211         gint kill_score;
212         gint important_score;
213
214         /* Actions */
215         GSList *actions_list;
216
217         /* Summary columns visibility, position and size */
218         gboolean summary_col_visible[N_SUMMARY_COLS];
219         gint summary_col_pos[N_SUMMARY_COLS];
220         gint summary_col_size[N_SUMMARY_COLS];
221
222         gboolean folder_col_visible[N_FOLDER_COLS];
223         gint folder_col_pos[N_FOLDER_COLS];
224         gint folder_col_size[N_FOLDER_COLS];
225
226         /* Widget visibility, position and size */
227         gint folderwin_x;
228         gint folderwin_y;
229         gint folderview_width;
230         gint folderview_height;
231         gboolean folderview_visible;
232
233         gint summaryview_width;
234         gint summaryview_height;
235
236         gint main_msgwin_x;
237         gint main_msgwin_y;
238         gint msgview_width;
239         gint msgview_height;
240         gboolean msgview_visible;
241
242         gint mainview_x;
243         gint mainview_y;
244         gint mainview_width;
245         gint mainview_height;
246         gint mainwin_x;
247         gint mainwin_y;
248         gint mainwin_width;
249         gint mainwin_height;
250
251         gint msgwin_width;
252         gint msgwin_height;
253
254         gint sourcewin_width;
255         gint sourcewin_height;
256
257         gint compose_width;
258         gint compose_height;
259         gint compose_x;
260         gint compose_y;
261
262         /* Message */
263         gboolean enable_color;
264         gboolean enable_bgcolor;
265         gulong quote_level1_col;
266         gulong quote_level2_col;
267         gulong quote_level3_col;
268         gulong quote_level1_bgcol;
269         gulong quote_level2_bgcol;
270         gulong quote_level3_bgcol;
271         gulong uri_col;
272         gulong tgt_folder_col;
273         gulong signature_col;
274         gboolean recycle_quote_colors;
275         gboolean display_header_pane;
276         gboolean display_header;
277         gboolean display_xface;
278         gint line_space;
279         gboolean render_html;
280         gboolean invoke_plugin_on_html;
281         gboolean textview_cursor_visible;
282         gboolean enable_smooth_scroll;
283         gint scroll_step;
284         gboolean scroll_halfpage;
285         gboolean respect_flowed_format;
286
287         gboolean show_other_header;
288         gboolean use_different_print_font;
289         GSList *disphdr_list;
290
291         gboolean attach_desc;
292
293         /* MIME viewer */
294         gchar *mime_textviewer;
295         gchar *mime_open_cmd;
296         gchar *attach_save_dir;
297         gchar *attach_load_dir;
298
299         GList *mime_open_cmd_history;
300
301 #if USE_GPGME
302         /* Privacy */
303         gboolean auto_check_signatures;
304         gboolean gpg_signature_popup;
305         gboolean store_passphrase;
306         gint store_passphrase_timeout;
307         gboolean passphrase_grab;
308         gboolean gpg_warning;
309 #endif /* USE_GPGME */
310
311         /* Addressbook */
312         gboolean addressbook_use_editaddress_dialog;
313         gint addressbook_hpaned_pos;
314         gint addressbook_vpaned_pos;
315
316         /* Interface */
317         gboolean layout_mode;
318
319         gint statusbar_update_step;
320         gboolean emulate_emacs;
321         gboolean always_show_msg;
322         gboolean mark_as_read_on_new_window;
323         gboolean mark_as_read_delay;
324         gboolean immediate_exec;
325         SelectOnEntry select_on_entry;
326         NextUnreadMsgDialogShow next_unread_msg_dialog;
327         gboolean add_address_by_click;
328         gchar *pixmap_theme_path;
329         int hover_timeout; /* msecs mouse hover timeout */
330         gboolean ask_mark_all_read;
331         gboolean ask_apply_per_account_filtering_rules;
332         gint apply_per_account_filtering_rules;
333
334         /* Other */
335         gchar *uri_cmd;
336         gchar *print_cmd;
337         gchar *ext_editor_cmd;
338
339     gboolean cliplog;
340     guint loglength;
341         gulong log_msg_color;
342         gulong log_warn_color;
343         gulong log_error_color;
344         gulong log_in_color;
345         gulong log_out_color;
346
347     gboolean confirm_on_exit;
348         gboolean clean_on_exit;
349         gboolean ask_on_clean;
350         gboolean warn_queued_on_exit;
351
352         gint io_timeout_secs;
353
354         gboolean gtk_can_change_accels;
355         
356         /* Memory cache*/
357         gint cache_max_mem_usage;
358         gint cache_min_keep_time;
359         
360         /* boolean for work offline 
361            stored here for use in inc.c */
362         gboolean work_offline;
363         
364         gint summary_quicksearch_type;
365         gint summary_quicksearch_sticky;
366         gint summary_quicksearch_recurse;
367         gint summary_quicksearch_dynamic;
368         gulong color_new;
369         
370         GList *summary_quicksearch_history;
371         GList *summary_search_from_history;
372         GList *summary_search_to_history;
373         GList *summary_search_subject_history;
374         GList *summary_search_body_history;
375         GList *summary_search_adv_condition_history;
376         GList *message_search_history;
377
378         gint filteringwin_width;
379         gint filteringwin_height;
380         gint filteringactionwin_width;
381         gint filteringactionwin_height;
382         gint matcherwin_width;
383         gint matcherwin_height;
384         gint templateswin_width;
385         gint templateswin_height;
386         gint actionswin_width;
387         gint actionswin_height;
388         gint addressbookwin_width;
389         gint addressbookwin_height;
390         gint addressbookeditpersonwin_width;
391         gint addressbookeditpersonwin_height;
392         gint addressbookeditgroupwin_width;
393         gint addressbookeditgroupwin_height;
394         gint pluginswin_width;
395         gint pluginswin_height;
396         gint prefswin_width;
397         gint prefswin_height;
398         gint folderitemwin_width;
399         gint folderitemwin_height;
400         gint editaccountwin_width;
401         gint editaccountwin_height;
402         gint accountswin_width;
403         gint accountswin_height;
404         gint logwin_width;
405         gint logwin_height;
406         gint folderselwin_width;
407         gint folderselwin_height;
408         gint addressaddwin_width;
409         gint addressaddwin_height;
410         gint addressbook_folderselwin_width;
411         gint addressbook_folderselwin_height;
412
413         gint warn_dnd;
414         gint broken_are_utf8;
415         gint skip_ssl_cert_check;
416         gint live_dangerously;
417         gint never_send_retrcpt;
418         gint hide_quotes;
419         gboolean unsafe_ssl_certs;
420 };
421
422 extern PrefsCommon prefs_common;
423
424 void prefs_common_read_config   (void);
425 void prefs_common_write_config  (void);
426 void prefs_common_open          (void);
427 PrefsCommon *prefs_common_get   (void);
428 void pref_get_unescaped_pref(gchar *out, const gchar *in);
429 void pref_get_escaped_pref(gchar *out, const gchar *in);
430 void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt);
431 void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt);
432 gchar *pref_get_pref_from_textview(GtkTextView *textview);
433 gchar *pref_get_pref_from_entry(GtkEntry *entry);
434
435 #endif /* __PREFS_COMMON_H__ */