use version as an actual version and bring back macros for setting up
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 6 Mar 2012 05:02:36 +0000 (05:02 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 6 Mar 2012 05:02:36 +0000 (05:02 +0000)
class header for those using const item class structs.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68770 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_gengrid.c
src/lib/elm_gengrid.h
src/lib/elm_genlist.c
src/lib/elm_genlist.h

index 956104d..4b020a0 100644 (file)
@@ -4,6 +4,9 @@
 #include "els_scroller.h"
 #include "elm_gen_common.h"
 
+// internally allocated
+#define CLASS_ALLOCATED 0x3a70f00f
+
 /* --
  * TODO:
  * Handle non-homogeneous objects too.
@@ -2770,7 +2773,7 @@ elm_gengrid_item_class_new(void)
    itc = calloc(1, sizeof(Elm_Gengrid_Item_Class));
    if (!itc)
      return NULL;
-   itc->version = ELM_GENGRID_ITEM_CLASS_VERSION;
+   itc->version = CLASS_ALLOCATED;
    itc->refcount = 1;
    itc->delete_me = EINA_FALSE;
 
@@ -2780,7 +2783,7 @@ elm_gengrid_item_class_new(void)
 EAPI void
 elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
 {
-   if (itc && (itc->version == ELM_GENGRID_ITEM_CLASS_VERSION))
+   if (itc && (itc->version == CLASS_ALLOCATED))
      {
         if (!itc->delete_me) itc->delete_me = EINA_TRUE;
         if (itc->refcount > 0) elm_gengrid_item_class_unref(itc);
@@ -2795,7 +2798,7 @@ elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
 EAPI void
 elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
 {
-   if (itc && (itc->version == ELM_GENGRID_ITEM_CLASS_VERSION))
+   if (itc && (itc->version == CLASS_ALLOCATED))
      {
         itc->refcount++;
         if (itc->refcount == 0) itc->refcount--;
@@ -2805,7 +2808,7 @@ elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
 EAPI void
 elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
 {
-   if (itc && (itc->version == ELM_GENGRID_ITEM_CLASS_VERSION))
+   if (itc && (itc->version == CLASS_ALLOCATED))
      {
         if (itc->refcount > 0) itc->refcount--;
         if (itc->delete_me && (!itc->refcount))
index bb454f9..c41add9 100644 (file)
@@ -838,6 +838,7 @@ EAPI const Elm_Gengrid_Item_Class *elm_gengrid_item_item_class_get(const Elm_Obj
 //EAPI unsigned int elm_gengrid_items_count(const Evas_Object *obj);
 
 #define ELM_GENGRID_ITEM_CLASS_VERSION 2 /* current version number */
+#define ELM_GENGRID_ITEM_CLASS_HEADER ELM_GENGRID_ITEM_CLASS_VERSION, 0, 0
 
 /**
  * Add a new gengrid item class in a given gengrid widget.
index 29b9f48..fb6acae 100644 (file)
@@ -6,6 +6,9 @@
 #include "els_scroller.h"
 #include "elm_gen_common.h"
 
+// internally allocated
+#define CLASS_ALLOCATED 0x3a70f11f
+
 #define MAX_ITEMS_PER_BLOCK 32
 #define REORDER_EFFECT_TIME 0.5
 
              ERR("Genlist_Item_Class(itc) is NULL"); \
              return; \
           } \
-        if (itc->version != ELM_GENLIST_ITEM_CLASS_VERSION) \
+        if ((itc->version != ELM_GENLIST_ITEM_CLASS_VERSION) && \
+            (itc->version != CLASS_ALLOCATED)) \
           { \
-             ERR("Genlist_Item_Class version mismatched! required = (%d), current  = (%d)", itc->version, ELM_GENLIST_ITEM_CLASS_VERSION); \
+             ERR("Genlist_Item_Class version mismatched! current = (%d), required = (%d) or (%d)", itc->version, ELM_GENLIST_ITEM_CLASS_VERSION, CLASS_ALLOCATED); \
              return; \
           } \
      } \
@@ -5666,7 +5670,7 @@ elm_genlist_item_class_new(void)
    itc = calloc(1, sizeof(Elm_Genlist_Item_Class));
    if (!itc)
      return NULL;
-   itc->version = ELM_GENLIST_ITEM_CLASS_VERSION;
+   itc->version = CLASS_ALLOCATED;
    itc->refcount = 1;
    itc->delete_me = EINA_FALSE;
 
@@ -5676,7 +5680,7 @@ elm_genlist_item_class_new(void)
 EAPI void
 elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
 {
-   if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
+   if (itc && (itc->version == CLASS_ALLOCATED))
      {
         if (!itc->delete_me) itc->delete_me = EINA_TRUE;
         if (itc->refcount > 0) elm_genlist_item_class_unref(itc);
@@ -5691,7 +5695,7 @@ elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
 EAPI void
 elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
 {
-   if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
+   if (itc && (itc->version == CLASS_ALLOCATED))
      {
         itc->refcount++;
         if (itc->refcount == 0) itc->refcount--;
@@ -5701,7 +5705,7 @@ elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
 EAPI void
 elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
 {
-   if (itc && (itc->version == ELM_GENLIST_ITEM_CLASS_VERSION))
+   if (itc && (itc->version == CLASS_ALLOCATED))
      {
         if (itc->refcount > 0) itc->refcount--;
         if (itc->delete_me && (!itc->refcount))
index 35482ca..b9e5661 100644 (file)
@@ -1122,6 +1122,7 @@ EAPI void                          elm_genlist_realized_items_update(Evas_Object
 EAPI unsigned int elm_genlist_items_count(const Evas_Object *obj);
 
 #define ELM_GENLIST_ITEM_CLASS_VERSION 2 /* current version number */
+#define ELM_GENLIST_ITEM_CLASS_HEADER ELM_GENLIST_ITEM_CLASS_VERSION, 0, 0
 
 /**
  * Add a new genlist item class in a given genlist widget.