Revert my box unpack function and use ones by Marco Trevisan instead.
authorDaniel Kolesa <quaker66@gmail.com>
Mon, 21 Sep 2009 18:09:51 +0000 (18:09 +0000)
committerDaniel Kolesa <quaker66@gmail.com>
Mon, 21 Sep 2009 18:09:51 +0000 (18:09 +0000)
SVN revision: 42603

src/lib/Elementary.h.in
src/lib/elm_box.c
src/lib/els_box.c
src/lib/els_box.h

index feaec97..923f343 100644 (file)
@@ -299,7 +299,8 @@ extern "C" {
    EAPI void         elm_box_pack_before(Evas_Object *obj, Evas_Object *subobj, Evas_Object *before);
    EAPI void         elm_box_pack_after(Evas_Object *obj, Evas_Object *subobj, Evas_Object *after);
    EAPI void         elm_box_clear(Evas_Object *obj);
-   EAPI void         elm_box_unpack(Evas_Object *obj);
+   EAPI void         elm_box_unpack(Evas_Object *obj, Evas_Object *subobj);
+   EAPI void         elm_box_unpack_all(Evas_Object *obj);
    /* smart callbacks called:
     */
 
index a407105..75a926b 100644 (file)
@@ -240,16 +240,35 @@ elm_box_clear(Evas_Object *obj)
 }
 
 /**
- * This unpacks an item from the box
+ * This unpack a box item
  *
- * This unpacks a single Evas_Object from the box.
+ * This unpack the selected member from the box object, but does not delete
+ * the box itself or the packed items.
  *
- * @param obj The box item
+ * @param obj The box object
+ *
+ * @ingroup Box
+ */
+EAPI void
+elm_box_unpack(Evas_Object *obj, Evas_Object *subobj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   _els_smart_box_unpack(wd->box, subobj);
+}
+
+/**
+ * This unpack the box items
+ *
+ * This unpack all members from the box object, but does not delete
+ * the box itself or the packed items.
+ *
+ * @param obj The box object
  *
  * @ingroup Box
  */
 EAPI void
-elm_box_unpack(Evas_Object *obj)
+elm_box_unpack_all(Evas_Object *obj)
 {
-   _els_smart_box_unpack(obj);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   _els_smart_box_unpack_all(wd->box);
 }
index b230082..020523b 100644 (file)
@@ -153,15 +153,16 @@ _els_smart_box_pack_after(Evas_Object *obj, Evas_Object *child, Evas_Object *aft
 }
 
 void
-_els_smart_box_unpack(Evas_Object *obj)
+_els_smart_box_unpack(Evas_Object *obj, Evas_Object *child)
 {
    Smart_Data *sd;
    
    if (!obj) return;
-   sd = evas_object_smart_data_get(evas_object_smart_parent_get(obj));
+   sd = evas_object_smart_data_get(obj);
    if (!sd) return;
-   sd->items = eina_list_remove(sd->items, obj);
-   _smart_disown(obj);
+   sd->items = eina_list_remove(sd->items, child);
+   elm_widget_sub_object_del(obj, child);
+   _smart_disown(child);
    if (!sd->deleting)
      {
         if (!evas_object_clipees_get(sd->clip))
@@ -171,6 +172,20 @@ _els_smart_box_unpack(Evas_Object *obj)
 }
 
 void
+_els_smart_box_unpack_all(Evas_Object *obj)
+{
+   Smart_Data *sd;
+
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   while (sd->items)
+     {
+       Evas_Object *child = sd->items->data;
+        _els_smart_box_unpack(obj, child);
+     }
+}
+
+void
 _els_smart_box_clear(Evas_Object *obj)
 {
    Smart_Data *sd;
@@ -222,7 +237,7 @@ _smart_disown(Evas_Object *obj)
 static void
 _smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
-   _els_smart_box_unpack(obj);
+   _els_smart_box_unpack(evas_object_smart_parent_get(obj), obj);
 }
 
 static void
@@ -507,7 +522,7 @@ _smart_del(Evas_Object *obj)
        Evas_Object *child;
        
        child = sd->items->data;
-       _els_smart_box_unpack(child);
+       _els_smart_box_unpack(obj, child);
      }
    evas_object_del(sd->clip);
    free(sd);
index a488de7..b285ab1 100644 (file)
@@ -6,5 +6,6 @@ int          _els_smart_box_pack_start        (Evas_Object *obj, Evas_Object *ch
 int          _els_smart_box_pack_end          (Evas_Object *obj, Evas_Object *child);
 int          _els_smart_box_pack_before       (Evas_Object *obj, Evas_Object *child, Evas_Object *before);
 int          _els_smart_box_pack_after        (Evas_Object *obj, Evas_Object *child, Evas_Object *after);
-void         _els_smart_box_unpack            (Evas_Object *obj);
+void         _els_smart_box_unpack            (Evas_Object *obj, Evas_Object *child);
+void         _els_smart_box_unpack_all        (Evas_Object *obj);
 void         _els_smart_box_clear             (Evas_Object *obj);