Debian Codegraph @

liblomiri-app-launch/app-store-legacy.h

raw
1 /*
2 * Copyright © 2017 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ted Gould <[email protected]>
18 */
19
20 #pragma once
21
22 #include "app-store-base.h"
23
24 #include <lomiri/util/GObjectMemory.h>
25
26 namespace lomiri
27 {
28 namespace app_launch
29 {
30 namespace app_store
31 {
32
33 class Legacy : public Base
34 {
35 public:
36 Legacy(const std::shared_ptr<Registry::Impl>& registry);
37 virtual ~Legacy();
38
39 /* Discover tools */
40 virtual bool verifyPackage(const AppID::Package& package) override;
41 virtual bool verifyAppname(const AppID::Package& package, const AppID::AppName& appname) override;
42 virtual AppID::AppName findAppname(const AppID::Package& package, AppID::ApplicationWildcard card) override;
43 virtual AppID::Version findVersion(const AppID::Package& package, const AppID::AppName& appname) override;
44 virtual bool hasAppId(const AppID& appid) override;
45
46 /* Possible apps */
47 virtual std::list<std::shared_ptr<Application>> list() override;
48
49 /* Application Creation */
50 virtual std::shared_ptr<app_impls::Base> create(const AppID& appid) override;
51
52 /* Info watching */
53 virtual core::Signal<const std::shared_ptr<Application>&>& infoChanged() override;
54 virtual core::Signal<const std::shared_ptr<Application>&>& appAdded() override;
55 virtual core::Signal<const AppID&>& appRemoved() override;
56
57 private:
58 std::set<std::unique_ptr<GFileMonitor, lomiri::util::GObjectDeleter>> monitors_;
59 std::once_flag monitorsSetup_;
60
61 void directoryChanged(GFile* file, GFileMonitorEvent type);
62 void setupMonitors();
63 };
64
65 } // namespace app_store
66 } // namespace app_launch
67 } // namespace lomiri