diff options
author | Youngjae Shin <yj99.shin@samsung.com> | 2012-02-17 16:24:04 +0900 |
---|---|---|
committer | Youngjae Shin <yj99.shin@samsung.com> | 2012-02-17 16:24:04 +0900 |
commit | b7f4e4cfe7951a4cb52683c28172a36e8bc8666e (patch) | |
tree | ecf2cb3ab51c05fc1c62793444cf4702407e8d35 | |
parent | 4d9b599ed69e0d5a99c7e883dbc21414fe3eaf41 (diff) | |
download | calendar-b7f4e4cfe7951a4cb52683c28172a36e8bc8666e.tar.gz calendar-b7f4e4cfe7951a4cb52683c28172a36e8bc8666e.tar.bz2 calendar-b7f4e4cfe7951a4cb52683c28172a36e8bc8666e.zip |
fix errata
-rwxr-xr-x | src/calendar.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/calendar.c b/src/calendar.c index 119617a..c91ec63 100755 --- a/src/calendar.c +++ b/src/calendar.c @@ -361,30 +361,41 @@ int calendar_event_set_location(calendar_event_h event, const char *location) } int calendar_event_get_reminder(calendar_event_h event,calendar_reminder_interval_type_e *reminder_interval_type, int *reminder_interval) -{ +{ CALENDAR_NULL_ARG_CHECK(event); CALENDAR_NULL_ARG_CHECK(reminder_interval_type); - CALENDAR_NULL_ARG_CHECK(reminder_interval); - - *reminder_interval_type = calendar_svc_struct_get_int((cal_struct*)((calendar_event_s*)event)->event_legacy, - CAL_VALUE_INT_ALARM_TICK_UNIT); - *reminder_interval = calendar_svc_struct_get_int((cal_struct*)((calendar_event_s*)event)->event_legacy, - CAL_VALUE_INT_ALARM_TICK); + CALENDAR_NULL_ARG_CHECK(reminder_interval); - return CALENDAR_ERROR_NONE; + GList* list = NULL; + if(calendar_svc_struct_get_list((cal_struct*)((calendar_event_s*)event)->event_legacy, + CAL_VALUE_LST_ALARM, &list) != CAL_SUCCESS) { + LOGE("[%s] CALENDAR_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALENDAR_ERROR_INVALID_PARAMETER); + return CALENDAR_ERROR_INVALID_PARAMETER; + } + + if (g_list_length(list) == 0) { + LOGE("[%s] CALENDAR_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALENDAR_ERROR_INVALID_PARAMETER); + return CALENDAR_ERROR_INVALID_PARAMETER; + } + cal_value *value = (cal_value *)list->data; + + *reminder_interval_type = calendar_svc_value_get_int(value, CAL_VALUE_INT_ALARMS_TICK_UNIT); + *reminder_interval = calendar_svc_value_get_int(value, CAL_VALUE_INT_ALARMS_TICK); + + return CALENDAR_ERROR_NONE; } int calendar_event_set_reminder(calendar_event_h event,calendar_reminder_interval_type_e reminder_interval_type, int reminder_interval) -{ +{ CALENDAR_NULL_ARG_CHECK(event); cal_value *value = calendar_svc_value_new(CAL_VALUE_LST_ALARM); - if(calendar_svc_value_set_int(value, CAL_VALUE_INT_ALARM_TICK_UNIT, reminder_interval_type) != CAL_SUCCESS) { + if(calendar_svc_value_set_int(value, CAL_VALUE_INT_ALARMS_TICK_UNIT, reminder_interval_type) != CAL_SUCCESS) { calendar_svc_value_free(&value); LOGE("[%s] CALENDAR_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALENDAR_ERROR_INVALID_PARAMETER); return CALENDAR_ERROR_INVALID_PARAMETER; } - + if(calendar_svc_value_set_int(value, CAL_VALUE_INT_ALARMS_TICK, reminder_interval) != CAL_SUCCESS) { calendar_svc_value_free(&value); LOGE("[%s] CALENDAR_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALENDAR_ERROR_INVALID_PARAMETER); @@ -394,7 +405,7 @@ int calendar_event_set_reminder(calendar_event_h event,calendar_reminder_interva GList* list = NULL; calendar_svc_struct_store_list((cal_struct*)((calendar_event_s*)event)->event_legacy, CAL_VALUE_LST_ALARM, NULL); list = g_list_append(list, value); - + if(calendar_svc_struct_store_list((cal_struct*)((calendar_event_s*)event)->event_legacy, CAL_VALUE_LST_ALARM, list) != CAL_SUCCESS) { calendar_svc_value_free(&value); @@ -407,7 +418,7 @@ int calendar_event_set_reminder(calendar_event_h event,calendar_reminder_interva } int calendar_event_get_recurrence_frequency(calendar_event_h event,calendar_recurrence_frequency_e *recurrence_frequency) -{ +{ CALENDAR_NULL_ARG_CHECK(event); CALENDAR_NULL_ARG_CHECK(recurrence_frequency); |