case OFFSET:
s.append("OFFSET");
break;
+ case TIMEZONE_PATH:
+ s.append("TIMEZONE_PATH");
+ break;
default:
ERR("Invalid type!");
return NULL;
if (ret != PREFERENCE_ERROR_NONE) {
ERR("preference_set_int failed[%d]: %s", ret, get_error_message(ret));
}
+ ret = preference_set_string(GetItemKey(TIMEZONE_PATH, i), item->tzpath.c_str());
+ if (ret != PREFERENCE_ERROR_NONE) {
+ ERR("preference_set_string failed[%d]: %s", ret, get_error_message(ret));
+ return;
+ }
}
const model::Location *WorldClock::LoadItem(int i)
char *city_name;
char *country_name;
+ char *timezone_path;
int ret = preference_get_string(GetItemKey(CITY, i), &city_name);
if (ret != PREFERENCE_ERROR_NONE) {
delete location;
return NULL;
}
+ ret = preference_get_string(GetItemKey(TIMEZONE_PATH, i), &timezone_path);
+ if (ret != PREFERENCE_ERROR_NONE) {
+ ERR("preference_get_string failed[%d]: %s", ret, get_error_message(ret));
+ free(city_name);
+ free(country_name);
+ delete location;
+ return NULL;
+ }
location->name = city_name;
location->country = country_name;
+ location->tzpath = timezone_path;
free(city_name);
free(country_name);
+ free(timezone_path);
return location;
}
for (auto l: locations) {
DBG();
LocationDeleteItemData *data = new LocationDeleteItemData;
- Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset(l->gmt_offset_).c_str());
+ Time t = Time::Now().InTimezone(l->tzpath.c_str());
int local_timezone_offset = Time::GetTimezoneOffset(Time::GetCurrentTimezone().c_str());
ss.str(std::string());
ss.clear();
LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
if (!strcmp(part, "time")) {
- Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset(ldid->gmt_offset).c_str());
+ Time t = Time::Now().InTimezone(ldid->location->tzpath.c_str());
ldid->time = elm_table_add(obj);
evas_object_size_hint_align_set(ldid->time, 0.0, 0.0);
for (auto it = locations.begin(); it != locations.end(); it++) {
LocationReorderItemData *lrid = new LocationReorderItemData;
- Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset((*it)->gmt_offset_).c_str());
+ Time t = Time::Now().InTimezone((*it)->tzpath.c_str());
int local_timezone_offset = Time::GetTimezoneOffset(Time::GetCurrentTimezone().c_str());
ss.str(std::string());
LocationReorderItemData *lrid = static_cast<LocationReorderItemData *>(data);
if (!strcmp(part, "time")) {
- Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset(lrid->gmt_offset).c_str());
+ Time t = Time::Now().InTimezone(lrid->location->tzpath.c_str());
lrid->time = elm_table_add(obj);
evas_object_size_hint_align_set(lrid->time, 0.0, 0.0);
void WorldClockView::AppendItemToCustomList(const model::Location *location)
{
LocationItemData *data = new LocationItemData;
- Time t = Time::Now().InTimezone(
- Time::GetTimezoneNameByOffset(location->gmt_offset_).c_str());
+
+ Time t = Time::Now().InTimezone(location->tzpath.c_str());
int local_timezone_offset = Time::GetTimezoneOffset(Time::GetCurrentTimezone().c_str());
std::stringstream ss;
elm_table_pack(lid->time, ampm, 2, 0, 1, 1);
elm_table_pack(lid->time, dynamic_padding, 3, 0, 1, 1);
- Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset(lid->gmt_offset).c_str());
+ Time t = Time::Now().InTimezone(lid->location->tzpath.c_str());
std::string timezone_time;
std::string meridiem;
char *city_name;
char *country_name;
char *timezone;
+ char *tzpath;
char **timezone_splited;
int h = 0;
ret = app_control_get_extra_data(reply, "country_name", &country_name);
if (ret != APP_CONTROL_ERROR_NONE) {
ERR("app_control_get_extra_data failed[%d]: %s", ret, get_error_message(ret));
+ free(city_name);
return;
}
ret = app_control_get_extra_data(reply, "timezone", &timezone);
if (ret != APP_CONTROL_ERROR_NONE) {
ERR("app_control_get_extra_data failed[%d]: %s", ret, get_error_message(ret));
+ free(city_name);
+ free(country_name);
+ return;
+ }
+ ret = app_control_get_extra_data(reply, "tzpath", &tzpath);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ ERR("app_control_get_extra_data failed[%d]: %s", ret, get_error_message(ret));
+ free(city_name);
+ free(country_name);
+ free(timezone);
return;
}
}
int gmt_offset = (60*h + min) * ((timezone[0] == '-') ? (-1) : (1));
- model::Location *l = new model::Location{
- std::string(city_name),
- std::string(country_name),
- gmt_offset,};
+ model::Location *l = new model::Location{ std::string(city_name),
+ std::string(country_name), gmt_offset, 0, 0, false, std::string(tzpath),};
WorldClockView *view = static_cast<WorldClockView *>(user_data);
view->SetItemToAdd(l);
free(city_name);
free(country_name);
free(timezone);
+ free(tzpath);
}
void WorldClockView::AddButtonClicked(void *data, Evas_Object *obj, void *event_info)