Commit 265c99ed authored by Christian Kellner's avatar Christian Kellner
Browse files

use X-Flatpak from desktop file, if available

Instead of using the AppId.get() id, use the X-Flatpak special
field to infer the additional "app_id". This also enables us to
remove the hack in Process, where we appended .desktop to the
name that was derived via the .flatpak-info file. Similar things
should be done for snaps.
parent 0ff1192d
......@@ -11,6 +11,7 @@ valac = meson.get_compiler('vala')
glib_dep = dependency('glib-2.0', version : '>=2.38')
gobject_dep = dependency('gobject-2.0')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
gtk_dep = dependency('gtk+-3.0', version : '>=3.20.10')
libdazzle_dep = dependency('libdazzle-1.0', version : '>=3.30')
libgtop_dep = dependency('libgtop-2.0', version : '>= 2.34.0')
......
......@@ -22,7 +22,13 @@ namespace Usage
var _apps_info = AppInfo.get_all ();
foreach (AppInfo info in _apps_info) {
appid_map.insert (info.get_id (), info);
GLib.DesktopAppInfo? dai = info as GLib.DesktopAppInfo;
if (dai != null) {
string id = dai.get_string ("X-Flatpak");
if (id != null)
appid_map.insert (id, info);
}
string cmd = info.get_commandline ();
......
......@@ -50,6 +50,7 @@ vala_sources = [
deps = [
gio_dep,
gio_unix_dep,
glib_dep,
gobject_dep,
gtk_dep,
......
......@@ -132,12 +132,8 @@ namespace Usage
string? name = null;
try {
if (kf.has_key ("Application", "name")) {
if (kf.has_key ("Application", "name"))
name = kf.get_string ("Application", "name");
// TODO: find a better way to match desktop ids
// and flatpak ids
name += ".desktop";
}
} catch (Error e) {
warning (@"Failed to parse faltpak info for: $pid");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment