efl.ui.clock: correct value_set/get & value_min/max APIs signature.
We could just pass Efl_Time value as copy by value to set time in setter APIs and return Efl_Time value in getter APIs. Thanks to @JackDanielZ for the report. Fixes T6008
This commit is contained in:
parent
cca312d42c
commit
3984148b8e
|
@ -33,7 +33,7 @@ _bt_clicked(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUS
|
|||
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_SECOND, EINA_TRUE);
|
||||
efl_ui_clock_field_visible_set(dt1, EFL_UI_CLOCK_TYPE_DAY, EINA_TRUE);
|
||||
|
||||
efl_ui_clock_value_set(dt1, &new_time);
|
||||
efl_ui_clock_value_set(dt1, new_time);
|
||||
elm_object_disabled_set(dt1, EINA_TRUE);
|
||||
|
||||
elm_object_disabled_set(obj, EINA_TRUE);
|
||||
|
|
|
@ -1105,25 +1105,19 @@ _efl_ui_clock_field_limit_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Ui_Clock_Type
|
|||
|
||||
if (!_field_cmp(fieldtype, &old_time, &sd->curr_time))
|
||||
efl_event_callback_legacy_call(obj, EFL_UI_CLOCK_EVENT_CHANGED, NULL);
|
||||
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_clock_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Clock_Data *sd, struct tm *currtime)
|
||||
EOLIAN static Efl_Time
|
||||
_efl_ui_clock_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Clock_Data *sd)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(currtime, EINA_FALSE);
|
||||
|
||||
*currtime = sd->curr_time;
|
||||
return EINA_TRUE;
|
||||
return sd->curr_time;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_clock_value_set(Eo *obj, Efl_Ui_Clock_Data *sd, struct tm *newtime)
|
||||
EOLIAN static void
|
||||
_efl_ui_clock_value_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Time newtime)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(newtime, EINA_FALSE);
|
||||
|
||||
if (_date_cmp(&sd->curr_time, newtime)) return EINA_TRUE;
|
||||
sd->curr_time = *newtime;
|
||||
if (_date_cmp(&sd->curr_time, &newtime)) return;
|
||||
sd->curr_time = newtime;
|
||||
// apply default field restrictions for curr_time
|
||||
_apply_range_restrictions(&sd->curr_time);
|
||||
// validate the curr_time according to the min_limt and max_limt
|
||||
|
@ -1132,28 +1126,21 @@ _efl_ui_clock_value_set(Eo *obj, Efl_Ui_Clock_Data *sd, struct tm *newtime)
|
|||
_apply_field_limits(obj);
|
||||
|
||||
efl_event_callback_legacy_call(obj, EFL_UI_CLOCK_EVENT_CHANGED, NULL);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_clock_value_min_get(Eo *obj EINA_UNUSED, Efl_Ui_Clock_Data *sd, Efl_Time *mintime)
|
||||
EOLIAN static Efl_Time
|
||||
_efl_ui_clock_value_min_get(Eo *obj EINA_UNUSED, Efl_Ui_Clock_Data *sd)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(mintime, EINA_FALSE);
|
||||
|
||||
*mintime = sd->min_limit;
|
||||
return EINA_TRUE;
|
||||
return sd->min_limit;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_clock_value_min_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Time *mintime)
|
||||
EOLIAN static void
|
||||
_efl_ui_clock_value_min_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Time mintime)
|
||||
{
|
||||
struct tm old_time;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(mintime, EINA_FALSE);
|
||||
|
||||
if (_date_cmp(&sd->min_limit, mintime)) return EINA_TRUE;
|
||||
sd->min_limit = *mintime;
|
||||
if (_date_cmp(&sd->min_limit, &mintime)) return;
|
||||
sd->min_limit = mintime;
|
||||
old_time = sd->curr_time;
|
||||
// apply default field restrictions for min_limit
|
||||
_apply_range_restrictions(&sd->min_limit);
|
||||
|
@ -1164,28 +1151,21 @@ _efl_ui_clock_value_min_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Time *mintime)
|
|||
|
||||
if (!_date_cmp(&old_time, &sd->curr_time))
|
||||
efl_event_callback_legacy_call(obj, EFL_UI_CLOCK_EVENT_CHANGED, NULL);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_clock_value_max_get(Eo *obj EINA_UNUSED, Efl_Ui_Clock_Data *sd, struct tm *maxtime)
|
||||
EOLIAN static Efl_Time
|
||||
_efl_ui_clock_value_max_get(Eo *obj EINA_UNUSED, Efl_Ui_Clock_Data *sd)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(maxtime, EINA_FALSE);
|
||||
|
||||
*maxtime = sd->max_limit;
|
||||
return EINA_TRUE;
|
||||
return sd->max_limit;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_clock_value_max_set(Eo *obj, Efl_Ui_Clock_Data *sd, struct tm *maxtime)
|
||||
EOLIAN static void
|
||||
_efl_ui_clock_value_max_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Time maxtime)
|
||||
{
|
||||
struct tm old_time;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(maxtime, EINA_FALSE);
|
||||
|
||||
if (_date_cmp(&sd->max_limit, maxtime)) return EINA_TRUE;
|
||||
sd->max_limit = *maxtime;
|
||||
if (_date_cmp(&sd->max_limit, &maxtime)) return;
|
||||
sd->max_limit = maxtime;
|
||||
old_time = sd->curr_time;
|
||||
// apply default field restrictions for max_limit
|
||||
_apply_range_restrictions(&sd->max_limit);
|
||||
|
@ -1196,8 +1176,6 @@ _efl_ui_clock_value_max_set(Eo *obj, Efl_Ui_Clock_Data *sd, struct tm *maxtime)
|
|||
|
||||
if (!_date_cmp(&old_time, &sd->curr_time))
|
||||
efl_event_callback_legacy_call(obj, EFL_UI_CLOCK_EVENT_CHANGED, NULL);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
|
@ -131,15 +131,8 @@ class Efl.Ui.Clock (Efl.Ui.Layout)
|
|||
|
||||
Minute: default value range is from 0 to 59.
|
||||
]]
|
||||
set {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
|
||||
keys {
|
||||
mintime: ptr(Efl.Time); [[Time structure containing the minimum time value.]]
|
||||
values {
|
||||
mintime: Efl.Time; [[Time structure containing the minimum time value.]]
|
||||
}
|
||||
}
|
||||
@property value_max {
|
||||
|
@ -158,15 +151,8 @@ class Efl.Ui.Clock (Efl.Ui.Layout)
|
|||
|
||||
Minute: default value range is from 0 to 59.
|
||||
]]
|
||||
set {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
|
||||
keys {
|
||||
maxtime: ptr(Efl.Time); [[Time structure containing the minimum time value.]]
|
||||
values {
|
||||
maxtime: Efl.Time; [[Time structure containing the maximum time value.]]
|
||||
}
|
||||
}
|
||||
@property value {
|
||||
|
@ -185,14 +171,8 @@ class Efl.Ui.Clock (Efl.Ui.Layout)
|
|||
|
||||
Minute: default value range is from 0 to 59.
|
||||
]]
|
||||
set {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
keys {
|
||||
curtime: ptr(Efl.Time); [[Time structure containing the minimum time value.]]
|
||||
values {
|
||||
curtime: Efl.Time; [[Time structure containing the time value.]]
|
||||
}
|
||||
}
|
||||
@property field_visible {
|
||||
|
|
|
@ -82,24 +82,29 @@ elm_datetime_field_limit_get(const Evas_Object *obj, Elm_Datetime_Field_Type fie
|
|||
EAPI Eina_Bool
|
||||
elm_datetime_value_min_set(Evas_Object *obj, const Efl_Time *mintime)
|
||||
{
|
||||
return efl_ui_clock_value_min_set(obj, (Efl_Time *)mintime);
|
||||
if (mintime) efl_ui_clock_value_min_set(obj, *mintime);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_datetime_value_min_get(const Evas_Object *obj, Efl_Time *mintime)
|
||||
{
|
||||
return efl_ui_clock_value_min_get(obj, mintime);
|
||||
if (mintime) *mintime = efl_ui_clock_value_min_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_datetime_value_set(Evas_Object *obj, const Efl_Time *newtime)
|
||||
{
|
||||
return efl_ui_clock_value_set(obj, (Efl_Time *)newtime);
|
||||
if (newtime) efl_ui_clock_value_set(obj, *newtime);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool elm_datetime_value_get(const Evas_Object *obj, Efl_Time *currtime)
|
||||
EAPI Eina_Bool
|
||||
elm_datetime_value_get(const Evas_Object *obj, Efl_Time *currtime)
|
||||
{
|
||||
return efl_ui_clock_value_get(obj, currtime);
|
||||
if (currtime) *currtime = efl_ui_clock_value_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -116,11 +121,13 @@ EAPI Eina_Bool elm_datetime_field_visible_get(const Evas_Object *obj, Elm_Dateti
|
|||
EAPI Eina_Bool
|
||||
elm_datetime_value_max_set(Evas_Object *obj, const Efl_Time *maxtime)
|
||||
{
|
||||
return efl_ui_clock_value_max_set(obj, (Efl_Time *)maxtime);
|
||||
if (maxtime) efl_ui_clock_value_max_set(obj, *maxtime);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_datetime_value_max_get(const Evas_Object *obj, Efl_Time *maxtime)
|
||||
{
|
||||
return efl_ui_clock_value_max_get(obj, maxtime);
|
||||
if (maxtime) *maxtime = efl_ui_clock_value_max_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -97,13 +97,13 @@ _diskselector_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
disk_data = (DiskItem_Data *)elm_object_item_data_get(event->info);
|
||||
if (!disk_data || !(disk_data->ctx_mod)) return;
|
||||
|
||||
efl_ui_clock_value_get(disk_data->ctx_mod->mod_data.base, &curr_time);
|
||||
curr_time = efl_ui_clock_value_get(disk_data->ctx_mod->mod_data.base);
|
||||
fmt = disk_data->ctx_mod->mod_data.field_format_get(disk_data->ctx_mod->mod_data.base, disk_data->sel_field_type);
|
||||
if ((disk_data->sel_field_type == EFL_UI_CLOCK_TYPE_HOUR) && ((!strncmp(fmt, "%I", FIELD_FORMAT_LEN)) ||
|
||||
(!strncmp(fmt, "%l", FIELD_FORMAT_LEN))) && (curr_time.tm_hour >= 12))
|
||||
disk_data->sel_field_value += 12;
|
||||
_field_value_set(&curr_time, disk_data->sel_field_type, disk_data->sel_field_value);
|
||||
efl_ui_clock_value_set(disk_data->ctx_mod->mod_data.base, &curr_time);
|
||||
efl_ui_clock_value_set(disk_data->ctx_mod->mod_data.base, curr_time);
|
||||
evas_object_hide(disk_data->ctx_mod->ctxpopup);
|
||||
}
|
||||
|
||||
|
@ -116,10 +116,10 @@ _ampm_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
ctx_mod = (Ctxpopup_Module_Data *)data;
|
||||
if (!ctx_mod) return;
|
||||
|
||||
efl_ui_clock_value_get(ctx_mod->mod_data.base, &curr_time);
|
||||
curr_time = efl_ui_clock_value_get(ctx_mod->mod_data.base);
|
||||
if (curr_time.tm_hour >= 12) curr_time.tm_hour -= 12;
|
||||
else curr_time.tm_hour += 12;
|
||||
efl_ui_clock_value_set(ctx_mod->mod_data.base, &curr_time);
|
||||
efl_ui_clock_value_set(ctx_mod->mod_data.base, curr_time);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -169,7 +169,7 @@ _field_clicked_cb(void *data, const Efl_Event *event)
|
|||
|
||||
field_type = (Efl_Ui_Clock_Type )evas_object_data_get(event->object, "_field_type");
|
||||
fmt = ctx_mod->mod_data.field_format_get(ctx_mod->mod_data.base, field_type);
|
||||
efl_ui_clock_value_get(ctx_mod->mod_data.base, &time1);
|
||||
time1 = efl_ui_clock_value_get(ctx_mod->mod_data.base);
|
||||
val = _field_value_get(&time1, field_type);
|
||||
ctx_mod->mod_data.field_limit_get(ctx_mod->mod_data.base, field_type, &min, &max);
|
||||
|
||||
|
@ -283,7 +283,7 @@ field_value_display(Efl_Ui_Clock_Module_Data *module_data, Evas_Object *obj)
|
|||
ctx_mod = (Ctxpopup_Module_Data *)module_data;
|
||||
if (!ctx_mod || !obj) return;
|
||||
|
||||
efl_ui_clock_value_get(ctx_mod->mod_data.base, &tim);
|
||||
tim = efl_ui_clock_value_get(ctx_mod->mod_data.base);
|
||||
field_type = (Efl_Ui_Clock_Type )evas_object_data_get(obj, "_field_type");
|
||||
fmt = ctx_mod->mod_data.field_format_get(ctx_mod->mod_data.base, field_type);
|
||||
buf[0] = 0;
|
||||
|
|
Loading…
Reference in New Issue