Search
lxdream.org :: lxdream/src/config.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/config.h
changeset 450:207461e79f21
next458:cbb2dd12daeb
author nkeynes
date Wed Oct 17 11:26:45 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Split config management out to config.[ch]
Manage config filename
Check home dir + sysconfdir for conf file
Initial work on a path settings dialog
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/config.h Wed Oct 17 11:26:45 2007 +0000
1.3 @@ -0,0 +1,83 @@
1.4 +/**
1.5 + * $Id: config.h,v 1.1 2007-10-17 11:26:45 nkeynes Exp $
1.6 + *
1.7 + * User configuration support
1.8 + *
1.9 + * Copyright (c) 2005 Nathan Keynes.
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.20 + */
1.21 +
1.22 +#ifndef lxdream_config_H
1.23 +#define lxdream_config_H 1
1.24 +
1.25 +#include <glib/gtypes.h>
1.26 +
1.27 +#define CONFIG_TYPE_NONE 0
1.28 +#define CONFIG_TYPE_FILE 1
1.29 +#define CONFIG_TYPE_PATH 2
1.30 +#define CONFIG_TYPE_KEY 3
1.31 +
1.32 +#define DEFAULT_CONFIG_FILENAME "lxdreamrc"
1.33 +
1.34 +typedef struct lxdream_config_entry {
1.35 + const gchar *key;
1.36 + const int type;
1.37 + const gchar *default_value;
1.38 + gchar *value;
1.39 +} *lxdream_config_entry_t;
1.40 +
1.41 +typedef struct lxdream_config_group {
1.42 + const gchar *key;
1.43 + struct lxdream_config_entry *params;
1.44 +} *lxdream_config_group_t;
1.45 +
1.46 +#define CONFIG_BIOS_PATH 0
1.47 +#define CONFIG_FLASH_PATH 1
1.48 +#define CONFIG_DEFAULT_PATH 2
1.49 +#define CONFIG_SAVE_PATH 3
1.50 +#define CONFIG_BOOTSTRAP 4
1.51 +
1.52 +extern struct lxdream_config_group lxdream_config_root[];
1.53 +
1.54 +/* Global config values */
1.55 +const gchar *lxdream_get_config_value( int key );
1.56 +
1.57 +void lxdream_set_config_value( int key, const gchar *value );
1.58 +
1.59 +/**
1.60 + * Search the standard locations for the configuration file:
1.61 + * $HOME/.lxdreamrc
1.62 + * $CWD/lxdreamrc
1.63 + * $SYSCONF_DIR/lxdreamrc
1.64 + * @return TRUE if the file was found, otherwise FALSE.
1.65 + */
1.66 +gboolean lxdream_find_config( );
1.67 +
1.68 +/**
1.69 + * Set the configuration file filename to the supplied string.
1.70 + * The string is copied internally (ie can be released by the
1.71 + * caller).
1.72 + */
1.73 +void lxdream_set_config_filename( const gchar *filename );
1.74 +
1.75 +/**
1.76 + * Load the configuration from the previously determined filename.
1.77 + */
1.78 +gboolean lxdream_load_config( );
1.79 +
1.80 +/**
1.81 + * Update the configuration
1.82 + */
1.83 +gboolean lxdream_save_config( );
1.84 +
1.85 +
1.86 +#endif /* !lxdream_config_H */
.