From: Colin Clark Date: Sat, 28 Oct 2023 10:19:33 +0000 (+0100) Subject: Change all .desktop files to RDNS style X-Git-Tag: v2.2~42 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=d4edde366d3c5ced22d93b4cc85a341fc5b251a4 Change all .desktop files to RDNS style --- diff --git a/plugins/camera-import/meson.build b/plugins/camera-import/meson.build index 9920664f..e57bc350 100644 --- a/plugins/camera-import/meson.build +++ b/plugins/camera-import/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-camera-import', 'geeqie-camera-import-hook-script', install_dir : gq_bindir) i18n.merge_file( - input : 'camera-import.desktop.in', - output : 'camera-import.desktop', + input : 'org.geeqie.camera-import.desktop.in', + output : 'org.geeqie.camera-import.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/camera-import/camera-import.desktop.in b/plugins/camera-import/org.geeqie.camera-import.desktop.in similarity index 100% rename from plugins/camera-import/camera-import.desktop.in rename to plugins/camera-import/org.geeqie.camera-import.desktop.in diff --git a/plugins/export-jpeg/meson.build b/plugins/export-jpeg/meson.build index 14c6983a..47828d8a 100644 --- a/plugins/export-jpeg/meson.build +++ b/plugins/export-jpeg/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-export-jpeg', install_dir : gq_bindir) i18n.merge_file( - input : 'export-jpeg.desktop.in', - output : 'export-jpeg.desktop', + input : 'org.geeqie.export-jpeg.desktop.in', + output : 'org.geeqie.export-jpeg.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/export-jpeg/export-jpeg.desktop.in b/plugins/export-jpeg/org.geeqie.export-jpeg.desktop.in similarity index 100% rename from plugins/export-jpeg/export-jpeg.desktop.in rename to plugins/export-jpeg/org.geeqie.export-jpeg.desktop.in diff --git a/plugins/image-crop/meson.build b/plugins/image-crop/meson.build index a2937168..13aa4334 100644 --- a/plugins/image-crop/meson.build +++ b/plugins/image-crop/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-image-crop', install_dir : gq_bindir) i18n.merge_file( - input : 'image-crop.desktop.in', - output : 'image-crop.desktop', + input : 'org.geeqie.image-crop.desktop.in', + output : 'org.geeqie.image-crop.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/image-crop/image-crop.desktop.in b/plugins/image-crop/org.geeqie.image-crop.desktop.in similarity index 100% rename from plugins/image-crop/image-crop.desktop.in rename to plugins/image-crop/org.geeqie.image-crop.desktop.in diff --git a/plugins/meson.build b/plugins/meson.build index 2476acd3..65d55bb7 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -24,8 +24,8 @@ subdir('tethered-photography') subdir('video-player') i18n.merge_file( - input : 'template.desktop.in', - output : 'template.desktop', + input : 'org.geeqie.template.desktop.in', + output : 'org.geeqie.template.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/template.desktop.in b/plugins/org.geeqie.template.desktop.in similarity index 100% rename from plugins/template.desktop.in rename to plugins/org.geeqie.template.desktop.in diff --git a/plugins/random-image/meson.build b/plugins/random-image/meson.build index 9a6070a6..4739660b 100644 --- a/plugins/random-image/meson.build +++ b/plugins/random-image/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-random-image', install_dir : gq_bindir) i18n.merge_file( - input : 'random-image.desktop.in', - output : 'random-image.desktop', + input : 'org.geeqie.random-image.desktop.in', + output : 'org.geeqie.random-image.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/random-image/random-image.desktop.in b/plugins/random-image/org.geeqie.random-image.desktop.in similarity index 100% rename from plugins/random-image/random-image.desktop.in rename to plugins/random-image/org.geeqie.random-image.desktop.in diff --git a/plugins/refresh-thumbnail/geeqie-refresh-thumbnail b/plugins/refresh-thumbnail/geeqie-refresh-thumbnail new file mode 100755 index 00000000..86ca6ccf --- /dev/null +++ b/plugins/refresh-thumbnail/geeqie-refresh-thumbnail @@ -0,0 +1,169 @@ +#!/bin/sh + +## @file +## @brief Import all images from camera +## +## Requires gphoto2 +## +finish() +{ + if [ -f /tmp/geeqie-camera-import-files ] + then + rm /tmp/geeqie-camera-import-files + fi + + if [ -p "$zen_pipe" ] + then + rm "$zen_pipe" + fi + + if [ "$gphoto2_pid" != "" ] + then + if ps -p "$gphoto2_pid" > /dev/null + then + kill "$gphoto2_pid" + fi + fi + + if [ "$zen_pid" != "" ] + then + if ps -p "$zen_pid" > /dev/null + then + kill "$zen_pid" + fi + fi +} +trap finish EXIT + +if ! [ -x "$(command -v gphoto2)" ] +then + zenity --title="Geeqie camera import" --info --width=200 --text="gphoto2 is not installed" 2> /dev/null + exit 0 +fi + +if [ -f /tmp/geeqie-camera-import.log ] +then + rm /tmp/geeqie-camera-import.log +fi + +if [ "$(gphoto2 --auto-detect | wc -l)" -le 2 ] +then + zenity --error --title="Geeqie camera import" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2> /dev/null + exit 0 +fi + +IFS=' +' + +list=$(gphoto2 --auto-detect | tail -n +3) +camera_list="" +n=1 +count=$(gphoto2 --auto-detect | tail -n +3 | wc -l) +if [ "$count" -gt 1 ] +then + for camera in $list + do + if [ "$n" -eq "$count" ] + then + camera_list="${camera_list:+${camera_list}}TRUE\n$camera\n$n" + else + camera_list="${camera_list:+${camera_list}}FALSE\n$camera\n$n\n" + fi + n=$((n + 1)) + done + + camera_selected=$(printf '%b' "$camera_list" | zenity --width=500 --height=250 --title="Geeqie camera import" --list --text "Select camera" --radiolist --column "Select" --column "Camera" --column "n" --print-column=2 2> /dev/null) + + if [ $? = 1 ] + then + exit 0 + fi +else + camera_selected=$(gphoto2 --auto-detect | tail +3) +fi + +port_type=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $1}' | awk '{print $NF}') +camera=$(printf '%s\n' "$camera_selected" | awk -F "$port_type" '{print $1}') +port_address=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $2}') +port="$port_type:$port_address" + +script_dir=$(dirname "$0") + +if ! zenity --question --title="Geeqie camera import" --text="Camera: $camera\n\nDownloading to folder:\n$PWD" --ok-label="OK" --cancel-label="Cancel" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=350 2> /dev/null +then + exit 0 +fi + +src_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +dest_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") + +( + gphoto2 --port "$port" --list-files 2> /tmp/geeqie-camera-import.log | awk '/#/ {print $2}' | sort > "$src_files_sorted" +) | zenity --progress --auto-close --auto-kill --title="Geeqie camera import" --text="Searching for files to download..." --pulsate --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 + +error=$(grep -i error /tmp/geeqie-camera-import.log) + +if [ -n "$error" ] +then + zenity --text-info --title="Geeqie camera import" - --window-icon=error --width=250 < /tmp/geeqie-camera-import.log 2> /dev/null + exit 1 +fi + +find . -maxdepth 1 -type f -exec basename {} \; | sort > "$dest_files_sorted" +existing_file_count=$(comm -12 "$src_files_sorted" "$dest_files_sorted" | wc -l) + +repeated=$(uniq --repeated "$src_files_sorted") +if [ -n "$repeated" ] +then + repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated" + + if zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null + then + exit 1 + fi +fi + +total=$(wc -l < "$src_files_sorted") +files_to_load=$((total - existing_file_count)) + +rm "$src_files_sorted" +rm "$dest_files_sorted" + +if [ "$files_to_load" -eq 0 ] +then + zenity --info --title="Geeqie camera download" --text="No photos to download" --width=250 --window-icon=usr/local/share/pixmaps/geeqie.png 2> /dev/null + exit 0 +fi + +if [ -f /tmp/geeqie-camera-import-files ] +then + rm /tmp/geeqie-camera-import-files +fi +touch /tmp/geeqie-camera-import-files + +zen_pipe=$(mktemp -u "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +mkfifo "$zen_pipe" + +gphoto2 --port "$port" --hook-script "$script_dir/"geeqie-camera-import-hook-script --get-all-files --skip-existing 2> /tmp/geeqie-camera-import.log & + +gphoto2_pid=$! + +(tail -f "$zen_pipe" 2> /dev/null) | zenity --progress --title="Geeqie camera import" --width=370 --text="Downloading: total: $files_to_load existing: $existing_file_count\n" --auto-close --auto-kill --percentage=0 window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null & +zen_pid=$! + +n=0 +while [ -f /tmp/geeqie-camera-import-files ] && [ "$n" -lt 100 ] +do + i=$(wc -l < "/tmp/geeqie-camera-import-files") + n=$(($((i * 100)) / files_to_load)) + printf '%s\n' "$n" > "$zen_pipe" + + latest_file=$(tail -n 1 /tmp/geeqie-camera-import-files) + if [ -z "$latest_file" ] + then + latest_file="Skipping existing files, if any..." + fi + printf '#Downloading: total: %s existing: %s\n%s' "$files_to_load existing" "$existing_file_count" "$latest_file" > "$zen_pipe" + + sleep 1 +done diff --git a/plugins/refresh-thumbnail/geeqie-refresh-thumbnail.sh b/plugins/refresh-thumbnail/geeqie-refresh-thumbnail.sh new file mode 100755 index 00000000..25203852 --- /dev/null +++ b/plugins/refresh-thumbnail/geeqie-refresh-thumbnail.sh @@ -0,0 +1,181 @@ +#!/bin/sh + +## @file +## @brief Import all images from camera +## +## Requires gphoto2 +## +finish() +{ + if [ -f /tmp/geeqie-camera-import-files ] + then + rm /tmp/geeqie-camera-import-files + fi + + if [ -p "$zen_pipe" ] + then + rm "$zen_pipe" + fi + + if [ "$gphoto2_pid" != "" ] + then + if ps -p "$gphoto2_pid" > /dev/null + then + kill "$gphoto2_pid" + fi + fi + + if [ "$zen_pid" != "" ] + then + if ps -p "$zen_pid" > /dev/null + then + kill "$zen_pid" + fi + fi +} +trap finish EXIT + +if [ $XDG_CACHE_HOME ] +then + + thumb_dir="$XDG_CACHE_HOME" +else + thumb_dir="$HOME/.cache/geeqie/thumbnails" +fi +echo $thumb_dir + +exit + + +if ! [ -x "$(command -v gphoto2)" ] +then + zenity --title="Geeqie camera import" --info --width=200 --text="gphoto2 is not installed" 2> /dev/null + exit 0 +fi + +if [ -f /tmp/geeqie-camera-import.log ] +then + rm /tmp/geeqie-camera-import.log +fi + +if [ "$(gphoto2 --auto-detect | wc -l)" -le 2 ] +then + zenity --error --title="Geeqie camera import" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2> /dev/null + exit 0 +fi + +IFS=' +' + +list=$(gphoto2 --auto-detect | tail -n +3) +camera_list="" +n=1 +count=$(gphoto2 --auto-detect | tail -n +3 | wc -l) +if [ "$count" -gt 1 ] +then + for camera in $list + do + if [ "$n" -eq "$count" ] + then + camera_list="${camera_list:+${camera_list}}TRUE\n$camera\n$n" + else + camera_list="${camera_list:+${camera_list}}FALSE\n$camera\n$n\n" + fi + n=$((n + 1)) + done + + camera_selected=$(printf '%b' "$camera_list" | zenity --width=500 --height=250 --title="Geeqie camera import" --list --text "Select camera" --radiolist --column "Select" --column "Camera" --column "n" --print-column=2 2> /dev/null) + + if [ $? = 1 ] + then + exit 0 + fi +else + camera_selected=$(gphoto2 --auto-detect | tail +3) +fi + +port_type=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $1}' | awk '{print $NF}') +camera=$(printf '%s\n' "$camera_selected" | awk -F "$port_type" '{print $1}') +port_address=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $2}') +port="$port_type:$port_address" + +script_dir=$(dirname "$0") + +if ! zenity --question --title="Geeqie camera import" --text="Camera: $camera\n\nDownloading to folder:\n$PWD" --ok-label="OK" --cancel-label="Cancel" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=350 2> /dev/null +then + exit 0 +fi + +src_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +dest_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") + +( + gphoto2 --port "$port" --list-files 2> /tmp/geeqie-camera-import.log | awk '/#/ {print $2}' | sort > "$src_files_sorted" +) | zenity --progress --auto-close --auto-kill --title="Geeqie camera import" --text="Searching for files to download..." --pulsate --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 + +error=$(grep -i error /tmp/geeqie-camera-import.log) + +if [ -n "$error" ] +then + zenity --text-info --title="Geeqie camera import" - --window-icon=error --width=250 < /tmp/geeqie-camera-import.log 2> /dev/null + exit 1 +fi + +find . -maxdepth 1 -type f -exec basename {} \; | sort > "$dest_files_sorted" +existing_file_count=$(comm -12 "$src_files_sorted" "$dest_files_sorted" | wc -l) + +repeated=$(uniq --repeated "$src_files_sorted") +if [ -n "$repeated" ] +then + repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated" + + if zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null + then + exit 1 + fi +fi + +total=$(wc -l < "$src_files_sorted") +files_to_load=$((total - existing_file_count)) + +rm "$src_files_sorted" +rm "$dest_files_sorted" + +if [ "$files_to_load" -eq 0 ] +then + zenity --info --title="Geeqie camera download" --text="No photos to download" --width=250 --window-icon=usr/local/share/pixmaps/geeqie.png 2> /dev/null + exit 0 +fi + +if [ -f /tmp/geeqie-camera-import-files ] +then + rm /tmp/geeqie-camera-import-files +fi +touch /tmp/geeqie-camera-import-files + +zen_pipe=$(mktemp -u "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +mkfifo "$zen_pipe" + +gphoto2 --port "$port" --hook-script "$script_dir/"geeqie-camera-import-hook-script --get-all-files --skip-existing 2> /tmp/geeqie-camera-import.log & + +gphoto2_pid=$! + +(tail -f "$zen_pipe" 2> /dev/null) | zenity --progress --title="Geeqie camera import" --width=370 --text="Downloading: total: $files_to_load existing: $existing_file_count\n" --auto-close --auto-kill --percentage=0 window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null & +zen_pid=$! + +n=0 +while [ -f /tmp/geeqie-camera-import-files ] && [ "$n" -lt 100 ] +do + i=$(wc -l < "/tmp/geeqie-camera-import-files") + n=$(($((i * 100)) / files_to_load)) + printf '%s\n' "$n" > "$zen_pipe" + + latest_file=$(tail -n 1 /tmp/geeqie-camera-import-files) + if [ -z "$latest_file" ] + then + latest_file="Skipping existing files, if any..." + fi + printf '#Downloading: total: %s existing: %s\n%s' "$files_to_load existing" "$existing_file_count" "$latest_file" > "$zen_pipe" + + sleep 1 +done diff --git a/plugins/refresh-thumbnail/meson.build b/plugins/refresh-thumbnail/meson.build new file mode 100644 index 00000000..9877a398 --- /dev/null +++ b/plugins/refresh-thumbnail/meson.build @@ -0,0 +1,22 @@ +# This file is a part of Geeqie project (https://www.geeqie.org/). +# Copyright (C) 2008 - 2022 The Geeqie Team +# +# 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 +# + +install_data('geeqie-refresh-thumbnail', install_dir : gq_bindir) + +i18n.merge_file( + input : 'org.geeqie.refresh-thumbnail.desktop.in', + output : 'org.geeqie.refresh-thumbnail.desktop', + type : 'desktop', + po_dir : podir, + install : true, + install_dir : desktopdir) diff --git a/plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in b/plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in new file mode 100644 index 00000000..14d57252 --- /dev/null +++ b/plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in @@ -0,0 +1,20 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Refresh Thumbnail +Comment=Refresh Thumbnail + +# Requires gphoto2 +# The gphoto2 file $HOME/.gphoto2/settings can +# be used to set auto-rename on download + +Exec=geeqie-refresh-thumbnail + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# It can be made verbose +#X-Geeqie-Verbose=true + +Icon=geeqie diff --git a/plugins/resize-image/meson.build b/plugins/resize-image/meson.build index 23db14b9..ae750393 100644 --- a/plugins/resize-image/meson.build +++ b/plugins/resize-image/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-resize-image', 'downsize', 'resize-help.sh', install_dir : gq_bindir) i18n.merge_file( - input : 'resize-image.desktop.in', - output : 'resize-image.desktop', + input : 'org.geeqie.resize-image.desktop.in', + output : 'org.geeqie.resize-image.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/resize-image/resize-image.desktop.in b/plugins/resize-image/org.geeqie.resize-image.desktop.in similarity index 100% rename from plugins/resize-image/resize-image.desktop.in rename to plugins/resize-image/org.geeqie.resize-image.desktop.in diff --git a/plugins/rotate/meson.build b/plugins/rotate/meson.build index f815525f..7110e53c 100644 --- a/plugins/rotate/meson.build +++ b/plugins/rotate/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-rotate', install_dir : gq_bindir) i18n.merge_file( - input : 'rotate.desktop.in', - output : 'rotate.desktop', + input : 'org.geeqie.rotate.desktop.in', + output : 'org.geeqie.rotate.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/rotate/rotate.desktop.in b/plugins/rotate/org.geeqie.rotate.desktop.in similarity index 100% rename from plugins/rotate/rotate.desktop.in rename to plugins/rotate/org.geeqie.rotate.desktop.in diff --git a/plugins/symlink/meson.build b/plugins/symlink/meson.build index f4e7bc5b..bbc3e845 100644 --- a/plugins/symlink/meson.build +++ b/plugins/symlink/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-symlink', install_dir : gq_bindir) i18n.merge_file( - input : 'symlink.desktop.in', - output : 'symlink.desktop', + input : 'org.geeqie.symlink.desktop.in', + output : 'org.geeqie.symlink.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/symlink/symlink.desktop.in b/plugins/symlink/org.geeqie.symlink.desktop.in similarity index 100% rename from plugins/symlink/symlink.desktop.in rename to plugins/symlink/org.geeqie.symlink.desktop.in diff --git a/plugins/tethered-photography/meson.build b/plugins/tethered-photography/meson.build index 26a5c71c..5544b0ad 100644 --- a/plugins/tethered-photography/meson.build +++ b/plugins/tethered-photography/meson.build @@ -14,8 +14,8 @@ install_data('geeqie-tethered-photography', 'geeqie-tethered-photography-hook-script', install_dir : gq_bindir) i18n.merge_file( - input : 'tethered-photography.desktop.in', - output : 'tethered-photography.desktop', + input : 'org.geeqie.tethered-photography.desktop.in', + output : 'org.geeqie.tethered-photography.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/tethered-photography/tethered-photography.desktop.in b/plugins/tethered-photography/org.geeqie.tethered-photography.desktop.in similarity index 100% rename from plugins/tethered-photography/tethered-photography.desktop.in rename to plugins/tethered-photography/org.geeqie.tethered-photography.desktop.in diff --git a/plugins/video-player/meson.build b/plugins/video-player/meson.build index 861e9bd0..1f25ed62 100644 --- a/plugins/video-player/meson.build +++ b/plugins/video-player/meson.build @@ -12,8 +12,8 @@ # i18n.merge_file( - input : 'video-player.desktop.in', - output : 'video-player.desktop', + input : 'org.geeqie.video-player.desktop.in', + output : 'org.geeqie.video-player.desktop', type : 'desktop', po_dir : podir, install : true, diff --git a/plugins/video-player/video-player.desktop.in b/plugins/video-player/org.geeqie.video-player.desktop.in similarity index 100% rename from plugins/video-player/video-player.desktop.in rename to plugins/video-player/org.geeqie.video-player.desktop.in