From: Kalle Wallin Date: Tue, 22 Jun 2004 13:25:22 +0000 (+0000) Subject: Added options: audible-bell, visible-bell, wrap-around, find-wrap X-Git-Tag: v0.12_alpha1~501 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8e032a17efe4851c9c9de61775101e890d5594f1;p=ncmpc.git Added options: audible-bell, visible-bell, wrap-around, find-wrap git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1611 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/src/conf.c b/src/conf.c index a40c90a..343a8a4 100644 --- a/src/conf.c +++ b/src/conf.c @@ -53,6 +53,11 @@ #define CONF_COLOR_DEFINITION "colordef" #define CONF_LIST_FORMAT "list-format" #define CONF_STATUS_FORMAT "status-format" +#define CONF_LIST_WRAP "wrap-around" +#define CONF_FIND_WRAP "find-wrap" +#define CONF_AUDIBLE_BELL "audible-bell" +#define CONF_VISIBLE_BELL "visible-bell" +#define CONF_XTERM_TITLE "xterm-title" /* Deprecated - configuration field names */ #define OLD_CONF_ENABLE_COLORS "enable_colors" @@ -75,13 +80,13 @@ typedef enum { KEY_PARSER_DONE } key_parser_state_t; -static int +static gboolean str2bool(char *str) { - if( !strcasecmp(str,"no") || !strcasecmp(str,"false") || - !strcasecmp(str,"off") || !strcasecmp(str,"0") ) - return 0; - return 1; + if( !strcasecmp(str,"yes") || !strcasecmp(str,"true") || + !strcasecmp(str,"on") || !strcasecmp(str,"1") ) + return TRUE; + return FALSE; } static int @@ -503,14 +508,32 @@ read_rc_file(char *filename, options_t *options) { g_free(options->list_format); options->list_format = get_format(value); - fprintf(stderr, "list-format = \'%s\'\n", options->list_format); } /* status format string */ else if( !strcasecmp(CONF_STATUS_FORMAT, name) ) { g_free(options->status_format); options->status_format = get_format(value); - fprintf(stderr, "status-format = \'%s\'\n", options->status_format); + } + else if( !strcasecmp(CONF_LIST_WRAP, name) ) + { + options->list_wrap = str2bool(value); + } + else if( !strcasecmp(CONF_FIND_WRAP, name) ) + { + options->find_wrap = str2bool(value); + } + else if( !strcasecmp(CONF_AUDIBLE_BELL, name) ) + { + options->audible_bell = str2bool(value); + } + else if( !strcasecmp(CONF_VISIBLE_BELL, name) ) + { + options->visible_bell = str2bool(value); + } + else if( !strcasecmp(CONF_XTERM_TITLE, name) ) + { + options->enable_xterm_title = str2bool(value); } else { diff --git a/src/options.c b/src/options.c index 952f436..e958e4b 100644 --- a/src/options.c +++ b/src/options.c @@ -176,11 +176,10 @@ options_init( void ) options.list_format = NULL; options.status_format = NULL; - options.reconnect = 1; - options.find_wrap = 1; - options.wide_cursor = 1; - options.enable_beep = 1; - + options.reconnect = TRUE; + options.find_wrap = TRUE; + options.wide_cursor = TRUE; + options.audible_bell = TRUE; return &options; } diff --git a/src/options.h b/src/options.h index 4ca1a45..0034cec 100644 --- a/src/options.h +++ b/src/options.h @@ -12,13 +12,16 @@ typedef struct char *list_format; char *status_format; int port; - int reconnect; - int debug; - int find_wrap; - int auto_center; - int wide_cursor; - int enable_colors; - int enable_beep; + gboolean reconnect; + gboolean debug; + gboolean find_wrap; + gboolean list_wrap; + gboolean auto_center; + gboolean wide_cursor; + gboolean enable_colors; + gboolean audible_bell; /* not implemented */ + gboolean visible_bell; /* not implemented */ + gboolean enable_xterm_title; /* not implemented */ } options_t;