146
/** Checks the AppID by making sure the version is "0.0" and then
147
calling verifyAppname() to check the rest.
149
\param appid AppID to check
150
\param registry persistent connections to use
152
bool Libertine::hasAppId(const AppID& appid, const std::shared_ptr<Registry>& registry)
156
if (appid.version.value() != "0.0")
161
return verifyAppname(appid.package, appid.appname, registry);
163
catch (std::runtime_error& e)
169
/** Verify a package name by getting the list of containers from
170
liblibertine and ensuring it is in that list.
172
\param package Container name
173
\param registry persistent connections to use
175
bool Libertine::verifyPackage(const AppID::Package& package, const std::shared_ptr<Registry>& registry)
177
auto containers = std::shared_ptr<gchar*>(libertine_list_containers(), g_strfreev);
179
for (int i = 0; containers.get()[i] != nullptr; i++)
181
auto container = containers.get()[i];
182
if (container == package.value())
191
/** Gets the list of applications from the container using liblibertine
192
and see if @appname is in that list.
194
\param package Container name
195
\param appname Application name to look for
196
\param registry persistent connections to use
198
bool Libertine::verifyAppname(const AppID::Package& package,
199
const AppID::AppName& appname,
200
const std::shared_ptr<Registry>& registry)
202
auto apps = std::shared_ptr<gchar*>(libertine_list_apps_for_container(package.value().c_str()), g_strfreev);
204
for (int i = 0; apps.get()[i] != nullptr; i++)
206
auto appid = AppID::parse(apps.get()[i]);
207
if (appid.appname.value() == appname.value())
216
/** We don't really have a way to implement this for Libertine, any
217
search wouldn't really make sense. We just throw an error.
219
\param package Container name
220
\param card Application search paths
221
\param registry persistent connections to use
223
AppID::AppName Libertine::findAppname(const AppID::Package& package,
224
AppID::ApplicationWildcard card,
225
const std::shared_ptr<Registry>& registry)
227
throw std::runtime_error("Legacy apps can't be discovered by package");
230
/** Function to return "0.0"
232
\param package Container name (unused)
233
\param appname Application name (unused)
234
\param registry persistent connections to use (unused)
236
AppID::Version Libertine::findVersion(const AppID::Package& package,
237
const AppID::AppName& appname,
238
const std::shared_ptr<Registry>& registry)
240
return AppID::Version::from_raw("0.0");
243
std::list<std::shared_ptr<Application>> Libertine::list(const std::shared_ptr<Registry>& registry)
245
std::list<std::shared_ptr<Application>> applist;
247
auto containers = std::shared_ptr<gchar*>(libertine_list_containers(), g_strfreev);
249
for (int i = 0; containers.get()[i] != nullptr; i++)
251
auto container = containers.get()[i];
252
auto apps = std::shared_ptr<gchar*>(libertine_list_apps_for_container(container), g_strfreev);
254
for (int j = 0; apps.get()[j] != nullptr; j++)
258
auto appid = AppID::parse(apps.get()[j]);
259
auto sapp = std::make_shared<Libertine>(appid.package, appid.appname, registry);
260
applist.emplace_back(sapp);
262
catch (std::runtime_error& e)
264
g_debug("Unable to create application for libertine appname '%s': %s", apps.get()[j], e.what());
272
146
std::shared_ptr<Application::Info> Libertine::info()