elementary/genlist, gengrid - reverted item_class version checking.
The version field is not for preventing ABI break but just for checking allocator (to not free the item class created by user) SVN revision: 68670
This commit is contained in:
parent
e083aa2095
commit
b5c7288f05
|
@ -9,12 +9,14 @@ typedef Eina_Bool (*Elm_Gen_Item_State_Get_Cb)(void *data, E
|
||||||
typedef void (*Elm_Gen_Item_Del_Cb)(void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */
|
typedef void (*Elm_Gen_Item_Del_Cb)(void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */
|
||||||
struct _Elm_Gen_Item_Class
|
struct _Elm_Gen_Item_Class
|
||||||
{
|
{
|
||||||
|
//XXX: version name is not intuitive.
|
||||||
|
//How about Eina_Bool allocated_by_gen : 1 ?
|
||||||
int version;
|
int version;
|
||||||
unsigned int refcount;
|
unsigned int refcount;
|
||||||
|
Eina_Bool delete_me : 1;
|
||||||
const char *item_style;
|
const char *item_style;
|
||||||
const char *mode_item_style;
|
const char *mode_item_style;
|
||||||
const char *edit_item_style;
|
const char *edit_item_style;
|
||||||
Eina_Bool delete_me : 1;
|
|
||||||
struct _Elm_Gen_Item_Class_Func
|
struct _Elm_Gen_Item_Class_Func
|
||||||
{
|
{
|
||||||
Elm_Gen_Item_Text_Get_Cb text_get;
|
Elm_Gen_Item_Text_Get_Cb text_get;
|
||||||
|
|
|
@ -21,23 +21,6 @@
|
||||||
(it)->unsel_cb = (Ecore_Cb)_item_unselect; \
|
(it)->unsel_cb = (Ecore_Cb)_item_unselect; \
|
||||||
(it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
|
(it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
|
||||||
|
|
||||||
#define ELM_GENGRID_CHECK_ITC_VER(itc) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
if (!itc) \
|
|
||||||
{ \
|
|
||||||
ERR("Gengrid_Item_Class(itc) is NULL"); \
|
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
if (itc->version != ELM_GENGRID_ITEM_CLASS_VERSION) \
|
|
||||||
{ \
|
|
||||||
ERR("Gengrid_Item_Class version mismatched! required = (%d), current = (%d)", itc->version, ELM_GENGRID_ITEM_CLASS_VERSION); \
|
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
while(0)
|
|
||||||
|
|
||||||
|
|
||||||
struct Elm_Gen_Item_Type
|
struct Elm_Gen_Item_Type
|
||||||
{
|
{
|
||||||
Elm_Gen_Item *it;
|
Elm_Gen_Item *it;
|
||||||
|
@ -2797,7 +2780,8 @@ elm_gengrid_item_class_new(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
|
elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
|
||||||
{
|
{
|
||||||
ELM_GENGRID_CHECK_ITC_VER(itc);
|
if (itc && (itc->version == ELM_GENGRID_ITEM_CLASS_VERSION))
|
||||||
|
{
|
||||||
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
||||||
if (itc->refcount > 0) elm_gengrid_item_class_unref(itc);
|
if (itc->refcount > 0) elm_gengrid_item_class_unref(itc);
|
||||||
else
|
else
|
||||||
|
@ -2806,23 +2790,26 @@ elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
|
||||||
free(itc);
|
free(itc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
|
elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
|
||||||
{
|
{
|
||||||
ELM_GENGRID_CHECK_ITC_VER(itc);
|
if (itc && (itc->version == ELM_GENGRID_ITEM_CLASS_VERSION))
|
||||||
|
{
|
||||||
itc->refcount++;
|
itc->refcount++;
|
||||||
if (itc->refcount == 0) itc->refcount--;
|
if (itc->refcount == 0) itc->refcount--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
|
elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
|
||||||
{
|
{
|
||||||
ELM_GENGRID_CHECK_ITC_VER(itc);
|
if (itc && (itc->version == ELM_GENGRID_ITEM_CLASS_VERSION))
|
||||||
|
{
|
||||||
if (itc->refcount > 0) itc->refcount--;
|
if (itc->refcount > 0) itc->refcount--;
|
||||||
if (itc->delete_me && (!itc->refcount))
|
if (itc->delete_me && (!itc->refcount))
|
||||||
elm_gengrid_item_class_free(itc);
|
elm_gengrid_item_class_free(itc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -5620,7 +5620,8 @@ elm_genlist_item_class_new(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
|
elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
|
||||||
{
|
{
|
||||||
ELM_GENLIST_CHECK_ITC_VER(itc);
|
if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
|
||||||
|
{
|
||||||
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
||||||
if (itc->refcount > 0) elm_genlist_item_class_unref(itc);
|
if (itc->refcount > 0) elm_genlist_item_class_unref(itc);
|
||||||
else
|
else
|
||||||
|
@ -5629,25 +5630,28 @@ elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
|
||||||
free(itc);
|
free(itc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
|
elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
|
||||||
{
|
{
|
||||||
ELM_GENLIST_CHECK_ITC_VER(itc);
|
if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
|
||||||
|
{
|
||||||
itc->refcount++;
|
itc->refcount++;
|
||||||
if (itc->refcount == 0) itc->refcount--;
|
if (itc->refcount == 0) itc->refcount--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
|
elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
|
||||||
{
|
{
|
||||||
ELM_GENLIST_CHECK_ITC_VER(itc);
|
if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
|
||||||
|
{
|
||||||
if (itc->refcount > 0) itc->refcount--;
|
if (itc->refcount > 0) itc->refcount--;
|
||||||
if (itc->delete_me && (!itc->refcount))
|
if (itc->delete_me && (!itc->refcount))
|
||||||
elm_genlist_item_class_free(itc);
|
elm_genlist_item_class_free(itc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* for gengrid as of now */
|
/* for gengrid as of now */
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue