filename | src/config.h |
changeset | 1072:d82e04e6d497 |
prev | 1041:5fcc39857c5c |
next | 1144:00dd49743974 |
author | nkeynes |
date | Sat Sep 11 09:44:21 2010 +1000 (13 years ago) |
permissions | -rw-r--r-- |
last change | GTK: Comment out non-existent setting menu-items, to reduce potential confusion |
file | annotate | diff | log | raw |
1.1 --- a/src/config.h Fri Jun 26 05:47:04 2009 +00001.2 +++ b/src/config.h Sat Sep 11 09:44:21 2010 +10001.3 @@ -21,12 +21,15 @@1.5 #include <glib/gtypes.h>1.6 #include <glib/glist.h>1.7 +#include "lxdream.h"1.8 #include "gettext.h"1.10 #ifdef __cplusplus1.11 extern "C" {1.12 #endif1.14 +#define CONFIG_MAX_KEYS 241.15 +1.16 #define CONFIG_TYPE_NONE 01.17 #define CONFIG_TYPE_FILE 11.18 #define CONFIG_TYPE_PATH 21.19 @@ -39,14 +42,32 @@1.20 typedef struct lxdream_config_entry {1.21 const gchar *key;1.22 const gchar *label; // i18n1.23 - const int type;1.24 + int type;1.25 const gchar *default_value;1.26 + uint32_t tag;1.27 gchar *value;1.28 } *lxdream_config_entry_t;1.30 +struct lxdream_config_group;1.31 +1.32 +/**1.33 + * Callback invoked for key presses (key-up/key-down).1.34 + */1.35 +typedef void (*key_binding_t)( void *data, uint32_t value, uint32_t pressure, gboolean isKeyDown );1.36 +1.37 +/**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.40 + */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.43 +1.44 typedef struct lxdream_config_group {1.45 const gchar *key;1.46 - struct lxdream_config_entry *params;1.47 + config_change_callback_t on_change;1.48 + key_binding_t key_binding;1.49 + void *data;1.50 + struct lxdream_config_entry params[CONFIG_MAX_KEYS];1.51 } *lxdream_config_group_t;1.53 #define CONFIG_BIOS_PATH 01.54 @@ -61,17 +82,20 @@1.55 #define CONFIG_QUICK_STATE 91.56 #define CONFIG_KEY_MAX CONFIG_QUICK_STATE1.58 -extern struct lxdream_config_group lxdream_config_root[];1.59 +#define CONFIG_GROUP_GLOBAL 01.60 +#define CONFIG_GROUP_HOTKEYS 21.61 +#define CONFIG_GROUP_SERIAL 31.62 +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.79 /**1.80 * Return a fully expanded path value for a key - this performs substitutions
.