efl_ui_pager: set current page as -1 when pager is empty
authorJaeun Choi <jaeun12.choi@samsung.com>
Wed, 23 Jan 2019 12:17:29 +0000 (21:17 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Thu, 31 Jan 2019 01:53:48 +0000 (10:53 +0900)
it makes more sense that the current page number is -1 when pager is empty
since numbering starts from 0 when pager actually contains pages.
this patch also fixes a bug in pack_begin function, in which
the current page is increased by 1.

src/lib/elementary/efl_ui_pager.c

index 4b84ea7..e0e3313 100644 (file)
@@ -339,7 +339,7 @@ _efl_ui_pager_efl_object_constructor(Eo *obj,
    pd->cnt = 0;
    pd->loop = EFL_UI_PAGER_LOOP_DISABLED;
 
-   pd->curr.page = 0;
+   pd->curr.page = -1;
    pd->curr.pos = 0.0;
 
    pd->transition = NULL;
@@ -424,6 +424,7 @@ _efl_ui_pager_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
    pd->content_list = eina_list_append(pd->content_list, subobj);
 
    pd->cnt++;
+   if (pd->curr.page == -1) pd->curr.page = 0;
 
    if (pd->transition)
      efl_page_transition_update(pd->transition, pd->curr.pos);