summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2006-12-19 19:10:50 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2006-12-19 19:10:50 +0000
commitace000d3a03181607b130c28da69652f5f60f7d6 (patch)
treefe32ae3c47913ec693e0c1cfbe18b71d7ad9223b /src/xine-engine
parentb69b939bc672c639696bd1862808ade41e9aedbc (diff)
downloadxine-lib-ace000d3a03181607b130c28da69652f5f60f7d6.tar.gz
xine-lib-ace000d3a03181607b130c28da69652f5f60f7d6.tar.bz2
Mark string-type configuration items according to whether they're plain
strings or names of files, device nodes or directories. This information is available to front ends (via .num_value) so that they can present file/dir-open dialogue boxes if they so choose. Subtitle font selection is split up due to this. CVS patchset: 8425 CVS date: 2006/12/19 19:10:50
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/configfile.c51
-rw-r--r--src/xine-engine/configfile.h12
-rw-r--r--src/xine-engine/xine.c6
-rw-r--r--src/xine-engine/xine_interface.c18
4 files changed, 71 insertions, 16 deletions
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index 21ebfd5be..5d552f8f1 100644
--- a/src/xine-engine/configfile.c
+++ b/src/xine-engine/configfile.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: configfile.c,v 1.81 2006/09/26 21:51:11 dgp85 Exp $
+ * $Id: configfile.c,v 1.82 2006/12/19 19:10:52 dsalt Exp $
*
* config object (was: file) management - implementation
*
@@ -491,14 +491,15 @@ static cfg_entry_t *config_register_key (config_values_t *this,
return entry;
}
-static char *config_register_string (config_values_t *this,
- const char *key,
- const char *def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static cfg_entry_t *config_register_string_internal (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ int num_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry;
_x_assert(this);
@@ -512,7 +513,7 @@ static char *config_register_string (config_values_t *this,
if (entry->type != XINE_CONFIG_TYPE_UNKNOWN) {
lprintf("config entry already registered: %s\n", key);
pthread_mutex_unlock(&this->config_lock);
- return entry->str_value;
+ return entry;
}
config_reset_value(entry);
@@ -525,13 +526,40 @@ static char *config_register_string (config_values_t *this,
else
entry->str_value = strdup(def_value);
+ entry->num_value = num_value;
+
/* fill out rest of struct */
entry->str_default = strdup(def_value);
entry->description = (description) ? strdup(description) : NULL;
entry->help = (help) ? strdup(help) : NULL;
pthread_mutex_unlock(&this->config_lock);
- return entry->str_value;
+ return entry;
+}
+
+static char *config_register_string (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
+ return config_register_string_internal (this, key, def_value, 0, description,
+ help, exp_level, changed_cb, cb_data)->str_value;
+}
+
+static char *config_register_filename (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ int req_type,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
+ return config_register_string_internal (this, key, def_value, req_type, description,
+ help, exp_level, changed_cb, cb_data)->str_value;
}
static int config_register_num (config_values_t *this,
@@ -1184,6 +1212,7 @@ config_values_t *_x_config_init (void) {
pthread_mutex_init(&this->config_lock, &attr);
this->register_string = config_register_string;
+ this->register_filename = config_register_filename;
this->register_range = config_register_range;
this->register_enum = config_register_enum;
this->register_num = config_register_num;
diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h
index 2a98be9f1..29413610c 100644
--- a/src/xine-engine/configfile.h
+++ b/src/xine-engine/configfile.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: configfile.h,v 1.38 2006/09/26 05:19:48 dgp85 Exp $
+ * $Id: configfile.h,v 1.39 2006/12/19 19:10:52 dsalt Exp $
*
* config file management
*
@@ -108,6 +108,16 @@ struct config_values_s {
xine_config_cb_t changed_cb,
void *cb_data);
+ char* (*register_filename) (config_values_t *self,
+ const char *key,
+ const char *def_value,
+ int req_type,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
int (*register_range) (config_values_t *self,
const char *key,
int def_value,
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 07d9455e1..63afc86d3 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.338 2006/12/19 14:10:35 klan Exp $
+ * $Id: xine.c,v 1.339 2006/12/19 19:10:52 dsalt Exp $
*/
/*
@@ -1579,9 +1579,9 @@ void xine_init (xine_t *this) {
/*
* save directory
*/
- this->save_path = this->config->register_string (
+ this->save_path = this->config->register_filename (
this->config,
- "media.capture.save_dir", "",
+ "media.capture.save_dir", "", XINE_CONFIG_STRING_IS_DIRECTORY_NAME,
_("directory for saving streams"),
_("When using the stream save feature, files will be written only into this directory.\n"
"This setting is security critical, because when changed to a different directory, xine "
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index d0dc0e4a5..7e7527de7 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_interface.c,v 1.99 2006/10/16 06:29:38 dgp85 Exp $
+ * $Id: xine_interface.c,v 1.100 2006/12/19 19:10:52 dsalt Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -100,7 +100,23 @@ const char* xine_config_register_string (xine_t *self,
cb_data);
}
+
+const char* xine_config_register_filename (xine_t *self,
+ const char *key,
+ const char *def_value,
+ int req_type,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
+ return self->config->register_filename (self->config,
+ key, def_value, req_type,
+ description, help, exp_level,
+ changed_cb, cb_data);
+}
+
int xine_config_register_range (xine_t *self,
const char *key,
int def_value,