2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #include "installer_controller.h"
17 #include <dpl/log/log.h>
18 #include <dpl/singleton_impl.h>
19 IMPLEMENT_SINGLETON(InstallerController)
21 InstallerController::InstallerController()
25 void InstallerController::OnEventReceived(
26 const InstallerControllerEvents::InstallWidgetEvent &event)
28 std::string fileName = event.GetArg0();
29 WidgetInstallationStruct installerStruct = event.GetArg1();
30 Jobs::JobHandle handle =
31 m_installerLogic.InstallWidget(fileName, installerStruct);
33 //TODO return handle to API
37 void InstallerController::OnEventReceived(
38 const InstallerControllerEvents::InstallPluginEvent &event)
40 std::string dirName = event.GetArg0();
41 PluginInstallerStruct installerStruct = event.GetArg1();
43 Jobs::JobHandle handle =
44 m_installerLogic.InstallPlugin(dirName, installerStruct);
46 //TODO return handle to API
50 void InstallerController::OnEventReceived(
51 const InstallerControllerEvents::UninstallWidgetEvent &event)
53 WidgetHandle widgetHandle = event.GetArg0();
54 WidgetUninstallationStruct uninstallerStruct = event.GetArg1();
55 Jobs::JobHandle handle =
56 m_installerLogic.UninstallWidget(widgetHandle, uninstallerStruct);
58 //TODO return handle to API
62 Eina_Bool InstallerController::AddNextStep(void *data)
64 Jobs::Job* model = static_cast<Jobs::Job *>(data);
65 CONTROLLER_POST_EVENT(InstallerController,
66 InstallerControllerEvents::NextStepEvent(model));
68 return ECORE_CALLBACK_CANCEL;
71 void InstallerController::OnEventReceived(
72 const InstallerControllerEvents::NextStepEvent &event)
74 Jobs::Job* model = event.GetArg0();
75 Assert(model != NULL);
77 if (m_installerLogic.NextStep(model)) {
78 ecore_idler_add(AddNextStep, model);
82 void InstallerController::OnEventReceived(
83 const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent &
87 m_installerLogic.InstallDeferredWidgetPackages();
90 void InstallerController::OnEventReceived(
91 const InstallerControllerEvents::InitializeEvent & /*event*/)
93 m_installerLogic.Initialize();
96 void InstallerController::OnEventReceived(
97 const InstallerControllerEvents::TerminateEvent & /*event*/)
99 m_installerLogic.Terminate();