forked from enlightenment/enlightenment
e17: add macro to get gacon client config item by id, if id is NULL get a new id.
seems almost all modules got it wrong (those with uuid counter). when there are two gcc and gcc 1 is removed and e is restarted uuid counter will be 1, so when you add a new one it will get id of gcc 2 SVN revision: 63123
This commit is contained in:
parent
936aeb2651
commit
7b399e3b2c
|
@ -315,5 +315,29 @@ EAPI void e_gadcon_location_unregister (E_Gadcon_Location *loc);
|
|||
EAPI void e_gadcon_location_set_icon_name(E_Gadcon_Location *loc, const char *name);
|
||||
EAPI void e_gadcon_client_add_location_menu(E_Gadcon_Client *gcc, E_Menu *menu);
|
||||
|
||||
#define GADCON_CLIENT_CONFIG_GET(_type, _items, _gc_class, _id) \
|
||||
if (!_id) \
|
||||
{ \
|
||||
char buf[128]; \
|
||||
int num = 0; \
|
||||
_type *ci; \
|
||||
if (_items) \
|
||||
{ \
|
||||
const char *p; \
|
||||
ci = eina_list_last(_items)->data; \
|
||||
p = strrchr (ci->id, '.'); \
|
||||
if (p) num = atoi (p + 1) + 1; \
|
||||
} \
|
||||
snprintf (buf, sizeof (buf), "%s.%d", _gc_class.name, num); \
|
||||
_id = buf; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Eina_List *l; \
|
||||
_type *ci; \
|
||||
EINA_LIST_FOREACH(_items, l, ci) \
|
||||
if ((ci->id) && (!strcmp(ci->id, id))) return ci; \
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue