summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshashank.p <shashank.p@samsung.com>2016-03-04 15:41:02 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-03-04 16:14:37 -0800
commitdeeb391d18974f5395d149b088e78966fc859aae (patch)
tree082647fa5e8d3cc4dd45632b41a3ce9b116565c3
parentddf416c66189ef1f458d537bb1e2cbf5fa70567f (diff)
genlist: add elm_genlist_filtered_items_count API
Summary: This API will return the number of items that have passed the filter at a given point of time. If the API is called before "filter,done" callback comes, it may or may not give the filtered count for the complete genlist. Test Plan: Updated Genlist_filter example to print the output from filtered_count_get API in "filter,done" callback. Reviewers: SanghyeonLee, shilpasingh, cedric Reviewed By: cedric Subscribers: buds Differential Revision: https://phab.enlightenment.org/D3725 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/test_genlist.c6
-rw-r--r--src/lib/elm_genlist.c6
-rw-r--r--src/lib/elm_genlist.eo10
3 files changed, 19 insertions, 3 deletions
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 483199d61..0c25669e2 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -5025,11 +5025,11 @@ gl_filter_get(void *data, Evas_Object *obj EINA_UNUSED, void *key)
5025} 5025}
5026 5026
5027static void 5027static void
5028_gl_filter_finished_cb(void *data EINA_UNUSED, 5028_gl_filter_finished_cb(void *data,
5029 Evas_Object *obj EINA_UNUSED, 5029 Evas_Object *obj EINA_UNUSED,
5030 void *event_info EINA_UNUSED) 5030 void *event_info EINA_UNUSED)
5031{ 5031{
5032 printf("Filter finished\n"); 5032 printf("Filter finished, filtered items count is %d\n", elm_genlist_filtered_items_count((Evas_Object *)data));
5033} 5033}
5034 5034
5035void 5035void
@@ -5117,7 +5117,7 @@ test_genlist_filter(void *data EINA_UNUSED,
5117 evas_object_smart_callback_add(gl, "activated", _gl_focus_item_cb, "activated"); 5117 evas_object_smart_callback_add(gl, "activated", _gl_focus_item_cb, "activated");
5118 evas_object_smart_callback_add(gl, "highlighted", _gl_focus_item_cb, "highlighted"); 5118 evas_object_smart_callback_add(gl, "highlighted", _gl_focus_item_cb, "highlighted");
5119 evas_object_smart_callback_add(gl, "unhighlighted", _gl_focus_item_cb, "unhighlighted"); 5119 evas_object_smart_callback_add(gl, "unhighlighted", _gl_focus_item_cb, "unhighlighted");
5120 evas_object_smart_callback_add(gl, "filter,done", _gl_filter_finished_cb, NULL); 5120 evas_object_smart_callback_add(gl, "filter,done", _gl_filter_finished_cb, gl);
5121 evas_object_event_callback_add(gl, EVAS_CALLBACK_KEY_DOWN, _gl_focus_key_down_cb, NULL); 5121 evas_object_event_callback_add(gl, EVAS_CALLBACK_KEY_DOWN, _gl_focus_key_down_cb, NULL);
5122 5122
5123 itc = elm_genlist_item_class_new(); 5123 itc = elm_genlist_item_class_new();
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 5447e72d4..ebb31f2c2 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -7652,6 +7652,12 @@ _elm_genlist_filter_iterator_new(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
7652 return &iter->iterator; 7652 return &iter->iterator;
7653} 7653}
7654 7654
7655EOLIAN static unsigned int
7656_elm_genlist_filtered_items_count(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
7657{
7658 return sd->filtered_count;
7659}
7660
7655EOLIAN static void 7661EOLIAN static void
7656_elm_genlist_longpress_timeout_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, double timeout) 7662_elm_genlist_longpress_timeout_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, double timeout)
7657{ 7663{
diff --git a/src/lib/elm_genlist.eo b/src/lib/elm_genlist.eo
index 5ab6266ce..f3a0d0927 100644
--- a/src/lib/elm_genlist.eo
+++ b/src/lib/elm_genlist.eo
@@ -423,6 +423,16 @@ class Elm.Genlist (Elm.Layout, Elm.Interface_Scrollable, Evas.Clickable_Interfac
423 ]] 423 ]]
424 return: free(own(iterator<Elm_Gen_Item *> *), eina_iterator_free); [[Iterator on genlist]] 424 return: free(own(iterator<Elm_Gen_Item *> *), eina_iterator_free); [[Iterator on genlist]]
425 } 425 }
426 filtered_items_count @const {
427 [[Return how many items have passed the filter currently.
428
429 This behaviour is O(1) and may or may not return the
430 filtered count for complete genlist based on the timing
431 of the call. To get complete count, call after "filter,done"
432 callback
433 ]]
434 return: uint;
435 }
426 items_count @const { 436 items_count @const {
427 [[Return how many items are currently in a list. 437 [[Return how many items are currently in a list.
428 438