]> git.deb.at Git - pkg/abook.git/blobdiff - options.c
Merge remote-tracking branch 'upstream/master' into upstream
[pkg/abook.git] / options.c
index a370a30ddd1c7cdb749e2ffd541c562de7db8f98..6f75a06db368f215c85f6731b3415222badb2a41 100644 (file)
--- a/options.c
+++ b/options.c
@@ -50,11 +50,7 @@ static struct option abook_vars[] = {
        { "autosave", OT_BOOL, BOOL_AUTOSAVE, TRUE },
 
        { "show_all_emails", OT_BOOL, BOOL_SHOW_ALL_EMAILS, TRUE },
-       { "emailpos", OT_INT, INT_EMAILPOS, 25 },
-       { "extra_column", OT_STR, STR_EXTRA_COLUMN, UL "phone" },
-       { "extra_alternative", OT_STR, STR_EXTRA_ALTERNATIVE, UL "-1" },
-       { "extrapos", OT_INT, INT_EXTRAPOS, 65 },
-
+       { "index_format", OT_STR, STR_INDEX_FORMAT, UL " {name:22} {email:40} {phone:12|workphone|mobile}" },
        { "mutt_command", OT_STR, STR_MUTT_COMMAND, UL "mutt" },
        { "mutt_return_all_emails", OT_BOOL, BOOL_MUTT_RETURN_ALL_EMAILS,
                TRUE },
@@ -71,7 +67,30 @@ static struct option abook_vars[] = {
        { "preserve_fields", OT_STR, STR_PRESERVE_FIELDS, UL "standard" },
        { "sort_field", OT_STR, STR_SORT_FIELD, UL "nick" },
        { "show_cursor", OT_BOOL, BOOL_SHOW_CURSOR, FALSE },
-
+       { "use_mouse", OT_BOOL, BOOL_USE_MOUSE, FALSE },
+       { "scroll_speed", OT_INT, INT_SCROLL_SPEED, UL 2 },
+       { "use_colors", OT_BOOL, BOOL_USE_COLORS, FALSE },
+       { "color_header_fg", OT_STR, STR_COLOR_HEADER_FG, UL "blue" },
+       { "color_header_fg", OT_STR, STR_COLOR_HEADER_FG, UL "blue" },
+       { "color_header_bg", OT_STR, STR_COLOR_HEADER_BG, UL "red" },
+       { "color_footer_fg", OT_STR, STR_COLOR_FOOTER_FG, UL "red" },
+       { "color_footer_bg", OT_STR, STR_COLOR_FOOTER_BG, UL "default" },
+       { "color_list_even_fg", OT_STR, STR_COLOR_LIST_EVEN_FG, UL "yellow" },
+       { "color_list_even_bg", OT_STR, STR_COLOR_LIST_EVEN_BG, UL "default" },
+       { "color_list_odd_fg", OT_STR, STR_COLOR_LIST_ODD_FG, UL "default" },
+       { "color_list_odd_bg", OT_STR, STR_COLOR_LIST_ODD_BG, UL "default" },
+       { "color_list_header_fg", OT_STR, STR_COLOR_LIST_HEADER_FG, UL "white" },
+       { "color_list_header_bg", OT_STR, STR_COLOR_LIST_HEADER_BG, UL "blue" },
+       { "color_list_highlight_fg", OT_STR, STR_COLOR_LIST_HIGHLIGHT_FG, UL "black" },
+       { "color_list_highlight_bg", OT_STR, STR_COLOR_LIST_HIGHLIGHT_BG, UL "green" },
+       { "color_tab_border_fg", OT_STR, STR_COLOR_TAB_BORDER_FG, UL "cyan" },
+       { "color_tab_border_bg", OT_STR, STR_COLOR_TAB_BORDER_BG, UL "default" },
+       { "color_tab_label_fg", OT_STR, STR_COLOR_TAB_LABEL_FG, UL "magenta" },
+       { "color_tab_label_bg", OT_STR, STR_COLOR_TAB_LABEL_BG, UL "default" },
+       { "color_field_name_fg", OT_STR, STR_COLOR_FIELD_NAME_FG, UL "yellow" },
+       { "color_field_name_bg", OT_STR, STR_COLOR_FIELD_NAME_BG, UL "default" },
+       { "color_field_value_fg", OT_STR, STR_COLOR_FIELD_VALUE_FG, UL "green" },
+       { "color_field_value_bg", OT_STR, STR_COLOR_FIELD_VALUE_BG, UL "default" },
        { NULL }
 };
 
@@ -278,16 +297,17 @@ get_token(buffer *b, int options)
        return NULL;
 }
 
-static char *
+static const char *
 opt_set_set_option(char *p, struct option *opt)
 {
        int len;
 
-       strtrim(p);
+       assert(p);
 
+       strtrim(p);
        len = strlen(p);
 
-       if(p[len - 1] == '\"' && *p == '\"') {
+       if(*p == '\"' && p[len - 1] == '\"') {
                if(len < 3)
                        return _("invalid value");
                p[len - 1] = 0;
@@ -317,11 +337,14 @@ opt_set_set_option(char *p, struct option *opt)
        return NULL;
 }
 
-static char *
+static const char *
 opt_set_option(char *var, char *p)
 {
        int i;
 
+       assert(var);
+       assert(p);
+
        for(i = 0; abook_vars[i].option; i++)
                if(!strcmp(abook_vars[i].option, var))
                        return opt_set_set_option(p, &abook_vars[i]);
@@ -360,7 +383,7 @@ check_options()
 /*
  * syntax: set <option> = <value>
  */
-static char *
+static const char *
 opt_parse_set(buffer *b)
 {
        char *var, *err;
@@ -374,7 +397,7 @@ opt_parse_set(buffer *b)
        return opt_set_option(var, b->ptr);
 }
 
-static char *
+static const char *
 opt_parse_customfield(buffer *b)
 {
        return _("customfield: obsolete command - please use the "
@@ -386,7 +409,7 @@ opt_parse_customfield(buffer *b)
 /*
  * syntax: view <tab name> = <field1> [ , <field2>, ... ]
  */
-static char *
+static const char *
 opt_parse_view(buffer *b)
 {
        char *err, *view;
@@ -416,7 +439,7 @@ opt_parse_view(buffer *b)
 /*
  * syntax: field <identifier> = <human readable name> [ , <type> ]
  */
-static char *
+static const char *
 opt_parse_field(buffer *b)
 {
        char *err, *field, *name;
@@ -445,7 +468,7 @@ opt_parse_field(buffer *b)
 
 static struct {
        char *token;
-       char * (*func) (buffer *line);
+       const char * (*func) (buffer *line);
 } opt_parsers[] = {
        { "set", opt_parse_set },
        { "customfield", opt_parse_customfield }, /* obsolete */
@@ -458,7 +481,7 @@ static bool
 opt_parse_line(char *line, int n, char *fn)
 {
        int i;
-       char *err = NULL;
+       const char *err = NULL;
        char *token;
        buffer b;