/* * Copyright © 2016 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . * * Authors: * Ted Gould */ #include #include #include #include "info-watcher-zg.h" #include "jobs-base.h" #include "registry-impl.h" #include "registry.h" namespace lomiri { namespace app_launch { Registry::Registry() : impl{std::make_shared()} { impl->setJobs(jobs::manager::Base::determineFactory(impl)); impl->setAppStores(app_store::Base::allAppStores(impl)); impl->setZgWatcher(std::make_shared(impl)); } Registry::Registry(const std::shared_ptr& inimpl) : impl{inimpl} { /* We're assuming the impl has been setup */ } Registry::~Registry() { } std::list> Registry::runningApps(std::shared_ptr registry) { return registry->impl->jobs()->runningApps(); } std::list> Registry::installedApps(std::shared_ptr connection) { std::list> list; for (const auto& appStore : connection->impl->appStores()) { list.splice(list.begin(), appStore->list()); } return list; } std::list> Registry::runningHelpers(Helper::Type type, std::shared_ptr registry) { return registry->impl->jobs()->runningHelpers(type); } void Registry::setManager(const std::shared_ptr& manager, const std::shared_ptr& registry) { registry->impl->jobs()->setManager(manager); } void Registry::clearManager() { impl->jobs()->clearManager(); } std::shared_ptr defaultRegistry; std::shared_ptr Registry::getDefault() { if (!defaultRegistry) { defaultRegistry = std::make_shared(); } return defaultRegistry; } void Registry::clearDefault() { defaultRegistry.reset(); } core::Signal&, const std::shared_ptr&>& Registry::appStarted( const std::shared_ptr& reg) { return reg->impl->jobs()->appStarted(); } core::Signal&, const std::shared_ptr&>& Registry::appStopped( const std::shared_ptr& reg) { return reg->impl->jobs()->appStopped(); } core::Signal&, const std::shared_ptr&, Registry::FailureType>& Registry::appFailed(const std::shared_ptr& reg) { return reg->impl->jobs()->appFailed(); } core::Signal&, const std::shared_ptr&, const std::vector&>& Registry::appPaused(const std::shared_ptr& reg) { return reg->impl->jobs()->appPaused(); } core::Signal&, const std::shared_ptr&, const std::vector&>& Registry::appResumed(const std::shared_ptr& reg) { return reg->impl->jobs()->appResumed(); } core::Signal&, const std::shared_ptr&>& Registry::helperStarted( Helper::Type type, const std::shared_ptr& reg) { return reg->impl->jobs()->helperStarted(type); } core::Signal&, const std::shared_ptr&>& Registry::helperStopped( Helper::Type type, const std::shared_ptr& reg) { return reg->impl->jobs()->helperStopped(type); } core::Signal&, const std::shared_ptr&, Registry::FailureType>& Registry::helperFailed(Helper::Type type, const std::shared_ptr& reg) { return reg->impl->jobs()->helperFailed(type); } core::Signal&>& Registry::appInfoUpdated(const std::shared_ptr& reg) { return reg->impl->appInfoUpdated(); } core::Signal&>& Registry::appAdded(const std::shared_ptr& reg) { return reg->impl->appAdded(); } core::Signal& Registry::appRemoved(const std::shared_ptr& reg) { return reg->impl->appRemoved(); } } // namespace app_launch } // namespace lomiri