1.1 --- a/src/config.h Fri Jun 26 05:47:04 2009 +0000
1.2 +++ b/src/config.h Mon Mar 15 22:10:24 2010 +1000
1.5 #include <glib/gtypes.h>
1.6 #include <glib/glist.h>
1.7 +#include "lxdream.h"
1.14 +#define CONFIG_MAX_KEYS 24
1.16 #define CONFIG_TYPE_NONE 0
1.17 #define CONFIG_TYPE_FILE 1
1.18 #define CONFIG_TYPE_PATH 2
1.20 typedef struct lxdream_config_entry {
1.22 const gchar *label; // i18n
1.25 const gchar *default_value;
1.28 } *lxdream_config_entry_t;
1.30 +struct lxdream_config_group;
1.33 + * Callback invoked for key presses (key-up/key-down).
1.35 +typedef void (*key_binding_t)( void *data, uint32_t value, uint32_t pressure, gboolean isKeyDown );
1.38 + * Callback invoked immediately before updating a configuration item.
1.39 + * @return FALSE to abort the change (ie invalid value), or TRUE to proceed normally.
1.41 +typedef gboolean (*config_change_callback_t)( void *data, struct lxdream_config_group *group, unsigned item,
1.42 + const gchar *oldval, const gchar *newval );
1.44 typedef struct lxdream_config_group {
1.46 - struct lxdream_config_entry *params;
1.47 + config_change_callback_t on_change;
1.48 + key_binding_t key_binding;
1.50 + struct lxdream_config_entry params[CONFIG_MAX_KEYS];
1.51 } *lxdream_config_group_t;
1.53 #define CONFIG_BIOS_PATH 0
1.55 #define CONFIG_QUICK_STATE 9
1.56 #define CONFIG_KEY_MAX CONFIG_QUICK_STATE
1.58 -extern struct lxdream_config_group lxdream_config_root[];
1.59 +#define CONFIG_GROUP_GLOBAL 0
1.60 +#define CONFIG_GROUP_HOTKEYS 2
1.61 +#define CONFIG_GROUP_SERIAL 3
1.64 /* Global config values */
1.65 const gchar *lxdream_get_global_config_value( int key );
1.66 -const struct lxdream_config_entry * lxdream_get_global_config_entry( int key );
1.67 +struct lxdream_config_group * lxdream_get_config_group( int group );
1.68 void lxdream_set_global_config_value( int key, const gchar *value );
1.70 -void lxdream_register_config_group( const gchar *key, lxdream_config_entry_t group );
1.71 -void lxdream_set_config_value( lxdream_config_entry_t entry, const gchar *value );
1.72 -gboolean lxdream_set_group_value( lxdream_config_group_t group, const gchar *key, const gchar *value );
1.73 -void lxdream_copy_config_list( lxdream_config_entry_t dest, lxdream_config_entry_t src );
1.74 +void lxdream_register_config_group( const gchar *key, lxdream_config_group_t group );
1.75 +gboolean lxdream_set_config_value( lxdream_config_group_t group, int key, const gchar *value );
1.76 +void lxdream_copy_config_group( lxdream_config_group_t dest, lxdream_config_group_t src );
1.77 +void lxdream_clone_config_group( lxdream_config_group_t dest, lxdream_config_group_t src );
1.80 * Return a fully expanded path value for a key - this performs substitutions