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