summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2014-11-28 14:37:01 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2014-11-28 14:37:01 +0100
commit870197085d14d18b4636f31db74fbcd6a4834ab5 (patch)
treea7068d8fb12fe4caf9e143d78b2ea6e66d97010e
parentbbaa7100c8ef03b01f35f87ae39e9cc304cecbd6 (diff)
Let the stack behave better when you select contents from the menu.
-rw-r--r--src/elm_settingspane.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/elm_settingspane.c b/src/elm_settingspane.c
index 95f147e..c35c6e2 100644
--- a/src/elm_settingspane.c
+++ b/src/elm_settingspane.c
@@ -235,6 +235,13 @@ _menu_layout_hidden_to_show(Evas_Object *w, Elm_Settingspane_Item *new, Elm_Sett
235 Evas_Object *behindlist = evas_object_data_get(behind, "__menu_genlist"); 235 Evas_Object *behindlist = evas_object_data_get(behind, "__menu_genlist");
236 Evas_Object *hiddenlist = evas_object_data_get(hidden, "__menu_genlist"); 236 Evas_Object *hiddenlist = evas_object_data_get(hidden, "__menu_genlist");
237 237
238 Elm_Settingspane_Item *item_shown = evas_object_data_get(shown, "__showed_item");
239 Elm_Settingspane_Item *item_hidden = evas_object_data_get(hidden, "__showed_item");
240
241 if ((item_hidden == lower_new) && (item_shown == new))
242 return;
243
244
238 if (lower_new) 245 if (lower_new)
239 { 246 {
240 elm_widget_signal_emit(behind, "state,default", "conf"); 247 elm_widget_signal_emit(behind, "state,default", "conf");
@@ -345,24 +352,32 @@ _item_stack_push(Evas_Object *obj, Elm_Settingspane_Item *item)
345 _content_layout_content_set(obj, item); 352 _content_layout_content_set(obj, item);
346} 353}
347 354
348static void 355static Elm_Settingspane_Item*
349_item_stack_pop(Evas_Object *obj) 356_item_stack_pop_raw(Evas_Object *obj)
350{ 357{
351 Elm_Settingspane_Data *wd = eo_data_scope_get(obj, ELM_SETTINGSPANE_CLASS); 358 Elm_Settingspane_Data *wd = eo_data_scope_get(obj, ELM_SETTINGSPANE_CLASS);
352
353 DBG("POPPING");
354
355 if (eina_list_count(wd->stack) < 1) 359 if (eina_list_count(wd->stack) < 1)
356 return; //trololol lets pop item zero 360 return NULL; //trololol lets pop item zero
357 361
358 Elm_Settingspane_Item *old = eina_list_data_get(eina_list_last(wd->stack)); 362 Elm_Settingspane_Item *old = eina_list_data_get(eina_list_last(wd->stack));
359 363
364 wd->stack = eina_list_remove(wd->stack, old);
365
366 return old;
367}
368
369static void
370_item_stack_pop(Evas_Object *obj)
371{
372 Elm_Settingspane_Data *wd = eo_data_scope_get(obj, ELM_SETTINGSPANE_CLASS);
373 Elm_Settingspane_Item *old = _item_stack_pop_raw(obj);
374
375 if (!old)
376 return;
377
360 if (!_item_is_category(old)) 378 if (!_item_is_category(old))
361 _content_layout_content_hide(obj); 379 _content_layout_content_hide(obj);
362 380
363 //pop out the last item
364 wd->stack = eina_list_remove_list(wd->stack, eina_list_last(wd->stack));
365
366 Eina_List *new_node = eina_list_last(wd->stack); 381 Eina_List *new_node = eina_list_last(wd->stack);
367 Elm_Settingspane_Item *new = eina_list_data_get(new_node); 382 Elm_Settingspane_Item *new = eina_list_data_get(new_node);
368 Elm_Settingspane_Item *lower_new = eina_list_data_get(eina_list_prev(new_node)); 383 Elm_Settingspane_Item *lower_new = eina_list_data_get(eina_list_prev(new_node));
@@ -371,7 +386,6 @@ _item_stack_pop(Evas_Object *obj)
371 _menu_layout_hidden_to_show(obj, new, lower_new); 386 _menu_layout_hidden_to_show(obj, new, lower_new);
372 else if (_item_is_category(new) && !_item_is_category(old)) 387 else if (_item_is_category(new) && !_item_is_category(old))
373 _menu_layout_hidden_to_show(obj, new, lower_new); 388 _menu_layout_hidden_to_show(obj, new, lower_new);
374 //TODO this makes somehow a strange animation if new is allready displayed, we should check that.
375 else if (!_item_is_category(new)) 389 else if (!_item_is_category(new))
376 { 390 {
377 _content_layout_content_set(obj, new); 391 _content_layout_content_set(obj, new);
@@ -433,6 +447,10 @@ _item_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNU
433{ 447{
434 Elm_Settingspane_Item *selected = data; 448 Elm_Settingspane_Item *selected = data;
435 Elm_Settingspane_Item_Data *id = eo_data_scope_get(selected, ELM_SETTINGSPANE_ITEM_CLASS); 449 Elm_Settingspane_Item_Data *id = eo_data_scope_get(selected, ELM_SETTINGSPANE_ITEM_CLASS);
450 Elm_Settingspane_Data *wd = eo_data_scope_get(id->sw, ELM_SETTINGSPANE_CLASS);
451
452 if (!_item_is_category(eina_list_data_get(eina_list_last(wd->stack))))
453 _item_stack_pop_raw(id->sw);
436 _item_stack_push(id->sw, selected); 454 _item_stack_push(id->sw, selected);
437} 455}
438 456