109
/** Checks the AppID by making sure the version is "0.0" and then
110
calling verifyAppname() to check the rest.
112
\param appid AppID to check
113
\param registry persistent connections to use
115
bool Libertine::hasAppId(const AppID& appid, const std::shared_ptr<Registry>& registry)
119
if (appid.version.value() != "0.0")
124
return verifyAppname(appid.package, appid.appname, registry);
126
catch (std::runtime_error& e)
132
/** Verify a package name by getting the list of containers from
133
liblibertine and ensuring it is in that list.
135
\param package Container name
136
\param registry persistent connections to use
138
bool Libertine::verifyPackage(const AppID::Package& package, const std::shared_ptr<Registry>& registry)
140
auto containers = std::shared_ptr<gchar*>(libertine_list_containers(), g_strfreev);
142
for (int i = 0; containers.get()[i] != nullptr; i++)
144
auto container = containers.get()[i];
145
if (container == package.value())
154
/** Gets the list of applications from the container using liblibertine
155
and see if @appname is in that list.
157
\param package Container name
158
\param appname Application name to look for
159
\param registry persistent connections to use
161
bool Libertine::verifyAppname(const AppID::Package& package,
162
const AppID::AppName& appname,
163
const std::shared_ptr<Registry>& registry)
165
auto apps = std::shared_ptr<gchar*>(libertine_list_apps_for_container(package.value().c_str()), g_strfreev);
167
for (int i = 0; apps.get()[i] != nullptr; i++)
169
auto appid = AppID::parse(apps.get()[i]);
170
if (appid.appname.value() == appname.value())
179
/** We don't really have a way to implement this for Libertine, any
180
search wouldn't really make sense. We just throw an error.
182
\param package Container name
183
\param card Application search paths
184
\param registry persistent connections to use
186
AppID::AppName Libertine::findAppname(const AppID::Package& package,
187
AppID::ApplicationWildcard card,
188
const std::shared_ptr<Registry>& registry)
190
throw std::runtime_error("Legacy apps can't be discovered by package");
193
/** Function to return "0.0"
195
\param package Container name (unused)
196
\param appname Application name (unused)
197
\param registry persistent connections to use (unused)
199
AppID::Version Libertine::findVersion(const AppID::Package& package,
200
const AppID::AppName& appname,
201
const std::shared_ptr<Registry>& registry)
203
return AppID::Version::from_raw("0.0");
109
206
std::list<std::shared_ptr<Application>> Libertine::list(const std::shared_ptr<Registry>& registry)
111
208
std::list<std::shared_ptr<Application>> applist;