From 77e7cb417cd87bf85f76c821285f2677b9bd8f2d Mon Sep 17 00:00:00 2001 From: "kyeongwoo.lee" Date: Thu, 23 May 2013 13:17:21 +0900 Subject: [PATCH] Revert "Revert "Apply the code for handling the multiple providers that existed in the same application."" This reverts commit 5450a50d399849b0691cccb2c1334237945f0104 --- inc/FShell_AppWidgetContextBase.h | 2 +- inc/FShell_AppWidgetManagerService.h | 1 + src/FShell_AppWidgetManagerService.cpp | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/inc/FShell_AppWidgetContextBase.h b/inc/FShell_AppWidgetContextBase.h index 1f9666a..2400eb6 100644 --- a/inc/FShell_AppWidgetContextBase.h +++ b/inc/FShell_AppWidgetContextBase.h @@ -55,6 +55,7 @@ public: virtual void OnPopupDestoyed(void) = 0; virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0; void SetIpcClientId(int clientId); + int GetClientId(void) const; bool HasValidClientId(void) const; // for buffered appWidget int GetSharedMemId(int w, int h); @@ -76,7 +77,6 @@ protected: void SetForeground(bool forground); bool IsForeground(void) const; Tizen::Base::String GetUserInfo(void) const; - int GetClientId(void) const; void SetWidth(int width); void SetHeight(int height); diff --git a/inc/FShell_AppWidgetManagerService.h b/inc/FShell_AppWidgetManagerService.h index 421afe8..26ee083 100644 --- a/inc/FShell_AppWidgetManagerService.h +++ b/inc/FShell_AppWidgetManagerService.h @@ -93,6 +93,7 @@ private: void StartPingTimer(void); virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); _AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const; + int Find(const Tizen::App::AppId& appId) const; class _TaskHandlerThread : public Tizen::Base::Runtime::Thread diff --git a/src/FShell_AppWidgetManagerService.cpp b/src/FShell_AppWidgetManagerService.cpp index e17f202..37185b6 100644 --- a/src/FShell_AppWidgetManagerService.cpp +++ b/src/FShell_AppWidgetManagerService.cpp @@ -146,6 +146,28 @@ AppWidgetManagerService::Find(const String& appId, const String& instanceId) con return null; } +int +AppWidgetManagerService::Find(const String& appId) const +{ + int clientId = -1; + + for (int i = 0; i < __appWidgetContextList.GetCount(); i++) + { + _AppWidgetContext* pAppWidgetContext = null; + __appWidgetContextList.GetAt(i, pAppWidgetContext); + + if (pAppWidgetContext->GetProviderId() == appId) + { + clientId = pAppWidgetContext->GetClientId(); + break; + } + } + + SysLog(NID_SHELL, "clientId is %d", clientId); + + return clientId; +} + result AppWidgetManagerService::SetIpcClientIds(const Tizen::App::AppId& appId, int clientId) { @@ -236,6 +258,17 @@ AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, in arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority); SysTryReturn(NID_SHELL, pAppWidgetContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); + int clientId = AppWidgetManagerService::GetInstance()->Find(arg->pkgname); + if (clientId != -1) + { + SysLog(NID_SHELL, "There is same parent application."); + pAppWidgetContext->SetIpcClientId(clientId); + } + else + { + SysLog(NID_SHELL, "There is no same parent application."); + } + AppWidgetManagerService* pAppWidgetService = AppWidgetManagerService::GetInstance(); pAppWidgetService->AddAppWidget(pAppWidgetContext); pAppWidgetContext->OnAdded(); -- 2.7.4