[gnome-software/gnome-3-30] flatpak: Use X-Flatpak key for mapping desktop files to apps
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-30] flatpak: Use X-Flatpak key for mapping desktop files to apps
- Date: Thu, 29 Nov 2018 13:15:15 +0000 (UTC)
commit af05c3e565024e7638b2d687d5d34f2f92099bac
Author: Kalev Lember <klember redhat com>
Date: Thu Nov 29 10:35:23 2018 +0100
flatpak: Use X-Flatpak key for mapping desktop files to apps
When scanning local desktop files, rely on appstream-glib correctly
parsing X-Flatpak key and only do .desktop discarding as fallback.
08:43:06:0210 GsPluginFlatpak Could not get app (from ID 'org.libreoffice.LibreOffice-calc') for
installed desktop file /var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice-calc.desktop:
App org.libreoffice.LibreOffice-calc not installed
08:43:06:0217 GsPluginFlatpak Could not get app (from ID 'org.libreoffice.LibreOffice-base') for
installed desktop file /var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice-base.desktop:
App org.libreoffice.LibreOffice-base not installed
08:43:06:0217 GsPluginFlatpak Could not get app (from ID 'org.libreoffice.LibreOffice-impress') for
installed desktop file
/var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice-impress.desktop: App
org.libreoffice.LibreOffice-impress not installed
08:43:06:0218 GsPluginFlatpak Could not get app (from ID 'org.libreoffice.LibreOffice-draw') for
installed desktop file /var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice-draw.desktop:
App org.libreoffice.LibreOffice-draw not installed
08:43:06:0220 GsPluginFlatpak Could not get app (from ID 'org.libreoffice.LibreOffice-math') for
installed desktop file /var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice-math.desktop:
App org.libreoffice.LibreOffice-math not installed
08:43:06:0222 GsPluginFlatpak Could not get app (from ID 'org.libreoffice.LibreOffice-writer') for
installed desktop file
/var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice-writer.desktop: App
org.libreoffice.LibreOffice-writer not installed
plugins/flatpak/gs-flatpak.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 1e8b7f5c..5c7457b3 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -433,7 +433,6 @@ gs_flatpak_rescan_installed (GsFlatpak *self,
g_autoptr(AsApp) app = NULL;
g_autoptr(AsFormat) format = as_format_new ();
g_autoptr(FlatpakInstalledRef) app_ref = NULL;
- g_autofree gchar *app_id = NULL;
/* ignore */
if (g_strcmp0 (fn, "mimeinfo.cache") == 0)
@@ -448,6 +447,13 @@ gs_flatpak_rescan_installed (GsFlatpak *self,
continue;
}
+ /* fall back to guessing app ID */
+ if (as_app_get_id (app) == NULL) {
+ g_autofree gchar *app_id = gs_flatpak_discard_desktop_suffix (fn);
+ g_debug ("failed to get app ID from X-Flatpak; falling back to %s", app_id);
+ as_app_set_id (app, app_id);
+ }
+
/* fix up icons */
icons = as_app_get_icons (app);
for (guint i = 0; i < icons->len; i++) {
@@ -468,14 +474,13 @@ gs_flatpak_rescan_installed (GsFlatpak *self,
as_format_set_filename (format, fn_desktop);
as_app_add_format (app, format);
- app_id = gs_flatpak_discard_desktop_suffix (fn);
app_ref = flatpak_installation_get_current_installed_app (self->installation,
- app_id,
+ as_app_get_id (app),
cancellable,
&error_local);
if (app_ref == NULL) {
g_warning ("Could not get app (from ID '%s') for installed desktop "
- "file %s: %s", app_id, fn_desktop, error_local->message);
+ "file %s: %s", as_app_get_id (app), fn_desktop, error_local->message);
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]