elementary/panes - Patch to handle deletion of current contents while setting new ones

Attached to the mail is a patch for elm_panes.

I have a query that shall we hide the unset content in the widget itself or should application explicitly hide them after unsetting!
In case of edje_object_part_unswallow, application needs to do it explicitly and it is documented but in case of elm_object_part_content_unset, there is no documentation available.

Details of the patch:

Existing Issue before this change:
   1. Panes deletes the older content while setting a new content even though both are same.
   2. left and right content are being unswallowed in the content_left_set and _content_right_unset functions. So when the reparenting happens, say when the content is put inside a layout then only _sub_del gets called and  
unswallowing does not happen as these functions do not get called.
e.g.   @@ -253,8 +250,6 @@ _content_left_unset(Evas_Object *obj)
    if (!wd->contents.left) return NULL;
    Evas_Object *content = wd->contents.left;
    elm_widget_sub_object_del(obj, content); //wd->contents.left already gets set to NULL in _sub_del
-   edje_object_part_unswallow(wd->panes, content); // can be unswallowed in _sub_del as in case of reparenting like setting content in a layout, only _sub_del will get called, not this function
-   wd->contents.left = NULL; //this instruction is redundent as it happens in _sub_del anyway
    return content;
 }
Change Description:
  1. Unswallowing the contents now in _sub_del as this is a common function to be executed when subobject removal happens.
  2. Comparing the current content with new before deleting. 

Signed-Off-By: RAJEEV RANJAN<rajeev.r@samsumg.com>

Thanks.
Regards,
Rajeev



SVN revision: 69720
This commit is contained in:
ChunEon Park 2012-03-29 07:08:22 +00:00
parent ff7dbb7a73
commit 9bd243f89d
1 changed files with 8 additions and 15 deletions

View File

@ -166,6 +166,7 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
{
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
edje_object_part_unswallow(wd->panes, sub);
wd->contents.left = NULL;
_sizing_eval(obj);
}
@ -173,12 +174,12 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
{
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
edje_object_part_unswallow(wd->panes, sub);
wd->contents.right= NULL;
_sizing_eval(obj);
}
}
static void
_clicked(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__)
{
@ -216,14 +217,12 @@ static void
_content_left_set(Evas_Object *obj, Evas_Object *content)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->contents.left == content) return;
if (wd->contents.left)
{
evas_object_del(wd->contents.left);
wd->contents.left = NULL;
}
evas_object_del(wd->contents.left);
wd->contents.left = content;
if (content)
{
wd->contents.left = content;
elm_widget_sub_object_add(obj, content);
edje_object_part_swallow(wd->panes, "elm.swallow.left", content);
}
@ -233,14 +232,12 @@ static void
_content_right_set(Evas_Object *obj, Evas_Object *content)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->contents.right == content) return;
if (wd->contents.right)
{
evas_object_del(wd->contents.right);
wd->contents.right = NULL;
}
evas_object_del(wd->contents.right);
wd->contents.right = content;
if (content)
{
wd->contents.right = content;
elm_widget_sub_object_add(obj, content);
edje_object_part_swallow(wd->panes, "elm.swallow.right", content);
}
@ -253,8 +250,6 @@ _content_left_unset(Evas_Object *obj)
if (!wd->contents.left) return NULL;
Evas_Object *content = wd->contents.left;
elm_widget_sub_object_del(obj, content);
edje_object_part_unswallow(wd->panes, content);
wd->contents.left = NULL;
return content;
}
@ -265,8 +260,6 @@ _content_right_unset(Evas_Object *obj)
if (!wd->contents.right) return NULL;
Evas_Object *content = wd->contents.right;
elm_widget_sub_object_del(obj, content);
edje_object_part_unswallow(wd->panes, content);
wd->contents.right = NULL;
return content;
}