[gnome-software/1753-local-file-desktop-mimetypes-may-not-match-reality] data: Split local-file.desktop on MimeTypes based on built plugins



commit 7a3703e22a78df1619b918b509296a701e2033ba
Author: Milan Crha <mcrha redhat com>
Date:   Mon Aug 22 10:33:44 2022 +0200

    data: Split local-file.desktop on MimeTypes based on built plugins
    
    This allows to more precisely match which MimeTypes the gnome-software
    really supports, according to the build options and to the installed
    plugins for the packages.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1753

 contrib/gnome-software.spec.in                     |  4 +-
 po/POTFILES.in                                     |  5 ++-
 src/gnome-software-local-file-flatpak.desktop.in   | 12 +++++
 src/gnome-software-local-file-fwupd.desktop.in     | 12 +++++
 ...nome-software-local-file-packagekit.desktop.in} |  2 +-
 src/gnome-software-local-file-snap.desktop.in      | 12 +++++
 src/meson.build                                    | 51 ++++++++++++++++++----
 7 files changed, 87 insertions(+), 11 deletions(-)
---
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index c54b7fb1e..6266107bc 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -132,7 +132,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
 %doc AUTHORS README.md
 %license COPYING
 %{_bindir}/gnome-software
-%{_datadir}/applications/gnome-software-local-file.desktop
+%{_datadir}/applications/gnome-software-local-file-flatpak.desktop
+%{_datadir}/applications/gnome-software-local-file-fwupd.desktop
+%{_datadir}/applications/gnome-software-local-file-packagekit.desktop
 %{_datadir}/applications/org.gnome.Software.desktop
 %dir %{_datadir}/gnome-software
 %{_datadir}/gnome-software/*.png
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 80f52fe43..02574dda0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,10 @@ data/metainfo/org.gnome.Software.metainfo.xml.in
 data/org.gnome.software.external-appstream.policy.in.in
 data/org.gnome.software.gschema.xml
 gs-install-appstream/gs-install-appstream.c
-src/gnome-software-local-file.desktop.in
+src/gnome-software-local-file-flatpak.desktop.in
+src/gnome-software-local-file-fwupd.desktop.in
+src/gnome-software-local-file-packagekit.desktop.in
+src/gnome-software-local-file-snap.desktop.in
 src/gs-age-rating-context-dialog.c
 src/gs-age-rating-context-dialog.ui
 lib/gs-app.c
diff --git a/src/gnome-software-local-file-flatpak.desktop.in 
b/src/gnome-software-local-file-flatpak.desktop.in
new file mode 100644
index 000000000..ef37d0776
--- /dev/null
+++ b/src/gnome-software-local-file-flatpak.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=Software Install
+Comment=Install selected software on the system
+Categories=System;
+Exec=gnome-software --local-filename %f
+Terminal=false
+Type=Application
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=system-software-install
+StartupNotify=true
+NoDisplay=true
+MimeType=application/vnd.flatpak;application/vnd.flatpak.repo;application/vnd.flatpak.ref;
diff --git a/src/gnome-software-local-file-fwupd.desktop.in b/src/gnome-software-local-file-fwupd.desktop.in
new file mode 100644
index 000000000..7bf12ae9c
--- /dev/null
+++ b/src/gnome-software-local-file-fwupd.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=Software Install
+Comment=Install selected software on the system
+Categories=System;
+Exec=gnome-software --local-filename %f
+Terminal=false
+Type=Application
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=system-software-install
+StartupNotify=true
+NoDisplay=true
+MimeType=application/vnd.ms-cab-compressed;
diff --git a/src/gnome-software-local-file.desktop.in b/src/gnome-software-local-file-packagekit.desktop.in
similarity index 68%
rename from src/gnome-software-local-file.desktop.in
rename to src/gnome-software-local-file-packagekit.desktop.in
index 1c4cb0f9e..b3095c12a 100644
--- a/src/gnome-software-local-file.desktop.in
+++ b/src/gnome-software-local-file-packagekit.desktop.in
@@ -9,4 +9,4 @@ Type=Application
 Icon=system-software-install
 StartupNotify=true
 NoDisplay=true
-MimeType=application/x-rpm;application/x-redhat-package-manager;application/x-deb;application/x-app-package;application/vnd.ms-cab-compressed;application/vnd.flatpak;application/vnd.flatpak.repo;application/vnd.flatpak.ref;application/vnd.snap;
+MimeType=application/x-rpm;application/x-redhat-package-manager;application/x-deb;application/x-app-package;
diff --git a/src/gnome-software-local-file-snap.desktop.in b/src/gnome-software-local-file-snap.desktop.in
new file mode 100644
index 000000000..61b48aab8
--- /dev/null
+++ b/src/gnome-software-local-file-snap.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=Software Install
+Comment=Install selected software on the system
+Categories=System;
+Exec=gnome-software --local-filename %f
+Terminal=false
+Type=Application
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=system-software-install
+StartupNotify=true
+NoDisplay=true
+MimeType=application/vnd.snap;
diff --git a/src/meson.build b/src/meson.build
index 967159405..e7f5c48ae 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -201,14 +201,49 @@ i18n.merge_file(
   install_dir: join_paths(get_option('datadir'), 'applications')
 )
 
-i18n.merge_file(
-  input: 'gnome-software-local-file.desktop.in',
-  output: 'gnome-software-local-file.desktop',
-  type: 'desktop',
-  po_dir: join_paths(meson.project_source_root(), 'po'),
-  install: true,
-  install_dir: join_paths(get_option('datadir'), 'applications')
-)
+if get_option('flatpak')
+  i18n.merge_file(
+    input: 'gnome-software-local-file-flatpak.desktop.in',
+    output: 'gnome-software-local-file-flatpak.desktop',
+    type: 'desktop',
+    po_dir: join_paths(meson.project_source_root(), 'po'),
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+  )
+endif
+
+if get_option('fwupd')
+  i18n.merge_file(
+    input: 'gnome-software-local-file-fwupd.desktop.in',
+    output: 'gnome-software-local-file-fwupd.desktop',
+    type: 'desktop',
+    po_dir: join_paths(meson.project_source_root(), 'po'),
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+  )
+endif
+
+if get_option('packagekit') or get_option('rpm_ostree')
+  i18n.merge_file(
+    input: 'gnome-software-local-file-packagekit.desktop.in',
+    output: 'gnome-software-local-file-packagekit.desktop',
+    type: 'desktop',
+    po_dir: join_paths(meson.project_source_root(), 'po'),
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+  )
+endif
+
+if get_option('snap')
+  i18n.merge_file(
+    input: 'gnome-software-local-file-snap.desktop.in',
+    output: 'gnome-software-local-file-snap.desktop',
+    type: 'desktop',
+    po_dir: join_paths(meson.project_source_root(), 'po'),
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+  )
+endif
 
 install_data('org.gnome.Software-search-provider.ini',
              install_dir : 'share/gnome-shell/search-providers')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]