elm_genlist: apply the item_select_on_focus_disable feature on key_action_move
authorMinkyu Kang <mk7.kang@samsung.com>
Thu, 1 Sep 2016 11:20:53 +0000 (20:20 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Thu, 1 Sep 2016 11:20:53 +0000 (20:20 +0900)
Summary:
Previously, focused item was always selected on first and last key action.
If item_select_on_focus_disable is true, item should not be selected.

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
Test Plan: elementary_test -to genlist

Reviewers: cedric, SanghyeonLee, Hermet

Reviewed By: Hermet

Subscribers: sju27, seoz, jpeg

Differential Revision: https://phab.enlightenment.org/D4272

src/lib/elementary/elm_genlist.c

index 7c0cc15..5affc55 100644 (file)
@@ -3033,7 +3033,15 @@ _key_action_move(Evas_Object *obj, const char *params)
         it = elm_genlist_first_item_get(obj);
         if (it)
           {
-             elm_genlist_item_selected_set(it, EINA_TRUE);
+             if (_elm_config->item_select_on_focus_disable)
+               {
+                  elm_object_item_focus_set(it, EINA_TRUE);
+                  elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP);
+               }
+             else
+               {
+                  elm_genlist_item_selected_set(it, EINA_TRUE);
+               }
              return EINA_TRUE;
           }
      }
@@ -3042,7 +3050,15 @@ _key_action_move(Evas_Object *obj, const char *params)
         it = elm_genlist_last_item_get(obj);
         if (it)
           {
-             elm_genlist_item_selected_set(it, EINA_TRUE);
+             if (_elm_config->item_select_on_focus_disable)
+               {
+                  elm_object_item_focus_set(it, EINA_TRUE);
+                  elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM);
+               }
+             else
+               {
+                  elm_genlist_item_selected_set(it, EINA_TRUE);
+               }
              return EINA_TRUE;
           }
      }