return ECORE_CALLBACK_CANCEL;
}
+
+BoxInfoPtr Box::getBoxInfo()
+{
+ LogD("enter");
+ return m_boxInfo;
+}
bool changePeriod(float period);
bool isCurrentTab();
time_t getLastUpdateRequestTime();
+ BoxInfoPtr getBoxInfo();
+
~Box();
private:
contentInfo()
{
};
+
+ BoxInfo() :
+ boxType(),
+ boxId(),
+ instanceId(),
+ boxWidth(0),
+ boxHeight(0),
+ pdWidth(0),
+ pdHeight(0),
+ pdX(0.0f),
+ pdY(0.0f),
+ priority(0),
+ period(0),
+ contentInfo()
+ {
+ };
};
typedef std::shared_ptr<struct BoxInfo> BoxInfoPtr;
case REQUEST_CMD_UPDATE_BOX:
result = requestUpdateBox(boxInfo->boxId, boxInfo->contentInfo);
break;
+ case REQUEST_CMD_CHANGE_LANGUAGE:
+ result = requestChangeLanguage(boxInfo->instanceId);
+ break;
default:
LogD("not available request type");
break;
return true;
}
+bool BoxManager::requestChangeLanguage(std::string& instanceId)
+{
+ LogD("enter");
+
+ IBoxPtr box;
+ box.reset();
+
+ time_t requestTime = time(NULL);
+
+ for (auto it = m_boxMap.begin(); it != m_boxMap.end(); ++it) {
+ if (it->second) {
+ box = it->second;
+ box->update(requestTime, box->getBoxInfo()->contentInfo);
+ }
+ }
+ return true;
+}
+
void BoxManager::insertBoxMap(std::string& instanceId, IBoxPtr box)
{
if (!searchBoxMap(instanceId)) {
virtual bool requestClosePd(std::string& instanceId);
virtual bool requestChangePeriod(std::string& instanceId, float period);
virtual bool requestUpdateBox(std::string& boxId, std::string& contentInfo);
+ virtual bool requestChangeLanguage(std::string& instanceId);
// ewk context deleter
struct EwkContextDeleter {
virtual bool changePeriod(float period) = 0;
virtual bool isCurrentTab() = 0;
virtual time_t getLastUpdateRequestTime() = 0;
+ virtual BoxInfoPtr getBoxInfo() = 0;
//virtual IBox& operator=(const IBox& rhs) = 0;
//virtual bool operator==(const IBox& rhs) const = 0;
#include <Ecore_X.h>
#include <provider.h>
#include <livebox-service.h>
+#include <appcore-efl.h>
#include <Core/Util/Log.h>
#include <Plugin/IBoxPluginConnector.h>
#include <Plugin/BoxPluginConnector.h>
BoxDaemonImpl::BoxDaemonImpl()
: m_pluginConnector(BoxPluginConnector::create())
{
+ appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, requestChangeLanguageCallback, this);
}
BoxDaemonImpl::~BoxDaemonImpl()
delete jobInfo;
}
+int BoxDaemonImpl::requestChangeLanguageCallback(void* data)
+{
+ LogD("enter");
+
+ BoxDaemonImpl* This = static_cast<BoxDaemonImpl*>(data);
+ BoxInfoPtr info = BoxInfoPtr(new BoxInfo());
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_CHANGE_LANGUAGE, info, This);
+
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+ return 0;
+}
static int resumeCallback(ProviderEventArgPtr arg, void* data);
static int boxPeriodChangeCallback(ProviderEventArgPtr arg, void* data);
static int boxUpdateCallback(ProviderEventArgPtr arg, void* data);
+ // callback for app-core event
+ static int requestChangeLanguageCallback(void* data);
// common private functions
void setProviderCallbacks(ProviderCallbacks& callbacks);
LogD("enter");
// in case of request of resume all or pause all, all plugins should handle that.
- if (type == REQUEST_CMD_RESUME_ALL || type == REQUEST_CMD_PAUSE_ALL) {
+ if (type == REQUEST_CMD_RESUME_ALL ||
+ type == REQUEST_CMD_PAUSE_ALL ||
+ type == REQUEST_CMD_CHANGE_LANGUAGE) {
for (auto it = m_pluginMap.begin();
it != m_pluginMap.end(); ++it)
{
if (it->second) {
- // In this case, boxInfo doesn't have any meaning
it->second->command(type, boxInfo);
}
}
REQUEST_CMD_PAUSE_ALL,
REQUEST_CMD_CHANGE_PERIOD,
REQUEST_CMD_UPDATE_BOX,
+ REQUEST_CMD_CHANGE_LANGUAGE
} request_cmd_type;
// definition of interface function type