Search
lxdream.org :: lxdream/src/config.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/config.h
changeset 724:f2bc1c7cca14
prev561:533f6b478071
next736:a02d1475ccfd
author nkeynes
date Sun Jul 06 03:17:32 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change Add descriptive (localized) label to config entries for UI use
view annotate diff log raw
     1 /**
     2  * $Id$
     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>
    23 #include <glib/gi18n.h>
    25 #define CONFIG_TYPE_NONE 0
    26 #define CONFIG_TYPE_FILE 1
    27 #define CONFIG_TYPE_PATH 2
    28 #define CONFIG_TYPE_KEY 3
    30 #define DEFAULT_CONFIG_FILENAME "lxdreamrc"
    32 typedef struct lxdream_config_entry {
    33     const gchar *key;
    34     const gchar *label; // i18n 
    35     const int type;
    36     const gchar *default_value;
    37     gchar *value;
    38 } *lxdream_config_entry_t;
    40 typedef struct lxdream_config_group {
    41     const gchar *key;
    42     struct lxdream_config_entry *params;
    43 } *lxdream_config_group_t;
    45 #define CONFIG_BIOS_PATH 0
    46 #define CONFIG_FLASH_PATH 1
    47 #define CONFIG_DEFAULT_PATH 2
    48 #define CONFIG_SAVE_PATH 3
    49 #define CONFIG_BOOTSTRAP 4
    50 #define CONFIG_GDROM 5
    51 #define CONFIG_RECENT 6
    52 #define CONFIG_KEY_MAX CONFIG_RECENT
    54 extern struct lxdream_config_group lxdream_config_root[];
    56 /* Global config values */
    57 const gchar *lxdream_get_config_value( int key );
    58 const lxdream_config_entry_t lxdream_get_config_entry( int key );
    60 void lxdream_set_global_config_value( int key, const gchar *value );
    61 void lxdream_set_config_value( lxdream_config_entry_t entry, const gchar *value );
    62 gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value );
    63 void lxdream_copy_config_list( lxdream_config_entry_t dest, lxdream_config_entry_t src );
    65 /**
    66  * Search the standard locations for the configuration file:
    67  *   $HOME/.lxdreamrc
    68  *   $CWD/lxdreamrc
    69  *   $SYSCONF_DIR/lxdreamrc
    70  * @return TRUE if the file was found, otherwise FALSE.
    71  */
    72 gboolean lxdream_find_config( );
    74 /**
    75  * Set the configuration file filename to the supplied string.
    76  * The string is copied internally (ie can be released by the
    77  * caller).
    78  */
    79 void lxdream_set_config_filename( const gchar *filename );
    81 /**
    82  * Load the configuration from the previously determined filename.
    83  */
    84 gboolean lxdream_load_config( );
    86 /**
    87  * Update the configuration
    88  */
    89 gboolean lxdream_save_config( );
    92 #endif /* !lxdream_config_H */
.