static void ReceiveSuspendSignalCb(GDBusConnection*, const gchar*,
const gchar*, const gchar*, const gchar*, GVariant*, gpointer);
static void OnLowBatteryCb(keynode_t* key, void* data);
+ static void OnTimeZoneChangedCb(keynode_t* key, void* data);
static void LockCb(keynode_t* node, void* user_data);
static void AutoRotationChangedCb(sensor_t sensor, unsigned int event_type,
sensor_data_t* data, void* user_data);
}
}
+void AppCoreBase::Impl::OnTimeZoneChangedCb(keynode_t* key, void* data) {
+ char* time_zone_id = vconf_keynode_get_str(key);
+ if (time_zone_id == nullptr) {
+ return;
+ }
+
+ char* time_zone = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_INT);
+ if (time_zone != nullptr) {
+ AppCoreBase* base = reinterpret_cast<AppCoreBase*>(data);
+ base->impl_->InvokeCallback(std::string(time_zone) + "|" + time_zone_id,
+ IEvent::Type::TIME_ZONE_CHANGED);
+ free(time_zone);
+ }
+}
+
void AppCoreBase::Impl::UnregisterRotationChangedEvent() {
if (!__rotation.ref)
return;
break;
case IEvent::Type::SUSPENDED_STATE_CHANGE:
break;
+ case IEvent::Type::TIME_ZONE_CHANGED:
+ vconf_notify_key_changed(VCONFKEY_SETAPPL_TIMEZONE_ID,
+ impl_->OnTimeZoneChangedCb, this);
+ break;
default:
break;
}
std::shared_ptr<SystemEvent> lang_change_;
std::shared_ptr<SystemEvent> device_orientation_changed_;
std::shared_ptr<SystemEvent> region_change_;
+ std::shared_ptr<SystemEvent> time_zone_change_;
GMainLoop* loop_ = nullptr;
std::queue<UiState> queue_;
mutable std::recursive_mutex mutex_;
IAppCore::IEvent::Type::DEVICE_ORIENTATION_CHANGED, this);
region_change_ = std::make_shared<SystemEvent>(
IAppCore::IEvent::Type::REGION_CHANGE, this);
+ time_zone_change_ = std::make_shared<SystemEvent>(
+ IAppCore::IEvent::Type::TIME_ZONE_CHANGED, this);
}
void AppCoreTaskBase::Impl::LoopInit(int argc, char** argv) {
}
void AppCoreTaskBase::Impl::UnsetSystemEvents() {
+ parent_->RemoveEvent(time_zone_change_);
parent_->RemoveEvent(region_change_);
parent_->RemoveEvent(device_orientation_changed_);
parent_->RemoveEvent(lang_change_);
ConvertRotationState(device_orientation_changed_->GetVal(0)));
} else if (type == IAppCore::IEvent::Type::REGION_CHANGE) {
parent_->OnRegionChanged(region_change_->GetVal(""));
+ } else if (type == IAppCore::IEvent::Type::TIME_ZONE_CHANGED) {
+ parent_->OnTimeZoneChanged(time_zone_change_->GetVal(""));
}
}
void AppCoreTaskBase::OnRegionChanged(const std::string& region) {}
+void AppCoreTaskBase::OnTimeZoneChanged(const std::string& time_zone) {}
+
void AppCoreTaskBase::Run(int argc, char** argv) {
impl_->SetSystemEvents();
AppCoreBase::Run(argc, argv);