summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2014-12-01 21:15:42 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2014-12-01 21:15:42 +0100
commitea0be080f3103a5ed4478688827aeb14fe759917 (patch)
tree64a9cefd7cd4cc8c46655774ac00756a469d6cb0
parent3a9eee63f6a83727dd71d4b6af358cddea4e2e31 (diff)
reorganized the stack, allready opened items will be raised.
If there are two panels after each other in the stack the menu will be hidden, otherwise it is a little bit confusing.
-rw-r--r--src/elm_settingspane.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/elm_settingspane.c b/src/elm_settingspane.c
index 5735292..3b7c86b 100644
--- a/src/elm_settingspane.c
+++ b/src/elm_settingspane.c
@@ -28,6 +28,7 @@ typedef struct
28 28
29static void _item_sel_cb(void *data, Evas_Object *obj, void *event_info); 29static void _item_sel_cb(void *data, Evas_Object *obj, void *event_info);
30static void _item_stack_pop(Elm_Settingspane *pane); 30static void _item_stack_pop(Elm_Settingspane *pane);
31static void _item_stack_remove(Elm_Settingspane_Item *del);
31 32
32#define CATEGORY_TEST(id) (!strcmp(id->class->style, "category")) 33#define CATEGORY_TEST(id) (!strcmp(id->class->style, "category"))
33 34
@@ -420,6 +421,30 @@ _menu_layout_refresh(Evas_Object *w)
420} 421}
421 422
422static void 423static void
424_menu_layout_restore(Evas_Object *w)
425{
426 Evas_Object *shown = evas_object_data_get(w, DK_MAIN_MENU_SHOWED);
427 Evas_Object *hidden = evas_object_data_get(w, DK_MAIN_MENU_HIDDEN);
428 Evas_Object *behind = evas_object_data_get(w, DK_MAIN_MENU_BEHIND);
429
430 elm_widget_signal_emit(hidden, EMIT_MENU_HIDDEN);
431 elm_widget_signal_emit(shown, EMIT_MENU_VISIBLE);
432 elm_widget_signal_emit(behind, EMIT_MENU_DEFAULT);
433}
434
435static void
436_menu_layout_hide(Evas_Object *w)
437{
438 Evas_Object *shown = evas_object_data_get(w, DK_MAIN_MENU_SHOWED);
439 Evas_Object *hidden = evas_object_data_get(w, DK_MAIN_MENU_HIDDEN);
440 Evas_Object *behind = evas_object_data_get(w, DK_MAIN_MENU_BEHIND);
441
442 elm_widget_signal_emit(hidden, EMIT_MENU_DEFAULT);
443 elm_widget_signal_emit(shown, EMIT_MENU_HIDDEN);
444 elm_widget_signal_emit(behind, EMIT_MENU_DEFAULT);
445}
446
447static void
423_menu_layout_hidden_to_show(Evas_Object *w, Elm_Settingspane_Item *new, Elm_Settingspane_Item *lower_new) 448_menu_layout_hidden_to_show(Evas_Object *w, Elm_Settingspane_Item *new, Elm_Settingspane_Item *lower_new)
424{ 449{
425 Evas_Object *shown = evas_object_data_get(w, DK_MAIN_MENU_SHOWED); 450 Evas_Object *shown = evas_object_data_get(w, DK_MAIN_MENU_SHOWED);
@@ -531,13 +556,33 @@ _item_stack_dump(Elm_Settingspane_Data *wd)
531static void 556static void
532_item_stack_push(Evas_Object *obj, Elm_Settingspane_Item *item) 557_item_stack_push(Evas_Object *obj, Elm_Settingspane_Item *item)
533{ 558{
534 Elm_Settingspane_Item_Data *id = eo_data_scope_get(item, ELM_SETTINGSPANE_ITEM_CLASS); 559 Elm_Settingspane_Item_Data *idl, *id = eo_data_scope_get(item, ELM_SETTINGSPANE_ITEM_CLASS);
535 Elm_Settingspane_Data *wd = eo_data_scope_get(id->sw, ELM_SETTINGSPANE_CLASS); 560 Elm_Settingspane_Data *wd = eo_data_scope_get(id->sw, ELM_SETTINGSPANE_CLASS);
561 Eina_List *pfirst;
562
563 /* this is the "top" item, we do not do anything. */
564
565 if (eina_list_data_get(eina_list_last(wd->stack)) == item)
566 return;
567
568 //we dont want to have a item twice on the stack, so remove the item from the stack!
569 _item_stack_remove(item);
570
571 pfirst = eina_list_last(wd->stack);
536 572
537 wd->stack = eina_list_append(wd->stack, item); 573 wd->stack = eina_list_append(wd->stack, item);
538 if (eina_list_count(wd->stack) > 1) 574 if (eina_list_count(wd->stack) > 1)
539 elm_widget_signal_emit(id->sw, EMIT_BACK_ENABLE); 575 elm_widget_signal_emit(id->sw, EMIT_BACK_ENABLE);
540 576
577 if (pfirst)
578 {
579 Elm_Settingspane_Item *it;
580 it = eina_list_data_get(pfirst);
581 idl = eo_data_scope_get(it, ELM_SETTINGSPANE_ITEM_CLASS);
582 if (!CATEGORY_TEST(idl))
583 _menu_layout_hide(id->sw);
584 }
585
541 if (CATEGORY_TEST(id)) 586 if (CATEGORY_TEST(id))
542 _menu_layout_show(obj, item, id->par ? EINA_FALSE : EINA_TRUE); 587 _menu_layout_show(obj, item, id->par ? EINA_FALSE : EINA_TRUE);
543 else 588 else
@@ -582,7 +627,9 @@ _item_stack_pop(Evas_Object *obj)
582 else if (!_item_is_category(new)) 627 else if (!_item_is_category(new))
583 { 628 {
584 _content_layout_content_set(obj, new); 629 _content_layout_content_set(obj, new);
585 //TODO we should somehow make sure if lower_new is a menu item we should fill the menu up with those items 630
631 if (_item_is_category(lower_new))
632 _menu_layout_restore(obj);
586 } 633 }
587 634
588 if (eina_list_count(wd->stack) < 2) 635 if (eina_list_count(wd->stack) < 2)