From: jungmin76.park Date: Thu, 13 Jun 2013 13:37:08 +0000 (+0900) Subject: RequestUpdate appwigdet when font/lang/country is changed. X-Git-Tag: accepted/tizen/20130912.081830~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8578eebeb16906c748094b16e594219d5903cf91;p=platform%2Fframework%2Fnative%2Fappwidget-service.git RequestUpdate appwigdet when font/lang/country is changed. Change-Id: I80fa10814cccdefd9d4b64b45c69fe9752499107 Signed-off-by: jungmin76.park --- diff --git a/inc/FShell_AppWidgetManagerService.h b/inc/FShell_AppWidgetManagerService.h index fcd3dcc..385e176 100644 --- a/inc/FShell_AppWidgetManagerService.h +++ b/inc/FShell_AppWidgetManagerService.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "FShell_AppWidgetContext.h" #include "FShell_AppWidgetManagerStub.h" @@ -40,6 +41,7 @@ namespace Tizen { namespace Shell { namespace App { class AppWidgetManagerService :public Tizen::Shell::App::_AppWidgetManagerStub ,public Tizen::Base::Runtime::ITimerEventListener + ,public Tizen::System::ISettingEventListener { public: static AppWidgetManagerService* GetInstance(void); @@ -68,7 +70,7 @@ private: static int OnAppWidgetResumeAll(struct event_arg *pArg, void* pData); static int OnAppWidgetClick(struct event_arg *arg, void* data); static int OnAppWidgetResize(struct event_arg *arg, void* data); - static int OnAppWidgetPeriodChaned(struct event_arg *arg, void* data); + static int OnAppWidgetPeriodChanged(struct event_arg *arg, void* data); static int OnAppWidgetRecreate(struct event_arg *arg, void* data); // stub implementations @@ -89,6 +91,7 @@ private: // ipc virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId); virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId); + virtual void OnSettingChanged(Tizen::Base::String & key); // helpers result SetIpcClientIds(const Tizen::App::AppId& appId, int clientId); diff --git a/src/FShell_AppWidgetManagerService.cpp b/src/FShell_AppWidgetManagerService.cpp index 327f2ba..c107964 100644 --- a/src/FShell_AppWidgetManagerService.cpp +++ b/src/FShell_AppWidgetManagerService.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -99,6 +100,8 @@ AppWidgetManagerService::Construct(const char* pIdForCoreDaemon) r = __handlerThread.Start(); SysTryReturnResult(NID_SHELL, IsFailed(r) == false, r, "Event thread Start failure."); + SettingInfo::AddSettingEventListener(*this); + return InitializeCoreDaemonEventReceiver(pIdForCoreDaemon); } @@ -229,6 +232,24 @@ AppWidgetManagerService::OnIpcClientDisconnected(const _IpcServer& server, int c this->SetIpcClientIds(appId, -1); } +wchar_t KEY_SETTING_FONT_SIZE[] = L"http://tizen.org/setting/font.size"; +wchar_t KEY_SETTING_FONT_TYPE[] = L"http://tizen.org/setting/font.type"; +wchar_t KEY_SETTING_LANGUAGE[] = L"http://tizen.org/setting/locale.language"; +wchar_t KEY_SETTING_COUNTRY[] = L"http://tizen.org/setting/locale.country"; + +void +AppWidgetManagerService::OnSettingChanged(Tizen::Base::String& key) +{ + if( key == KEY_SETTING_FONT_TYPE +// || key == KEY_SETTING_FONT_SIZE + || key == KEY_SETTING_LANGUAGE + || key == KEY_SETTING_COUNTRY ) + { + SysLog(NID_SHELL, "'%ls' is changed.", key.GetPointer() ); + RequestUpdate("", "", ""); + } +} + result AppWidgetManagerService::AddAppWidget(_AppWidgetContext* pAppWidgetContext) { @@ -470,7 +491,7 @@ AppWidgetManagerService::OnAppWidgetResize(struct event_arg *arg, void* data) } int -AppWidgetManagerService::OnAppWidgetPeriodChaned(struct event_arg *arg, void* data) +AppWidgetManagerService::OnAppWidgetPeriodChanged(struct event_arg *arg, void* data) { SysTryReturn(NID_SHELL, arg != null, 0, E_SUCCESS, "arg is null!"); SysSecureLog(NID_SHELL, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id); @@ -537,7 +558,7 @@ AppWidgetManagerService::InitializeCoreDaemonEventReceiver(const char *pIdForCor cbs.pd_destroy = OnAppWidgetPopupDestroy, cbs.clicked = OnAppWidgetClick, cbs.resize = OnAppWidgetResize, - cbs.set_period = OnAppWidgetPeriodChaned; + cbs.set_period = OnAppWidgetPeriodChanged; cbs.lb_recreate = OnAppWidgetRecreate;/* Recover from the fault of slave */ //cbs.content_event = OnAppWidgetContentEvent, @@ -560,18 +581,22 @@ AppWidgetManagerService::DeinitializeCoreDaemonEventReceiver(void) /////////////////////////////////////////////////////// // stub implementation /////////////////////////////////////////////////////// + + result AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) { - SysLog(NID_SHELL, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() ); - bool found = false; + bool updateAllSuspended = appId.IsEmpty(); + for( int i = 0; i < __appWidgetContextList.GetCount(); i++ ) { _AppWidgetContext* pAppWidgetContext = null; __appWidgetContextList.GetAt(i, pAppWidgetContext); + SysAssertf(pAppWidgetContext, "pAppWidgetContext is null!"); - if ( pAppWidgetContext->GetAppId() == appId && pAppWidgetContext->GetProviderName() == providerName) + if ( (updateAllSuspended == true && AppManager::GetInstance()->IsRunning(appId) == false ) + || ( pAppWidgetContext->GetAppId() == appId && pAppWidgetContext->GetProviderName() == providerName ) ) { ArrayList* pArray = new (std::nothrow) ArrayList(); SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); @@ -583,6 +608,7 @@ AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tiz result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray); SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r)); + SysLog(NID_SHELL, "UserEvent(%d) is sent for '%ls.%ls'.", LOCAL_EVENT_REQUEST_UPDATE, pAppWidgetContext->GetAppId().GetPointer(), pAppWidgetContext->GetProviderName().GetPointer() ); found = true; } }