aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/conf.h48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/conf.h b/src/conf.h
index 8a0678312..815c739b1 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2010 The Music Player Daemon Project
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -72,6 +72,9 @@
#define CONF_PLAYLIST_PLUGIN "playlist_plugin"
#define CONF_AUTO_UPDATE "auto_update"
#define CONF_AUTO_UPDATE_DEPTH "auto_update_depth"
+#define CONF_DESPOTIFY_USER "despotify_user"
+#define CONF_DESPOTIFY_PASSWORD "despotify_password"
+#define CONF_DESPOTIFY_HIGH_BITRATE "despotify_high_bitrate"
#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
@@ -108,6 +111,7 @@ struct config_param {
* A GQuark for GError instances, resulting from malformed
* configuration.
*/
+G_GNUC_CONST
static inline GQuark
config_quark(void)
{
@@ -129,11 +133,11 @@ config_read_file(const char *file, GError **error_r);
/* don't free the returned value
set _last_ to NULL to get first entry */
G_GNUC_PURE
-struct config_param *
+const struct config_param *
config_get_next_param(const char *name, const struct config_param *last);
G_GNUC_PURE
-static inline struct config_param *
+static inline const struct config_param *
config_get_param(const char *name)
{
return config_get_next_param(name, NULL);
@@ -152,17 +156,15 @@ config_get_string(const char *name, const char *default_value);
/**
* Returns an optional configuration variable which contains an
- * absolute path. If there is a tilde prefix, it is expanded. Aborts
- * MPD if the path is not a valid absolute path.
+ * absolute path. If there is a tilde prefix, it is expanded.
+ * Returns NULL if the value is not present. If the path could not be
+ * parsed, returns NULL and sets the error.
+ *
+ * The return value must be freed with g_free().
*/
-/* We lie here really. This function is not pure as it has side
- effects -- it parse the value and creates new string freeing
- previous one. However, because this works the very same way each
- time (ie. from the outside it appears as if function had no side
- effects) we should be in the clear declaring it pure. */
-G_GNUC_PURE
-const char *
-config_get_path(const char *name);
+G_GNUC_MALLOC
+char *
+config_dup_path(const char *name, GError **error_r);
G_GNUC_PURE
unsigned
@@ -173,7 +175,7 @@ unsigned
config_get_positive(const char *name, unsigned default_value);
G_GNUC_PURE
-struct block_param *
+const struct block_param *
config_get_block_param(const struct config_param *param, const char *name);
G_GNUC_PURE
@@ -184,6 +186,7 @@ const char *
config_get_block_string(const struct config_param *param, const char *name,
const char *default_value);
+G_GNUC_MALLOC
static inline char *
config_dup_block_string(const struct config_param *param, const char *name,
const char *default_value)
@@ -191,6 +194,15 @@ config_dup_block_string(const struct config_param *param, const char *name,
return g_strdup(config_get_block_string(param, name, default_value));
}
+/**
+ * Same as config_dup_path(), but looks up the setting in the
+ * specified block.
+ */
+G_GNUC_MALLOC
+char *
+config_dup_block_path(const struct config_param *param, const char *name,
+ GError **error_r);
+
G_GNUC_PURE
unsigned
config_get_block_unsigned(const struct config_param *param, const char *name,
@@ -201,11 +213,15 @@ bool
config_get_block_bool(const struct config_param *param, const char *name,
bool default_value);
+G_GNUC_MALLOC
struct config_param *
config_new_param(const char *value, int line);
-bool
+void
+config_param_free(struct config_param *param);
+
+void
config_add_block_param(struct config_param * param, const char *name,
- const char *value, int line, GError **error_r);
+ const char *value, int line);
#endif