summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-02-27 12:53:29 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 12:54:39 +0200
commite37660e2d9f4bd0773ca82e14a85f01e66424974 (patch)
tree5c0abaa6c4f0c65b8715a400ed592b39bb7b13ee
parente32225568ddbee9301f07c4d062ed977abcb14ac (diff)
settingspanel: content is not longer deleted directly
Deletion of the content is scheduled, and done after a transition is done.
-rw-r--r--data/themes/edc/elm/settingspane.edc6
-rw-r--r--src/lib/elc_settingspane.c105
2 files changed, 77 insertions, 34 deletions
diff --git a/data/themes/edc/elm/settingspane.edc b/data/themes/edc/elm/settingspane.edc
index 74869843b..f4988cc80 100644
--- a/data/themes/edc/elm/settingspane.edc
+++ b/data/themes/edc/elm/settingspane.edc
@@ -291,8 +291,14 @@ group { name: "elm/settingspane/base/default";
291 signal: "elm,state,default"; source: "elm"; 291 signal: "elm,state,default"; source: "elm";
292 action: STATE_SET "default" 0.0; 292 action: STATE_SET "default" 0.0;
293 transition: DECELERATE 0.8; 293 transition: DECELERATE 0.8;
294 after: "trans_done";
294 target: "base"; 295 target: "base";
295 } 296 }
297 program {
298 name: "trans_done";
299 action: SIGNAL_EMIT "elm,state,default,reached" "elm";
300 target: "";
301 }
296 } 302 }
297 } 303 }
298 group { name: "elm/settingspane/menu/default"; 304 group { name: "elm/settingspane/menu/default";
diff --git a/src/lib/elc_settingspane.c b/src/lib/elc_settingspane.c
index 2110270c4..4ea71d3a4 100644
--- a/src/lib/elc_settingspane.c
+++ b/src/lib/elc_settingspane.c
@@ -70,6 +70,8 @@ typedef struct
70 Evas_Smart_Cb reset; 70 Evas_Smart_Cb reset;
71 Content_Get_Cb content_get; 71 Content_Get_Cb content_get;
72 } panel; 72 } panel;
73 Eina_Bool keep;
74 Eina_Bool scheduled;
73} Elm_Settingspane_Item_Data; 75} Elm_Settingspane_Item_Data;
74 76
75typedef struct _Search_Run 77typedef struct _Search_Run
@@ -273,7 +275,49 @@ _content_layout_reset_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event E
273 _item_content_reset(displayed); 275 _item_content_reset(displayed);
274} 276}
275 277
278static void
279_content_del(Elm_Settingspane_Item *it)
280{
281 Evas_Object *shown_content;
282 IC_DATA(it);
283
284 shown_content = id->panel.tmp_content;
285 id->panel.tmp_content = NULL;
286 eo_unref(shown_content);
287 evas_object_del(shown_content);
288 if (it)
289 _item_content_del(it);
290}
291static void
292_content_layout_hide(Evas_Object *obj, Elm_Object_Item *item)
293{
294 evas_object_data_del(obj, DK_PANEL_ITEM_SHOWN);
295 IC_DATA(item);
296
297 if (!id->keep)
298 _content_del(item);
299 else
300 {
301 Evas_Object *cnt;
302
303 cnt = elm_object_part_content_unset(obj, POS_PANEL_CONTENT);
304 evas_object_hide(cnt);
305 }
306}
307static void
308_default_reached_cb(void *data EINA_UNUSED, Evas_Object *obj, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
309{
310 Elm_Object_Item *item;
311
312 item = evas_object_data_get(obj, DK_PANEL_ITEM_SHOWN);
313 IC_DATA(item);
314
315 if (!id->scheduled)
316 return;
276 317
318 DBG("schedule del %s => panel %p", id->name, obj);
319 _content_layout_hide(obj, item);
320}
277 321
278static void 322static void
279_content_layout_content_init(Evas_Object *w) 323_content_layout_content_init(Evas_Object *w)
@@ -289,6 +333,7 @@ _content_layout_content_init(Evas_Object *w)
289 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 333 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
290 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 334 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
291 elm_layout_theme_set(o, "settingspane", "panel", "default"); 335 elm_layout_theme_set(o, "settingspane", "panel", "default");
336 elm_layout_signal_callback_add(o, "elm,state,default,reached", EMITTER, _default_reached_cb, o);
292 evas_object_show(o); 337 evas_object_show(o);
293 338
294 pad = evas_object_rectangle_add(evas_object_evas_get(w)); 339 pad = evas_object_rectangle_add(evas_object_evas_get(w));
@@ -333,38 +378,19 @@ _content_layout_content_init(Evas_Object *w)
333} 378}
334 379
335static void 380static void
336_content_del(Elm_Settingspane_Item *it) 381_content_layout_schedule_hide(Evas_Object *w, Eina_Bool keep)
337{
338 Evas_Object *shown_content;
339 IC_DATA(it);
340
341 shown_content = id->panel.tmp_content;
342 id->panel.tmp_content = NULL;
343 eo_unref(shown_content);
344 evas_object_del(shown_content);
345 if (it)
346 _item_content_del(it);
347
348}
349
350static void
351_content_layout_content_hide(Evas_Object *w, Eina_Bool keep)
352{ 382{
353 Evas_Object *shown = evas_object_data_get(w, DK_MAIN_PANEL_SHOWED); 383 Evas_Object *shown = evas_object_data_get(w, DK_MAIN_PANEL_SHOWED);
354 Elm_Object_Item *item = evas_object_data_get(shown, DK_PANEL_ITEM_SHOWN); 384 Elm_Object_Item *item = evas_object_data_get(shown, DK_PANEL_ITEM_SHOWN);
385 IC_DATA(item);
355 386
356 evas_object_data_del(shown, DK_PANEL_ITEM_SHOWN); 387 if (!item) //nothing to hide
357 elm_layout_signal_emit(shown, EMIT_CONTENT_DEFAULT); 388 return;
358
359 if (!keep && item)
360 _content_del(item);
361 else
362 {
363 Evas_Object *cnt;
364 389
365 cnt = elm_object_part_content_unset(shown, POS_PANEL_CONTENT); 390 id->keep = keep;
366 evas_object_hide(cnt); 391 id->scheduled = EINA_TRUE;
367 } 392 DBG("set to true %s => panel %p", id->name, shown);
393 elm_layout_signal_emit(shown, EMIT_CONTENT_DEFAULT);
368} 394}
369 395
370static void 396static void
@@ -404,6 +430,7 @@ _content_layout_display(Evas_Object *w, Evas_Object *content)
404static void 430static void
405_content_layout_content_set(Evas_Object *w, Elm_Settingspane_Item *it) 431_content_layout_content_set(Evas_Object *w, Elm_Settingspane_Item *it)
406{ 432{
433 Elm_Object_Item *oitem;
407 IC_DATA(it); 434 IC_DATA(it);
408 435
409 Evas_Object *hidden = evas_object_data_get(w, DK_MAIN_PANEL_HIDDEN); 436 Evas_Object *hidden = evas_object_data_get(w, DK_MAIN_PANEL_HIDDEN);
@@ -418,6 +445,16 @@ _content_layout_content_set(Evas_Object *w, Elm_Settingspane_Item *it)
418 elm_object_content_set(id->panel.tmp_content, _item_content_get(it, w)); 445 elm_object_content_set(id->panel.tmp_content, _item_content_get(it, w));
419 446
420 } 447 }
448 oitem = evas_object_data_get(hidden, DK_PANEL_ITEM_SHOWN);
449
450 if (oitem && oitem != it)
451 {
452 Elm_Settingspane_Item_Data *oid = IC_DATA_L(oitem);
453
454 oid->scheduled = EINA_FALSE;
455 DBG("pre del %s => panel %p", oid->name, hidden);
456 _content_layout_hide(hidden, oitem);
457 }
421 458
422 _content_layout_display(w, id->panel.tmp_content); 459 _content_layout_display(w, id->panel.tmp_content);
423 evas_object_data_set(hidden, DK_PANEL_ITEM_SHOWN, it); 460 evas_object_data_set(hidden, DK_PANEL_ITEM_SHOWN, it);
@@ -781,7 +818,7 @@ _history_stack_push(Evas_Object *w, Elm_Object_Item *it)
781 818
782 if (old && HAS_PANEL(ido)) 819 if (old && HAS_PANEL(ido))
783 { 820 {
784 _content_layout_content_hide(w, ido->changed); 821 _content_layout_schedule_hide(w, ido->changed);
785 } 822 }
786 823
787 if (HAS_PANEL(id)) 824 if (HAS_PANEL(id))
@@ -824,19 +861,19 @@ _history_stack_pop(Evas_Object *w)
824 { 861 {
825 IC_DATA(current); 862 IC_DATA(current);
826 _menu_layout_fill(id->par); 863 _menu_layout_fill(id->par);
827 _content_layout_content_hide(w, keep); 864 _content_layout_schedule_hide(w, keep);
828 _content_layout_content_set(w, current); 865 _content_layout_content_set(w, current);
829 } 866 }
830 else if (_item_has_panel(current) && !_item_has_panel(poped)) 867 else if (_item_has_panel(current) && !_item_has_panel(poped))
831 { 868 {
832 IC_DATA(current); 869 IC_DATA(current);
833 _menu_layout_fill(id->par); 870 _menu_layout_fill(id->par);
834 _content_layout_content_hide(w, keep); 871 _content_layout_schedule_hide(w, keep);
835 _content_layout_content_set(w, current); 872 _content_layout_content_set(w, current);
836 } 873 }
837 else if (!_item_has_panel(current) && _item_has_panel(poped)) 874 else if (!_item_has_panel(current) && _item_has_panel(poped))
838 { 875 {
839 _content_layout_content_hide(w, keep); 876 _content_layout_schedule_hide(w, keep);
840 _menu_layout_fill(current); 877 _menu_layout_fill(current);
841 } 878 }
842 else 879 else
@@ -975,7 +1012,7 @@ _search_panel_display(Evas_Object *w)
975 evas_object_show(g); 1012 evas_object_show(g);
976 1013
977 evas_object_data_set(w, DK_MAIN_SEARCH_OBJECTS, o); 1014 evas_object_data_set(w, DK_MAIN_SEARCH_OBJECTS, o);
978 _content_layout_content_hide(w, EINA_TRUE); 1015 _content_layout_schedule_hide(w, EINA_TRUE);
979 _content_layout_display(w, o); 1016 _content_layout_display(w, o);
980 _menu_layout_hide(w); 1017 _menu_layout_hide(w);
981} 1018}
@@ -996,7 +1033,7 @@ _search_panel_hide(Evas_Object *w)
996 1033
997 if (_item_has_panel(item)) 1034 if (_item_has_panel(item))
998 { 1035 {
999 _content_layout_content_hide(w, EINA_TRUE); 1036 _content_layout_schedule_hide(w, EINA_TRUE);
1000 _content_layout_content_set(w, item); 1037 _content_layout_content_set(w, item);
1001 if (id->par) 1038 if (id->par)
1002 { 1039 {
@@ -1006,7 +1043,7 @@ _search_panel_hide(Evas_Object *w)
1006 } 1043 }
1007 else 1044 else
1008 { 1045 {
1009 _content_layout_content_hide(w, EINA_TRUE); 1046 _content_layout_schedule_hide(w, EINA_TRUE);
1010 _menu_layout_restore(w); 1047 _menu_layout_restore(w);
1011 _menu_layout_fill(item); 1048 _menu_layout_fill(item);
1012 } 1049 }