summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 12:43:07 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 13:52:12 +0200
commite14cc95e76bd0158cb295897b39ea6209dc21a4d (patch)
treee7870cf4208e01b762d01b704ac82625c889a6b7
parent1272cf7e9c29fd2a9869df640039eb0e8501b516 (diff)
settingspane: Drop out parent
-rw-r--r--src/lib/elc_settingspane.c56
-rw-r--r--src/lib/elm_settingspane_item.eo13
2 files changed, 27 insertions, 42 deletions
diff --git a/src/lib/elc_settingspane.c b/src/lib/elc_settingspane.c
index c1fc7c394..291ef3ca4 100644
--- a/src/lib/elc_settingspane.c
+++ b/src/lib/elc_settingspane.c
@@ -67,8 +67,6 @@ typedef struct
67 67
68typedef struct 68typedef struct
69{ 69{
70 Elm_Settingspane_Item *par;
71
72 Eina_List *childs; //list of Elm_Settingspane_Item* 70 Eina_List *childs; //list of Elm_Settingspane_Item*
73 71
74 const char *key_word; //< the original string which was given 72 const char *key_word; //< the original string which was given
@@ -176,6 +174,14 @@ static const Elm_Layout_Part_Alias_Description _content_aliases[] =
176 {NULL, NULL} 174 {NULL, NULL}
177}; 175};
178 176
177EOLIAN static Eo*
178_parent(Eo *item)
179{
180 Eo *par = NULL;
181 eo_do(item, par = eo_parent_get());
182 return par;
183}
184
179static void 185static void
180conf_menu_back_cb(void *data EINA_UNUSED, Evas_Object *obj, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 186conf_menu_back_cb(void *data EINA_UNUSED, Evas_Object *obj, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
181{ 187{
@@ -205,18 +211,17 @@ _title_bar_cb(void *data , Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED
205static void 211static void
206_title_bar_refresh(Evas_Object *w) 212_title_bar_refresh(Evas_Object *w)
207{ 213{
208 Elm_Object_Item *it, *walker; 214 Elm_Object_Item *walker;
209 Elm_Settingspane_Item_Data *id = NULL; 215 Elm_Settingspane_Item_Data *id = NULL;
210 Evas_Object *bt; 216 Evas_Object *bt;
211 217
212 C_DATA(w); 218 C_DATA(w);
213 219
214 it = _history_stack_current(w);
215
216 elm_box_clear(wd->title_box); 220 elm_box_clear(wd->title_box);
217 221
222 walker = _history_stack_current(w);
223
218 do { 224 do {
219 walker = id ? id->par : it;
220 id = IC_DATA_L(walker); 225 id = IC_DATA_L(walker);
221 226
222 bt = elm_button_add(wd->title_box); 227 bt = elm_button_add(wd->title_box);
@@ -226,7 +231,9 @@ _title_bar_refresh(Evas_Object *w)
226 evas_object_show(bt); 231 evas_object_show(bt);
227 232
228 elm_box_pack_start(wd->title_box, bt); 233 elm_box_pack_start(wd->title_box, bt);
229 } while(id->par); 234
235 walker = _parent(walker);
236 } while(walker);
230} 237}
231 238
232/** 239/**
@@ -325,12 +332,11 @@ _item_new(Evas_Object *obj, Elm_Settingspane_Item *par,
325 void *usr_data, 332 void *usr_data,
326 const char *name) 333 const char *name)
327{ 334{
328 Elm_Settingspane_Item *item = eo_add(ELM_SETTINGSPANE_ITEM_CLASS, NULL); 335 Elm_Settingspane_Item *item = eo_add(ELM_SETTINGSPANE_ITEM_CLASS, par);
329 Elm_Settingspane_Item_Data *data = eo_data_scope_get(item, ELM_SETTINGSPANE_ITEM_CLASS); 336 Elm_Settingspane_Item_Data *data = eo_data_scope_get(item, ELM_SETTINGSPANE_ITEM_CLASS);
330 337
331 data->data = usr_data; 338 data->data = usr_data;
332 data->sw = obj; 339 data->sw = obj;
333 data->par = par;
334 data->name = name; 340 data->name = name;
335 data->key_words = NULL; 341 data->key_words = NULL;
336 data->key_words = eina_list_append(data->key_words, eina_stringshare_add(name)); 342 data->key_words = eina_list_append(data->key_words, eina_stringshare_add(name));
@@ -1011,12 +1017,13 @@ _elm_settingspane_item_append(Eo *obj, Elm_Settingspane_Data *pd, void *data, co
1011 return _elm_settingspane_item_append_full(obj, pd, data, eina_stringshare_add(name), par, NULL); 1017 return _elm_settingspane_item_append_full(obj, pd, data, eina_stringshare_add(name), par, NULL);
1012} 1018}
1013 1019
1020
1014EOLIAN static Elm_Settingspane_Item * 1021EOLIAN static Elm_Settingspane_Item *
1015_elm_settingspane_item_append_relative(Eo *obj, Elm_Settingspane_Data *pd, void *data, const char *name, Elm_Settingspane_Item *rel) 1022_elm_settingspane_item_append_relative(Eo *obj, Elm_Settingspane_Data *pd, void *data, const char *name, Elm_Settingspane_Item *rel)
1016{ 1023{
1017 EINA_SAFETY_ON_NULL_RETURN_VAL(rel, NULL); 1024 EINA_SAFETY_ON_NULL_RETURN_VAL(rel, NULL);
1018 Elm_Settingspane_Item_Data *id = eo_data_scope_get(rel, ELM_SETTINGSPANE_ITEM_CLASS); 1025
1019 return _elm_settingspane_item_append_full(obj, pd, data, eina_stringshare_add(name), id->par, rel); 1026 return _elm_settingspane_item_append_full(obj, pd, data, eina_stringshare_add(name), _parent(obj), rel);
1020} 1027}
1021 1028
1022/* Item implement */ 1029/* Item implement */
@@ -1169,6 +1176,7 @@ EOLIAN static void
1169_elm_settingspane_item_realize(Eo *obj, Elm_Settingspane_Item_Data *pd) 1176_elm_settingspane_item_realize(Eo *obj, Elm_Settingspane_Item_Data *pd)
1170{ 1177{
1171 C_DATA(pd->sw); 1178 C_DATA(pd->sw);
1179 Eo *par = _parent(obj);
1172 DBG("realize %p", obj); 1180 DBG("realize %p", obj);
1173 1181
1174 if (wd->panel_visible) 1182 if (wd->panel_visible)
@@ -1188,8 +1196,8 @@ _elm_settingspane_item_realize(Eo *obj, Elm_Settingspane_Item_Data *pd)
1188 pd->panel = p; 1196 pd->panel = p;
1189 } 1197 }
1190 /* show its menu */ 1198 /* show its menu */
1191 if (pd->par) 1199 if (par)
1192 eo_do(pd->par, elm_obj_settingspane_item_realize()); 1200 eo_do(par, elm_obj_settingspane_item_realize());
1193 /* show this panel */ 1201 /* show this panel */
1194 _item_panel_show(obj, pd); 1202 _item_panel_show(obj, pd);
1195 /* set us as visible */ 1203 /* set us as visible */
@@ -1206,12 +1214,12 @@ _elm_settingspane_item_realize(Eo *obj, Elm_Settingspane_Item_Data *pd)
1206 if (wd->menu_visible) 1214 if (wd->menu_visible)
1207 eo_do(wd->menu_visible, elm_obj_settingspane_item_unrealize()); 1215 eo_do(wd->menu_visible, elm_obj_settingspane_item_unrealize());
1208 wd->menu_hidden = NULL; 1216 wd->menu_hidden = NULL;
1209 if (pd->par) 1217 if (par)
1210 { 1218 {
1211 Elm_Settingspane_Item_Data *ido; 1219 Elm_Settingspane_Item_Data *ido;
1212 ido = IC_DATA_L(pd->par); 1220 ido = IC_DATA_L(par);
1213 _item_menu_realize(pd->par, ido, wd); 1221 _item_menu_realize(par, ido, wd);
1214 wd->menu_hidden = pd->par; 1222 wd->menu_hidden = par;
1215 _item_menu_visible_hide(wd->menu_hidden); 1223 _item_menu_visible_hide(wd->menu_hidden);
1216 } 1224 }
1217 _item_menu_show(obj, pd, (!!wd->menu_hidden)); 1225 _item_menu_show(obj, pd, (!!wd->menu_hidden));
@@ -1308,12 +1316,6 @@ _elm_settingspane_item_delete(Eo *obj, Elm_Settingspane_Item_Data *pd EINA_UNUSE
1308 eo_del(obj); 1316 eo_del(obj);
1309} 1317}
1310 1318
1311EOLIAN static const Elm_Settingspane_Item *
1312_elm_settingspane_item_parent_get(Eo *obj EINA_UNUSED, Elm_Settingspane_Item_Data *pd)
1313{
1314 return pd->par;
1315}
1316
1317EOLIAN static void 1319EOLIAN static void
1318_elm_settingspane_item_changed_set(Eo *obj, Elm_Settingspane_Item_Data *pd, Eina_Bool changed) 1320_elm_settingspane_item_changed_set(Eo *obj, Elm_Settingspane_Item_Data *pd, Eina_Bool changed)
1319{ 1321{
@@ -1398,12 +1400,8 @@ _elm_settingspane_item_eo_base_destructor(Eo *obj EINA_UNUSED, Elm_Settingspane_
1398 } 1400 }
1399 } 1401 }
1400 1402
1401 if (pd->par) 1403 if (_parent(obj))
1402 { 1404 _item_menu_refresh(_parent(obj), id_par);
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 1405
1408 //if we have the item somewhere in the stack, remove it! 1406 //if we have the item somewhere in the stack, remove it!
1409 _history_stack_remove(pd->sw, obj); 1407 _history_stack_remove(pd->sw, obj);
diff --git a/src/lib/elm_settingspane_item.eo b/src/lib/elm_settingspane_item.eo
index c0d4f4f16..5defc2e74 100644
--- a/src/lib/elm_settingspane_item.eo
+++ b/src/lib/elm_settingspane_item.eo
@@ -45,19 +45,6 @@ class Elm.Settingspane.Item(Eo.Base){
45 group : const(char)*; 45 group : const(char)*;
46 } 46 }
47 } 47 }
48 @property parent {
49 get {
50 [[
51 Returns the parent of this item
52
53 This will return the parent item of this item. If there is none it will return NULL.
54
55 ]]
56 }
57 values {
58 parent : const(Elm.Settingspane.Item)*;
59 }
60 }
61 @property changed { 48 @property changed {
62 [[ 49 [[
63 This will mark this item internally as changed, 50 This will mark this item internally as changed,