[svn] GnuPG - r4106 - trunk/g10

svn author dshaw cvs at cvs.gnupg.org
Tue Apr 11 21:20:11 CEST 2006


Author: dshaw
Date: 2006-04-11 21:20:08 +0200 (Tue, 11 Apr 2006)
New Revision: 4106

Modified:
   trunk/g10/ChangeLog
   trunk/g10/options.skel
   trunk/g10/photoid.c
Log:
* options.skel, photoid.c (get_default_photo_command): Find an image
viewer at runtime.  Seems FC5 doesn't have xloadimage.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2006-04-11 13:53:21 UTC (rev 4105)
+++ trunk/g10/ChangeLog	2006-04-11 19:20:08 UTC (rev 4106)
@@ -1,3 +1,8 @@
+2006-04-11  David Shaw  <dshaw at jabberwocky.com>
+
+	* options.skel, photoid.c (get_default_photo_command): Find an
+	image viewer at runtime.  Seems FC5 doesn't have xloadimage.
+
 2006-04-08  David Shaw  <dshaw at jabberwocky.com>
 
 	* getkey.c (parse_auto_key_locate): Fix dupe-removal code.

Modified: trunk/g10/options.skel
===================================================================
--- trunk/g10/options.skel	2006-04-11 13:53:21 UTC (rev 4105)
+++ trunk/g10/options.skel	2006-04-11 19:20:08 UTC (rev 4106)
@@ -182,14 +182,13 @@
 # input is the best way to do this as it avoids the time and effort in
 # generating and then cleaning up a secure temp file.
 #
-# The default program is "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin"
-# On Mac OS X and Windows, the default is to use your regular JPEG image
-# viewer.
+# If no photo-viewer is provided, GnuPG will look for xloadimage, eog,
+# or display (ImageMagick).  On Mac OS X and Windows, the default is
+# to use your regular JPEG image viewer.
 #
 # Some other viewers:
 # photo-viewer "qiv %i"
 # photo-viewer "ee %i"
-# photo-viewer "display -title 'KeyID 0x%k'"
 #
 # This one saves a copy of the photo ID in your home directory:
 # photo-viewer "cat > ~/photoid-for-key-%k.%t"

Modified: trunk/g10/photoid.c
===================================================================
--- trunk/g10/photoid.c	2006-04-11 13:53:21 UTC (rev 4105)
+++ trunk/g10/photoid.c	2006-04-11 19:20:08 UTC (rev 4106)
@@ -259,7 +259,8 @@
 }
 
 #if !defined(FIXED_PHOTO_VIEWER) && !defined(DISABLE_PHOTO_VIEWER)
-static const char *get_default_photo_command(void)
+static const char *
+get_default_photo_command(void)
 {
 #if defined(_WIN32)
   OSVERSIONINFO osvi;
@@ -278,7 +279,14 @@
 #elif defined(__riscos__)
   return "Filer_Run %I";
 #else
-  return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin";
+  if(path_access("xloadimage",X_OK)==0)
+    return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin";
+  else if(path_access("eog",X_OK)==0)
+    return "eog %i";
+  else if(path_access("display",X_OK)==0)
+    return "display -title 'KeyID 0x%k' %i";
+  else
+    return "";
 #endif
 }
 #endif
@@ -316,6 +324,12 @@
 	  opt.photo_viewer=get_default_photo_command();
 #endif
 
+	if(!*opt.photo_viewer)
+	  {
+	    log_info(_("no photo viewer set\n"));
+	    goto fail;
+	  }
+
 	/* make command grow */
 	command=pct_expando(opt.photo_viewer,&args);
 	if(!command)




More information about the Gnupg-commits mailing list