Code

Added options: audible-bell, visible-bell, wrap-around, find-wrap
authorKalle Wallin <kaw@linux.se>
Tue, 22 Jun 2004 13:25:22 +0000 (13:25 +0000)
committerKalle Wallin <kaw@linux.se>
Tue, 22 Jun 2004 13:25:22 +0000 (13:25 +0000)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1611 09075e82-0dd4-0310-85a5-a0d7c8717e4f

src/conf.c
src/options.c
src/options.h

index a40c90ad7a4354b5a4ad46dc4d4d4e1a45a804ee..343a8a4c547084c7cee4a057cfc6a1e1e4850092 100644 (file)
 #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
                {
index 952f436d541c07d5d5a6befd39207ae3cba9ae89..e958e4b957531a96cfcc2c39161b84d8569fc6b5 100644 (file)
@@ -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;
 }
index 4ca1a4561bbb37b06575bc38f63bf6b9df4ba492..0034cecb5d3a2be0b96f8c91e7de1de14c9117c4 100644 (file)
@@ -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;