Check and revise .desktop files
authorColin Clark <colin.clark@cclark.uk>
Sat, 27 Jan 2024 11:13:55 +0000 (11:13 +0000)
committerColin Clark <colin.clark@cclark.uk>
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 153552f..bb40d8d 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 9bc8508..eb3a9f1 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 e57bc35..a7838ac 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 cd9181e..c82f65b 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 47828d8..c9c0394 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 70ba843..53bbe40 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 13aa433..14c056f 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 39107ca..104276c 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 503c94c..76dab89 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 4f533f5..2872a29 100644 (file)
@@ -19,3 +19,5 @@ i18n.merge_file(
     install : true,
     install_dir : desktopdir)
 
+
+desktop_sources += files('org.geeqie.open-with.desktop.in')
index 5e3677c..8d7b13f 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 f1d4805..1ea0f6f 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 4739660..d6d4aed 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 afd3f64..51a88ea 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 9877a39..3b76719 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 14d5725..646f415 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 ae75039..5259652 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 bbd12be..48a3920 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 7110e53..8952ad2 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 217a287..7e007fd 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 bbc3e84..992d58f 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 f82a706..fa754a0 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 5544b0a..e8058df 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 ef8d76b..a3c7e6c 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 1f25ed6..d379f9d 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 0c92c1b..ccbe1f9 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 305ba36..1d47776 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',