filename | src/config.h |
changeset | 464:8e099fad42a6 |
prev | 460:a0c865b74c63 |
next | 470:e09a16196693 |
author | nkeynes |
date | Sun Oct 28 07:23:46 2007 +0000 (16 years ago) |
permissions | -rw-r--r-- |
last change | Fix CDI with multiple tracks/session Fix file being closed too early |
view | annotate | diff | log | raw |
1 /**
2 * $Id: config.h,v 1.4 2007-10-27 05:44:53 nkeynes Exp $
3 *
4 * User configuration support
5 *
6 * Copyright (c) 2005 Nathan Keynes.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
19 #ifndef lxdream_config_H
20 #define lxdream_config_H 1
22 #include <glib/gtypes.h>
24 #define CONFIG_TYPE_NONE 0
25 #define CONFIG_TYPE_FILE 1
26 #define CONFIG_TYPE_PATH 2
27 #define CONFIG_TYPE_KEY 3
29 #define DEFAULT_CONFIG_FILENAME "lxdreamrc"
31 typedef struct lxdream_config_entry {
32 const gchar *key;
33 const int type;
34 const gchar *default_value;
35 gchar *value;
36 } *lxdream_config_entry_t;
38 typedef struct lxdream_config_group {
39 const gchar *key;
40 struct lxdream_config_entry *params;
41 } *lxdream_config_group_t;
43 #define CONFIG_BIOS_PATH 0
44 #define CONFIG_FLASH_PATH 1
45 #define CONFIG_DEFAULT_PATH 2
46 #define CONFIG_SAVE_PATH 3
47 #define CONFIG_BOOTSTRAP 4
48 #define CONFIG_GDROM 5
50 extern struct lxdream_config_group lxdream_config_root[];
52 /* Global config values */
53 const gchar *lxdream_get_config_value( int key );
55 void lxdream_set_global_config_value( int key, const gchar *value );
56 void lxdream_set_config_value( lxdream_config_entry_t entry, const gchar *value );
57 gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value );
58 void lxdream_copy_config_list( lxdream_config_entry_t dest, lxdream_config_entry_t src );
60 /**
61 * Search the standard locations for the configuration file:
62 * $HOME/.lxdreamrc
63 * $CWD/lxdreamrc
64 * $SYSCONF_DIR/lxdreamrc
65 * @return TRUE if the file was found, otherwise FALSE.
66 */
67 gboolean lxdream_find_config( );
69 /**
70 * Set the configuration file filename to the supplied string.
71 * The string is copied internally (ie can be released by the
72 * caller).
73 */
74 void lxdream_set_config_filename( const gchar *filename );
76 /**
77 * Load the configuration from the previously determined filename.
78 */
79 gboolean lxdream_load_config( );
81 /**
82 * Update the configuration
83 */
84 gboolean lxdream_save_config( );
87 #endif /* !lxdream_config_H */
.