Changeset 723e611
- Timestamp:
- 2007-02-26T04:46:35Z (18 years ago)
- Branches:
- master
- Children:
- fa29d093
- Parents:
- b6423a09
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
set.c
rb6423a09 r723e611 92 92 return 0; 93 93 94 if( ( g_strcasecmp( s, "true" ) == 0 ) || ( g_strcasecmp( s, "yes" ) == 0 ) || ( g_strcasecmp( s, "on" ) == 0 ) )95 return 1;96 97 94 if( sscanf( s, "%d", &i ) != 1 ) 98 95 return 0; -
set.h
rb6423a09 r723e611 32 32 from setting invalid values, you can write an evaluator function for 33 33 every setting, which can check a new value and block it by returning 34 NULL, or replace it by returning a new value. See struct set.eval. */ 34 NULL, or replace it by returning a new value. See struct set.eval. 35 One thing that is really missing here is additional data for the 36 evaluator. This could be useful to add minimum and maximum values for 37 integers, for example. */ 35 38 36 39 typedef char *(*set_eval) ( struct set *set, char *value ); … … 46 49 notices a new value is exactly the same as 47 50 the default, value gets set to NULL. So when 48 you read a setting, don't forget about this! */ 51 you read a setting, don't forget about this! 52 In fact, you should only read values using 53 set_getstr/int(). */ 49 54 50 55 int flags; /* See account.h, for example. set.c doesn't use … … 68 73 G_MODULE_EXPORT char *set_getstr( set_t **head, char *key ); 69 74 70 /* Get an integer. Right now this also converts true/false/on/off/etc to 71 numbers, but this is for historical reasons, please use set_getbool() 72 for booleans instead. */ 75 /* Get an integer. In previous versions set_getint() was also used to read 76 boolean values, but this SHOULD be done with set_getbool() now! */ 73 77 G_MODULE_EXPORT int set_getint( set_t **head, char *key ); 74 78 G_MODULE_EXPORT int set_getbool( set_t **head, char *key );
Note: See TracChangeset
for help on using the changeset viewer.