? gphoto/build
? gphoto/barbie/.cvsignore
? gphoto/digita/.cvsignore
? gphoto/dimera/.cvsignore
? gphoto/gallery/CSSjimmac/.cvsignore
? gphoto/jd11/.cvsignore
? gphoto/libgpio/ieee1394/Makefile.in
? gphoto/libgpio/include/Makefile.in
? gphoto/libgpio/libgpio/Makefile.in
? gphoto/libgpio/network/Makefile.in
? gphoto/libgpio/parallel/Makefile.in
? gphoto/libgpio/serial/Makefile.in
? gphoto/libgpio/usb/Makefile.in
? gphoto/polaroid/.cvsignore
? gphoto/src/desktop.c
? gphoto/src/desktop-events.c
? gphoto/src/desktop-events.h
? gphoto/src/desktop.h
Index: gphoto/.cvsignore
===================================================================
RCS file: /cvs/gnome/gphoto/.cvsignore,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 .cvsignore
--- gphoto/.cvsignore	1999/11/21 16:33:37	1.2.2.1
+++ gphoto/.cvsignore	2000/08/02 11:39:03
@@ -18,3 +18,4 @@
 install-sh
 missing
 mkinstalldirs
+ChangeLog
Index: gphoto/autogen.sh
===================================================================
RCS file: /cvs/gnome/gphoto/autogen.sh,v
retrieving revision 1.4.2.3
diff -u -r1.4.2.3 autogen.sh
--- gphoto/autogen.sh	2000/06/08 12:36:13	1.4.2.3
+++ gphoto/autogen.sh	2000/08/02 11:39:03
@@ -1,66 +1,17 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
-# This was lifted from the Gimp, and adapted slightly by
-# Raph Levien .
 
-DIE=0
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
 
-PROJECT=gphoto
+PKG_NAME="GPhoto"
 
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "You must have autoconf installed to compile $PROJECT."
-    echo "Download the appropriate package for your distribution,"
-    echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-    DIE=1
-}
-
-(libtool --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "You must have libtool installed to compile $PROJECT."
-    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz"
-    echo "(or a newer version if it is available)"
-    DIE=1
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "You must have automake installed to compile $PROJECT."
-    echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
-    echo "(or a newer version if it is available)"
-    DIE=1
-}
-
-if test "$DIE" -eq 1; then
+(test -f $srcdir/configure.in \
+  && test -f $srcdir/HACKING \
+  && test -d $srcdir/photopc) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level GPhoto directory"
     exit 1
-fi
-
-test -f PROGRAMMERS || {
-        echo "You must run this script in the top-level gphoto directory"
-        exit 1
 }
-
-if test -z "$*"; then
-    echo "I am going to run ./configure with no arguments - if you wish "
-    echo "to pass any to it, please specify them on the $0 command line."
-fi
-
-
-case $CC in
-*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
-esac
-
-for dir in .
-do 
-    echo processing $dir
-    (cd $dir; \
-    libtoolize --copy --force; \
-    aclocalinclude="$ACLOCAL_FLAGS"; \
-    aclocal $aclocalinclude; \
-    autoheader; automake --add-missing --gnu $am_opt; autoconf)
-done
-
-./configure "$@"
 
-echo 
-echo "Now type 'make' to compile $PROJECT."
+. $srcdir/macros/autogen.sh
Index: gphoto/configure.in
===================================================================
RCS file: /cvs/gnome/gphoto/configure.in,v
retrieving revision 1.31.2.23
diff -u -r1.31.2.23 configure.in
--- gphoto/configure.in	2000/06/11 16:55:42	1.31.2.23
+++ gphoto/configure.in	2000/08/02 11:39:03
@@ -1,10 +1,16 @@
 dnl Process this file with autoconf to produce a configure script.
+
 AC_INIT(src/gallery.c)
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE(gphoto, 0.5.1)
 AM_MAINTAINER_MODE
 
+dnl Pick up the Gnome macros.
+AM_ACLOCAL_INCLUDE(macros)
+
 dnl Checks for programs.
+GNOME_INIT
+AC_ISC_POSIX
 AC_PROG_CC
 AC_PROG_CPP
 AM_PROG_LIBTOOL
Index: gphoto/canon/canon.c
===================================================================
RCS file: /cvs/gnome/gphoto/canon/canon.c,v
retrieving revision 1.3.2.17
diff -u -r1.3.2.17 canon.c
--- gphoto/canon/canon.c	2000/06/22 18:09:01	1.3.2.17
+++ gphoto/canon/canon.c	2000/08/02 11:39:03
@@ -532,7 +532,7 @@
   //    GtkWidget *window,*box,*scrolled_win,*tree,*clear,*done;
   GtkWidget *dialog, *hbox, *vbox, *label, *tree, *vseparator;
   GtkWidget *file_list, *button, *cbutton, *clear,*set_button;
-  GtkWidget *combo, *swoff, *sync, *linkCombo;
+  GtkWidget *combo, *swoff, *sync;
   GtkWidget *owner_entry, *ga;
   GList *list;
 
Index: gphoto/canon/psa50.c
===================================================================
RCS file: /cvs/gnome/gphoto/canon/psa50.c,v
retrieving revision 1.4.2.17
diff -u -r1.4.2.17 psa50.c
--- gphoto/canon/psa50.c	2000/06/08 12:25:41	1.4.2.17
+++ gphoto/canon/psa50.c	2000/08/02 11:39:03
@@ -544,7 +544,6 @@
   int msgsize;
   char packet[0x3000];
   static char buffer[0x3000];
-  int i;
   int lonlen;
 
     memset(packet,0x00,0x3000);  /* zero block */
@@ -1303,7 +1302,6 @@
     unsigned char msg[0x3000];
     unsigned char *msgg;
     char newstr[100];
-    unsigned char *namn;
     unsigned int total = 0,expect = 0,size;
     int name_len,len,maxfilesize;
     
Index: gphoto/canon/serial.c
===================================================================
RCS file: /cvs/gnome/gphoto/canon/serial.c,v
retrieving revision 1.3.2.12
diff -u -r1.3.2.12 serial.c
--- gphoto/canon/serial.c	2000/07/21 00:12:39	1.3.2.12
+++ gphoto/canon/serial.c	2000/08/02 11:39:03
@@ -19,22 +19,15 @@
 #include <sys/time.h>
 #include <errno.h>
 #include <sys/ioctl.h>
+#include <string.h>
 
 #include "util.h"
 #include "psa50.h"
 #include "../src/gphoto.h"
 
-/****  new stuff ********/
 #include <gpio/gpio.h>
 extern struct Model *Camera;  
-int gpio_usb_find_device(int idvendor, int idproduct, struct usb_device **device);
-int gpio_usb_msg_write(gpio_device *dev, int value, char *bytes, int size);
-int gpio_usb_msg_read(gpio_device *dev, int value, char *bytes, int size);
-int gpio_usb_read(gpio_device *dev, char *bytes, int size);
-int gpio_usb_write(gpio_device *dev, char *bytes, int size);
-/*******  new stuff *********/
 
-
 /****************************************************************************
  *
  * static global storage area
@@ -114,10 +107,8 @@
 {
 #ifdef GPIO_USB
     char msg[65536];
-    char mem;
     char buffer[65536];
     gpio_device_settings settings;
-    struct usb_device *udev;
 #endif
 
     debug_message("Initializing the camera.\n");
@@ -126,25 +117,23 @@
   case CANON_USB:
 #ifdef GPIO_USB
     
-    if (gpio_usb_find_device(Camera->idVendor,
-			     Camera->idProduct, &udev)) {
+    iodev = gpio_new(GPIO_DEVICE_USB);
+    if (!iodev)
+      {
+	 return -1; 
+      }
+
+    if (gpio_usb_find_device(iodev,Camera->idVendor,
+			     Camera->idProduct)) {
       printf("found '%s' @ %s/%s\n", Camera->name,
-	     udev->bus->dirname, udev->filename);
+      	iodev->usb_device->bus->dirname, iodev->usb_device->filename);
     }
     else
       {
 	printf("Found no camera!\n");
 	exit(1);
       }
-    iodev = gpio_new(GPIO_DEVICE_USB);
-    if (!iodev)
-      {
-	 return -1; 
-      }
-      
     
-    settings.usb.udev = udev;
-
 	settings.usb.inep = 0x81;
 	settings.usb.outep = 0x02;
 	settings.usb.config = 1;
@@ -247,13 +236,13 @@
 
     if (sleep>0) {
       for(i=0;i<len;i++) {
-    	gpio_write(iodev,buf,1);
+    	gpio_write(iodev,(char *)buf,1);
 	buf++;
 	usleep(sleep);
       }
     }
     else {
-      gpio_write(iodev,buf,len);
+      gpio_write(iodev,(char *)buf,len);
     }
     
     return 0;
Index: gphoto/casio/command.c
===================================================================
RCS file: /cvs/gnome/gphoto/casio/command.c,v
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1.2.1 command.c
--- gphoto/casio/command.c	2000/07/05 11:07:47	1.1.1.1.2.1
+++ gphoto/casio/command.c	2000/08/02 11:39:03
@@ -1,6 +1,7 @@
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
Index: gphoto/casio/ppm.c
===================================================================
RCS file: /cvs/gnome/gphoto/casio/ppm.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ppm.c
--- gphoto/casio/ppm.c	1999/05/27 18:32:02	1.1.1.1
+++ gphoto/casio/ppm.c	2000/08/02 11:39:03
@@ -1,6 +1,7 @@
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 
 #include "../src/gphoto.h"
Index: gphoto/digita/commands.c
===================================================================
RCS file: /cvs/gnome/gphoto/digita/Attic/commands.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 commands.c
--- gphoto/digita/commands.c	2000/06/08 12:25:41	1.1.2.2
+++ gphoto/digita/commands.c	2000/08/02 11:39:03
@@ -11,6 +11,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <termios.h>
+#include <string.h>
 
 #include "digita.h"
 
Index: gphoto/digita/digita.c
===================================================================
RCS file: /cvs/gnome/gphoto/digita/Attic/digita.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 digita.c
--- gphoto/digita/digita.c	2000/06/08 12:25:41	1.1.2.2
+++ gphoto/digita/digita.c	2000/08/02 11:39:03
@@ -9,6 +9,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <termios.h>
+#include <string.h>
 
 #include "digita.h"
 
Index: gphoto/digita/serial.c
===================================================================
RCS file: /cvs/gnome/gphoto/digita/Attic/serial.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 serial.c
--- gphoto/digita/serial.c	2000/06/08 12:25:41	1.1.2.2
+++ gphoto/digita/serial.c	2000/08/02 11:39:03
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 #include <termios.h>
 
 #include "digita.h"
@@ -201,12 +202,12 @@
 	tcsendbreak(dev->gpdev->device_fd, 4);
 
 	dev->gpdev->settings.serial.speed = 0;
-	gpio_serial_set_baudrate(dev->gpdev);
+	gpio_update(dev->gpdev);
 
 	usleep(50);
 
 	dev->gpdev->settings.serial.speed = 9600;
-	gpio_serial_set_baudrate(dev->gpdev);
+	gpio_update(dev->gpdev);
 
 	usleep(2000);
 
@@ -250,7 +251,7 @@
 	dev->deviceframesize = ntohs(beacon_comp.deviceframesize);
 
 	dev->gpdev->settings.serial.speed = ntohl(beacon_comp.dataspeed);
-	gpio_serial_set_baudrate(dev->gpdev);
+	gpio_update(dev->gpdev);
 
 	usleep(100000);
 
Index: gphoto/digita/usb.c
===================================================================
RCS file: /cvs/gnome/gphoto/digita/Attic/usb.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 usb.c
--- gphoto/digita/usb.c	2000/07/21 00:12:39	1.1.2.4
+++ gphoto/digita/usb.c	2000/08/02 11:39:03
@@ -11,10 +11,8 @@
 #include <errno.h>
 
 #include "digita.h"
-
 #include "../src/gphoto.h"
-
-#include <gpio/gpio.h>
+#include <gpio.h>
 
 static int digita_usb_read(struct digita_device *dev, void *buffer, int len)
 {
@@ -37,17 +35,16 @@
 #ifdef GPIO_USB
 extern struct Model *Camera;
 
-int digita_usb_probe(struct usb_device **udev)
+int digita_usb_probe(struct digita_device *dev)
 {
-	if (gpio_usb_find_device(Camera->idVendor,
-	    Camera->idProduct, udev)) {
+	if (gpio_usb_find_device(dev->gpdev,Camera->idVendor,
+	    Camera->idProduct) == GPIO_OK) {
 		printf("found '%s' @ %s/%s\n", Camera->name,
-			(*udev)->bus->dirname, (*udev)->filename);
+			dev->gpdev->usb_device->bus->dirname,
+			dev->gpdev->usb_device->filename);
 		return 1;
 	}
-
 	fprintf(stderr, "unable to find any compatible USB cameras\n");
-
 	return 0;
 }
 #endif
@@ -59,9 +56,6 @@
 	gpio_device_settings settings;
 	struct usb_device *udev;
 
-	if (!digita_usb_probe(&udev))
-		return NULL;
-
 	dev = malloc(sizeof(*dev));
 	if (!dev)
 		return NULL;
@@ -70,7 +64,8 @@
 	if (!dev->gpdev)
 		return NULL;
 
-	settings.usb.udev = udev;
+	if (!digita_usb_probe(dev))
+		return NULL;
 
 	settings.usb.inep = 0x81;
 	settings.usb.outep = 0x02;
Index: gphoto/jd11/decomp.c
===================================================================
RCS file: /cvs/gnome/gphoto/jd11/Attic/decomp.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 decomp.c
--- gphoto/jd11/decomp.c	2000/06/05 07:00:37	1.1.2.1
+++ gphoto/jd11/decomp.c	2000/08/02 11:39:04
@@ -2,6 +2,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 
 #include "decomp.h"
 
Index: gphoto/jd11/jd11.c
===================================================================
RCS file: /cvs/gnome/gphoto/jd11/Attic/jd11.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 jd11.c
--- gphoto/jd11/jd11.c	2000/06/05 07:00:37	1.1.2.1
+++ gphoto/jd11/jd11.c	2000/08/02 11:39:04
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <termios.h>
 #include <unistd.h>
+#include <string.h>
 
 #include "../src/gphoto.h"
 
Index: gphoto/kodak/kodak_dc210.c
===================================================================
RCS file: /cvs/gnome/gphoto/kodak/kodak_dc210.c,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 kodak_dc210.c
--- gphoto/kodak/kodak_dc210.c	1999/11/30 18:32:10	1.4.2.2
+++ gphoto/kodak/kodak_dc210.c	2000/08/02 11:39:04
@@ -7,6 +7,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 /* glib is used for byte swapping and endian checking */
 #include <glib.h>
Index: gphoto/konica_qmxxx/main.c
===================================================================
RCS file: /cvs/gnome/gphoto/konica_qmxxx/main.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 main.c
--- gphoto/konica_qmxxx/main.c	1999/11/21 16:33:38	1.1.2.1
+++ gphoto/konica_qmxxx/main.c	2000/08/02 11:39:04
@@ -2,6 +2,7 @@
 #include "../src/gphoto.h"
 #undef DECLARE_GLOBAL_VARS_IN_GPHOTO_H
 
-void main(void)
+int main(void)
 {
+	return 0;
 }
Index: gphoto/konica_qmxxx/qm.c
===================================================================
RCS file: /cvs/gnome/gphoto/konica_qmxxx/qm.c,v
retrieving revision 1.1
diff -u -r1.1 qm.c
--- gphoto/konica_qmxxx/qm.c	1999/10/03 00:09:02	1.1
+++ gphoto/konica_qmxxx/qm.c	2000/08/02 11:39:04
@@ -25,6 +25,7 @@
 #include <sys/stat.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#include <string.h>
 
 #include "../src/gphoto.h"
 #include "../src/util.h"
Index: gphoto/mustek/core.c
===================================================================
RCS file: /cvs/gnome/gphoto/mustek/core.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 core.c
--- gphoto/mustek/core.c	2000/01/13 22:52:38	1.1.2.3
+++ gphoto/mustek/core.c	2000/08/02 11:39:04
@@ -26,6 +26,7 @@
 #include <termios.h>
 #include <sys/time.h>
 #include <stdlib.h>
+#include <string.h>
 #include "print.h"
 
 //------------- Global System Data ----------------------------------------/
Index: gphoto/mustek/image.c
===================================================================
RCS file: /cvs/gnome/gphoto/mustek/image.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 image.c
--- gphoto/mustek/image.c	2000/01/13 22:52:38	1.1.2.3
+++ gphoto/mustek/image.c	2000/08/02 11:39:04
@@ -22,6 +22,7 @@
  * is used.
  */
 
+#include <string.h>
 #include "image.h"
 #include "print.h"
 
Index: gphoto/mustek/io.c
===================================================================
RCS file: /cvs/gnome/gphoto/mustek/io.c,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 io.c
--- gphoto/mustek/io.c	2000/02/24 19:50:23	1.1.2.5
+++ gphoto/mustek/io.c	2000/08/02 11:39:04
@@ -32,6 +32,7 @@
 #undef _IO_C
 #include "../src/gphoto.h"
 
+#include <string.h>
 #include <sys/time.h>
 #include "print.h"
 #include "rs232.h"
Index: gphoto/nikon/coolpix600.c
===================================================================
RCS file: /cvs/gnome/gphoto/nikon/coolpix600.c,v
retrieving revision 1.2
diff -u -r1.2 coolpix600.c
--- gphoto/nikon/coolpix600.c	1999/09/11 09:51:29	1.2
+++ gphoto/nikon/coolpix600.c	2000/08/02 11:39:04
@@ -51,16 +51,17 @@
 *    - port to other *nixs. That shouldn't be too hard.
 */
 
-#include<stdio.h>
-#include<sys/types.h>
-#include<sys/stat.h>
-#include<fcntl.h>
-#include<unistd.h>
-#include<termios.h>
-#include<sys/ioctl.h>
-#include<setjmp.h>
-#include<sys/time.h>
-#include<signal.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <setjmp.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <string.h>
 #include "../src/gphoto.h"
 #include "../src/util.h"
 
Index: gphoto/philips/gphoto_philips.c
===================================================================
RCS file: /cvs/gnome/gphoto/philips/gphoto_philips.c,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 gphoto_philips.c
--- gphoto/philips/gphoto_philips.c	1999/11/21 16:33:39	1.5.2.2
+++ gphoto/philips/gphoto_philips.c	2000/08/02 11:39:04
@@ -25,6 +25,7 @@
 
 #include <stdio.h>
 #include <time.h>
+#include <string.h>
 /* #include <jpeglib.h> */
 #include "../src/gphoto.h"
 #include "../src/util.h"
Index: gphoto/philips/gphoto_philips_callbacks.c
===================================================================
RCS file: /cvs/gnome/gphoto/philips/gphoto_philips_callbacks.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 gphoto_philips_callbacks.c
--- gphoto/philips/gphoto_philips_callbacks.c	1999/10/08 00:49:24	1.1.2.1
+++ gphoto/philips/gphoto_philips_callbacks.c	2000/08/02 11:39:04
@@ -31,6 +31,7 @@
 
 
 #include <time.h>
+#include <string.h>
 #include <gtk/gtk.h>
 #include <gdk_imlib.h>
 
Index: gphoto/photopc/eph_cmd.c
===================================================================
RCS file: /cvs/gnome/gphoto/photopc/eph_cmd.c,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 eph_cmd.c
--- gphoto/photopc/eph_cmd.c	2000/07/05 11:07:49	1.2.2.1
+++ gphoto/photopc/eph_cmd.c	2000/08/02 11:39:04
@@ -79,6 +79,7 @@
 #include "config.h"
 #endif
 #include <stdio.h>
+#include <string.h>
 #include "eph_io.h"
 #include "eph_priv.h"
 
@@ -258,7 +259,7 @@
 			putpoint=buf;
 			maywrite=sizeof(buf);
 			pktsize=0;
-			(iob->runcb)(written);
+			(iob->runcb)(written,0);
 		}
 		if (length <= maywrite) {
 			maywrite=length;
@@ -295,6 +296,7 @@
 	char *ptr;
 	char *tmpbuf=NULL;
 	size_t tmpbufsize=0;
+	off_t total = *bufsize;
 
 	if ((buffer == NULL) && (iob->storecb == NULL)) {
 		eph_error(iob,ERR_BADARGS,
@@ -361,7 +363,7 @@
 		if (pkt.seq == expect) {
 			index+=readsize;
 			expect++;
-			(iob->runcb)(index);
+			(iob->runcb)(index,total);
 			if (buffer == NULL) {
 				if (iob->debug)
 					printf("storing %lu at %08lx\n",
Index: gphoto/photopc/eph_io.c
===================================================================
RCS file: /cvs/gnome/gphoto/photopc/eph_io.c,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 eph_io.c
--- gphoto/photopc/eph_io.c	2000/07/09 21:40:14	1.2.2.2
+++ gphoto/photopc/eph_io.c	2000/08/02 11:39:04
@@ -368,10 +368,10 @@
 		uint16 usb_read;
 		unsigned char usbbuf[256];
 		unsigned char *buffer_ptr;
+		unsigned char *buffer_ext;
 		uint16 buffer_remaining;
 		uint16 buffer_read;
 
-		buffer_ptr=buffer;
 		buffer_read=0;
 		usb_read=olympus_usb_read (gpdev,usbbuf,usbbuf_size);
 		if (usb_read<4) {
@@ -396,16 +396,32 @@
 			(unsigned long)length,(unsigned long)*bufsize);
 			return -1;
 		}
+		length+=2;	/* frame length + 2bytes crc */
+		buffer_ext = (iob->realloccb)(NULL,(size_t)length);
+		buffer_ptr = buffer_ext;
+		if (buffer_ext==0) {
+			eph_error(iob,ERR_DATA_TOO_LONG,
+			"could not malloc() %lu bytes",(unsigned long)length);
+			return -1;
+		}
 		buffer_read=MIN (length,usb_read-4);
 		memcpy (buffer_ptr,usbbuf+4,buffer_read);
+		for (i=0; i<buffer_read; i++)
+			crc1 += buffer_ptr[i];
 		buffer_remaining=length-buffer_read;
 		buffer_ptr+=buffer_read;
+
 		while (usb_read=olympus_usb_read (gpdev,usbbuf,usbbuf_size)) {
-			buffer_read=MIN (buffer_remaining,usb_read);
-			memcpy (buffer_ptr,usbbuf,buffer_read);
-			buffer_remaining-=buffer_read;
-			buffer_ptr+=buffer_read;
+			if (buffer_remaining) {
+				buffer_read=MIN (buffer_remaining,usb_read);
+				memcpy (buffer_ptr,usbbuf,buffer_read);
+				for (i=0; i<buffer_read; i++)
+					crc1 += buffer_ptr[i];
+				buffer_remaining-=buffer_read;
+				buffer_ptr+=buffer_read;
+			}
 		}
+		
 		if (buffer_remaining) {
 			eph_error(iob,ERR_BADREAD,
 					"read only %d bytes, %d expected\n",
@@ -413,128 +429,175 @@
 					length);
 			return -1;
 		}
-		(*bufsize)=length;
+		/*
+		 * verifying checksum. Here, length is supposed to be >= 2.
+		 */
+		crc2=(buffer_ext[length-1]<<8)|buffer_ext[length-2];
+		crc1-=buffer_ext[length-1];
+		crc1-=buffer_ext[length-2];
+		if (iob->debug) {
+			printf ("crc1=0x%04x\n",crc1);
+			printf ("crc2=0x%04x\n\n",crc2);
+		}
+		if (crc1 != crc2) {
+			if (iob->debug)
+				printf("crc %04x != %04x\n",crc1,crc2);
+			eph_error(iob,ERR_BADCRC,
+				  "crc received=0x%04x counted=0x%04x",
+				  crc2,crc1);
+			return -1;
+		}
+		/*
+		 * copy the data to the buffer passed as argument, and
+		 * exclude the final checksum
+		 */
+		memcpy (buffer,buffer_ext,length-2);
+		free (buffer_ext);
+		(*bufsize)=length-2;
 		return 0;
-	}
-
-	i=eph_readt(iob,buf,1,timeout_usec,&rc);
-	if (iob->debug > 1)
-		printf ("pktstart: i=%d rc=%d char=0x%02x\n",i,rc,*buf);
-	if (i < 0) {
-		eph_error(iob,ERRNO,"pkt start read error %s",strerror(ERRNO));
-		return -1;
-	} else if ((i == 0) && (rc == 0)) {
-		eph_error(iob,ERR_TIMEOUT,"pkt start read timeout (%ld)",
-				timeout_usec);
-		return -2;
-	} else if (i != 1) {
-		eph_error(iob,ERR_BADREAD,"pkt start read %d, expected 1",i);
-		return -1;
-	}
-	pkthdr->typ=buf[0];
-	if ((*buf != PKT_DATA) && (*buf != PKT_LAST)) {
-		if ((*buf != NAK) && (*buf != DC1))
-			eph_error(iob,ERR_BADDATA,"pkt start got 0x%02x",*buf);
-		return *buf;
-	}
-	got=0;
-	while ((i=eph_readt(iob,buf+1+got,3-got,DATATIMEOUT,&rc)) > 0) {
-		got+=i;
-	}
-	if (got != 3) {
-		if (i < 0) {
-			eph_error(iob,ERRNO,"pkt hdr read error %s (got %d)",
-					strerror(ERRNO),got);
-			return -1;
-		} else if ((i == 0) && (rc == 0)) {
-			eph_error(iob,ERR_TIMEOUT,"pkt hdr read timeout (%ld)",
-					DATATIMEOUT);
-			return -2;
-		} else {
-			eph_error(iob,ERR_BADREAD,"pkt hdr read return %d rc %d",
-					i,rc);
-			return -1;
-		}
-	}
-	if (iob->debug > 1) printf("header: %02x %02x %02x %02x\n",
-				buf[0],buf[1],buf[2],buf[3]);
-	pkthdr->seq=buf[1];
-	length=(buf[3]<<8)|buf[2];
-	if (length > *bufsize) {
-		eph_error(iob,ERR_DATA_TOO_LONG,
-			"length in pkt header %lu bigger than buffer size %lu",
-			(unsigned long)length,(unsigned long)*bufsize);
-		return -1;
-	}
-
-	got=0;
-	while ((i=eph_readt(iob,buffer+got,length-got,iob->timeout,&rc)) > 0) {
-		got+=i;
-	}
-	if (got != length) {
+	} else {
+		i=eph_readt(iob,buf,1,timeout_usec,&rc);
+		if (iob->debug > 1)
+			printf ("pktstart: i=%d rc=%d char=0x%02x\n",i,rc,*buf);
 		if (i < 0) {
-			eph_error(iob,ERRNO,"pkt data read error %s",strerror(ERRNO));
+			eph_error(iob,ERRNO,
+				  "pkt start read error %s",strerror(ERRNO));
 			return -1;
 		} else if ((i == 0) && (rc == 0)) {
-			eph_error(iob,ERR_TIMEOUT,"pkt data read timeout (%ld)",
-				iob->timeout);
+			eph_error(iob,ERR_TIMEOUT,
+				  "pkt start read timeout (%ld)",timeout_usec);
 			return -2;
-		} else {
+		} else if (i != 1) {
 			eph_error(iob,ERR_BADREAD,
-				"pkt read return %d, rc %d",i,rc);
+				  "pkt start read %d, expected 1",i);
 			return -1;
 		}
-	}
-
-	for (i=0;i<length;i++) {
-		crc1+=(unsigned char)buffer[i];
-	}
-
-	got=0;
-	while ((i=eph_readt(iob,buf+got,2-got,DATATIMEOUT,&rc)) > 0) {
-		got+=i;
-	}
-	if (iob->debug > 1)
-		printf ("crc: %02x %02x i=%d rc=%d\n",buf[0],buf[1],i,rc);
-	if (got != 2) {
-		if (i < 0) {
-			eph_error(iob,ERRNO,"pkt crc read error %s",strerror(ERRNO));
-			return -1;
-		} else if ((i == 0) && (rc == 0)) {
-			eph_error(iob,ERR_TIMEOUT,"pkt crc read timeout (%ld)",
-					DATATIMEOUT);
-			return -2;
-		} else {
-			eph_error(iob,ERR_BADREAD,"pkt crc read return %d rc %d",
-					i,rc);
-			return -1;
-		}
-	}
-
-	crc2=(buf[1]<<8)|buf[0];
-	if (crc1 != crc2) {
-		if (iob->debug) printf("crc %04x != %04x\n",crc1,crc2);
-		eph_error(iob,ERR_BADCRC,
-			"crc received=0x%04x counted=0x%04x",crc2,crc1);
-		return -1;
-	}
-	if (iob->debug > 1) {
-		int j;
-
-		printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length);
-		if (iob->debug > 2) for (j=0;j<length;j++) {
-			printf(" %02x",(unsigned char)buffer[j]);
-		} else printf(" ...");
-		printf("\n");
-		printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length);
-		if (iob->debug > 2) for (j=0;j<length;j++) {
-			printf(" %c ",(buffer[j] >= ' ' && buffer[j] < 127)
+		pkthdr->typ=buf[0];
+		if ((*buf != PKT_DATA) && (*buf != PKT_LAST)) {
+			if ((*buf != NAK) && (*buf != DC1))
+				eph_error(iob,ERR_BADDATA,
+					  "pkt start got 0x%02x",*buf);
+			return *buf;
+		}
+		got=0;
+		while ((i=eph_readt(iob,buf+1+got,3-got,DATATIMEOUT,&rc)) > 0)
+			got+=i;
+		if (got != 3) {
+			if (i < 0) {
+				eph_error(iob,ERRNO,
+					  "pkt hdr read error %s (got %d)",
+					  strerror(ERRNO),got);
+				return -1;
+			} else if ((i == 0) && (rc == 0)) {
+				eph_error(iob,ERR_TIMEOUT,
+					  "pkt hdr read timeout (%ld)",
+					  DATATIMEOUT);
+				return -2;
+			} else {
+				eph_error(iob,ERR_BADREAD,
+					  "pkt hdr read return %d rc %d",
+					  i,rc);
+				return -1;
+			}
+		}
+		if (iob->debug > 1)
+			printf("header: %02x %02x %02x %02x\n",
+			       buf[0],buf[1],buf[2],buf[3]);
+		pkthdr->seq=buf[1];
+		length=(buf[3]<<8)|buf[2];
+		if (length > *bufsize) {
+			eph_error(iob,ERR_DATA_TOO_LONG,
+				  "length in pkt header %lu "
+				  "bigger than buffer size %lu",
+				  (unsigned long)length,
+				  (unsigned long)*bufsize);
+			return -1;
+		}
+
+		got=0;
+		while ((i=eph_readt(iob,buffer+got,
+				    length-got,iob->timeout,&rc)) > 0)
+			got+=i;
+		if (got != length) {
+			if (i < 0) {
+				eph_error(iob,ERRNO,
+					  "pkt data read error %s",
+					  strerror(ERRNO));
+				return -1;
+			} else if ((i == 0) && (rc == 0)) {
+				eph_error(iob,ERR_TIMEOUT,
+					  "pkt data read timeout (%ld)",
+					  iob->timeout);
+				return -2;
+			} else {
+				eph_error(iob,ERR_BADREAD,
+					  "pkt read return %d, rc %d",i,rc);
+				return -1;
+			}
+		}
+
+		for (i=0;i<length;i++)
+			crc1+=(unsigned char)buffer[i];
+
+		got=0;
+		while ((i=eph_readt(iob,buf+got,2-got,DATATIMEOUT,&rc)) > 0)
+			got+=i;
+		if (iob->debug > 1)
+			printf ("crc: %02x %02x i=%d rc=%d\n",
+				buf[0],buf[1],i,rc);
+		if (got != 2) {
+			if (i < 0) {
+				eph_error(iob,ERRNO,
+					  "pkt crc read error %s",
+					  strerror(ERRNO));
+				return -1;
+			} else if ((i == 0) && (rc == 0)) {
+				eph_error(iob,ERR_TIMEOUT,
+					  "pkt crc read timeout (%ld)",
+					  DATATIMEOUT);
+				return -2;
+			} else {
+				eph_error(iob,ERR_BADREAD,
+					  "pkt crc read return %d rc %d",
+					  i,rc);
+				return -1;
+			}
+		}
+
+		crc2=(buf[1]<<8)|buf[0];
+		if (crc1 != crc2) {
+			if (iob->debug)
+				printf("crc %04x != %04x\n",crc1,crc2);
+			eph_error(iob,ERR_BADCRC,
+				  "crc received=0x%04x counted=0x%04x",
+				  crc2,crc1);
+			return -1;
+		}
+		if (iob->debug > 1) {
+			int j;
+
+			printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length);
+			if (iob->debug > 2)
+				for (j=0;j<length;j++) {
+					printf(" %02x",
+					       (unsigned char)buffer[j]);
+				} else 
+					printf(" ...");
+			printf("\n");
+			printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length);
+			if (iob->debug > 2)
+				for (j=0;j<length;j++) {
+					printf(" %c ",
+					       (buffer[j] >= ' ' 
+						&& buffer[j] < 127)
 							? buffer[j] : '.');
-		} else printf(" ...");
-		printf("\n");
+				} else 
+					printf(" ...");
+			printf("\n");
+		}
+		(*bufsize)=length;
+		return 0;
 	}
-	(*bufsize)=length;
-	return 0;
 }
 
 int
Index: gphoto/photopc/eph_io.h
===================================================================
RCS file: /cvs/gnome/gphoto/photopc/eph_io.h,v
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1.2.1 eph_io.h
--- gphoto/photopc/eph_io.h	2000/07/05 11:07:49	1.1.1.1.2.1
+++ gphoto/photopc/eph_io.h	2000/08/02 11:39:04
@@ -95,7 +95,7 @@
 typedef struct _eph_iob {
 	void (*errorcb)(int errcode,char *errstr);
 	void *(*realloccb)(void *old,size_t length);
-	void (*runcb)(off_t count);
+	void (*runcb)(off_t count, off_t total);
 	int (*storecb)(char *data,size_t size);
 	int debug;
 #if defined(UNIX)
@@ -119,7 +119,7 @@
 
 eph_iob *eph_new(void (*errorcb)(int errcode,char *errstr),
 		void *(*realloccb)(void *old,size_t length),
-		void (*runcb)(off_t count),
+		void (*runcb)(off_t count, off_t total),
 		int (*storecb)(char *data,size_t size),
 		int debug);
 int eph_open(eph_iob *iob,char *device_name,long speed,
Index: gphoto/photopc/eph_iob.c
===================================================================
RCS file: /cvs/gnome/gphoto/photopc/eph_iob.c,v
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1.2.1 eph_iob.c
--- gphoto/photopc/eph_iob.c	2000/07/05 11:07:49	1.1.1.1.2.1
+++ gphoto/photopc/eph_iob.c	2000/08/02 11:39:04
@@ -78,7 +78,7 @@
 }
 
 static void
-defruncb(off_t count)
+defruncb(off_t count, off_t total)
 {
 	return;
 }
@@ -86,7 +86,7 @@
 eph_iob *
 eph_new(void (*errorcb)(int errcode,char *errstr),
 		void *(*realloccb)(void *old,size_t length),
-		void (*runcb)(off_t count),
+		void (*runcb)(off_t count, off_t total),
 		int (*storecb)(char *data,size_t size),
 		int debug)
 {
Index: gphoto/photopc/olympus.c
===================================================================
RCS file: /cvs/gnome/gphoto/photopc/olympus.c,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 olympus.c
--- gphoto/photopc/olympus.c	2000/07/05 11:07:49	1.5.2.1
+++ gphoto/photopc/olympus.c	2000/08/02 11:39:04
@@ -19,9 +19,21 @@
 eph_iob   *iob;                /* Olympus/photoPC io-buffer    */
 struct olympus_device *gpdev;
 
-int oly_initialize () {
+extern float progress_min;
+extern float progress_max;
+	
+static void
+oly_update_progress (off_t count, off_t total)
+{
+	float percent = (float)count/(float)total;
+	if (total)
+		update_progress (progress_min+percent*(progress_max-progress_min));
+}
 
-	iob = eph_new(NULL, NULL, NULL, NULL, 0);
+int
+oly_initialize () {
+
+	iob = eph_new(NULL, NULL, oly_update_progress, NULL, 0);
 	return 1;
 }
 
@@ -32,7 +44,8 @@
  * for the context.  Cameras not supporting folders should not
  * reach this code, but should still work if they do. -mid 
  */
-static int xchdir(eph_iob *iob,char *where, int have_folders)
+static int 
+xchdir(eph_iob *iob,char *where, int have_folders)
 {
       char path[MAXPATH],*p;
 
@@ -57,7 +70,8 @@
       return 0;
 }
 
-static int descend(eph_iob *iob,int depth,char *root,int(*each)(eph_iob *iob,char *path), int have_folders)
+static int 
+descend(eph_iob *iob,int depth,char *root,int(*each)(eph_iob *iob,char *path), int have_folders)
 {
       long nfolders=0L,i;
       off_t f_size;
@@ -125,7 +139,8 @@
       } else return 0;
 }
 
-int oly_init2(eph_iob *iob)
+int 
+oly_init2(eph_iob *iob)
 {
 	long ret;
 	int rc;
@@ -142,7 +157,9 @@
       return 0;
 }
 
-int oly_open_camera () {
+int 
+oly_open_camera ()
+{
 
 	/* Open the camera for reading/writing */
 
@@ -154,19 +171,21 @@
 
 		gpdev = olympus_usb_open();
 		if (!gpdev)
-			return (0);
+			return 0;
 		info_size=16;
 		info=malloc(info_size);
 	} else {
 		if (eph_open(iob, serial_port, 115200, 0, 0) == -1)
-			return (0);
+			return 0;
 	}
 
 	oly_init2(iob);
-	return (1);
+	return 1;
 }
 
-void oly_close_camera() {
+void 
+oly_close_camera() 
+{
 
 	/* Close the camera */
 
@@ -176,7 +195,9 @@
 		eph_close(iob, 0);
 }
 
-int oly_number_of_pictures () {
+int 
+oly_number_of_pictures () 
+{
 
 	long num_pictures_taken = 0;
 
@@ -190,7 +211,9 @@
 	return ((int)num_pictures_taken);
 }
 
-int oly_take_picture () {
+int 
+oly_take_picture () 
+{
 
 	char zero = 0;
 
@@ -203,7 +226,9 @@
 	return (oly_number_of_pictures());
 }
 
-struct Image *oly_get_picture (int picNum, int thumbnail) {
+struct Image *
+oly_get_picture (int picNum, int thumbnail) 
+{
 
 	/*
 	   Reads image #picNum the Olympus camera.
@@ -255,20 +280,26 @@
 	strcpy(im->image_type, "jpg");
 
 	oly_close_camera();
-	update_progress(0);
 	return (im);
 }
 
-struct Image *oly_get_preview () {
+struct Image *
+oly_get_preview () 
+{
 
-	char zero = '0';
+	char zero = 0;
 
-	oly_open_camera();
+	if (oly_open_camera() == 0) {
+		error_dialog("Could not open camera.");
+		return NULL;
+	}
 	eph_action(iob,5,&zero,1);
 	return (oly_get_picture(0, 0));
 }
 
-int oly_configure () {
+int 
+oly_configure () 
+{
 
 	/*
 	   Shows the Olympus config dialog
@@ -277,6 +308,8 @@
 	char *info, *camID;
 	off_t info_size = 2048;
 	time_t camtime;
+	time_t gmttime;
+	struct tm *loctime;
 	char *atime;
 
 	long value;
@@ -526,8 +559,8 @@
 
 	eph_getint(iob,2,&camtime);
 	update_progress(1.0);
-	atime = ctime(&camtime);
-	label = gtk_label_new(atime);
+	atime  = asctime(gmtime(&camtime));
+	label  = gtk_label_new(atime);
 	gtk_widget_show(label);
 	gtk_table_attach_defaults(GTK_TABLE(table),label,3,5,11,12);
 
@@ -639,9 +672,17 @@
 
 	/* Set the clock... */
 	if (GTK_WIDGET_STATE(Config.clk_comp) == GTK_STATE_ACTIVE) {
-		camtime = time(&camtime);
-		eph_setint(iob,2,camtime);
-		sleep(1);
+		gmttime = time(NULL);
+		loctime = localtime(&gmttime);
+
+		/*
+		 * Let's get the Seconds east of UTC
+		 */
+#ifdef __USE_BSD
+		eph_setint(iob,2,gmttime+loctime->tm_gmtoff);
+#else
+		eph_setint(iob,2,gmttime+loctime->__tm_gmtoff);
+#endif
 	}
 	update_progress(1.00);
 	oly_close_camera();
@@ -651,7 +692,9 @@
 	return 1;
 }
 
-int oly_delete_image (int picNum) {
+int 
+oly_delete_image (int picNum) 
+{
 
 	/*
 	   deletes image #picNum from the Olympus camera.
@@ -672,7 +715,9 @@
 char oly_summary_text[1024];
 
 
-char *oly_summary() {
+char *
+oly_summary() 
+{
 
 	unsigned long l;
 	char *s;
Index: gphoto/photopc/photopc-usb.c
===================================================================
RCS file: /cvs/gnome/gphoto/photopc/Attic/photopc-usb.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 photopc-usb.c
--- gphoto/photopc/photopc-usb.c	2000/07/21 00:12:39	1.1.2.3
+++ gphoto/photopc/photopc-usb.c	2000/08/02 11:39:04
@@ -17,19 +17,27 @@
 
 #include <gpio/gpio.h>
 
-int olympus_usb_read(struct olympus_device *dev, void *buffer, int len)
+int
+olympus_usb_read(struct olympus_device *dev, void *buffer, int len)
 {
 #ifdef GPIO_USB
-	return gpio_read(dev->gpdev, buffer, len);
+	if (dev)
+		return gpio_read(dev->gpdev, buffer, len);
+	else
+		return GPIO_ERROR;
 #else
 	return GPIO_ERROR;
 #endif
 }
 
-int olympus_usb_send(struct olympus_device *dev, void *buffer, int len)
+int
+olympus_usb_send(struct olympus_device *dev, void *buffer, int len)
 {
 #ifdef GPIO_USB
-	return gpio_write(dev->gpdev, buffer, len);
+	if (dev)
+		return gpio_write(dev->gpdev, buffer, len);
+	else
+		return GPIO_ERROR;
 #else
 	return GPIO_ERROR;
 #endif
@@ -38,12 +46,14 @@
 #ifdef GPIO_USB
 extern struct Model *Camera;
 
-int olympus_usb_probe(struct usb_device **udev)
+int 
+olympus_usb_probe(struct olympus_device *dev)
 {
-	if (gpio_usb_find_device(Camera->idVendor,
-	    Camera->idProduct, udev)) {
-		printf("found '%s' @ %s/%s\n", Camera->name,
-			(*udev)->bus->dirname, (*udev)->filename);
+	if (gpio_usb_find_device(dev->gpdev, Camera->idVendor,
+				 Camera->idProduct) == GPIO_OK) {
+                printf("found '%s' @ %s/%s\n", Camera->name,
+ 		       dev->gpdev->usb_device->bus->dirname,
+		       dev->gpdev->usb_device->filename);
 		return 1;
 	}
 
@@ -53,7 +63,8 @@
 }
 #endif
 
-struct olympus_device *olympus_usb_open(void)
+struct olympus_device *
+olympus_usb_open(void)
 {
 #ifdef GPIO_USB
 	struct olympus_device *dev;
@@ -68,7 +79,7 @@
 	if (!dev->gpdev)
 		return NULL;
 
-	if (!olympus_usb_probe(&udev))
+	if (!olympus_usb_probe(dev))
 		return NULL;
 
 	gpio_set_timeout (dev->gpdev, 5000);
@@ -80,7 +91,7 @@
 	settings.usb.altsetting = 0;
 
 	gpio_set_settings(dev->gpdev, settings);
-	gpio_set_timeout(dev->gpdev, 50000);
+	gpio_set_timeout(dev->gpdev, 5000);
 	if (gpio_open(dev->gpdev) < 0) {
 		fprintf(stderr, "error opening device\n");
 		return NULL;
@@ -92,18 +103,23 @@
 #endif
 }
 
-void olympus_usb_close (struct olympus_device *dev)
+void 
+olympus_usb_close (struct olympus_device *dev)
 {
 #ifdef GPIO_USB
-	gpio_close (dev->gpdev);
-	gpio_free (dev->gpdev);
-	free (dev);
+	if (dev) {
+		gpio_close (dev->gpdev);
+		gpio_free (dev->gpdev);
+		free (dev);
+	}
 #endif
 }
 
-void olympus_usb_reset (struct olympus_device *dev)
+void
+olympus_usb_reset (struct olympus_device *dev)
 {
 #ifdef GPIO_USB
-	gpio_usb_clear_halt (dev->gpdev);
+	if (dev)
+		gpio_usb_clear_halt (dev->gpdev, GPIO_USB_IN_ENDPOINT);
 #endif
 }
Index: gphoto/ricoh/ricoh_300_io.c
===================================================================
RCS file: /cvs/gnome/gphoto/ricoh/ricoh_300_io.c,v
retrieving revision 1.2
diff -u -r1.2 ricoh_300_io.c
--- gphoto/ricoh/ricoh_300_io.c	1999/06/18 12:25:19	1.2
+++ gphoto/ricoh/ricoh_300_io.c	2000/08/02 11:39:04
@@ -23,6 +23,8 @@
 #include <errno.h>
 #include <signal.h>
 #include <time.h>
+#include <string.h>
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 
Index: gphoto/ricoh/ricoh_300z.c
===================================================================
RCS file: /cvs/gnome/gphoto/ricoh/ricoh_300z.c,v
retrieving revision 1.8
diff -u -r1.8 ricoh_300z.c
--- gphoto/ricoh/ricoh_300z.c	1999/10/02 23:41:37	1.8
+++ gphoto/ricoh/ricoh_300z.c	2000/08/02 11:39:04
@@ -4,6 +4,7 @@
 #include <jpeglib.h>
 #include <setjmp.h>
 #include <time.h>
+#include <string.h>
 #include "../src/gphoto.h"
 #include "../src/util.h"
 
Index: gphoto/samsung/samsung.c
===================================================================
RCS file: /cvs/gnome/gphoto/samsung/samsung.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 samsung.c
--- gphoto/samsung/samsung.c	2000/01/13 19:31:48	1.1.2.1
+++ gphoto/samsung/samsung.c	2000/08/02 11:39:04
@@ -32,16 +32,17 @@
    **
  */
 
-#include<stdio.h>
-#include<sys/types.h>
-#include<sys/stat.h>
-#include<fcntl.h>
-#include<unistd.h>
-#include<termios.h>
-#include<sys/ioctl.h>
-#include<setjmp.h>
-#include<sys/time.h>
-#include<signal.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <setjmp.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <string.h>
 #include "../src/gphoto.h"
 #include "../src/util.h"
 
Index: gphoto/sony/command.c
===================================================================
RCS file: /cvs/gnome/gphoto/sony/command.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 command.c
--- gphoto/sony/command.c	1999/05/27 18:32:06	1.1.1.1
+++ gphoto/sony/command.c	2000/08/02 11:39:04
@@ -1,5 +1,6 @@
 #include "config.h"
 #include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include "common.h"
 #ifdef X68
@@ -288,11 +289,11 @@
       break;
     }
     sprintf(tmp_buf, "Total Pictures: %02d\n", pic_num);
-    strcat(status_buf, tmp_buf, sizeof(tmp_buf));
+    strcat(status_buf, tmp_buf);
     sprintf(tmp_buf, "Date: %02d/%02d/%02d\n", month, date, year);
-    strcat(status_buf, tmp_buf, sizeof(tmp_buf));
+    strcat(status_buf, tmp_buf);
     sprintf(tmp_buf, "Time: %02d:%02d\n",hour, minutes);
-    strcat(status_buf, tmp_buf, sizeof(tmp_buf));
+    strcat(status_buf, tmp_buf);
   }
   /* return (buf[2]);	ok*/
     strcpy(return_buf, status_buf);
Index: gphoto/sony/dscf55/Makefile.am
===================================================================
RCS file: /cvs/gnome/gphoto/sony/dscf55/Makefile.am,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 Makefile.am
--- gphoto/sony/dscf55/Makefile.am	2000/06/08 12:25:43	1.1.2.2
+++ gphoto/sony/dscf55/Makefile.am	2000/08/02 11:39:04
@@ -7,8 +7,8 @@
 rsony_SOURCES = 
 rsony_LDADD = srsony.o config.o serio.o
 
-srsony.o : rsony.c serio.o config.o serio.h 
-	$(COMPILE) -DSTAND_ALONE -o srsony.o -c rsony.c
+srsony.o : ${srcdir}/rsony.c serio.o config.o serio.h 
+	$(COMPILE) -DSTAND_ALONE -o srsony.o -c ${srcdir}/rsony.c
 
 ## rsony_SOURCES = rmain.c rsony.c config.c serio.c serio.h
 
@@ -18,4 +18,4 @@
 
 libgphoto_sony_dscf55_la_LDFLAGS = -version-info 0:0:0
 
-EXTRA_DIST = serio.h rsony.c serio.c config.c config.h
\ No newline at end of file
+EXTRA_DIST = serio.h rsony.c serio.c config.c config.h
Index: gphoto/src/Makefile.am
===================================================================
RCS file: /cvs/gnome/gphoto/src/Makefile.am,v
retrieving revision 1.18.2.10
diff -u -r1.18.2.10 Makefile.am
--- gphoto/src/Makefile.am	2000/06/08 12:25:44	1.18.2.10
+++ gphoto/src/Makefile.am	2000/08/02 11:39:04
@@ -2,11 +2,46 @@
 
 SUBDIRS = icons
 
+INCLUDES = -I$(srcdir/icons) $(GNOME_INCLUDEDIR)
+
 bin_PROGRAMS = gphoto
+
+gphoto_SOURCES = \
+	gphoto.h \
+	\
+	main.c \
+	commandline.c \
+	live.c \
+	gallery.c \
+	menu.c \
+	toolbar.c \
+	callbacks.c \
+	util.c \
+	developer_dialog.c \
+	img_edit.c \
+	gphoto.c \
+	main.h \
+	commandline.h \
+	live.h \
+	gallery.h \
+	menu.h \
+	toolbar.h \
+	callbacks.h \
+	util.h \
+	cameras.h \
+	developer.h \
+	developer_dialog.h \
+	exif.c \
+	exif.h 
+#	desktop.c \
+#	desktop.h \
+#	desktop-events.c \
+#	desktop-events.h
 
-CFLAGS = @CFLAGS@ -I$(srcdir)/icons @GTK_CFLAGS@ @GDK_IMLIB_CFLAGS@
+gphoto_LDFLAGS = -export-dynamic
 
-gphoto_LDADD = ../konica/libgphoto_konica_qm100.la \
+gphoto_libs = \
+	../konica/libgphoto_konica_qm100.la \
 	../konica_qmxxx/libgphoto_konica_qmxxx.la \
 	../barbie/libgphoto_barbie.la \
 	../canon/libgphoto_canon.la \
@@ -27,11 +62,12 @@
 	../samsung/libgphoto_samsung.la \
 	../sony/libgphoto_sony_dscf1.la \
 	../sony/dscf55/libgphoto_sony_dscf55.la \
-	../directory/libgphoto_dir.la \
-	@GTK_LIBS@ @GDK_IMLIB_LIBS@ -ljpeg -lgpio
+	../directory/libgphoto_dir.la
 
-gphoto_SOURCES =  main.c commandline.c live.c gallery.c menu.c \
-	toolbar.c callbacks.c util.c developer_dialog.c img_edit.c gphoto.c \
-	main.h commandline.h live.h gallery.h menu.h toolbar.h callbacks.h \
-	util.h cameras.h gphoto.h developer.h developer_dialog.h \
-	exif.c exif.h
+gphoto_LDADD = \
+	$(gphoto_libs) \
+	$(GNOME_LIBDIR) \
+	-ljpeg -lgpio \
+	$(GDK_IMLIB_LIBS) \
+	$(GTK_LIBS) \
+	$(GNOMEUI_LIBS)
Index: gphoto/src/callbacks.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/callbacks.c,v
retrieving revision 1.51.2.23
diff -u -r1.51.2.23 callbacks.c
--- gphoto/src/callbacks.c	2000/07/06 18:08:15	1.51.2.23
+++ gphoto/src/callbacks.c	2000/08/02 11:39:04
@@ -31,8 +31,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#include "post_processing_on.xpm"
-#include "post_processing_off.xpm"
+#include "icons/post_processing_on.xpm"
+#include "icons/post_processing_off.xpm"
 
 #define DEBUG(x) printf(x)
 
@@ -57,6 +57,10 @@
 
 extern char 	 *filesel_cwd;
 
+extern float progress_min;
+extern float progress_max;
+extern int cam_busy;
+
 /* Search the image_info tags for "name", return its value (string) */
 char *find_tag(struct Image *im, char *name)
 {
@@ -90,6 +94,7 @@
 void set_camera(char *model)
 {
 	int i;
+	int ret;
 
 	for (i = 0; cameras[i].name; i++) {
 		if (strcmp(model, cameras[i].name))
@@ -103,14 +108,29 @@
 		    
 		Camera = &cameras[i];
 
-		if (Camera->ops->initialize() != 0)
+		if (cam_busy) {
+	 		error_dialog("Camera is already busy");
 			return;
+		}
+		cam_busy=1;
+		ret=Camera->ops->initialize();
+		cam_busy=0;
+		if (ret) return;
 	}
 }
 
 void configure_call(void)
 {
-	if (Camera->ops->configure() == 0)
+	int ret;
+
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
+	ret=Camera->ops->configure();
+	cam_busy=0;
+	if (ret == 0)
 	 	error_dialog("No configuration options.");
 }
 
@@ -126,14 +146,20 @@
 
 	update_status("Taking picture...");
 	
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
 	picNum = Camera->ops->take_picture();
+	cam_busy=0;
 
 	if (!picNum) {
 		error_dialog("Could not take a picture.");
 		return;
 	}
 	    
-	appendpic(picNum, 0, TRUE, NULL);
+	appendpic(picNum, 0, TRUE, NULL, 100);
 	sprintf(status, "New picture is #%03i", picNum);
 	gtk_notebook_set_page(GTK_NOTEBOOK(notebook), picNum);
 	update_status(status);
@@ -144,6 +170,11 @@
 	gint current, no_pics, i;
 	char error[32];
 
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
 	no_pics = Camera->ops->number_of_pictures();
 	i = no_pics;
 
@@ -166,6 +197,7 @@
 	update_status("Deleted all images.");
 	update_progress(0);
 	gtk_widget_destroy(dialog);
+	cam_busy=0;
 }
 
 void del_pics(GtkWidget *dialog, GtkObject *button)
@@ -174,6 +206,11 @@
 	char error[32];
 	struct ImageMembers *node = &Thumbnails;
 
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
 	gtk_widget_hide(dialog);
 	update_status("Deleting selected pictures...");
 
@@ -196,6 +233,7 @@
 	}
 	gtk_widget_destroy(dialog);
 	update_status("Done.");
+	cam_busy=0;
 }
 
 void del_dialog(int type)
@@ -282,7 +320,14 @@
 		}
 	}
 
-	if ((im = Camera->ops->get_picture(picNum, thumbnail)) == 0) {
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
+	im = Camera->ops->get_picture(picNum, thumbnail);
+	cam_busy=0;
+	if (im == 0) {
 		sprintf(error, "Could not save #%i", picNum);
 		error_dialog(error);
 		return;
@@ -383,13 +428,14 @@
 	update_status(fname);
 }
 
-void appendpic(gint picNum, gint thumbnail, gint fromCamera, char *fileName)
+void appendpic(gint picNum, gint thumbnail, gint fromCamera, char *fileName, int factor)
 {
 	int w, h;
 	char fname[15], error[32], process[1024],
 	     imagename[1024],*openName;
 	
 	GtkWidget *scrwin, *label;
+	GdkImlibImage *scaledImage;
 	GdkPixmap *pixmap;
 	struct Image *im;
 
@@ -410,7 +456,14 @@
 	node->next = NULL;
 
 	if (fromCamera) {
-		if ((im = Camera->ops->get_picture(picNum, thumbnail))==0) {
+		if (cam_busy) {
+			error_dialog("Camera is already busy");
+			return;
+		}
+		cam_busy=1;
+		im = Camera->ops->get_picture(picNum, thumbnail);
+		cam_busy=0;
+		if (im == 0) {
 			sprintf(error, "Could not retrieve #%i", picNum);
 			error_dialog(error);
 			return;
@@ -432,8 +485,29 @@
 	 } else
 		node->imlibimage = gdk_imlib_load_image(fileName);
 
+	if (node->imlibimage==0) {
+		sprintf(error, "Could not load image #%i to memory", picNum);
+		error_dialog(error);
+		return;
+	}
+	w = node->imlibimage->rgb_width;
+	h = node->imlibimage->rgb_height;
+
+	w = (w * factor)/100;
+	h = (h * factor)/100;
+
+	scaledImage = gdk_imlib_clone_scaled_image(node->imlibimage,w,h);
+	gdk_imlib_kill_image(node->imlibimage);
+
+	if (scaledImage==0) {
+		sprintf(error, "Could not load image #%i to memory", picNum);
+		error_dialog(error);
+		return;
+	}
+	node->imlibimage = scaledImage;
 	w = node->imlibimage->rgb_width;
 	h = node->imlibimage->rgb_height;
+
 	gdk_imlib_render(node->imlibimage, w, h);
 	pixmap = gdk_imlib_move_image(node->imlibimage);
 	node->image = gtk_pixmap_new(pixmap, NULL);
@@ -620,7 +694,8 @@
 		GTK_SIGNAL_FUNC(detected_unselect_row), NULL);
 
 	count = 0;
-#ifdef GPIO_USB
+/* FIXME : broken by latest libgpio changes (000801) */
+#if 0
 	for (bus = usb_busses; bus; bus = bus->next) {
 		for (dev = bus->devices; dev; dev = dev->next) {
 			for (i = 0; cameras[i].name; i++) {
@@ -1097,14 +1172,21 @@
 
 	/* If the thumbnail is already there, then just load the image */
 	if (node->image && node->imlibimage) {
-		appendpic(i, 0, TRUE, NULL);
+		appendpic(i, 0, TRUE, NULL, 100);
 		return;
 	}
 
 	sprintf(status, "Getting thumbnail %i...", i);
 	update_status(status);
 
-	if ((im = Camera->ops->get_picture(i, 1))==0) {
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
+	im = Camera->ops->get_picture(i, 1);
+	cam_busy=0;
+	if (im==0) {
 		sprintf(error, "Could not retrieve #%i", i);
 		error_dialog(error);
 		return;
@@ -1123,6 +1205,11 @@
 	node->imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size);
 
 	free_image (im);
+	if (node->imlibimage==0) {
+		sprintf(error, "Could not load image #%i to memory", i);
+		error_dialog(error);
+		return;
+	}
 
 	w = node->imlibimage->rgb_width; 
 	h = node->imlibimage->rgb_height;
@@ -1203,8 +1290,14 @@
         gtk_widget_show(index_table);
         gtk_container_add(GTK_CONTAINER(index_vp), index_table);
 
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
 	num_pictures_taken = Camera->ops->number_of_pictures();
-fprintf(stderr, "num_pictures_taken is %d\n", num_pictures_taken);
+	cam_busy=0;
+	fprintf(stderr, "num_pictures_taken is %d\n", num_pictures_taken);
 	if (num_pictures_taken == -1) {
 		error_dialog("Could not get the number of pictures");
 		return;
@@ -1259,6 +1352,8 @@
 		node->image=NULL;
 		node->imlibimage=NULL;
 
+		progress_min=(float)i/(float)num_pictures_taken;
+		progress_max=(float)(i+1)/(float)num_pictures_taken;
 		if (getthumbs)
 			insert_thumbnail(node);
 
@@ -1271,7 +1366,7 @@
 				 node->button,
 				 i%6,i%6+1,i/6,i/6+1,
 				 GTK_FILL,GTK_FILL,5,5);
-		update_progress((float)i/(float)(num_pictures_taken - 1));
+		update_progress(progress_max);
 	}
 	deactivate_button(stop_button);
 	update_progress(0);
@@ -1298,6 +1393,12 @@
 /* get selected pictures */
 void getpics(char *pictype)
 {
+	getpics_with_scale (pictype, 100);
+}
+
+/* get selected pictures at a given scale */
+void getpics_with_scale(char *pictype, int factor)
+{
 	char status[256];
 	gint i=0;
 	gint x=0, y=0;	
@@ -1322,23 +1423,25 @@
 		node = node->next;
 		i++;
 		if (GTK_TOGGLE_BUTTON(node->button)->active) {
+			progress_min=(float)y/(float)x;
+			progress_max=(float)(y+1)/(float)x;
 			y++;
 			if ((strcmp("i", pictype) == 0) ||
 			    (strcmp("ti", pictype) == 0)) {
 				sprintf(status, "Getting Image #%03i...", i);
 				update_status(status);
-				appendpic(i, 0, TRUE, NULL);
+				appendpic(i, 0, TRUE, NULL, factor);
 			}
 			if ((strcmp("t", pictype) == 0) ||
 			    (strcmp("ti", pictype) == 0)) {			
-				appendpic(i, 1, TRUE, NULL);
+				appendpic(i, 1, TRUE, NULL, factor);
 				sprintf(status, "Getting Thumbnail #%03i...", i);
 				update_status(status);
 			}
 			gtk_toggle_button_set_state(
 				GTK_TOGGLE_BUTTON(node->button),
 				FALSE);
-			update_progress((float)y/(float)x);
+			update_progress(progress_max);
 		}
 	}
 
@@ -1484,7 +1587,7 @@
 		return;
 
 	appendpic(0, 0, FALSE, gtk_file_selection_get_filename(
-		GTK_FILE_SELECTION(filew)));	
+		GTK_FILE_SELECTION(filew)), 100);	
 	gtk_widget_destroy(filew);
 }
 
@@ -1826,7 +1929,14 @@
 
 void summary_dialog(void)
 {
-	message_window("Camera Summary", Camera->ops->summary(), GTK_JUSTIFY_FILL);
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
+	cam_busy=1;
+	message_window("Camera Summary", 
+			Camera->ops->summary(), GTK_JUSTIFY_FILL);
+	cam_busy=0;
 }
 
 /* Decreases image size by factor n % */
@@ -1903,8 +2013,18 @@
 }
 
 void open_images(gpointer data, guint action, GtkWidget *widget)
+{
+	getpics_with_scale("i",100);
+}
+
+void open_images_and_scale50(gpointer data, guint action, GtkWidget *widget)
+{
+	getpics_with_scale("i",50);
+}
+
+void open_images_and_scale25(gpointer data, guint action, GtkWidget *widget)
 {
-	getpics("i");
+	getpics_with_scale("i",25);
 }
 
 void save_thumbs(gpointer data, guint action, GtkWidget *widget)
@@ -1914,7 +2034,7 @@
 
 void open_thumbs(gpointer data, guint action, GtkWidget *widget)
 {
-	getpics("t");
+	getpics_with_scale("t",100);
 }
 
 void save_both (gpointer data, guint action, GtkWidget *widget)
@@ -1925,7 +2045,7 @@
 
 void open_both(gpointer data, guint action, GtkWidget *widget)
 {
-	getpics("ti");
+	getpics_with_scale("ti",100);
 }
 
 
Index: gphoto/src/callbacks.h
===================================================================
RCS file: /cvs/gnome/gphoto/src/callbacks.h,v
retrieving revision 1.12.2.6
diff -u -r1.12.2.6 callbacks.h
--- gphoto/src/callbacks.h	1999/11/21 16:33:39	1.12.2.6
+++ gphoto/src/callbacks.h	2000/08/02 11:39:04
@@ -16,7 +16,7 @@
 void del_dialog (int type);
 void savepictodisk (int picNum, int thumbnail, char *prefix);
 void saveselectedtodisk (GtkWidget *widget, char *type);
-void appendpic (int picNum, int thumbnail, int fromCamera, char *fileName);
+void appendpic (int picNum, int thumbnail, int fromCamera, char *fileName, int factor);
 void destroy (GtkWidget *widget, gpointer data);
 void port_dialog();
 void version_dialog();
@@ -32,6 +32,7 @@
 void getindex_empty ();
 void halt_action ();
 void getpics (char *type);
+void getpics_with_scale (char *type, int factor);
 void remove_image(int i);
 void closepic ();
 void print_pic ();
@@ -47,6 +48,8 @@
 void scale_double ();
 void save_images (gpointer data, guint action, GtkWidget *widget);
 void open_images (gpointer data, guint action, GtkWidget *widget);
+void open_images_and_scale25 (gpointer data, guint action, GtkWidget *widget);
+void open_images_and_scale50 (gpointer data, guint action, GtkWidget *widget);
 void save_thumbs (gpointer data, guint action, GtkWidget *widget);
 void open_thumbs (gpointer data, guint action, GtkWidget *widget);
 void save_both (gpointer data, guint action, GtkWidget *widget);
Index: gphoto/src/commandline.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/commandline.c,v
retrieving revision 1.8.2.4
diff -u -r1.8.2.4 commandline.c
--- gphoto/src/commandline.c	2000/02/24 19:50:24	1.8.2.4
+++ gphoto/src/commandline.c	2000/08/02 11:39:04
@@ -1,4 +1,5 @@
 
+#include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 
Index: gphoto/src/gallery.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/gallery.c,v
retrieving revision 1.18.2.7
diff -u -r1.18.2.7 gallery.c
--- gphoto/src/gallery.c	2000/07/06 18:08:15	1.18.2.7
+++ gphoto/src/gallery.c	2000/08/02 11:39:04
@@ -202,6 +202,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 extern GtkWidget *index_window;
 /* extern GtkWidget *browse_button; */
@@ -210,7 +211,10 @@
 extern struct ImageMembers Images;
 extern struct Model *Camera;
 extern char   *filesel_cwd;
+extern float  progress_min, progress_max;
 
+extern int cam_busy;
+
 /* initialize some tags */
 char gallery_name[256];
 char gallery_index[128];
@@ -323,7 +327,7 @@
         char * cmd1, *cmd2, *cmd3, *cmd4, *cmd5, *cmd6,
            *cmd7, *cmd8, *cmd9, *cmd10, *cmd11;
         pid_t pid;
-        const char *argv [5];
+        const char * argv [5];
         
         cmd1 = gallery_make_sed_command ("s", "#GALLERY_NAME#", gallery_name);
         cmd2 = gallery_make_sed_command ("s", "#GALLERY_INDEX#", gallery_index);
@@ -383,7 +387,7 @@
               perror ("close");
            }
            
-           execvp (argv [0], argv);
+           execvp (argv [0], (char * const *)argv);
            perror ("exec");
            exit (1);
         }
@@ -408,6 +412,7 @@
 	int i=0, j=0, num_selected = 0;
 	char outputdir[1024], theme[32];
 	char filename[1024], filename2[1024], cp[1024], error[32], statmsg[128];
+	int thumbnail_scale, image_scale;
 	struct Image *im;
 
 	GList *dlist;
@@ -416,6 +421,8 @@
 	GtkWidget *netscape, *shtml, *table_border, *image_border;
 	GtkWidget *galentry;
 	GtkWidget *label, *dirlabel, *dirbutton, *hbox, *hseparator;
+	GtkWidget *thumb_scale_spinner, *image_scale_spinner;
+	GtkAdjustment *adj;
 
 	struct ImageMembers *node = &Thumbnails;
 
@@ -540,6 +547,36 @@
 		GTK_SIGNAL_FUNC(gallery_change_dir),dirlabel);
 	gtk_box_pack_end(GTK_BOX(hbox), dirbutton, FALSE, FALSE, 0);
 
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_widget_show(hbox);
+	label = gtk_label_new("Thumbnails scale factor (in %):");
+	gtk_widget_show(label);
+	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+	adj = (GtkAdjustment *) gtk_adjustment_new (50.0, 1.0, 100.0, 1.0, 5.0, 0.0);
+	thumb_scale_spinner = gtk_spin_button_new (adj, 0, 0);
+	gtk_spin_button_set_wrap  (GTK_SPIN_BUTTON (thumb_scale_spinner), TRUE);
+	gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (thumb_scale_spinner), GTK_SHADOW_OUT);
+	gtk_widget_show (thumb_scale_spinner);
+	gtk_box_pack_end(GTK_BOX(hbox), thumb_scale_spinner, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0);
+
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_widget_show(hbox);
+	label = gtk_label_new("Images scale factor (in %):");
+	gtk_widget_show(label);
+	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+	adj = (GtkAdjustment *) gtk_adjustment_new (50.0, 1.0, 100.0, 1.0, 5.0, 0.0);
+	image_scale_spinner = gtk_spin_button_new (adj, 0, 0);
+	gtk_spin_button_set_wrap  (GTK_SPIN_BUTTON (image_scale_spinner), TRUE);
+	gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (image_scale_spinner), GTK_SHADOW_OUT);
+	gtk_widget_show (image_scale_spinner);
+	gtk_box_pack_end(GTK_BOX(hbox), image_scale_spinner, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0);
+
 	/* i made this
 	 * it should make extra buttons for shtml, table borders, and 
 	 * image borders
@@ -613,8 +650,8 @@
 	   else {
 		strcpy(image_border_width, "1");
         }
-
-	 
+	thumbnail_scale = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(thumb_scale_spinner));
+	image_scale     = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(image_scale_spinner));
 	 
 	strcpy(cp, "");
 	sprintf(theme, "%s",(char*)gtk_object_get_data(GTK_OBJECT(dlist->data),
@@ -675,7 +712,18 @@
 		/* Get the current thumbnail */
 			sprintf(cp, "Getting Thumbnail #%i...", j+1);
 			update_status(cp);
-			if ((im = Camera->ops->get_picture(j+1, 1))==0) {
+			if (cam_busy) {
+				error_dialog("Camera is already busy");
+				if (GTK_IS_OBJECT(dialog))
+					gtk_widget_destroy(dialog);
+				return;
+			}
+			progress_min=(float)(2*i)/(float)(num_selected*2);
+			progress_max=(float)(2*i+1)/(float)(num_selected*2);
+			cam_busy=1;
+			im = Camera->ops->get_picture(j+1, 1);
+			cam_busy=0;
+			if (im==0) {
 				sprintf(error, "Could not retrieve #%i",
 					j+1);
 				error_dialog(error);
@@ -699,14 +747,25 @@
 						gtk_widget_destroy(dialog);
 					return;
 				}
-				save_image(filename2, im);
+				save_scaled_image(filename2, im, thumbnail_scale);
 				free_image(im);
 			}
 			/* Get the current image */
 			sprintf(cp, "Getting Image #%i...", j+1);
 			update_status(cp);
 			
-			if ((im = Camera->ops->get_picture(j+1, 0))==0) {
+			if (cam_busy) {
+				error_dialog("Camera is already busy");
+				if (GTK_IS_OBJECT(dialog))
+					gtk_widget_destroy(dialog);
+				return;
+			}
+			progress_min=(float)(2*i+1)/(float)(num_selected*2);
+			progress_max=(float)(2*i+2)/(float)(num_selected*2);
+			cam_busy=1;
+			im = Camera->ops->get_picture(j+1, 0);
+			cam_busy=0;
+			if (im==0) {
 				sprintf(error, "Could not retrieve #%i", j+1);
 				error_dialog(error);
 				sprintf(picture, "Not Available");
@@ -725,7 +784,7 @@
 						gtk_widget_destroy(dialog);
 					return;
 				}
-				save_image(filename2, im);
+				save_scaled_image(filename2, im, image_scale);
 				free_image(im);
 			}
 			if (i+1 == num_selected)
Index: gphoto/src/live.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/live.c,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 live.c
--- gphoto/src/live.c	2000/07/06 18:08:15	1.4.2.2
+++ gphoto/src/live.c	2000/08/02 11:39:04
@@ -10,6 +10,7 @@
 */
 
 extern struct Model *Camera;
+extern int cam_busy;
 
 int live_video_mode = 0;
 
@@ -22,22 +23,32 @@
 	struct Image *im;
 
 	GList *child = gtk_container_children(
-                        GTK_CONTAINER(GTK_DIALOG(dialog)->vbox));
+                  GTK_CONTAINER(GTK_DIALOG(dialog)->vbox));
 	GtkWidget *gpixmap = GTK_WIDGET(child->data);
 
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
 	update_status("Getting live image...");
+	cam_busy=1;
         if ((im = Camera->ops->get_preview()) == 0) {
 		error_dialog("Could not get preview");
 		return;
 	}
-	imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size);
-	free_image(im);
-        w = imlibimage->rgb_width;
-        h = imlibimage->rgb_height;
-        gdk_imlib_render(imlibimage, w, h);
-        pixmap = gdk_imlib_move_image(imlibimage);
-        gtk_pixmap_set(GTK_PIXMAP(gpixmap), pixmap, NULL);
-	update_status("Done.");
+	cam_busy=0;
+	if (im) {
+		imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size);
+		free_image(im);
+		if (imlibimage) {
+			w = imlibimage->rgb_width;
+			h = imlibimage->rgb_height;
+			gdk_imlib_render(imlibimage, w, h);
+			pixmap = gdk_imlib_move_image(imlibimage);
+			gtk_pixmap_set(GTK_PIXMAP(gpixmap), pixmap, NULL);
+			update_status("Done.");
+		}
+	}
 }
 
 void live_video (GtkWidget *button, GtkWidget *dialog) {
@@ -50,10 +61,16 @@
 	while (live_video_mode) {
 		while (gtk_events_pending())
 			gtk_main_iteration();
-		live_snapshot(dialog);
+		if (live_video_mode)
+			live_snapshot(dialog);
 	}
 }
 
+void live_close (GtkWidget *dialog) {
+	live_video_mode = 0;
+	gtk_widget_destroy (dialog);
+}
+
 void live_main () {
 	int w, h;
 
@@ -65,6 +82,10 @@
 	GdkImlibImage *imlibimage;
 	struct Image *im;
 
+	if (cam_busy) {
+		error_dialog("Camera is already busy");
+		return;
+	}
 	update_status("Getting live image...");
 	dialog = gtk_dialog_new();
 	gtk_window_set_title(GTK_WINDOW(dialog), "Live Camera!");
@@ -103,12 +124,14 @@
 				  cbutton);
 
         gtk_signal_connect_object(GTK_OBJECT(cbutton), "clicked",
-                           GTK_SIGNAL_FUNC(gtk_widget_destroy),
+                           GTK_SIGNAL_FUNC(live_close),
                            GTK_OBJECT(dialog)); 
+	cam_busy=1;
         if ((im = Camera->ops->get_preview()) == 0) {
 	        error_dialog("Could not get preview");
 		return;
 	}
+	cam_busy=0;
 	imlibimage = gdk_imlib_load_image_mem(im->image, im->image_size);
 	free(im->image);
 	free(im);
Index: gphoto/src/main.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/main.c,v
retrieving revision 1.22.2.11
diff -u -r1.22.2.11 main.c
--- gphoto/src/main.c	2000/07/09 21:40:15	1.22.2.11
+++ gphoto/src/main.c	2000/08/02 11:39:04
@@ -24,8 +24,8 @@
 #include "commandline.h"
 #include "developer_dialog.h"
 
-#include "splash.xpm"           /* Splash screen  */
-#include "post_processing_off.xpm"
+#include "icons/splash.xpm"           /* Splash screen  */
+#include "icons/post_processing_off.xpm"
 
 extern  struct Model cameras[];
 extern  GtkAccelGroup*  mainag;
@@ -37,6 +37,10 @@
 	GtkWidget *index_vp;            /* Viewport for above           */
 	GtkWidget *index_window;	/* Index Scrolled Window        */
 	GtkWidget *progress;		/* Progress bar			*/
+	float	  progress_min;		/* min and max values for       */
+	float	  progress_max;		/* Progress Bar during download */
+	int	  cam_busy;		/* TRUE/FALSE to lock operation */
+					/* with the camera              */
 
 	int	   post_process;	/* TRUE/FALSE to post-process   */
 	char	   post_process_script[1024]; /* Full path/filename	*/
@@ -135,9 +139,9 @@
 		command_line_mode = 0;
 
 	gtk_init(&argc, &argv);
-#if 1 /* by fujisawa */
 	gdk_imlib_init();
-#endif
+	gpio_init();
+
 	gtk_widget_push_visual(gdk_imlib_get_visual());
 	gtk_widget_push_colormap(gdk_imlib_get_colormap());
 
@@ -197,7 +201,8 @@
 	gtk_widget_show(status_bar);
 	gtk_label_set_justify(GTK_LABEL(status_bar), GTK_JUSTIFY_LEFT);	
 	gtk_box_pack_start(GTK_BOX(sbox), status_bar, FALSE, FALSE, 0);
-	update_status("Select \"Camera->Download Index->Thumbnails\" to begin.");	progress = gtk_progress_bar_new();
+	update_status("Select \"Camera->Download Index->Thumbnails\" to begin.");	
+	progress = gtk_progress_bar_new();
 
 	gtk_widget_show(progress);
 	gtk_box_pack_end(GTK_BOX(sbox), progress, FALSE, FALSE, 0);
Index: gphoto/src/menu.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/menu.c,v
retrieving revision 1.12.2.8
diff -u -r1.12.2.8 menu.c
--- gphoto/src/menu.c	2000/02/24 19:50:24	1.12.2.8
+++ gphoto/src/menu.c	2000/08/02 11:39:04
@@ -211,6 +211,8 @@
 	{"/Camera/Download _Selected",				NULL, 0,		0, "<Branch>"},
 	{"/Camera/Download Selected/_Images",			NULL, 0,		0, "<Branch>"},
 	{"/Camera/Download Selected/Images/_Open in window",		NULL, open_images,	18},
+	{"/Camera/Download Selected/Images/_Open in window (scale 50%)",NULL, open_images_and_scale50,18},
+	{"/Camera/Download Selected/Images/_Open in window (scale 25%)",NULL, open_images_and_scale25,18},
 	{"/Camera/Download Selected/Images/_Save to disk...","<control>g", save_images,	19},
 	{"/Camera/Download Selected/_Thumbnails",			NULL, 0,		0, "<Branch>"},
 	{"/Camera/Download Selected/Thumbnails/_Open in window",	NULL, open_thumbs,	0},
Index: gphoto/src/toolbar.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/toolbar.c,v
retrieving revision 1.10.2.4
diff -u -r1.10.2.4 toolbar.c
--- gphoto/src/toolbar.c	1999/11/21 16:33:39	1.10.2.4
+++ gphoto/src/toolbar.c	2000/08/02 11:39:04
@@ -7,27 +7,27 @@
 /* The toolbar xpm icons */
 
 /*  #include "batch_save.xpm" */
-#include "close_image.xpm"
-#include "colors.xpm"
-#include "configure.xpm"
-#include "delete_images.xpm"
-#include "exit.xpm"
-#include "fliph.xpm"
-#include "flipv.xpm"
-#include "get_index.xpm"
-#include "get_index_empty.xpm"
-#include "get_selected_images.xpm"
-#include "help.xpm"
-#include "left_arrow.xpm"
-#include "mail_image.xpm"
-#include "open_image.xpm"
-#include "print_image.xpm"
-#include "resize.xpm"
-#include "right_arrow.xpm"
-#include "rotc.xpm"
-#include "rotcc.xpm"
-#include "save_current_image.xpm"
-#include "stop.xpm"
+#include "icons/close_image.xpm"
+#include "icons/colors.xpm"
+#include "icons/configure.xpm"
+#include "icons/delete_images.xpm"
+#include "icons/exit.xpm"
+#include "icons/fliph.xpm"
+#include "icons/flipv.xpm"
+#include "icons/get_index.xpm"
+#include "icons/get_index_empty.xpm"
+#include "icons/get_selected_images.xpm"
+#include "icons/help.xpm"
+#include "icons/left_arrow.xpm"
+#include "icons/mail_image.xpm"
+#include "icons/open_image.xpm"
+#include "icons/print_image.xpm"
+#include "icons/resize.xpm"
+#include "icons/right_arrow.xpm"
+#include "icons/rotc.xpm"
+#include "icons/rotcc.xpm"
+#include "icons/save_current_image.xpm"
+#include "icons/stop.xpm"
 
 /* #include "web_browse.xpm"   */
 /* #include "take_picture.xpm" */
Index: gphoto/src/util.c
===================================================================
RCS file: /cvs/gnome/gphoto/src/util.c,v
retrieving revision 1.25.2.1
diff -u -r1.25.2.1 util.c
--- gphoto/src/util.c	2000/03/10 16:16:10	1.25.2.1
+++ gphoto/src/util.c	2000/08/02 11:39:04
@@ -243,6 +243,22 @@
 		free (im);
 }
 
+void save_scaled_image (char *filename, struct Image *im, int factor) {
+	GdkImlibImage *imlibimage1, *imlibimage2;
+	int w,h;
+
+	imlibimage1 = gdk_imlib_load_image_mem(im->image, (size_t)im->image_size);
+	w = imlibimage1->rgb_width;
+	h = imlibimage1->rgb_height;
+	w = ( w * factor)/100;
+	h = ( h * factor)/100;
+
+	imlibimage2 = gdk_imlib_clone_scaled_image(imlibimage1, w, h);
+	gdk_imlib_kill_image(imlibimage1);
+	gdk_imlib_save_image(imlibimage2, filename, NULL);
+	gdk_imlib_kill_image(imlibimage2);
+}
+
 void save_image (char *filename, struct Image *im) {
 
 	char errormsg[1024];
Index: gphoto/src/util.h
===================================================================
RCS file: /cvs/gnome/gphoto/src/util.h,v
retrieving revision 1.12
diff -u -r1.12 util.h
--- gphoto/src/util.h	1999/07/14 03:32:29	1.12
+++ gphoto/src/util.h	2000/08/02 11:39:04
@@ -33,6 +33,8 @@
 
 void free_image(struct Image *im);
 
+void save_scaled_image (char *filename, struct Image *im, int factor);
+
 void save_image(char *filename, struct Image *im);
 
 void free_imagemembers (struct ImageMembers *im);
