aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2019-01-24 15:38:40 +0900
committerJaeun Choi <jaeun12.choi@samsung.com>2019-01-25 13:47:37 +0900
commit90865582b50b2681a5c776c3a6dcae5418828537 (patch)
treee2f767682dae8f749bf2f2c9543f3dbd8bab1818
parentefl_page_transition_scroll: remove unnecessary line (diff)
downloadefl-90865582b50b2681a5c776c3a6dcae5418828537.tar.gz
efl_ui_pager: make loop set function to return boolean value
loop mode might not be available if the number of pages is less than required to make a loop
-rw-r--r--src/lib/elementary/efl_page_transition.c6
-rw-r--r--src/lib/elementary/efl_page_transition_scroll.c11
-rw-r--r--src/lib/elementary/efl_ui_pager.c13
-rw-r--r--src/lib/elementary/efl_ui_pager.eo5
-rw-r--r--src/lib/elementary/elm_priv.h2
5 files changed, 29 insertions, 8 deletions
diff --git a/src/lib/elementary/efl_page_transition.c b/src/lib/elementary/efl_page_transition.c
index 69d4a8e020..11beb39a35 100644
--- a/src/lib/elementary/efl_page_transition.c
+++ b/src/lib/elementary/efl_page_transition.c
@@ -71,12 +71,14 @@ _efl_page_transition_curr_page_change(Eo *obj EINA_UNUSED,
}
-EOLIAN static void
+EOLIAN static Eina_Bool
_efl_page_transition_loop_set(Eo *obj EINA_UNUSED,
Efl_Page_Transition_Data *pd,
Efl_Ui_Pager_Loop loop)
{
pd->loop = loop;
+
+ return EINA_TRUE;
}
@@ -88,7 +90,7 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_page_size_set,
EFL_FUNC_CALL(sz), Eina_Size2D sz)
EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_padding_size_set,
EFL_FUNC_CALL(padding), int padding)
-EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_loop_set,
+EOAPI EFL_FUNC_BODYV(efl_page_transition_loop_set, Eina_Bool, 0,
EFL_FUNC_CALL(loop), Efl_Ui_Pager_Loop loop)
diff --git a/src/lib/elementary/efl_page_transition_scroll.c b/src/lib/elementary/efl_page_transition_scroll.c
index 1fb30f218a..600a6bb469 100644
--- a/src/lib/elementary/efl_page_transition_scroll.c
+++ b/src/lib/elementary/efl_page_transition_scroll.c
@@ -550,18 +550,25 @@ _efl_page_transition_scroll_side_page_num_set(Eo *obj,
_page_info_geometry_change(pd, spd);
}
-EOLIAN static void
+EOLIAN static Eina_Bool
_efl_page_transition_scroll_loop_set(Eo *obj,
Efl_Page_Transition_Scroll_Data *pd,
Efl_Ui_Pager_Loop loop)
{
EFL_PAGE_TRANSITION_DATA_GET(obj, spd);
- if (spd->loop == loop) return;
+ if (loop == efl_ui_pager_loop_mode_get(spd->pager.obj))
+ return EINA_TRUE;
+
+ if ((loop == EFL_UI_PAGER_LOOP_ENABLED) &&
+ (efl_content_count(spd->pager.obj) < (pd->page_info_num - 1)))
+ return EINA_FALSE;
efl_page_transition_loop_set(efl_super(obj, MY_CLASS), loop);
_content_show(pd, spd);
+
+ return EINA_TRUE;
}
EOLIAN static Eo *
diff --git a/src/lib/elementary/efl_ui_pager.c b/src/lib/elementary/efl_ui_pager.c
index 729fcfd586..ba20c6192d 100644
--- a/src/lib/elementary/efl_ui_pager.c
+++ b/src/lib/elementary/efl_ui_pager.c
@@ -773,14 +773,21 @@ _efl_ui_pager_scroll_block_set(Eo *obj EINA_UNUSED,
pd->next_block = next;
}
-EOLIAN static void
+EOLIAN static Eina_Bool
_efl_ui_pager_loop_mode_set(Eo *obj EINA_UNUSED,
Efl_Ui_Pager_Data *pd,
Efl_Ui_Pager_Loop loop)
{
- pd->loop = loop;
+ if (pd->loop == loop) return EINA_TRUE;
+
+ if (!pd->transition) return EINA_FALSE;
- efl_page_transition_loop_set(pd->transition, loop);
+ if (efl_page_transition_loop_set(pd->transition, loop))
+ {
+ pd->loop = loop;
+ return EINA_TRUE;
+ }
+ else return EINA_FALSE;
}
EOLIAN static Efl_Ui_Pager_Loop
diff --git a/src/lib/elementary/efl_ui_pager.eo b/src/lib/elementary/efl_ui_pager.eo
index 4962f782d6..7ccdd0c791 100644
--- a/src/lib/elementary/efl_ui_pager.eo
+++ b/src/lib/elementary/efl_ui_pager.eo
@@ -68,6 +68,11 @@ class Efl.Ui.Pager extends Efl.Ui.Layout implements Efl.Pack_Linear
[[Pager is not scrolled after it's scrolled to the end by default.
This property gives the option to make a loop through pages.
]]
+ set {
+ return: bool; [[$true on success, $false otherwise]]
+ }
+ get {
+ }
values {
loop: Efl.Ui.Pager_Loop;
}
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index 010643d7b5..2de703ca2c 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -775,7 +775,7 @@ EOAPI void efl_page_transition_padding_size_set(Eo *obj, int padding);
EOAPI void efl_page_transition_update(Eo *obj, double pos);
EOAPI void efl_page_transition_curr_page_change(Eo *obj, double move);
EOAPI void efl_page_transition_pack_end(Eo *obj, Efl_Gfx_Entity *subobj);
-EOAPI void efl_page_transition_loop_set(Eo *obj, Efl_Ui_Pager_Loop loop);
+EOAPI Eina_Bool efl_page_transition_loop_set(Eo *obj, Efl_Ui_Pager_Loop loop);
EOAPI void efl_page_indicator_update(Eo *obj, double pos);
EOAPI void efl_page_indicator_pack(Eo *obj, int index);