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>
20 IMPLEMENT_SINGLETON(Logic::InstallerController)
25 InstallerController::InstallerController()
29 void InstallerController::OnEventReceived(
30 const InstallerControllerEvents::InstallWidgetEvent &event)
32 std::string fileName = event.GetArg0();
33 WidgetInstallationStruct installerStruct = event.GetArg1();
34 m_installerLogic.InstallWidget(fileName, installerStruct);
37 void InstallerController::OnEventReceived(
38 const InstallerControllerEvents::InstallPluginEvent &event)
40 std::string dirName = event.GetArg0();
41 PluginInstallerStruct installerStruct = event.GetArg1();
42 m_installerLogic.InstallPlugin(dirName, installerStruct);
45 void InstallerController::OnEventReceived(
46 const InstallerControllerEvents::UninstallWidgetEvent &event)
48 WidgetHandle widgetHandle = event.GetArg0();
49 WidgetUninstallationStruct uninstallerStruct = event.GetArg1();
50 m_installerLogic.UninstallWidget(widgetHandle, uninstallerStruct);
53 Eina_Bool InstallerController::AddNextStep(void *data)
55 Jobs::Job* model = static_cast<Jobs::Job *>(data);
56 CONTROLLER_POST_EVENT(InstallerController,
57 InstallerControllerEvents::NextStepEvent(model));
59 return ECORE_CALLBACK_CANCEL;
62 void InstallerController::OnEventReceived(
63 const InstallerControllerEvents::NextStepEvent &event)
65 Jobs::Job* model = event.GetArg0();
66 Assert(model != NULL);
68 if (m_installerLogic.NextStep(model)) {
69 ecore_idler_add(AddNextStep, model);
73 void InstallerController::OnEventReceived(
74 const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent &
78 m_installerLogic.InstallDeferredWidgetPackages();
81 void InstallerController::OnEventReceived(
82 const InstallerControllerEvents::InitializeEvent & /*event*/)
84 m_installerLogic.Initialize();
87 void InstallerController::OnEventReceived(
88 const InstallerControllerEvents::TerminateEvent & /*event*/)
90 m_installerLogic.Terminate();