track config edds, add e_config_descriptor_find() for retrieving them

SVN revision: 83550
This commit is contained in:
Mike Blumenkrantz 2013-02-01 11:31:59 +00:00
parent 226ec15f2d
commit 813496a865
4 changed files with 30 additions and 2 deletions

View File

@ -2,6 +2,7 @@
* split out binding configs into separate config domain
* added functions for freeing binding config structs
* E_Config_DD structs are now tracked and retrievable through e_config_descriptor_find
2013-01-31 Mike Blumenkrantz

1
NEWS
View File

@ -21,6 +21,7 @@ Additions:
* Added API for fetching module .desktop files
* e_config_xkb functions
* added functions for freeing binding config structs
* E_Config_DD structs are now tracked and retrievable through e_config_descriptor_find
Config:
* Added option for disabling icons in menus
* Added option for disabling pointer warping when performing directional focus changes using winlist

View File

@ -1,9 +1,23 @@
#include "e.h"
static Eina_Hash *config_hash = NULL;
EAPI void
e_config_descriptor_free(E_Config_DD *edd)
{
#if (EET_VERSION_MAJOR > 1) || (EET_VERSION_MINOR >= 8)
eina_hash_del_by_key(config_hash, eet_data_descriptor_name_get((Eet_Data_Descriptor*)edd));
#else
eina_hash_del_by_data(config_hash, edd);
#endif
eet_data_descriptor_free((Eet_Data_Descriptor*)edd);
}
EAPI E_Config_DD *
e_config_descriptor_new(const char *name, int size)
{
Eet_Data_Descriptor_Class eddc;
E_Config_DD *edd;
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), name, size))
return NULL;
@ -12,6 +26,16 @@ e_config_descriptor_new(const char *name, int size)
But this need a break in all user of config every where in E.
*/
return (E_Config_DD *)eet_data_descriptor_stream_new(&eddc);
edd = (E_Config_DD *)eet_data_descriptor_stream_new(&eddc);
if (!config_hash) config_hash = eina_hash_string_superfast_new(NULL);
eina_hash_set(config_hash, name, edd);
return edd;
}
EAPI E_Config_DD *
e_config_descriptor_find(const char *name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
return eina_hash_find(config_hash, name);
}

View File

@ -12,7 +12,7 @@
* is used to free definition of a struct
* \eed eed the pointer created by \link #E_CONFIG_DD_NEW
*/
#define E_CONFIG_DD_FREE(eed) if (eed) { eet_data_descriptor_free((eed)); (eed) = NULL; }
#define E_CONFIG_DD_FREE(eed) if (eed) { e_config_descriptor_free((eed)); (eed) = NULL; }
#define E_CONFIG_VAL(edd, type, member, dtype) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
#define E_CONFIG_SUB(edd, type, member, eddtype) EET_DATA_DESCRIPTOR_ADD_SUB(edd, type, #member, member, eddtype)
@ -55,6 +55,8 @@ typedef Eet_Data_Descriptor E_Config_DD;
#define E_CONFIG_DATA_H
EAPI E_Config_DD *e_config_descriptor_new(const char *name, int size);
EAPI void e_config_descriptor_free(E_Config_DD *edd);
EAPI E_Config_DD *e_config_descriptor_find(const char *name);
#endif
#endif