summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwang.an <jinwang.an@samsung.com>2018-09-17 13:43:36 +0900
committerjinwang.an <jinwang.an@samsung.com>2018-09-17 14:11:46 +0900
commit2ec2e0d84c46d8f752c605ad22215f6b808e4ba4 (patch)
tree570c5b0df980f9e89998ffe226c737d9ff90ea08
parent494ae351a107b89d0d0b2c053634f705d63070a8 (diff)
downloadwatch-setting-2ec2e0d84c46d8f752c605ad22215f6b808e4ba4.tar.gz
watch-setting-2ec2e0d84c46d8f752c605ad22215f6b808e4ba4.tar.bz2
watch-setting-2ec2e0d84c46d8f752c605ad22215f6b808e4ba4.zip
- To use thread safety function. Change-Id: I6b76ef9b70a2fb483a50b5c372b4378117a11f9c Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rw-r--r--include/setting-connection.h2
-rw-r--r--src/setting-connection.c4
-rw-r--r--src/setting-datausage.c42
3 files changed, 27 insertions, 21 deletions
diff --git a/include/setting-connection.h b/include/setting-connection.h
index 925b4e6..06b8679 100644
--- a/include/setting-connection.h
+++ b/include/setting-connection.h
@@ -35,7 +35,9 @@ enum {
/* SETTING_CONNECTION_BT_ALERTS, */
SETTING_CONNECTION_FLIGHT_MODE,
SETTING_CONNECTION_LOCATION,
+#ifndef FEATURE_SETTING_EMUL
SETTING_CONNECTION_DATAUSAGE
+#endif
};
struct _connection_menu_item {
diff --git a/src/setting-connection.c b/src/setting-connection.c
index 972e8a5..45564cf 100644
--- a/src/setting-connection.c
+++ b/src/setting-connection.c
@@ -68,7 +68,9 @@ static struct _connection_menu_item connection_menu_its[] = {
{ "IDS_ST_BODY_NFC", SETTING_CONNECTION_NFC, _nfc_cb },
/* { "Alerts", SETTING_CONNECTION_BT_ALERTS, _alerts_cb }, */
{ "IDS_ST_BODY_FLIGHT_MODE", SETTING_CONNECTION_FLIGHT_MODE, _flight_mode_cb },
+#ifndef FEATURE_SETTING_EMUL
{ "Data usage", SETTING_CONNECTION_DATAUSAGE, _datausage_cb},
+#endif
{ "IDS_ST_BODY_LOCATION", SETTING_CONNECTION_LOCATION, _location_cb },
};
@@ -686,9 +688,11 @@ Evas_Object *_create_connection_list(void *data)
/* case SETTING_CONNECTION_BT_ALERTS: */
itc_tmp = itc;
break;
+#ifndef FEATURE_SETTING_EMUL
case SETTING_CONNECTION_DATAUSAGE:
itc_tmp = text1;
break;
+#endif
case SETTING_CONNECTION_FLIGHT_MODE:
itc_tmp = text_icon;
break;
diff --git a/src/setting-datausage.c b/src/setting-datausage.c
index abc54f4..481ee2f 100644
--- a/src/setting-datausage.c
+++ b/src/setting-datausage.c
@@ -1,4 +1,5 @@
-/* * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
*
* Licensed under the Flora License, Version 1.0 (the License);
* you may not use this file except in compliance with the License.
@@ -793,17 +794,18 @@ static void _set_stats_time_frame_from_cycle(Data_Limits_T *limits)
struct tm tm_past_delta = {0,};
struct tm tm_future_delta = {0,};
time(&now);
- struct tm *tm_now = localtime(&now);
- tm_now->tm_sec = 1;
- tm_now->tm_min = 0;
- tm_now->tm_hour = 0;
- tm_past_delta = *tm_now;
- tm_future_delta = *tm_now;
+ struct tm tm_now = {0};
+ localtime_r(&now, &tm_now);
+ tm_now.tm_sec = 1;
+ tm_now.tm_min = 0;
+ tm_now.tm_hour = 0;
+ tm_past_delta = tm_now;
+ tm_future_delta = tm_now;
switch (limits->cycle_mode) {
case CYCLE_MODE_MONTHLY:
tm_past_delta.tm_mday = limits->cycle_start;
- if (tm_now->tm_mday >= limits->cycle_start) {
+ if (tm_now.tm_mday >= limits->cycle_start) {
tm_future_delta.tm_mon++;
tm_future_delta.tm_sec = 0;
tm_future_delta.tm_min = 0;
@@ -816,12 +818,12 @@ static void _set_stats_time_frame_from_cycle(Data_Limits_T *limits)
break;
case CYCLE_MODE_WEEKLY:
vconf_get_int(VCONFKEY_SETAPPL_WEEKOFDAY_FORMAT_INT, &weekofDay);
- if (tm_now->tm_wday >= weekofDay) {
- tm_past_delta.tm_mday = tm_now->tm_mday - (tm_now->tm_wday - weekofDay);
- tm_future_delta.tm_mday = tm_now->tm_mday + (6 - tm_now->tm_wday + weekofDay);
+ if (tm_now.tm_wday >= weekofDay) {
+ tm_past_delta.tm_mday = tm_now.tm_mday - (tm_now.tm_wday - weekofDay);
+ tm_future_delta.tm_mday = tm_now.tm_mday + (6 - tm_now.tm_wday + weekofDay);
} else {
- tm_past_delta.tm_mday = tm_now->tm_mday - (7 - weekofDay + tm_now->tm_wday);
- tm_future_delta.tm_mday = tm_now->tm_mday + (weekofDay - tm_now->tm_wday - 1);
+ tm_past_delta.tm_mday = tm_now.tm_mday - (7 - weekofDay + tm_now.tm_wday);
+ tm_future_delta.tm_mday = tm_now.tm_mday + (weekofDay - tm_now.tm_wday - 1);
}
break;
case CYCLE_MODE_DAILY:
@@ -991,7 +993,7 @@ void _data_usage_detail_cb(void *data, Evas_Object *obj, void *event_info)
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
time_t now;
- struct tm *ts;
+ struct tm ts;
char mon[32];
char buf[256];
@@ -1015,8 +1017,8 @@ void _data_usage_detail_cb(void *data, Evas_Object *obj, void *event_info)
ad->popup = popup;
now = time(NULL);
- ts = localtime(&now);
- strftime(mon, sizeof(mon)-1, "%b", ts);
+ localtime_r(&now, &ts);
+ strftime(mon, sizeof(mon)-1, "%b", &ts);
if (vconf_get_int(VCONFKEY_SETAPPL_DATA_START_DATE_INT, &start_day) < 0)
ERR("Error! to get VCONFKEY_SETAPPL_DATA_USAGE_CYCLE_INT");
@@ -1027,7 +1029,7 @@ void _data_usage_detail_cb(void *data, Evas_Object *obj, void *event_info)
snprintf(buf, sizeof(buf)-1, "%s %d-%d:\n You've used "
"about %s %s. "
"Your service provider may measure your suage differently.",
- mon, start_day, ts->tm_mday, total, unit);
+ mon, start_day, ts.tm_mday, total, unit);
Evas_Object *layout;
layout = elm_layout_add(popup);
@@ -1475,8 +1477,6 @@ static void _data_usage_cycle_gl_cb(void *data, Evas_Object *obj, void *event_in
return;
}
- g_sim_limit.cycle_mode = cycle_index;
-
if (g_start_date_item)
elm_object_item_disabled_set(g_start_date_item, (!cycle_index) ? false : true);
elm_genlist_realized_items_update(g_data_usage_genlist);
@@ -1632,7 +1632,7 @@ static void _start_day_done_clicked_cb(void* data, Evas_Object* obj, void* event
int _startDate = elm_spinner_value_get(g_start_spinner);
if (vconf_set_int(VCONFKEY_SETAPPL_DATA_START_DATE_INT, _startDate) < 0)
- ERR("Error! to set VCONFKEY_SETAPPL_DATA_USAGE_CYCLE_INT");
+ ERR("Error! to set VCONFKEY_SETAPPL_DATA_START_DATE_INT");
ERR("_startDate:%d", _startDate);
elm_naviframe_item_pop(g_app_context->nf);
@@ -1673,7 +1673,7 @@ void _start_day_cb(void *data, Evas_Object *obj, void *event_info)
int _startDate = 1;
if (vconf_get_int(VCONFKEY_SETAPPL_DATA_START_DATE_INT, &_startDate) < 0)
- ERR("Error! to set VCONFKEY_SETAPPL_DATA_USAGE_CYCLE_INT");
+ ERR("Error! to set VCONFKEY_SETAPPL_DATA_START_DATE_INT");
elm_spinner_wrap_set(g_start_spinner, EINA_TRUE);
elm_spinner_min_max_set(g_start_spinner, 1, 31);