2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <glib/gi18n.h>
29 #include <gdk/gdkkeysyms.h>
34 #include <sys/types.h>
39 #include "prefs_gtk.h"
40 #include "prefs_common.h"
41 #include "prefs_display_header.h"
42 #include "prefs_summary_column.h"
43 #include "mainwindow.h"
44 #include "summaryview.h"
45 #include "messageview.h"
46 #include "manage_window.h"
52 #include "alertpanel.h"
56 #include "folderview.h"
57 #include "stock_pixmap.h"
58 #include "prefswindow.h"
66 PrefsCommon prefs_common;
71 parameter name, default value, pointer to the prefs variable, data type,
72 pointer to the widget pointer,
73 pointer to the function for data setting,
74 pointer to the function for widget setting
77 static PrefParam param[] = {
79 {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
81 {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING,
84 {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL,
86 {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT,
88 {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL,
90 {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc,
91 P_BOOL, NULL, NULL, NULL},
92 {"newmail_notify_manu", "FALSE", &prefs_common.newmail_notify_manu,
93 P_BOOL, NULL, NULL, NULL},
94 {"newmail_notify_auto", "FALSE", &prefs_common.newmail_notify_auto,
95 P_BOOL, NULL, NULL, NULL},
96 {"newmail_notify_cmd", "", &prefs_common.newmail_notify_cmd, P_STRING,
98 {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM,
100 {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel,
101 P_BOOL, NULL, NULL, NULL},
102 {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog,
103 P_BOOL, NULL, NULL, NULL},
106 {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL,
108 {"confirm_send_queued_messages", "FALSE", &prefs_common.confirm_send_queued_messages,
109 P_BOOL, NULL, NULL, NULL},
110 {"send_dialog_mode", "0", &prefs_common.send_dialog_mode, P_ENUM,
113 {"outgoing_charset", CS_AUTO, &prefs_common.outgoing_charset, P_STRING,
115 {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM,
118 {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
119 P_BOOL, NULL, NULL, NULL},
122 {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL,
124 {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment,
125 P_BOOL, NULL, NULL, NULL},
126 {"redirect_keep_from", "FALSE",
127 &prefs_common.redirect_keep_from, P_BOOL,
129 {"undo_level", "50", &prefs_common.undolevels, P_INT,
132 {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
134 {"linewrap_quotation", "TRUE", &prefs_common.linewrap_quote, P_BOOL,
136 {"linewrap_auto", "TRUE", &prefs_common.autowrap, P_BOOL,
138 {"linewrap_before_sending", "FALSE", &prefs_common.linewrap_at_send, P_BOOL,
140 {"autosave", "FALSE", &prefs_common.autosave,
141 P_BOOL, NULL, NULL, NULL},
142 {"autosave_length", "50", &prefs_common.autosave_length, P_INT,
145 {"enable_aspell", "TRUE", &prefs_common.enable_aspell, P_BOOL,
147 {"aspell_path", ASPELL_PATH, &prefs_common.aspell_path, P_STRING,
149 {"dictionary", "", &prefs_common.dictionary, P_STRING,
151 {"aspell_sugmode", "1", &prefs_common.aspell_sugmode, P_INT,
153 {"use_alternate_dict", "FALSE", &prefs_common.use_alternate, P_BOOL,
155 {"check_while_typing", "TRUE", &prefs_common.check_while_typing, P_BOOL,
157 {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_COLOR,
160 {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL,
163 /* Account autoselection */
164 {"reply_account_autoselect", "TRUE",
165 &prefs_common.reply_account_autosel, P_BOOL,
167 {"forward_account_autoselect", "TRUE",
168 &prefs_common.forward_account_autosel, P_BOOL,
170 {"reedit_account_autoselect", "TRUE",
171 &prefs_common.reedit_account_autosel, P_BOOL,
174 {"default_reply_list", "TRUE", &prefs_common.default_reply_list, P_BOOL,
177 {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL,
181 {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING,
183 {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%q",
184 &prefs_common.quotefmt, P_STRING, NULL, NULL, NULL},
186 {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING,
188 {"forward_quote_format",
189 "\\n\\nBegin forwarded message:\\n\\n"
190 "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
191 "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
192 &prefs_common.fw_quotefmt, P_STRING, NULL, NULL, NULL},
193 {"quote_chars", ">", &prefs_common.quote_chars, P_STRING,
197 /* Obsolete fonts. For coexisting with Gtk+-1.2 version */
198 {"widget_font", NULL,
199 &prefs_common.widgetfont_gtk1, P_STRING, NULL, NULL, NULL},
200 {"message_font", "-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",
201 &prefs_common.textfont_gtk1, P_STRING, NULL, NULL, NULL},
202 {"small_font", "-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*",
203 &prefs_common.smallfont_gtk1, P_STRING, NULL, NULL, NULL},
204 {"bold_font", "-*-helvetica-bold-r-normal--12-*-*-*-*-*-*-*",
205 &prefs_common.boldfont_gtk1, P_STRING, NULL, NULL, NULL},
206 {"normal_font", "-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*",
207 &prefs_common.normalfont_gtk1, P_STRING, NULL, NULL, NULL},
210 {"widget_font_gtk2", NULL,
211 &prefs_common.widgetfont, P_STRING, NULL, NULL, NULL},
212 {"message_font_gtk2", "Monospace 9",
213 &prefs_common.textfont, P_STRING, NULL, NULL, NULL},
214 {"small_font_gtk2", "Sans 9",
215 &prefs_common.smallfont, P_STRING, NULL, NULL, NULL},
216 {"bold_font_gtk2", "Sans Bold 9",
217 &prefs_common.boldfont, P_STRING, NULL, NULL, NULL},
218 {"normal_font_gtk2", "Sans 9",
219 &prefs_common.normalfont, P_STRING, NULL, NULL, NULL},
222 {"display_image", "TRUE", &prefs_common.display_img, P_BOOL,
224 {"resize_image", "TRUE", &prefs_common.resize_img, P_BOOL,
226 {"inline_image", "TRUE", &prefs_common.inline_img, P_BOOL,
229 {"display_folder_unread_num", "TRUE",
230 &prefs_common.display_folder_unread, P_BOOL,
232 {"newsgroup_abbrev_len", "16",
233 &prefs_common.ng_abbrev_len, P_INT,
236 {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL,
239 /* Display: Summary View */
240 {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL,
242 {"use_address_book", "FALSE", &prefs_common.use_addr_book, P_BOOL,
244 {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL,
246 {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
247 P_STRING, NULL, NULL, NULL},
249 {"enable_rules_hint", "TRUE", &prefs_common.enable_rules_hint, P_BOOL,
251 {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
253 {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
255 {"thread_by_subject_max_age", "10", &prefs_common.thread_by_subject_max_age,
256 P_INT, NULL, NULL, NULL },
258 {"enable_thread", "TRUE", &prefs_common.enable_thread, P_BOOL,
260 {"toolbar_style", "3", &prefs_common.toolbar_style, P_ENUM,
262 {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL,
264 {"show_searchbar", "TRUE", &prefs_common.show_searchbar, P_BOOL,
267 {"folderview_vscrollbar_policy", "0",
268 &prefs_common.folderview_vscrollbar_policy, P_ENUM,
271 {"summary_col_show_mark", "TRUE",
272 &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL, NULL, NULL, NULL},
273 {"summary_col_show_unread", "TRUE",
274 &prefs_common.summary_col_visible[S_COL_STATUS], P_BOOL, NULL, NULL, NULL},
275 {"summary_col_show_mime", "TRUE",
276 &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL, NULL, NULL, NULL},
277 {"summary_col_show_subject", "TRUE",
278 &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL, NULL, NULL, NULL},
279 {"summary_col_show_from", "TRUE",
280 &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL, NULL, NULL, NULL},
281 {"summary_col_show_date", "TRUE",
282 &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL, NULL, NULL, NULL},
283 {"summary_col_show_size", "TRUE",
284 &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL, NULL, NULL, NULL},
285 {"summary_col_show_number", "FALSE",
286 &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL, NULL, NULL, NULL},
287 {"summary_col_show_score", "FALSE",
288 &prefs_common.summary_col_visible[S_COL_SCORE], P_BOOL, NULL, NULL, NULL},
289 {"summary_col_show_locked", "FALSE",
290 &prefs_common.summary_col_visible[S_COL_LOCKED], P_BOOL, NULL, NULL, NULL},
292 {"summary_col_pos_mark", "0",
293 &prefs_common.summary_col_pos[S_COL_MARK], P_INT, NULL, NULL, NULL},
294 {"summary_col_pos_unread", "1",
295 &prefs_common.summary_col_pos[S_COL_STATUS], P_INT, NULL, NULL, NULL},
296 {"summary_col_pos_mime", "2",
297 &prefs_common.summary_col_pos[S_COL_MIME], P_INT, NULL, NULL, NULL},
298 {"summary_col_pos_subject", "3",
299 &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
300 {"summary_col_pos_from", "4",
301 &prefs_common.summary_col_pos[S_COL_FROM], P_INT, NULL, NULL, NULL},
302 {"summary_col_pos_date", "5",
303 &prefs_common.summary_col_pos[S_COL_DATE], P_INT, NULL, NULL, NULL},
304 {"summary_col_pos_size", "6",
305 &prefs_common.summary_col_pos[S_COL_SIZE], P_INT, NULL, NULL, NULL},
306 {"summary_col_pos_number", "7",
307 &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
308 {"summary_col_pos_score", "8",
309 &prefs_common.summary_col_pos[S_COL_SCORE], P_INT, NULL, NULL, NULL},
310 {"summary_col_pos_locked", "9",
311 &prefs_common.summary_col_pos[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
313 {"summary_col_size_mark", "10",
314 &prefs_common.summary_col_size[S_COL_MARK], P_INT, NULL, NULL, NULL},
315 {"summary_col_size_unread", "13",
316 &prefs_common.summary_col_size[S_COL_STATUS], P_INT, NULL, NULL, NULL},
317 {"summary_col_size_mime", "10",
318 &prefs_common.summary_col_size[S_COL_MIME], P_INT, NULL, NULL, NULL},
319 {"summary_col_size_subject", "200",
320 &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
321 {"summary_col_size_from", "120",
322 &prefs_common.summary_col_size[S_COL_FROM], P_INT, NULL, NULL, NULL},
323 {"summary_col_size_date", "118",
324 &prefs_common.summary_col_size[S_COL_DATE], P_INT, NULL, NULL, NULL},
325 {"summary_col_size_size", "45",
326 &prefs_common.summary_col_size[S_COL_SIZE], P_INT, NULL, NULL, NULL},
327 {"summary_col_size_number", "40",
328 &prefs_common.summary_col_size[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
329 {"summary_col_size_score", "40",
330 &prefs_common.summary_col_size[S_COL_SCORE], P_INT, NULL, NULL, NULL},
331 {"summary_col_size_locked", "13",
332 &prefs_common.summary_col_size[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
335 {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT,
337 {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT,
339 {"folderview_width", "179", &prefs_common.folderview_width, P_INT,
341 {"folderview_height", "450", &prefs_common.folderview_height, P_INT,
343 {"folderview_visible", "TRUE", &prefs_common.folderview_visible, P_BOOL,
346 {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT,
348 {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT,
350 {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT,
352 {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT,
355 {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT,
357 {"summaryview_height", "157", &prefs_common.summaryview_height, P_INT,
360 {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT,
362 {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT,
364 {"messageview_width", "600", &prefs_common.msgview_width, P_INT,
366 {"messageview_height", "300", &prefs_common.msgview_height, P_INT,
368 {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL,
371 {"mainview_x", "64", &prefs_common.mainview_x, P_INT,
373 {"mainview_y", "64", &prefs_common.mainview_y, P_INT,
375 {"mainview_width", "600", &prefs_common.mainview_width, P_INT,
377 {"mainview_height", "600", &prefs_common.mainview_height, P_INT,
379 {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT,
381 {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT,
383 {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT,
385 {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT,
387 {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT,
389 {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT,
391 {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT,
393 {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT,
395 {"compose_width", "600", &prefs_common.compose_width, P_INT,
397 {"compose_height", "560", &prefs_common.compose_height, P_INT,
399 {"compose_x", "0", &prefs_common.compose_x, P_INT,
401 {"compose_y", "0", &prefs_common.compose_y, P_INT,
404 {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL,
407 {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_COLOR,
409 {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_COLOR,
411 {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_COLOR,
413 {"uri_color", "32512", &prefs_common.uri_col, P_COLOR,
415 {"target_folder_color", "14294218", &prefs_common.tgt_folder_col, P_COLOR,
417 {"signature_color", "7960953", &prefs_common.signature_col, P_COLOR,
419 {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
420 P_BOOL, NULL, NULL, NULL},
422 {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL,
424 {"display_header_pane", "TRUE", &prefs_common.display_header_pane,
425 P_BOOL, NULL, NULL, NULL},
426 {"display_header", "TRUE", &prefs_common.display_header, P_BOOL,
428 {"render_html", "TRUE", &prefs_common.render_html, P_BOOL,
430 {"textview_cursor_visible", "FALSE",
431 &prefs_common.textview_cursor_visible, P_BOOL,
433 {"line_space", "2", &prefs_common.line_space, P_INT,
436 {"enable_smooth_scroll", "FALSE",
437 &prefs_common.enable_smooth_scroll, P_BOOL,
439 {"scroll_step", "1", &prefs_common.scroll_step, P_INT,
441 {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL,
444 {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
447 {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
449 {"attach_save_directory", NULL,
450 &prefs_common.attach_save_dir, P_STRING, NULL, NULL, NULL},
453 {"mime_image_viewer", "display '%s'",
454 &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
455 {"mime_audio_player", "play '%s'",
456 &prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL},
457 {"mime_open_command", "gedit '%s'",
458 &prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL},
461 {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL,
463 {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL,
466 /* {"emulate_emacs", "FALSE", &prefs_common.emulate_emacs, P_BOOL,
467 NULL, NULL, NULL}, */
468 {"always_show_message_when_selected", "FALSE",
469 &prefs_common.always_show_msg,
470 P_BOOL, NULL, NULL, NULL},
471 {"select_on_entry", NULL, &prefs_common.select_on_entry,
472 P_ENUM, NULL, NULL, NULL},
473 {"mark_as_read_on_new_window", "FALSE",
474 &prefs_common.mark_as_read_on_new_window,
475 P_BOOL, NULL, NULL, NULL},
476 {"mark_as_read_delay", "0",
477 &prefs_common.mark_as_read_delay, P_INT,
479 {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
480 P_BOOL, NULL, NULL, NULL},
481 {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL,
483 {"nextunreadmsg_dialog", NULL, &prefs_common.next_unread_msg_dialog, P_ENUM,
486 {"pixmap_theme_path", DEFAULT_PIXMAP_THEME,
487 &prefs_common.pixmap_theme_path, P_STRING,
490 {"hover_timeout", "500", &prefs_common.hover_timeout, P_INT,
494 {"uri_open_command", DEFAULT_BROWSER_CMD,
495 &prefs_common.uri_cmd, P_STRING, NULL, NULL, NULL},
496 {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING,
498 {"ext_editor_command", "gedit %s",
499 &prefs_common.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
501 {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
502 P_BOOL, NULL, NULL, NULL},
503 {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL,
505 {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL,
507 {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL,
509 {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
510 P_BOOL, NULL, NULL, NULL},
511 {"work_offline", "FALSE", &prefs_common.work_offline, P_BOOL,
513 {"summary_quicksearch_type", "0", &prefs_common.summary_quicksearch_type, P_INT,
515 {"summary_quicksearch_sticky", "1", &prefs_common.summary_quicksearch_sticky, P_INT,
517 {"summary_quicksearch_recurse", "1", &prefs_common.summary_quicksearch_recurse, P_INT,
520 {"io_timeout_secs", "60", &prefs_common.io_timeout_secs,
521 P_INT, NULL, NULL, NULL},
522 {"hide_score", "-9999", &prefs_common.kill_score, P_INT,
524 {"important_score", "1", &prefs_common.important_score, P_INT,
526 {"clip_log", "TRUE", &prefs_common.cliplog, P_BOOL,
528 {"log_length", "500", &prefs_common.loglength, P_INT,
531 {"cache_max_mem_usage", "4096", &prefs_common.cache_max_mem_usage, P_INT,
533 {"cache_min_keep_time", "15", &prefs_common.cache_min_keep_time, P_INT,
536 {"color_new", "179", &prefs_common.color_new, P_COLOR,
539 {"filteringwin_width", "500", &prefs_common.filteringwin_width, P_INT,
541 {"filteringwin_height", "-1", &prefs_common.filteringwin_height, P_INT,
543 {"warn_dnd", "1", &prefs_common.warn_dnd, P_INT,
546 {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
549 PrefsCommon *prefs_common_get(void)
551 return &prefs_common;
555 * Read history list from the specified history file
557 GList *prefs_common_read_history(const gchar *history)
561 gchar buf[PREFSBUFSIZE];
564 path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, history,
566 if ((fp = fopen(path, "rb")) == NULL) {
567 if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
572 while (fgets(buf, sizeof(buf), fp) != NULL) {
574 if (buf[0] == '\0') continue;
575 tmp = add_history(tmp, buf);
579 tmp = g_list_reverse(tmp);
584 void prefs_common_read_config(void)
588 rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
589 prefs_read_config(param, "Common", rcpath, NULL);
592 prefs_common.mime_open_cmd_history =
593 prefs_common_read_history(COMMAND_HISTORY);
594 prefs_common.summary_quicksearch_history =
595 prefs_common_read_history(QUICKSEARCH_HISTORY);
599 * Save history list to the specified history file
601 void prefs_common_save_history(const gchar *history, GList *list)
607 path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, history,
609 if ((fp = fopen(path, "wb")) == NULL) {
610 FILE_OP_ERROR(path, "fopen");
615 for (cur = list; cur != NULL; cur = cur->next) {
616 fputs((gchar *)cur->data, fp);
624 void prefs_common_write_config(void)
626 prefs_write_config(param, "Common", COMMON_RC);
628 prefs_common_save_history(COMMAND_HISTORY,
629 prefs_common.mime_open_cmd_history);
630 prefs_common_save_history(QUICKSEARCH_HISTORY,
631 prefs_common.summary_quicksearch_history);
634 void pref_set_textview_from_pref(GtkTextView *textview, gchar *txt)
636 GtkTextBuffer *buffer = gtk_text_view_get_buffer(textview);
637 gchar *o_out, *out = malloc(txt?(strlen(txt)+1):1);
639 memset(out, 0, strlen(txt)+1);
642 if (*t == '\\' && *(t+1) == 'n') {
645 } else if (*t == '\\') {
654 gtk_text_buffer_set_text(buffer, o_out?o_out:"", -1);
658 gchar *pref_get_pref_from_textview(GtkTextView *textview)
660 GtkTextBuffer *buffer;
661 GtkTextIter start, end;
662 gchar *o_out, *out, *tmp, *t;
664 buffer = gtk_text_view_get_buffer(textview);
665 gtk_text_buffer_get_start_iter(buffer, &start);
666 gtk_text_buffer_get_iter_at_offset(buffer, &end, -1);
667 tmp = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
669 o_out = out = malloc(2*strlen(tmp)+1);
675 } else if (*t == '\\') {