Check and revise .desktop files
authorColin Clark <[email protected]>
Sat, 27 Jan 2024 11:13:55 +0000 (11:13 +0000)
committerColin Clark <[email protected]>
Sat, 27 Jan 2024 11:13:55 +0000 (11:13 +0000)
Include a .desktop file check using desktop-file-validate.
Revise .desktop files - most had an incorrect Categories entry.

28 files changed:
meson.build
meson_options.txt
plugins/camera-import/meson.build
plugins/camera-import/org.geeqie.camera-import.desktop.in
plugins/export-jpeg/meson.build
plugins/export-jpeg/org.geeqie.export-jpeg.desktop.in
plugins/image-crop/meson.build
plugins/image-crop/org.geeqie.image-crop.desktop.in
plugins/meson.build
plugins/open-with/meson.build
plugins/open-with/org.geeqie.open-with.desktop.in
plugins/org.geeqie.template.desktop.in
plugins/random-image/meson.build
plugins/random-image/org.geeqie.random-image.desktop.in
plugins/refresh-thumbnail/meson.build
plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in
plugins/resize-image/meson.build
plugins/resize-image/org.geeqie.resize-image.desktop.in
plugins/rotate/meson.build
plugins/rotate/org.geeqie.rotate.desktop.in
plugins/symlink/meson.build
plugins/symlink/org.geeqie.symlink.desktop.in
plugins/tethered-photography/meson.build
plugins/tethered-photography/org.geeqie.tethered-photography.desktop.in
plugins/video-player/meson.build
plugins/video-player/org.geeqie.video-player.desktop.in
scripts/desktop-file-validate.sh [new file with mode: 0755]
scripts/meson.build

index 153552f8808a0b19839bd795924bc1303985b90d..bb40d8d7079c670d9a80ddb43ab9b4df291bb06e 100644 (file)
@@ -587,6 +587,9 @@ mdl_sources = []
 # For gtk builder checks on .ui files
 ui_sources = []
 
+# For checks on .desktop files
+desktop_sources = []
+
 # Process subdirs before the sources
 subdir('po')
 subdir('plugins')
@@ -796,3 +799,23 @@ if not option.disabled()
 else
     summary({'lua' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
 endif
+
+# Desktop files test
+option = get_option('desktop')
+if not option.disabled()
+    desktop_exe = find_program('desktop-file-validate', required : false)
+    if desktop_exe.found()
+        desktop_sh = find_program('desktop-file-validate.sh', dirs : scriptsdir, required : true)
+        test_desktop_dir = join_paths(meson.current_build_dir(), 'test-desktop-files.p')
+        foreach desktop_file : desktop_sources
+            desktop_path = '@0@'.format(desktop_file)
+            test('Desktop_check_ ' + desktop_path, desktop_sh, args: [test_desktop_dir, desktop_file], timeout: 100)
+        endforeach
+
+        summary({'Desktop files' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
+    else
+        summary({'Desktop files' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
+    endif
+else
+    summary({'Desktop files' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
+endif
index 9bc8508aeb712bf0be1a9d975404433854ff9196..eb3a9f1ca36dd202c7f7c8d699125bb60bee5b8b 100644 (file)
@@ -25,6 +25,7 @@ option('gq_localedir', type : 'string', value : '', description : 'Location wher
 
 option('archive', type : 'feature', value : 'auto', description : 'archive files e.g. zip, gz')
 option('cms', type : 'feature', value : 'auto', description : 'color management system')
+option('desktop', type : 'feature', value : 'auto', description : 'desktop file check')
 option('devel', type : 'feature', value : 'disabled', description : 'developer mode')
 option('doxygen', type : 'feature', value : 'auto', description : 'lua api help file')
 option('djvu', type : 'feature', value : 'auto', description : 'djvu')
index e57bc35069ea8121de9965261fca41304199deb1..a7838ac25dedaae194e9cd26f8b12adea31049ea 100644 (file)
@@ -23,3 +23,5 @@ i18n.merge_file(
 
 script_sources += files('geeqie-camera-import',
 'geeqie-camera-import-hook-script')
+
+desktop_sources += files('org.geeqie.camera-import.desktop.in')
index cd9181ea3dbe886f6c5018e0c13d33b409513b66..c82f65b666d64396f76cdd03cab7852ad3b372d0 100644 (file)
@@ -11,7 +11,7 @@ Comment=Import all images from camera
 Exec=geeqie-camera-import
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index 47828d8ae48efa85c177b06ca5c1ddebd2c3ef6e..c9c0394257d584bccff9bd217fc600f8ef705cc5 100644 (file)
@@ -22,3 +22,5 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 script_sources += files('geeqie-export-jpeg')
+
+desktop_sources += files('org.geeqie.export-jpeg.desktop.in')
index 70ba8439af4b27b2d40b74c4fa2d0e8e794dc06c..53bbe400c763fe5084750dd20ff461f26a5cac0f 100644 (file)
@@ -11,7 +11,7 @@ Exec=geeqie-export-jpeg %f
 #TryExec=jpgicc
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index 13aa43346b39a4c53af31a8c170d2ae8d351153f..14c056f5dcd1300b6544dc3e0c38e9884edd1a0a 100644 (file)
@@ -22,3 +22,5 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 script_sources += files('geeqie-image-crop')
+
+desktop_sources += files('org.geeqie.image-crop.desktop.in')
index 39107ca175c9d3e2ccfda8dbcc02c5e38a6d8e26..104276caad759cf12640867b1adbd3f1dfc04960 100644 (file)
@@ -9,7 +9,7 @@ Comment=Crop image from marked rectangle
 Exec=geeqie-image-crop %f
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index 503c94c468b23bdba538166f6b1b666bd5aae4b7..76dab89c387d661968ecc98e8a8f6ea5139cd5e2 100644 (file)
@@ -31,3 +31,5 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : appdir)
+
+desktop_sources += files('org.geeqie.template.desktop.in')
index 4f533f5de76f43ee99b5865ae51d67329643180a..2872a299b628161cf4fd0674ad1d3bbabb8f5323 100644 (file)
@@ -19,3 +19,5 @@ i18n.merge_file(
     install : true,
     install_dir : desktopdir)
 
+
+desktop_sources += files('org.geeqie.open-with.desktop.in')
index 5e3677c96a764852e56bba5f9f975d54afcfbe58..8d7b13f06dcacffc72a0146bbf5e35f947d4aa98 100644 (file)
@@ -7,7 +7,7 @@ Comment=Call the gtk application chooser dialog
 Exec=geeqie --remote --action:OpenWith %f
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index f1d48051ca54d1d9d37f65b183d6dbec8e237d7f..1ea0f6f636ee6fedd4022ebbc8dccd0428d8bf3e 100644 (file)
@@ -2,9 +2,8 @@
 Version=1.0
 Type=Application
 
-# The Desktop file MUST contain one or both of the following:
+# The Desktop file MUST contain the following:
 Categories=Graphics;
-Categories=X-Geeqie;
 
 # The name which appears in the menu:
 Name=Template
@@ -13,7 +12,7 @@ Name=Template
 #Name[de]=Vorlage
 
 # Replace "command" with the actual command or script:
-Exec=command <param>
+Exec=command param
 
 # Where <param> may be:
 # omitted      If no parameter is given the command will be executed in the
index 4739660b4bc30733d8407088edf13326a00c9b4a..d6d4aedc700c980d9813cc642332a87e9d836dee 100644 (file)
@@ -22,3 +22,5 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 script_sources += files('geeqie-random-image')
+
+desktop_sources += files('org.geeqie.random-image.desktop.in')
index afd3f649ed538492040c3ba829536364edb4d81f..51a88ea982f856d135dcac4b8434f3ca3181153f 100644 (file)
@@ -7,7 +7,7 @@ Comment=Display random image from Collections and current folder
 Exec=geeqie-random-image
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index 9877a39896810dca485fd59051f92a7d099f93fa..3b767198b4521780afc5f8c4e2cb1fbd9e707cd4 100644 (file)
@@ -20,3 +20,5 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
+
+desktop_sources += files('org.geeqie.refresh-thumbnail.desktop.in')
index 14d5725263db2880cc7a058fb78c461bb8cbabea..646f41527e50aaca7933fe50fce8a5ef1c237d9d 100644 (file)
@@ -11,7 +11,7 @@ Comment=Refresh Thumbnail
 Exec=geeqie-refresh-thumbnail
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index ae750393867adda286e12a37eab1acfe54b8820e..5259652c9af2c6a2fa64599c6d44c65e37258f13 100644 (file)
@@ -22,3 +22,5 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 script_sources += files('geeqie-resize-image')
+
+desktop_sources += files('org.geeqie.resize-image.desktop.in')
index bbd12be45a392b9a16849e0471e481bdf47109b3..48a3920bb51a1f816ba5d588330f1d707e058279 100644 (file)
@@ -7,7 +7,7 @@ Comment=Downsize an image
 Exec=geeqie-resize-image %f
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index 7110e53c3eb6366790c2e1163affce49db151a75..8952ad2ca29aacad413fc8b2bb36ae3da9ffc6b5 100644 (file)
@@ -22,3 +22,5 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 script_sources += files('geeqie-rotate')
+
+desktop_sources += files('org.geeqie.rotate.desktop.in')
index 217a287d8094d911b9e226e5337eed5cdd194673..7e007fd0dcbd997b9c7c3d9e74cb3067577e8d6b 100644 (file)
@@ -7,7 +7,7 @@ Name=Apply the orientation to image content
 Exec=geeqie-rotate -g %f
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # Show in menu "Edit/Orientation"
index bbc3e845b317393ee6e31ca75b042fdd4c74d1d1..992d58f3a452f22ff9e0ee5aa4ffe84e8b5d7ff6 100644 (file)
@@ -22,3 +22,5 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 script_sources += files('geeqie-symlink')
+
+desktop_sources += files('org.geeqie.symlink.desktop.in')
index f82a706ec232f6b27bad9869deb337b794a99d5d..fa754a0fc0ca4603d7ef4e65ff81b511e0574020 100644 (file)
@@ -7,7 +7,7 @@ Name=Symlink
 Exec=geeqie-symlink %f
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # Show in menu "File"
index 5544b0ad846a41f7af2d7f08455315fa126a6790..e8058dfb354f41ccb4227693a65bcbefaf9cd897 100644 (file)
@@ -23,3 +23,5 @@ i18n.merge_file(
 
 script_sources += files('geeqie-tethered-photography',
 'geeqie-tethered-photography-hook-script')
+
+desktop_sources += files('org.geeqie.tethered-photography.desktop.in')
index ef8d76b7c5b5e72ba2616e78da3677ecaf8279d4..a3c7e6c5ba7c5c716d2ca21d927863032b60bfeb 100644 (file)
@@ -6,7 +6,7 @@ Name=Tethered photography
 Exec=geeqie-tethered-photography
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 # It can be made verbose
index 1f25ed62fdf38a0f1f42142cf0c10e64218cdc50..d379f9d316d002b0635edc0a3e08de709f3997f0 100644 (file)
@@ -18,3 +18,5 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
+
+desktop_sources += files('org.geeqie.video-player.desktop.in')
index 0c92c1b0956734190676e1b366ce9ff8af64a429..ccbe1f9907176f5d6f6f573b07a3c423214ec138 100644 (file)
@@ -9,7 +9,7 @@ Comment=Display videos in Geeqie
 Exec=xdg-open %f
 
 # Desktop files that are usable only in Geeqie should be marked like this:
-Categories=X-Geeqie;
+Categories=Graphics;
 OnlyShowIn=X-Geeqie;
 
 TryExec=xdg-open
diff --git a/scripts/desktop-file-validate.sh b/scripts/desktop-file-validate.sh
new file mode 100755 (executable)
index 0000000..56986b9
--- /dev/null
@@ -0,0 +1,52 @@
+#! /bin/sh
+#**********************************************************************
+# Copyright (C) 2024 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Use desktop-file-validate on .desktop files.
+##
+## $1 temp directory \n
+## $2 desktop file name including .in extension \n
+##
+## desktop-file-validate will not process a file with
+## the extension ".in". Use a symlink as a workaround.
+
+if [ ! -d "$1" ]
+then
+       mkdir --parents "$1"
+fi
+
+desktop_file=$(basename "$2" ".in")
+
+ln --symbolic "$2" "$1/$desktop_file"
+
+result=$(desktop-file-validate "$1/$desktop_file")
+
+rm "$1/$desktop_file"
+
+if [ -z "$result" ]
+then
+       exit 0
+else
+       printf "%s\n" "$result"
+
+       exit 1
+fi
+
index 305ba36987b4fd493ab8aa6c0d8bcdb3c3009ae4..1d47776bf7afc61abf200fd0d3352afc4819607f 100644 (file)
@@ -12,6 +12,7 @@
 # GNU General Public License for more details.
 
 script_sources += files('authors.sh',
+'desktop-file-validate.sh',
 'devel-install.sh',
 'doxygen-help.sh',
 'doxygen.sh',