summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-09-04 17:10:18 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 12:56:26 +0200
commit49160d2620c6144a1f382457188c467b6eda25fe (patch)
tree43d1d24569fa13ef65fc52d86b6a7fc264975ac0
parent0f2b070271836b8e1f96387ca9d2d751702f51a6 (diff)
elm_settings_pane: cleanup correctly
-rw-r--r--src/lib/elc_settingspane.c91
1 files changed, 44 insertions, 47 deletions
diff --git a/src/lib/elc_settingspane.c b/src/lib/elc_settingspane.c
index c0638bcfc..c1fc7c394 100644
--- a/src/lib/elc_settingspane.c
+++ b/src/lib/elc_settingspane.c
@@ -325,7 +325,7 @@ _item_new(Evas_Object *obj, Elm_Settingspane_Item *par,
325 void *usr_data, 325 void *usr_data,
326 const char *name) 326 const char *name)
327{ 327{
328 Elm_Settingspane_Item *item = eo_add(ELM_SETTINGSPANE_ITEM_CLASS, obj); 328 Elm_Settingspane_Item *item = eo_add(ELM_SETTINGSPANE_ITEM_CLASS, NULL);
329 Elm_Settingspane_Item_Data *data = eo_data_scope_get(item, ELM_SETTINGSPANE_ITEM_CLASS); 329 Elm_Settingspane_Item_Data *data = eo_data_scope_get(item, ELM_SETTINGSPANE_ITEM_CLASS);
330 330
331 data->data = usr_data; 331 data->data = usr_data;
@@ -460,48 +460,6 @@ _item_append(Elm_Settingspane_Item *root, Elm_Settingspane_Item *toadd, Elm_Sett
460} 460}
461 461
462static void 462static void
463_item_del(Elm_Settingspane_Item *del, Eina_Bool full)
464{
465 IC_DATA(del);
466 Elm_Settingspane_Item_Data *id_par = NULL;
467 Eina_List *node, *nnode;
468 Elm_Settingspane_Item *ci;
469
470 eo_do(del, elm_obj_settingspane_item_unrealize());
471
472 if (id->changed)
473 {
474 ERR("This page has unsaved changes, you have lost all the data!");
475 }
476
477 if (!full)
478 {
479 Elm_Settingspane_Item *top = _history_stack_current(id->sw);
480 if (top == del)
481 {
482 _history_stack_pop(id->sw);
483 }
484 }
485 EINA_LIST_FOREACH_SAFE(id->childs, node, nnode, ci)
486 {
487 _item_del(ci, full);
488 }
489
490 if (id->par)
491 {
492 id_par = IC_DATA_L(id->par);
493 id_par->childs = eina_list_remove(id_par->childs, del);
494 if (!full)
495 _item_menu_refresh(id->par, id_par);
496 }
497
498 //if we have the item somewhere in the stack, remove it!
499 _history_stack_remove(id->sw, del);
500 //unref the content, if there is one
501 eo_del(del);
502}
503
504static void
505_item_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 463_item_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
506{ 464{
507 Elm_Settingspane_Item *curr, *selected = data; 465 Elm_Settingspane_Item *curr, *selected = data;
@@ -1347,7 +1305,7 @@ _elm_settingspane_item_unrealize(Eo *obj, Elm_Settingspane_Item_Data *pd)
1347EOLIAN static void 1305EOLIAN static void
1348_elm_settingspane_item_delete(Eo *obj, Elm_Settingspane_Item_Data *pd EINA_UNUSED) 1306_elm_settingspane_item_delete(Eo *obj, Elm_Settingspane_Item_Data *pd EINA_UNUSED)
1349{ 1307{
1350 _item_del(obj, EINA_FALSE); 1308 eo_del(obj);
1351} 1309}
1352 1310
1353EOLIAN static const Elm_Settingspane_Item * 1311EOLIAN static const Elm_Settingspane_Item *
@@ -1409,9 +1367,48 @@ _elm_settingspane_item_attach_panel(Eo *obj EINA_UNUSED, Elm_Settingspane_Item_D
1409EOLIAN static void 1367EOLIAN static void
1410_elm_settingspane_item_eo_base_destructor(Eo *obj EINA_UNUSED, Elm_Settingspane_Item_Data *pd) 1368_elm_settingspane_item_eo_base_destructor(Eo *obj EINA_UNUSED, Elm_Settingspane_Item_Data *pd)
1411{ 1369{
1412 if (pd->panel) 1370 Elm_Settingspane_Item_Data *id_par;
1413 eo_unref(pd->panel->layout); 1371 Elm_Settingspane_Item *top;
1372 C_DATA(pd->sw);
1373
1414 eo_do_super(obj, ELM_SETTINGSPANE_ITEM_CLASS, eo_destructor()); 1374 eo_do_super(obj, ELM_SETTINGSPANE_ITEM_CLASS, eo_destructor());
1375
1376 eo_do(obj, elm_obj_settingspane_item_unrealize());
1377
1378 wd->unsaved_changes = eina_list_remove(wd->unsaved_changes, obj);
1379
1380 if (pd->changed)
1381 {
1382 ERR("This page has unsaved changes, you have lost all the data!");
1383 }
1384
1385 top = _history_stack_current(pd->sw);
1386
1387 if (top == obj)
1388 {
1389 _history_stack_pop(pd->sw);
1390 }
1391 {
1392 Eina_List *node, *nnode;
1393 Elm_Settingspane_Item *ci;
1394
1395 EINA_LIST_FOREACH_SAFE(pd->childs, node, nnode, ci)
1396 {
1397 eo_del(ci);
1398 }
1399 }
1400
1401 if (pd->par)
1402 {
1403 id_par = IC_DATA_L(pd->par);
1404 id_par->childs = eina_list_remove(id_par->childs, obj);
1405 _item_menu_refresh(pd->par, id_par);
1406 }
1407
1408 //if we have the item somewhere in the stack, remove it!
1409 _history_stack_remove(pd->sw, obj);
1410 //unref the content, if there is one
1411 eo_del(obj);
1415} 1412}
1416 1413
1417EOLIAN static void 1414EOLIAN static void
@@ -1472,7 +1469,7 @@ _elm_settingspane_raise_unsaved(Eo *obj, Elm_Settingspane_Data *pd EINA_UNUSED)
1472EOLIAN static void 1469EOLIAN static void
1473_elm_settingspane_eo_base_destructor(Eo *obj, Elm_Settingspane_Data *pd) 1470_elm_settingspane_eo_base_destructor(Eo *obj, Elm_Settingspane_Data *pd)
1474{ 1471{
1475 _item_del(pd->zero, EINA_TRUE); 1472 eo_del(pd->zero);
1476 eo_do_super(obj, ELM_SETTINGSPANE_CLASS, eo_destructor()); 1473 eo_do_super(obj, ELM_SETTINGSPANE_CLASS, eo_destructor());
1477} 1474}
1478 1475