elementary/genlist - deprecated elm_genlist_item_del()
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 27 Jan 2012 11:59:22 +0000 (11:59 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 27 Jan 2012 11:59:22 +0000 (11:59 +0000)
now let's use elm_object_item_del() API.

and deprecated elm_genlist_horizontal_get() APIS also.

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

src/bin/test_genlist.c
src/edje_externals/elm_genlist.c
src/examples/genlist_example_05.c
src/lib/elm_deprecated.h
src/lib/elm_genlist.c
src/lib/elm_genlist.h

index a10c361..d345289 100644 (file)
@@ -126,7 +126,7 @@ test_genlist(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
    evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
    // FIXME: This causes genlist to resize the horiz axis very slowly :(
    // Reenable this and resize the window horizontally, then try to resize it back
-   //elm_genlist_horizontal_mode_set(gl, ELM_LIST_LIMIT);
+   //elm_genlist_mode_set(gl, ELM_LIST_LIMIT);
    evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_box_pack_end(bx, gl);
@@ -273,7 +273,7 @@ my_gl_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
         printf("no item selected\n");
         return;
      }
-   elm_genlist_item_del(gli);
+   elm_object_item_del(gli);
 }
 
 static void
index 75fb908..0bbf0d9 100644 (file)
@@ -53,7 +53,7 @@ external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *
        Elm_List_Mode set = _list_horizontal_setting_get(p->horizontal);
 
        if (set != ELM_LIST_LAST)
-          elm_genlist_horizontal_set(obj, set);
+          elm_genlist_mode_set(obj, set);
      }
    if (p->multi_exists)
      elm_genlist_multi_select_set(obj, p->multi);
@@ -89,7 +89,7 @@ external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_E
             Elm_List_Mode set = _list_horizontal_setting_get(param->s);
 
             if (set == ELM_LIST_LAST) return EINA_FALSE;
-            elm_genlist_horizontal_set(obj, set);
+            elm_genlist_mode_set(obj, set);
             return EINA_TRUE;
          }
      }
@@ -167,7 +167,7 @@ external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_E
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
          {
-            Elm_List_Mode list_horizontal_set = elm_genlist_horizontal_get(obj);
+            Elm_List_Mode list_horizontal_set = elm_genlist_mode_get(obj);
 
             if (list_horizontal_set == ELM_LIST_LAST)
               return EINA_FALSE;
index 7cea992..04bc68a 100644 (file)
@@ -180,7 +180,7 @@ _add_child_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__
    // Changing leaf item to parent item
    if (change_item)
      {
-        elm_genlist_item_del(glit);
+        elm_object_item_del(glit);
 
         if (glit_prev != glit_parent)
           glit = elm_genlist_item_insert_after(list, &_itp, d, glit_parent,
@@ -226,7 +226,7 @@ _del_item_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
    Node_Data *pdata, *d = elm_object_item_data_get(glit);
    glit_parent = elm_genlist_item_parent_get(glit);
    elm_genlist_item_subitems_clear(glit);
-   elm_genlist_item_del(glit);
+   elm_object_item_del(glit);
 
    _clear_list(d);
 
index 9f0acf6..4e4e7ff 100644 (file)
@@ -1738,7 +1738,7 @@ EINA_DEPRECATED EAPI void                          elm_genlist_horizontal_set(Ev
  * @deprecated use elm_genlist_mode_get()
  * @ingroup Genlist
  */
-EAPI Elm_List_Mode                 elm_genlist_horizontal_get(const Evas_Object *obj);
+EINA_DEPRECATED EAPI Elm_List_Mode                 elm_genlist_horizontal_get(const Evas_Object *obj);
 
 /**
  * Return the data associated to a given genlist item
@@ -1807,6 +1807,20 @@ EINA_DEPRECATED EAPI void                          elm_genlist_item_disabled_set
  */
 EINA_DEPRECATED EAPI Eina_Bool                     elm_genlist_item_disabled_get(const Elm_Object_Item *it);
 
+/**
+ * Remove a genlist item from the its parent, deleting it.
+ *
+ * @param it The item to be removed.
+ * @return @c EINA_TRUE on success or @c EINA_FALSE, otherwise.
+ *
+ * @see elm_genlist_clear(), to remove all items in a genlist at
+ * once.
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @ingroup Genlist
+ */
+EINA_DEPRECATED EAPI void                          elm_genlist_item_del(Elm_Object_Item *it);
+
 #define ELM_IMAGE_ROTATE_90_CW 1
 #define ELM_IMAGE_ROTATE_180_CW 2
 #define ELM_IMAGE_ROTATE_90_CCW 3
index 1c2fe13..b2c90c5 100644 (file)
@@ -3202,7 +3202,11 @@ _item_select(Elm_Gen_Item *it)
      {
         if ((!it->walking) && (it->generation < it->wd->generation))
           {
-             if (!it->relcount) it->del_cb(it);
+             if (!it->relcount)
+               {
+                  it->del_cb(it);
+                  elm_widget_item_free(it);
+               }
           }
         else
           it->wd->last_selected_item = it;
@@ -3263,6 +3267,36 @@ _item_disable_hook(Elm_Object_Item *it)
      }
 }
 
+static Eina_Bool
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+   Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
+
+   if ((_it->relcount > 0) || (_it->walking > 0))
+     {
+        elm_genlist_item_subitems_clear(it);
+        if (_it->wd->show_item == _it) _it->wd->show_item = NULL;
+        _elm_genlist_item_del_notserious(_it);
+        if (_it->item->block)
+          {
+             if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE);
+             _it->item->block->changed = EINA_TRUE;
+             if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job);
+             _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd);
+          }
+        if (_it->parent)
+          {
+             _it->parent->item->items =
+                eina_list_remove(_it->parent->item->items, it);
+             _it->parent = NULL;
+          }
+        return EINA_FALSE;
+     }
+   _item_del(_it);
+   return EINA_TRUE;
+}
+
 Elm_Gen_Item *
 _elm_genlist_item_new(Widget_Data              *wd,
                       const Elm_Gen_Item_Class *itc,
@@ -3286,6 +3320,7 @@ _elm_genlist_item_new(Widget_Data              *wd,
    elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
    elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
    elm_widget_item_disable_hook_set(it, _item_disable_hook);
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    /* TEMPORARY */
    it->sel_cb = (Ecore_Cb)_item_select;
 
@@ -3504,7 +3539,10 @@ newblock:
      {
         it->item->rel->relcount--;
         if ((it->item->rel->generation < it->wd->generation) && (!it->item->rel->relcount))
-          _item_del(it->item->rel);
+          {
+             _item_del(it->item->rel);
+             elm_widget_item_free(it->item->rel);
+          }
         it->item->rel = NULL;
      }
    if (itb->count > itb->wd->max_items_per_block)
@@ -4065,6 +4103,7 @@ _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby)
              if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next);
              if (itn) itn->walking++; /* prevent early death of subitem */
              it->del_cb(it);
+             elm_widget_item_free(it);
              if (itn) itn->walking--;
           }
      }
@@ -4295,7 +4334,7 @@ elm_genlist_item_subitems_clear(Elm_Object_Item *it)
    EINA_LIST_FOREACH(_it->item->items, l, it2)
      tl = eina_list_append(tl, it2);
    EINA_LIST_FREE(tl, it2)
-     elm_genlist_item_del(it2);
+     elm_object_item_del(it2);
 }
 
 EAPI void
@@ -4613,30 +4652,7 @@ elm_genlist_item_middle_bring_in(Elm_Object_Item *it)
 EAPI void
 elm_genlist_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
-
-   if ((_it->relcount > 0) || (_it->walking > 0))
-     {
-        elm_genlist_item_subitems_clear(it);
-        if (_it->wd->show_item == _it) _it->wd->show_item = NULL;
-        _elm_genlist_item_del_notserious(_it);
-        if (_it->item->block)
-          {
-             if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE);
-             _it->item->block->changed = EINA_TRUE;
-             if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job);
-             _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd);
-          }
-        if (_it->parent)
-          {
-             _it->parent->item->items =
-                eina_list_remove(_it->parent->item->items, it);
-             _it->parent = NULL;
-          }
-        return;
-     }
-   _item_del(_it);
+   elm_object_item_del(it);
 }
 
 EAPI void
@@ -5473,5 +5489,4 @@ _elm_genlist_item_del_serious(Elm_Gen_Item *it)
    it->item = NULL;
    if (it->wd->last_selected_item == it)
      it->wd->last_selected_item = NULL;
-   elm_widget_item_del(it);
 }
index d153457..df9332f 100644 (file)
  * the indicated item.
  *
  * The application can clear the list with elm_genlist_clear() which deletes
- * all the items in the list and elm_genlist_item_del() will delete a specific
+ * all the items in the list and elm_object_item_del() will delete a specific
  * item. elm_genlist_item_subitems_clear() will clear all items that are
  * children of the indicated parent item.
  *
@@ -420,7 +420,7 @@ struct _Elm_Genlist_Item_Class
  * This function inserts a new genlist widget on the canvas.
  *
  * @see elm_genlist_item_append()
- * @see elm_genlist_item_del()
+ * @see elm_object_item_del()
  * @see elm_genlist_clear()
  *
  * @ingroup Genlist
@@ -434,7 +434,7 @@ EAPI Evas_Object                  *elm_genlist_add(Evas_Object *parent);
  *
  * This removes (and deletes) all items in @p obj, leaving it empty.
  *
- * @see elm_genlist_item_del(), to remove just one item.
+ * @see elm_object_item_del(), to remove just one item.
  *
  * @ingroup Genlist
  */
@@ -782,7 +782,7 @@ EAPI double                        elm_genlist_longpress_timeout_get(const Evas_
  * @see elm_genlist_item_prepend()
  * @see elm_genlist_item_insert_before()
  * @see elm_genlist_item_insert_after()
- * @see elm_genlist_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Genlist
  */
@@ -806,7 +806,7 @@ EAPI Elm_Object_Item             *elm_genlist_item_append(Evas_Object *obj, cons
  * @see elm_genlist_item_append()
  * @see elm_genlist_item_insert_before()
  * @see elm_genlist_item_insert_after()
- * @see elm_genlist_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Genlist
  */
@@ -830,7 +830,7 @@ EAPI Elm_Object_Item             *elm_genlist_item_prepend(Evas_Object *obj, con
  * @see elm_genlist_item_append()
  * @see elm_genlist_item_prepend()
  * @see elm_genlist_item_insert_after()
- * @see elm_genlist_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Genlist
  */
@@ -854,7 +854,7 @@ EAPI Elm_Object_Item             *elm_genlist_item_insert_before(Evas_Object *ob
  * @see elm_genlist_item_append()
  * @see elm_genlist_item_prepend()
  * @see elm_genlist_item_insert_before()
- * @see elm_genlist_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Genlist
  */
@@ -1118,7 +1118,7 @@ EAPI Elm_Object_Item             *elm_genlist_item_parent_get(const Elm_Object_I
  * given item @p it.
  *
  * @see elm_genlist_clear()
- * @see elm_genlist_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Genlist
  */
@@ -1345,19 +1345,6 @@ EAPI void                          elm_genlist_item_middle_show(Elm_Object_Item
 EAPI void                          elm_genlist_item_middle_bring_in(Elm_Object_Item *it);
 
 /**
- * Remove a genlist item from the its parent, deleting it.
- *
- * @param it The item to be removed.
- * @return @c EINA_TRUE on success or @c EINA_FALSE, otherwise.
- *
- * @see elm_genlist_clear(), to remove all items in a genlist at
- * once.
- *
- * @ingroup Genlist
- */
-EAPI void                          elm_genlist_item_del(Elm_Object_Item *it);
-
-/**
  * Tells genlist to "orphan" contents fetchs by the item class
  *
  * @param it The item