*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#ifdef HAVE_CONFIG_H
#include "stock_pixmap.h"
#include "prefswindow.h"
#include "colorlabel.h"
+#include "addrcustomattr.h"
enum {
DATEFMT_FMT,
&prefs_common.smallfont, P_STRING, NULL, NULL, NULL},
{"normal_font_gtk2", "Sans 9",
&prefs_common.normalfont, P_STRING, NULL, NULL, NULL},
+ {"bold_font_gtk2", "Sans 9 Bold",
+ &prefs_common.boldfont, P_STRING, NULL, NULL, NULL},
/* Message */
{"attach_save_directory", NULL,
&prefs_common.attach_save_dir, P_STRING, NULL, NULL, NULL},
*/
static PrefParam param[] = {
+#ifdef MAEMO
+ {"data_root", "", &prefs_common.data_root, P_STRING,
+ NULL, NULL, NULL},
+#endif
/* Receive */
{"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
NULL, NULL, NULL},
P_BOOL, NULL, NULL, NULL},
{"newmail_notify_cmd", "", &SPECIFIC_PREFS.newmail_notify_cmd, P_STRING,
NULL, NULL, NULL},
+#ifdef MAEMO
+ {"maemo_show_led", "TRUE", &prefs_common.maemo_show_led, P_BOOL,
+ NULL, NULL, NULL},
+ {"maemo_play_sound", "FALSE", &prefs_common.maemo_play_sound, P_BOOL,
+ NULL, NULL, NULL},
+ {"maemo_show_banner", "FALSE", &prefs_common.maemo_show_banner, P_BOOL,
+ NULL, NULL, NULL},
+#endif
{"receive_dialog_mode", "2", &prefs_common.recv_dialog_mode, P_ENUM,
NULL, NULL, NULL},
{"receivewin_width", "460", &prefs_common.receivewin_width, P_INT,
NULL, NULL, NULL},
{"confirm_send_queued_messages", "FALSE", &prefs_common.confirm_send_queued_messages,
P_BOOL, NULL, NULL, NULL},
- {"send_dialog_mode", "1", &prefs_common.send_dialog_mode, P_ENUM,
+#ifndef MAEMO
+ {"send_dialog_mode", "0", &prefs_common.send_dialog_invisible, P_BOOL,
+ NULL, NULL, NULL},
+#else
+ {"send_dialog_mode", "1", &prefs_common.send_dialog_invisible, P_BOOL,
NULL, NULL, NULL},
+#endif
{"sendwin_width", "460", &prefs_common.sendwin_width, P_INT,
NULL, NULL, NULL},
{"sendwin_height", "-1", &prefs_common.sendwin_height, P_INT,
&SPECIFIC_PREFS.smallfont, P_STRING, NULL, NULL, NULL},
{"normal_font_gtk2", "Sans 9",
&SPECIFIC_PREFS.normalfont, P_STRING, NULL, NULL, NULL},
+ {"bold_font_gtk2", "Sans Bold 9",
+ &SPECIFIC_PREFS.boldfont, P_STRING, NULL, NULL, NULL},
#else
{"widget_font_gtk2", NULL,
&SPECIFIC_PREFS.widgetfont, P_STRING, NULL, NULL, NULL},
&SPECIFIC_PREFS.smallfont, P_STRING, NULL, NULL, NULL},
{"normal_font_gtk2", "Sans 8",
&SPECIFIC_PREFS.normalfont, P_STRING, NULL, NULL, NULL},
+ {"bold_font_gtk2", "Sans Bold 8",
+ &SPECIFIC_PREFS.boldfont, P_STRING, NULL, NULL, NULL},
#endif
+
+ {"use_different_print_font", "FALSE", &prefs_common.use_different_print_font, P_BOOL,
+ NULL, NULL, NULL},
+ {"derive_from_normal_font", "TRUE", &prefs_common.derive_from_normal_font, P_BOOL,
+ NULL, NULL, NULL},
+
/* custom colors */
{"custom_color1", "#ff9900", &prefs_common.custom_colorlabel[0].color, P_COLOR,
NULL, NULL, NULL},
#endif
{"toolbar_detachable", "FALSE", &prefs_common.toolbar_detachable, P_BOOL,
NULL, NULL, NULL},
- {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL,
+ {"show_col_headers", "TRUE", &prefs_common.show_col_headers, P_BOOL,
NULL, NULL, NULL},
#ifndef MAEMO
+ {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL,
+ NULL, NULL, NULL},
{"show_searchbar", "TRUE", &prefs_common.show_searchbar, P_BOOL,
NULL, NULL, NULL},
#else
+ {"show_statusbar", "FALSE", &prefs_common.show_statusbar, P_BOOL,
+ NULL, NULL, NULL},
{"show_searchbar", "FALSE", &prefs_common.show_searchbar, P_BOOL,
NULL, NULL, NULL},
#endif
&prefs_common.summary_col_visible[S_COL_SCORE], P_BOOL, NULL, NULL, NULL},
{"summary_col_show_locked", "FALSE",
&prefs_common.summary_col_visible[S_COL_LOCKED], P_BOOL, NULL, NULL, NULL},
+ {"summary_col_show_tags", "FALSE",
+ &prefs_common.summary_col_visible[S_COL_TAGS], P_BOOL, NULL, NULL, NULL},
{"summary_col_pos_mark", "0",
&prefs_common.summary_col_pos[S_COL_MARK], P_INT, NULL, NULL, NULL},
&prefs_common.summary_col_pos[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
{"summary_col_pos_to", "10",
&prefs_common.summary_col_pos[S_COL_TO], P_INT, NULL, NULL, NULL},
+ {"summary_col_pos_tags", "11",
+ &prefs_common.summary_col_pos[S_COL_TAGS], P_INT, NULL, NULL, NULL},
{"summary_col_size_mark", "10",
&prefs_common.summary_col_size[S_COL_MARK], P_INT, NULL, NULL, NULL},
&prefs_common.summary_col_size[S_COL_SCORE], P_INT, NULL, NULL, NULL},
{"summary_col_size_locked", "13",
&prefs_common.summary_col_size[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
+ {"summary_col_size_tags", "150",
+ &prefs_common.summary_col_size[S_COL_TAGS], P_INT, NULL, NULL, NULL},
/* Widget size */
{"folderwin_x", "16", &prefs_common.folderwin_x, P_INT,
NULL, NULL, NULL},
{"mainwin_y", "64", &prefs_common.mainwin_y, P_INT,
NULL, NULL, NULL},
+ {"mainwin_maximised", "FALSE", &prefs_common.mainwin_maximised, P_BOOL,
+ NULL, NULL, NULL},
#ifndef MAEMO
{"mainwin_width", "800", &prefs_common.mainwin_width, P_INT,
NULL, NULL, NULL},
NULL, NULL, NULL},
{"uri_color", "32512", &prefs_common.uri_col, P_COLOR,
NULL, NULL, NULL},
+ {"emphasis_color", "207", &prefs_common.emphasis_col, P_COLOR,
+ NULL, NULL, NULL},
{"target_folder_color", "14294218", &prefs_common.tgt_folder_col, P_COLOR,
NULL, NULL, NULL},
{"signature_color", "7960953", &prefs_common.signature_col, P_COLOR,
{"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
NULL, NULL, NULL},
- {"use_different_print_font", "FALSE", &prefs_common.use_different_print_font, P_BOOL,
- NULL, NULL, NULL},
-
{"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
NULL, NULL, NULL},
{"attach_save_directory", NULL,
{"always_show_message_when_selected", "FALSE",
&prefs_common.always_show_msg,
P_BOOL, NULL, NULL, NULL},
- {"select_on_entry", "2", &prefs_common.select_on_entry,
+ {"select_on_entry", "3", &prefs_common.select_on_entry,
P_ENUM, NULL, NULL, NULL},
+ {"show_tooltips", "TRUE", &prefs_common.show_tooltips,
+ P_BOOL, NULL, NULL, NULL},
+
+ /* do it SUMMARY_OPEN_ACTIONS-1 times */
+ {"summary_select_prio1", "0", &prefs_common.summary_select_prio[0], P_ENUM,
+ NULL, NULL, NULL},
+ {"summary_select_prio2", "0", &prefs_common.summary_select_prio[1], P_ENUM,
+ NULL, NULL, NULL},
+ {"summary_select_prio3", "0", &prefs_common.summary_select_prio[2], P_ENUM,
+ NULL, NULL, NULL},
+ {"summary_select_prio4", "0", &prefs_common.summary_select_prio[3], P_ENUM,
+ NULL, NULL, NULL},
+ {"summary_select_prio5", "0", &prefs_common.summary_select_prio[4], P_ENUM,
+ NULL, NULL, NULL},
+ {"summary_select_prio6", "0", &prefs_common.summary_select_prio[5], P_ENUM,
+ NULL, NULL, NULL},
+ {"summary_select_prio7", "0", &prefs_common.summary_select_prio[6], P_ENUM,
+ NULL, NULL, NULL},
+
{"mark_as_read_on_new_window", "FALSE",
&prefs_common.mark_as_read_on_new_window,
P_BOOL, NULL, NULL, NULL},
&SPECIFIC_PREFS.print_cmd, P_STRING, NULL, NULL, NULL},
{"ext_editor_command", DEFAULT_EDITOR_CMD,
&SPECIFIC_PREFS.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
+ {"cmds_use_system_default", "FALSE",
+ &prefs_common.cmds_use_system_default, P_BOOL, NULL, NULL, NULL},
{"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
P_BOOL, NULL, NULL, NULL},
{"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL,
{"important_score", "1", &prefs_common.important_score, P_INT,
NULL, NULL, NULL},
- {"clip_log", "TRUE", &prefs_common.cliplog, P_BOOL,
+ {"clip_log", "TRUE", &prefs_common.cliplog, P_BOOL,
NULL, NULL, NULL},
{"log_length", "500", &prefs_common.loglength, P_INT,
NULL, NULL, NULL},
-
+#ifndef MAEMO
+ {"enable_log_standard", "TRUE", &prefs_common.enable_log_standard, P_BOOL,
+ NULL, NULL, NULL},
+ {"enable_log_warning", "TRUE", &prefs_common.enable_log_warning, P_BOOL,
+ NULL, NULL, NULL},
+ {"enable_log_error", "TRUE", &prefs_common.enable_log_error, P_BOOL,
+ NULL, NULL, NULL},
+ {"enable_log_status", "TRUE", &prefs_common.enable_log_status, P_BOOL,
+ NULL, NULL, NULL},
+#else
+ {"enable_log_standard", "FALSE", &prefs_common.enable_log_standard, P_BOOL,
+ NULL, NULL, NULL},
+ {"enable_log_warning", "FALSE", &prefs_common.enable_log_warning, P_BOOL,
+ NULL, NULL, NULL},
+ {"enable_log_error", "FALSE", &prefs_common.enable_log_error, P_BOOL,
+ NULL, NULL, NULL},
+ {"enable_log_status", "FALSE", &prefs_common.enable_log_status, P_BOOL,
+ NULL, NULL, NULL},
+#endif
{"log_msg_color", "#00af00", &prefs_common.log_msg_color, P_COLOR,
NULL, NULL, NULL},
{"log_warn_color", "#af0000", &prefs_common.log_warn_color, P_COLOR,
{"actionswin_height", "-1", &prefs_common.actionswin_height, P_INT,
NULL, NULL, NULL},
+ {"tagswin_width", "486", &prefs_common.tagswin_width, P_INT,
+ NULL, NULL, NULL},
+ {"tagswin_height", "-1", &prefs_common.tagswin_height, P_INT,
+ NULL, NULL, NULL},
+
{"addressbookwin_width", "520", &prefs_common.addressbookwin_width, P_INT,
NULL, NULL, NULL},
{"addressbookwin_height", "-1", &prefs_common.addressbookwin_height, P_INT,
NULL, NULL, NULL},
{"live_dangerously", "FALSE", &prefs_common.live_dangerously, P_BOOL,
NULL, NULL, NULL},
+ {"save_parts_readwrite", "FALSE", &prefs_common.save_parts_readwrite, P_BOOL,
+ NULL, NULL, NULL},
{"hide_quotes", "0", &prefs_common.hide_quotes, P_INT,
NULL, NULL, NULL},
{"unsafe_ssl_certs", "FALSE", &prefs_common.unsafe_ssl_certs, P_BOOL,
{"real_time_sync", "TRUE", &prefs_common.real_time_sync, P_BOOL,
NULL, NULL, NULL},
#endif
+
+ {"print_paper_type", NULL, &prefs_common.print_paper_type, P_STRING,
+ NULL, NULL, NULL},
+ {"print_paper_orientation", "0", &prefs_common.print_paper_orientation, P_INT,
+ NULL, NULL, NULL},
+ {"print_use_color", "0", &prefs_common.print_use_color, P_INT,
+ NULL, NULL, NULL},
+ {"print_use_collate", "0", &prefs_common.print_use_collate, P_INT,
+ NULL, NULL, NULL},
+ {"print_use_reverse", "0", &prefs_common.print_use_reverse, P_INT,
+ NULL, NULL, NULL},
+ {"print_use_duplex", "0", &prefs_common.print_use_duplex, P_INT,
+ NULL, NULL, NULL},
+ {"print_imgs", "1", &prefs_common.print_imgs, P_INT,
+ NULL, NULL, NULL},
+ {"print_previewwin_width", "600", &prefs_common.print_previewwin_width, P_INT,
+ NULL, NULL, NULL},
+ {"print_previewwin_height", "-1", &prefs_common.print_previewwin_height, P_INT,
+ NULL, NULL, NULL},
+ {"use_networkmanager", "TRUE", &prefs_common.use_networkmanager, P_BOOL,
+ NULL, NULL, NULL},
+
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
-PrefsCommon *prefs_common_get(void)
-{
- return &prefs_common;
-}
-
/*
- * Read history list from the specified history file
+ * Read history list from the specified history file in the specified directory (subdir of rc_dir)
+ * Fallback to default_list if history file is not found
*/
-static GList *prefs_common_read_history(const gchar *history)
+GList *prefs_common_read_history_from_dir_with_defaults(const gchar *dirname, const gchar *history,
+ GList *default_list)
{
FILE *fp;
gchar *path;
gchar buf[PREFSBUFSIZE];
GList *tmp = NULL;
+ if (dirname) {
+ path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, dirname,
+ G_DIR_SEPARATOR_S, history,
+ NULL);
+ } else {
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, history,
NULL);
+ }
if ((fp = g_fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(path);
- return NULL;
+ /* returns default list if set, otherwise NULL */
+ return default_list;
}
g_free(path);
while (fgets(buf, sizeof(buf), fp) != NULL) {
return tmp;
}
+/*
+ * Read history list from the specified history file in the specified directory (subdir of rc_dir)
+ */
+static GList *prefs_common_read_history_from_dir(const gchar *dirname, const gchar *history)
+{
+ return prefs_common_read_history_from_dir_with_defaults(dirname, history, NULL);
+}
+
+/*
+ * Read history list from the specified history file
+ */
+static GList *prefs_common_read_history(const gchar *history)
+{
+ return prefs_common_read_history_from_dir(NULL, history);
+}
+
void prefs_common_read_config(void)
{
gchar *rcpath;
prefs_common.message_search_history =
prefs_common_read_history(MESSAGE_SEARCH_HISTORY);
+ prefs_common.addressbook_custom_attributes = addressbook_update_custom_attr_from_prefs();
+
colorlabel_update_colortable_from_prefs();
}
} \
/*
- * Save history list to the specified history file
+ * Save history list to the specified history file in the specified directory (subdir of rc_dir)
*/
-static void prefs_common_save_history(const gchar *history, GList *list)
+static void prefs_common_save_history_to_dir(const gchar *dirname, const gchar *history, GList *list)
{
GList *cur;
FILE *fp;
gchar *path, *tmp_path;
+ if (dirname) {
+ path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, dirname,
+ G_DIR_SEPARATOR_S, history,
+ NULL);
+ } else {
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, history,
NULL);
+ }
tmp_path = g_strconcat(path, ".tmp", NULL);
if ((fp = g_fopen(tmp_path, "wb")) == NULL) {
g_free(path);
}
+/*
+ * Save history list to the specified history file
+ */
+static void prefs_common_save_history(const gchar *history, GList *list)
+{
+ prefs_common_save_history_to_dir(NULL, history, list);
+}
+
#undef TRY
void prefs_common_write_config(void)
prefs_common.summary_search_adv_condition_history);
prefs_common_save_history(MESSAGE_SEARCH_HISTORY,
prefs_common.message_search_history);
+
+ prefs_common_save_history_to_dir(ADDRBOOK_DIR,
+ ADDRESSBOOK_CUSTOM_ATTRIBUTES,
+ prefs_common.addressbook_custom_attributes);
}
/* make a copy of string 'in' into buffer 'out'. un-escape \ sequences.
GtkTextBuffer *buffer;
gchar *out = NULL;
- g_return_if_fail( txt != NULL );
g_return_if_fail( textview != NULL );
buffer = gtk_text_view_get_buffer(textview);
- out = malloc(strlen(txt)+1);
- pref_get_unescaped_pref(out, txt);
+ if (!txt) {
+ gtk_text_buffer_set_text(buffer, "", -1);
+ } else {
+ out = malloc(strlen(txt)+1);
+
+ pref_get_unescaped_pref(out, txt);
- gtk_text_buffer_set_text(buffer, out?out:"", -1);
- g_free(out);
+ gtk_text_buffer_set_text(buffer, out?out:"", -1);
+ g_free(out);
+ }
}
/* set the contents of a gtkentry widget from the internal \-escaped
{
gchar *out = NULL;
- g_return_if_fail( txt != NULL );
g_return_if_fail( entry != NULL );
+ if (!txt) {
+ gtk_entry_set_text(entry, "");
+ } else {
+ out = malloc(strlen(txt)+1);
- out = malloc(strlen(txt)+1);
-
- pref_get_unescaped_pref(out, txt);
+ pref_get_unescaped_pref(out, txt);
- gtk_entry_set_text(entry, out?out:"");
- g_free(out);
+ gtk_entry_set_text(entry, out?out:"");
+ g_free(out);
+ }
}
/* get the \-escaped internal representation of a pref from the contents of
return prefs_common.unsafe_ssl_certs;
}
+gboolean prefs_common_enable_log_standard(void)
+{
+ return prefs_common.enable_log_standard;
+}
+
+gboolean prefs_common_enable_log_warning(void)
+{
+ return prefs_common.enable_log_warning;
+}
+gboolean prefs_common_enable_log_error(void)
+{
+ return prefs_common.enable_log_error;
+}
+gboolean prefs_common_enable_log_status(void)
+{
+ return prefs_common.enable_log_status;
+}
+
+#ifdef MAEMO
+const gchar *prefs_common_get_data_root(void)
+{
+ if (prefs_common.data_root && *prefs_common.data_root)
+ return prefs_common.data_root;
+ else
+ return NULL;
+}
+#endif
/**
return the translated name of a header, if the translate_header option is
set, otherwise return the untranslated header name (header_name itself).
return prefs_common.trans_hdr ? gettext(header_name) : header_name;
}
+
+const gchar *prefs_common_get_uri_cmd(void)
+{
+ gchar *tmp = NULL;
+
+ if (!prefs_common.cmds_use_system_default)
+ return prefs_common.uri_cmd;
+
+ tmp = g_find_program_in_path("xdg-open");
+ if (!tmp)
+ return prefs_common.uri_cmd;
+
+ g_free(tmp);
+ return "xdg-open %s";
+}
+
+const gchar *prefs_common_get_ext_editor_cmd(void)
+{
+ return prefs_common.ext_editor_cmd;
+#if 0 /* we should do that, but it detaches the editor and breaks
+ compose.c's external composition. */
+ gchar *tmp = NULL;
+
+ if (!prefs_common.cmds_use_system_default)
+ return prefs_common.ext_editor_cmd;
+
+ tmp = g_find_program_in_path("xdg-open");
+ if (!tmp)
+ return prefs_common.ext_editor_cmd;
+
+ g_free(tmp);
+ return "xdg-open %s";
+#endif
+}