/* * 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 "application-impl-base.h" #include "application-info-desktop.h" #pragma once namespace lomiri { namespace app_launch { namespace app_impls { /** Application Implementation for Legacy applications. These are applications that are typically installed as Debian packages on the base system. The standard place for them to put their desktop files is in /usr/share/applications though other directories may be used by setting the appropriate XDG environment variables. This implementation makes use of the GIO Desktop Appinfo functions which do caching of those files to make access faster. AppIDs for legacy applications only include the Appname variable. Both the package and the version entries are empty strings. The appname variable is the filename of the desktop file describing the application with the ".desktop" suffix. More info: https://specifications.freedesktop.org/desktop-entry-spec/latest/ */ class Legacy : public Base { public: Legacy(const AppID::AppName& appname, const std::shared_ptr& registry); AppID appId() const override { return {AppID::Package::from_raw({}), _appname, AppID::Version::from_raw({})}; } std::shared_ptr info() override; std::vector> instances() override; std::shared_ptr launch(const std::vector& urls = {}) override; std::shared_ptr launchTest(const std::vector& urls = {}) override; virtual std::shared_ptr findInstance(const std::string& instanceid) override; private: AppID::AppName _appname; std::string _basedir; std::shared_ptr _keyfile; std::shared_ptr appinfo_; std::string desktopPath_; std::regex instanceRegex_; std::list> launchEnv(const std::string& instance); }; } // namespace app_impls } // namespace app_launch } // namespace lomiri