filename | src/config.h |
changeset | 759:f16975739abc |
prev | 755:ab873907b00e |
next | 1024:c67f2d61ab97 |
author | nkeynes |
date | Fri Oct 31 03:27:43 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Enable sse-math for all platforms |
file | annotate | diff | log | raw |
nkeynes@450 | 1 | /** |
nkeynes@561 | 2 | * $Id$ |
nkeynes@450 | 3 | * |
nkeynes@450 | 4 | * User configuration support |
nkeynes@450 | 5 | * |
nkeynes@450 | 6 | * Copyright (c) 2005 Nathan Keynes. |
nkeynes@450 | 7 | * |
nkeynes@450 | 8 | * This program is free software; you can redistribute it and/or modify |
nkeynes@450 | 9 | * it under the terms of the GNU General Public License as published by |
nkeynes@450 | 10 | * the Free Software Foundation; either version 2 of the License, or |
nkeynes@450 | 11 | * (at your option) any later version. |
nkeynes@450 | 12 | * |
nkeynes@450 | 13 | * This program is distributed in the hope that it will be useful, |
nkeynes@450 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
nkeynes@450 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
nkeynes@450 | 16 | * GNU General Public License for more details. |
nkeynes@450 | 17 | */ |
nkeynes@450 | 18 | |
nkeynes@450 | 19 | #ifndef lxdream_config_H |
nkeynes@450 | 20 | #define lxdream_config_H 1 |
nkeynes@450 | 21 | |
nkeynes@450 | 22 | #include <glib/gtypes.h> |
nkeynes@755 | 23 | #include "gettext.h" |
nkeynes@450 | 24 | |
nkeynes@736 | 25 | #ifdef __cplusplus |
nkeynes@736 | 26 | extern "C" { |
nkeynes@736 | 27 | #endif |
nkeynes@736 | 28 | |
nkeynes@450 | 29 | #define CONFIG_TYPE_NONE 0 |
nkeynes@450 | 30 | #define CONFIG_TYPE_FILE 1 |
nkeynes@450 | 31 | #define CONFIG_TYPE_PATH 2 |
nkeynes@450 | 32 | #define CONFIG_TYPE_KEY 3 |
nkeynes@450 | 33 | |
nkeynes@450 | 34 | #define DEFAULT_CONFIG_FILENAME "lxdreamrc" |
nkeynes@450 | 35 | |
nkeynes@450 | 36 | typedef struct lxdream_config_entry { |
nkeynes@450 | 37 | const gchar *key; |
nkeynes@724 | 38 | const gchar *label; // i18n |
nkeynes@450 | 39 | const int type; |
nkeynes@450 | 40 | const gchar *default_value; |
nkeynes@450 | 41 | gchar *value; |
nkeynes@450 | 42 | } *lxdream_config_entry_t; |
nkeynes@450 | 43 | |
nkeynes@450 | 44 | typedef struct lxdream_config_group { |
nkeynes@450 | 45 | const gchar *key; |
nkeynes@450 | 46 | struct lxdream_config_entry *params; |
nkeynes@450 | 47 | } *lxdream_config_group_t; |
nkeynes@450 | 48 | |
nkeynes@450 | 49 | #define CONFIG_BIOS_PATH 0 |
nkeynes@450 | 50 | #define CONFIG_FLASH_PATH 1 |
nkeynes@450 | 51 | #define CONFIG_DEFAULT_PATH 2 |
nkeynes@450 | 52 | #define CONFIG_SAVE_PATH 3 |
nkeynes@450 | 53 | #define CONFIG_BOOTSTRAP 4 |
nkeynes@464 | 54 | #define CONFIG_GDROM 5 |
nkeynes@470 | 55 | #define CONFIG_RECENT 6 |
nkeynes@724 | 56 | #define CONFIG_KEY_MAX CONFIG_RECENT |
nkeynes@450 | 57 | |
nkeynes@450 | 58 | extern struct lxdream_config_group lxdream_config_root[]; |
nkeynes@450 | 59 | |
nkeynes@450 | 60 | /* Global config values */ |
nkeynes@450 | 61 | const gchar *lxdream_get_config_value( int key ); |
nkeynes@759 | 62 | const struct lxdream_config_entry * lxdream_get_config_entry( int key ); |
nkeynes@450 | 63 | |
nkeynes@460 | 64 | void lxdream_set_global_config_value( int key, const gchar *value ); |
nkeynes@460 | 65 | void lxdream_set_config_value( lxdream_config_entry_t entry, const gchar *value ); |
nkeynes@458 | 66 | gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value ); |
nkeynes@460 | 67 | void lxdream_copy_config_list( lxdream_config_entry_t dest, lxdream_config_entry_t src ); |
nkeynes@460 | 68 | |
nkeynes@450 | 69 | /** |
nkeynes@450 | 70 | * Search the standard locations for the configuration file: |
nkeynes@450 | 71 | * $HOME/.lxdreamrc |
nkeynes@450 | 72 | * $CWD/lxdreamrc |
nkeynes@450 | 73 | * $SYSCONF_DIR/lxdreamrc |
nkeynes@450 | 74 | * @return TRUE if the file was found, otherwise FALSE. |
nkeynes@450 | 75 | */ |
nkeynes@450 | 76 | gboolean lxdream_find_config( ); |
nkeynes@450 | 77 | |
nkeynes@450 | 78 | /** |
nkeynes@450 | 79 | * Set the configuration file filename to the supplied string. |
nkeynes@450 | 80 | * The string is copied internally (ie can be released by the |
nkeynes@450 | 81 | * caller). |
nkeynes@450 | 82 | */ |
nkeynes@450 | 83 | void lxdream_set_config_filename( const gchar *filename ); |
nkeynes@450 | 84 | |
nkeynes@450 | 85 | /** |
nkeynes@450 | 86 | * Load the configuration from the previously determined filename. |
nkeynes@450 | 87 | */ |
nkeynes@450 | 88 | gboolean lxdream_load_config( ); |
nkeynes@450 | 89 | |
nkeynes@450 | 90 | /** |
nkeynes@450 | 91 | * Update the configuration |
nkeynes@450 | 92 | */ |
nkeynes@450 | 93 | gboolean lxdream_save_config( ); |
nkeynes@450 | 94 | |
nkeynes@736 | 95 | #ifdef __cplusplus |
nkeynes@736 | 96 | } |
nkeynes@736 | 97 | #endif |
nkeynes@450 | 98 | |
nkeynes@450 | 99 | #endif /* !lxdream_config_H */ |
.