changeset 673:fbebf5cf4a55

Do not use printf() directly but use new wrapper function log_printf() instead.
author zas_
date Fri, 16 May 2008 12:16:49 +0000
parents 913eb0ba99a6
children 6b18c47a724c
files src/cache.c src/cache_maint.c src/collect-io.c src/collect-table.c src/collect.c src/debug.c src/debug.h src/dupe.c src/exif.c src/exiv2.cc src/filedata.c src/filefilter.c src/format_raw.c src/image-load.c src/main.c src/pixbuf-renderer.c src/pixbuf_util.c src/print.c src/remote.c src/ui_bookmark.c src/ui_fileops.c src/ui_spinner.c src/ui_tabcomp.c src/utilops.c src/view_dir_tree.c src/window.c
diffstat 26 files changed, 120 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/src/cache.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/cache.c	Fri May 16 12:16:49 2008 +0000
@@ -158,7 +158,7 @@
 
 	if (!ssi)
 		{
-		printf("Unable to save sim cache data: %s\n", cd->path);
+		log_printf("Unable to save sim cache data: %s\n", cd->path);
 		return FALSE;
 		}
 
@@ -606,7 +606,7 @@
 					DEBUG_1("creating sub dir:%s", path);
 					if (!mkdir_utf8(path, mode))
 						{
-						printf("create dir failed: %s\n", path);
+						log_printf("create dir failed: %s\n", path);
 						return FALSE;
 						}
 					}
--- a/src/cache_maint.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/cache_maint.c	Fri May 16 12:16:49 2008 +0000
@@ -189,7 +189,7 @@
 				    (strlen(path_buf) > base_length && !isfile(path_buf + base_length)) )
 					{
 					if (dot) *dot = '.';
-					if (!unlink_file(path_buf)) printf("failed to delete:%s\n", path_buf);
+					if (!unlink_file(path_buf)) log_printf("failed to delete:%s\n", path_buf);
 					}
 				else
 					{
@@ -212,7 +212,7 @@
 			{
 			if (!still_have_a_file && !dlist && cm->list->next && !rmdir_utf8(fd->path))
 				{
-				printf("Unable to delete dir: %s\n", fd->path);
+				log_printf("Unable to delete dir: %s\n", fd->path);
 				}
 			}
 		else
@@ -220,7 +220,7 @@
 			/* must re-check for an empty dir */
 			if (isempty(fd->path) && cm->list->next && !rmdir_utf8(fd->path))
 				{
-				printf("Unable to delete dir: %s\n", fd->path);
+				log_printf("Unable to delete dir: %s\n", fd->path);
 				}
 			}
 
@@ -377,7 +377,7 @@
 				DEBUG_1("Deleting thumb dir: %s", fd->path);
 				if (!rmdir_utf8(fd->path))
 					{
-					printf("Unable to delete dir: %s\n", fd->path);
+					log_printf("Unable to delete dir: %s\n", fd->path);
 					}
 				}
 			else
@@ -401,7 +401,7 @@
 			    (strlen(path) > base_length && !isfile(path + base_length)) )
 				{
 				if (dot) *dot = '.';
-				if (!unlink_file(path)) printf("failed to delete:%s\n", path);
+				if (!unlink_file(path)) log_printf("failed to delete:%s\n", path);
 				}
 			else
 				{
@@ -533,7 +533,7 @@
 		}
 	else
 		{
-		printf("Failed to create cache dir for move %s\n", base);
+		log_printf("Failed to create cache dir for move %s\n", base);
 		}
 	g_free(base);
 
--- a/src/collect-io.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/collect-io.c	Fri May 16 12:16:49 2008 +0000
@@ -101,7 +101,7 @@
 	g_free(pathl);
 	if (!f)
 		{
-		printf("Failed to open collection file: \"%s\"\n", path);
+		log_printf("Failed to open collection file: \"%s\"\n", path);
 		return FALSE;
 		}
 
@@ -167,7 +167,7 @@
 				    fail > GQ_COLLECTION_FAIL_MIN &&
 				    fail * 100 / total > GQ_COLLECTION_FAIL_PERCENT)
 					{
-					printf("%d invalid filenames in unofficial collection file, closing: %s\n", fail, path);
+					log_printf("%d invalid filenames in unofficial collection file, closing: %s\n", fail, path);
 					success = FALSE;
 					break;
 					}
@@ -575,7 +575,7 @@
 		if (orig_action)
 			{
 			/* target already exists */
-			printf("collection manager failed to add another action for target %s in collection %s\n",
+			log_printf("collection manager failed to add another action for target %s in collection %s\n",
 				action->newpath, entry->path);
 			return;
 			}
@@ -616,7 +616,7 @@
 	if (orig_action)
 		{
 		/* another action for the same source, ignore */
-		printf("collection manager failed to add another action for source %s in collection %s\n",
+		log_printf("collection manager failed to add another action for source %s in collection %s\n",
 			action->oldpath, entry->path);
 		return;
 		}
@@ -763,7 +763,7 @@
 		if (action->type != COLLECTION_MANAGER_UPDATE &&
 		    action->oldpath && action->newpath)
 			{
-			printf("collection manager failed to %s %s for collection %s\n",
+			log_printf("collection manager failed to %s %s for collection %s\n",
 				(action->type == COLLECTION_MANAGER_ADD) ? "add" : "remove",
 				action->oldpath, action->newpath);
 			}
--- a/src/collect-table.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/collect-table.c	Fri May 16 12:16:49 2008 +0000
@@ -555,7 +555,7 @@
 
 	if (!collection_save(ct->cd, ct->cd->path))
 		{
-		printf("failed saving to collection path: %s\n", ct->cd->path);
+		log_printf("failed saving to collection path: %s\n", ct->cd->path);
 		}
 }
 
--- a/src/collect.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/collect.c	Fri May 16 12:16:49 2008 +0000
@@ -98,7 +98,7 @@
 
 	collection_info_free_thumb(ci);
 
-	printf("collection_info_load_thumb not implemented!\n(because an instant thumb loader not implemented)");
+	log_printf("collection_info_load_thumb not implemented!\n(because an instant thumb loader not implemented)");
 	return FALSE;
 #if 0
 	if (create_thumbnail(ci->fd->path, &ci->pixmap, &ci->mask) < 0) return FALSE;
@@ -905,7 +905,7 @@
 					}
 				else if (!collection_save(cw->cd, cw->cd->path))
 					{
-					printf("failed saving to collection path: %s\n", cw->cd->path);
+					log_printf("failed saving to collection path: %s\n", cw->cd->path);
 					}
 				break;
 			case 'A': case 'a':
--- a/src/debug.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/debug.c	Fri May 16 12:16:49 2008 +0000
@@ -11,6 +11,31 @@
 
 #include "main.h"
 
+
+/*
+ * Logging functions
+ */
+
+gint log_domain_printf(const char *domain, const gchar *format, ...)
+{
+	va_list ap;
+	gchar buf[4096];
+	gint ret;
+
+	va_start(ap, format);
+	ret = vsnprintf(buf, sizeof(buf), format, ap);
+	va_end(ap);
+
+	puts(buf);
+
+	return ret;
+}
+
+
+/*
+ * Debugging only functions
+ */
+
 #ifdef DEBUG
 
 static gint debug_level = DEBUG_LEVEL_MIN;
@@ -96,4 +121,4 @@
 	get_exec_time();
 }
 
-#endif
+#endif /* DEBUG */
--- a/src/debug.h	Fri May 16 12:08:51 2008 +0000
+++ b/src/debug.h	Fri May 16 12:16:49 2008 +0000
@@ -12,6 +12,15 @@
 #ifndef DEBUG_H
 #define DEBUG_H
 
+#define DOMAIN_DEBUG "debug"
+#define DOMAIN_INFO  "info"
+
+gint log_domain_printf(const char *domain, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
+#define log_printf(...) log_domain_printf(DOMAIN_INFO, __VA_ARGS__)
+
+
+
+
 #if 1 /* set to 0 to disable compilation of debugging code and related options */
 # ifndef DEBUG
 # define DEBUG 1
@@ -35,9 +44,9 @@
 				gint debug_level = get_debug_level(); \
 				if (debug_level >= (n)) 	\
 					{ 		\
-					if (debug_level != 1) printf("%s:%d: ", __FILE__, __LINE__); \
-					printf(__VA_ARGS__); \
-					putchar('\n'); \
+					if (debug_level != 1) log_domain_printf(DOMAIN_DEBUG, "%s:%d: ", __FILE__, __LINE__); \
+					log_domain_printf(DOMAIN_DEBUG, __VA_ARGS__); \
+					log_domain_printf(DOMAIN_DEBUG, "\n"); \
 					} \
 				} while (0)
 
--- a/src/dupe.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/dupe.c	Fri May 16 12:16:49 2008 +0000
@@ -513,7 +513,7 @@
 		else
 			{
 			rank = 1;
-			printf("NULL group in item!\n");
+			log_printf("NULL group in item!\n");
 			}
 		}
 	else
@@ -928,7 +928,7 @@
 {
 	GList *work;
 
-	printf("+ %f %s\n", di->group_rank, di->fd->name);
+	log_printf("+ %f %s\n", di->group_rank, di->fd->name);
 
 	work = di->group;
 	while (work)
@@ -936,10 +936,10 @@
 		DupeMatch *dm = work->data;
 		work = work->next;
 
-		printf("  %f %s\n", dm->rank, dm->di->fd->name);
+		log_printf("  %f %s\n", dm->rank, dm->di->fd->name);
 		}
 
-	printf("\n");
+	log_printf("\n");
 }
 
 static void dupe_match_print_list(GList *list)
--- a/src/exif.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/exif.c	Fri May 16 12:16:49 2008 +0000
@@ -738,7 +738,7 @@
 	    ExifFormatList[src_format].size * ne > len)
 		{
 		gchar *tag = exif_item_get_tag_name(item);
-		printf("exif tag %s data size mismatch\n", tag);
+		log_printf("exif tag %s data size mismatch\n", tag);
 		g_free(tag);
 		return;
 		}
@@ -840,7 +840,7 @@
 		{
 		if (format >= EXIF_FORMAT_COUNT)
 			{
-			printf("warning: exif tag 0x%4x has invalid format %d\n", tag, format);
+			log_printf("warning: exif tag 0x%4x has invalid format %d\n", tag, format);
 			return 0;
 			}
 		/* allow non recognized tags to be displayed */
@@ -863,13 +863,13 @@
 			{
 			if (format < EXIF_FORMAT_COUNT)
 				{
-				printf("warning: exif tag %s format mismatch, found %s exif spec requests %s\n",
+				log_printf("warning: exif tag %s format mismatch, found %s exif spec requests %s\n",
 					marker->key, ExifFormatList[format].short_name,
 					ExifFormatList[marker->format].short_name);
 				}
 			else
 				{
-				printf("warning: exif tag %s format mismatch, found unknown id %d exif spec requests %d (%s)\n",
+				log_printf("warning: exif tag %s format mismatch, found unknown id %d exif spec requests %d (%s)\n",
 					marker->key, format, marker->format,
 					ExifFormatList[marker->format].short_name);
 				}
@@ -881,7 +881,7 @@
 	 */
 	if (marker->components > 0 && marker->components != count)
 		{
-		printf("warning: exif tag %s has %d elements, exif spec requests %d\n",
+		log_printf("warning: exif tag %s has %d elements, exif spec requests %d\n",
 			marker->key, count, marker->components);
 		}
 
@@ -891,7 +891,7 @@
 		data_offset = data_val;
 		if (size < data_offset + data_length)
 			{
-			printf("warning: exif tag %s data will overrun end of file, ignored.\n", marker->key);
+			log_printf("warning: exif tag %s data will overrun end of file, ignored.\n", marker->key);
 			return -1;
 			}
 		}
@@ -1521,7 +1521,7 @@
 
 int exif_write(ExifData *exif)
 {
-	printf("Not compiled with EXIF write support");
+	log_printf("Not compiled with EXIF write support");
 	return 0;
 }
 
--- a/src/exiv2.cc	Fri May 16 12:08:51 2008 +0000
+++ b/src/exiv2.cc	Fri May 16 12:16:49 2008 +0000
@@ -710,7 +710,7 @@
 {
 	if (map_data && munmap(map_data, map_len) == -1)
 		{
-		printf("Failed to unmap file \n");
+		log_printf("Failed to unmap file \n");
 		}
 }
 
@@ -782,7 +782,7 @@
 		*image_offset = offset;
 		if ((unsigned long) lseek(fd, *image_offset, SEEK_SET) != *image_offset)
 			{
-			printf("Failed to seek to embedded image\n");
+			log_printf("Failed to seek to embedded image\n");
 
 			*image_offset = 0;
 			if (*exif_offset) *exif_offset = 0;
--- a/src/filedata.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/filedata.c	Fri May 16 12:16:49 2008 +0000
@@ -117,7 +117,7 @@
 	ret = g_locale_to_utf8(buf, buflen, NULL, NULL, &error);
 	if (error)
 		{
-		printf("Error converting locale strftime to UTF-8: %s\n", error->message);
+		log_printf("Error converting locale strftime to UTF-8: %s\n", error->message);
 		g_error_free(error);
 		return "";
 		}
--- a/src/filefilter.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/filefilter.c	Fri May 16 12:16:49 2008 +0000
@@ -307,7 +307,7 @@
 				}
 			else
 				{
-				printf("WARNING: invalid file class %d\n", fe->file_class);
+				log_printf("WARNING: invalid file class %d\n", fe->file_class);
 				}
 			}
 		}
@@ -345,7 +345,7 @@
 
 	if (file_class < 0 || file_class >= FILE_FORMAT_CLASSES)
 		{
-		printf("WARNING: invalid file class %d\n", file_class);
+		log_printf("WARNING: invalid file class %d\n", file_class);
 		return FALSE;
 		}
 
--- a/src/format_raw.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/format_raw.c	Fri May 16 12:16:49 2008 +0000
@@ -343,14 +343,14 @@
 
 	if (fstat(fd, &st) == -1)
 		{
-		printf("Failed to stat file %d\n", fd);
+		log_printf("Failed to stat file %d\n", fd);
 		return FALSE;
 		}
 	map_len = st.st_size;
 	map_data = mmap(0, map_len, PROT_READ, MAP_PRIVATE, fd, 0);
 	if (map_data == MAP_FAILED)
 		{
-		printf("Failed to mmap file %d\n", fd);
+		log_printf("Failed to mmap file %d\n", fd);
 		return FALSE;
 		}
 
@@ -358,14 +358,14 @@
 
 	if (munmap(map_data, map_len) == -1)
 		{
-		printf("Failed to unmap file %d\n", fd);
+		log_printf("Failed to unmap file %d\n", fd);
 		}
 
 	if (success && image_offset)
 		{
 		if (lseek(fd, *image_offset, SEEK_SET) != *image_offset)
 			{
-			printf("Failed to seek to embedded image\n");
+			log_printf("Failed to seek to embedded image\n");
 
 			*image_offset = 0;
 			if (*exif_offset) *exif_offset = 0;
@@ -462,7 +462,7 @@
 		segment = offset + EXIF_TIFD_OFFSET_DATA;
 		}
 
-	printf("%*stag:0x%04X (%05d), type:%2d %9s, len:%6d [%02X %02X %02X %02X] @ offset:%d\n",
+	log_printf("%*stag:0x%04X (%05d), type:%2d %9s, len:%6d [%02X %02X %02X %02X] @ offset:%d\n",
 		level, "", tag, tag, type,
 		(type < EXIF_FORMAT_COUNT) ? ExifFormatList[type].short_name : "???", count,
 		data[segment], data[segment + 1], data[segment + 2], data[segment + 3], segment);
@@ -471,7 +471,7 @@
 		{
 		gint i;
 
-		printf("%*s~~~ found %s table\n", level, "", (tag == 0x14a) ? "subIFD" : "EXIF" );
+		log_printf("%*s~~~ found %s table\n", level, "", (tag == 0x14a) ? "subIFD" : "EXIF" );
 
 		for (i = 0; i < count; i++)
 			{
@@ -483,17 +483,17 @@
 		}
 	else if (tag == 0x8773 && type == EXIF_FORMAT_UNDEFINED)
 		{
-		printf("%*s~~~ found ICC color profile at offset %d, length %d\n", level, "", segment, seg_len);
+		log_printf("%*s~~~ found ICC color profile at offset %d, length %d\n", level, "", segment, seg_len);
 		}
 	else if (tag == 0x201 && (type == EXIF_FORMAT_LONG_UNSIGNED || type == EXIF_FORMAT_LONG))
 		{
 		guint subset = exif_byte_get_int32(data + segment, bo);
-		printf("%*s~~~ found jpeg data at offset %d\n", level, "", subset);
+		log_printf("%*s~~~ found jpeg data at offset %d\n", level, "", subset);
 		}
 	else if (tag == 0x202 && (type == EXIF_FORMAT_LONG_UNSIGNED || type == EXIF_FORMAT_LONG))
 		{
 		guint subset = exif_byte_get_int32(data + segment, bo);
-		printf("%*s~~~ found jpeg data length of %d\n", level, "", subset);
+		log_printf("%*s~~~ found jpeg data length of %d\n", level, "", subset);
 		}
 }
 
@@ -511,14 +511,14 @@
 	offset += 2;
 	if (len < offset + count * EXIF_TIFD_SIZE + 4) return 0;
 
-	printf("%*s== tiff table #%d has %d entries ==\n", level, "", level, count);
+	log_printf("%*s== tiff table #%d has %d entries ==\n", level, "", level, count);
 
 	for (i = 0; i < count; i++)
 		{
 		format_debug_tiff_entry(data, len, offset + i * EXIF_TIFD_SIZE, bo, level);
 		}
 
-	printf("%*s----------- end of #%d ------------\n", level, "", level);
+	log_printf("%*s----------- end of #%d ------------\n", level, "", level);
 
 	return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
 }
@@ -546,7 +546,7 @@
 		return FALSE;
 		}
 
-	printf("*** debug parsing tiff\n");
+	log_printf("*** debug parsing tiff\n");
 
 	offset = exif_byte_get_int32(data + 4, bo);
 	level = 0;
@@ -556,7 +556,7 @@
 		level++;
 		}
 
-	printf("*** end\n");
+	log_printf("*** end\n");
 
 	/* we are debugging, not trying to return any data */
 	return FALSE;
--- a/src/image-load.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/image-load.c	Fri May 16 12:16:49 2008 +0000
@@ -56,7 +56,7 @@
 			image_loader_sync_pixbuf(il);
 			if (!il->pixbuf)
 				{
-				printf("critical: area_ready signal with NULL pixbuf (out of mem?)\n");
+				log_printf("critical: area_ready signal with NULL pixbuf (out of mem?)\n");
 				}
 			}
 		il->func_area_ready(il, x, y, w, h, il->data_area_ready);
--- a/src/main.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/main.c	Fri May 16 12:16:49 2008 +0000
@@ -374,19 +374,19 @@
 			else if (strcmp(cmd_line, "-v") == 0 ||
 				 strcmp(cmd_line, "--version") == 0)
 				{
-				printf("%s %s\n", GQ_APPNAME, VERSION);
+				log_printf("%s %s\n", GQ_APPNAME, VERSION);
 				exit(0);
 				}
 			else if (strcmp(cmd_line, "--alternate") == 0)
 				{
 				/* enable faster experimental algorithm */
-				printf("Alternate similarity algorithm enabled\n");
+				log_printf("Alternate similarity algorithm enabled\n");
 				image_sim_alternate_set(TRUE);
 				}
 			else if (strcmp(cmd_line, "-h") == 0 ||
 				 strcmp(cmd_line, "--help") == 0)
 				{
-				printf("%s %s\n", GQ_APPNAME, VERSION);
+				log_printf("%s %s\n", GQ_APPNAME, VERSION);
 				printf_term(_("Usage: %s [options] [path]\n\n"), GQ_APPNAME_LC);
 				print_term(_("valid options are:\n"));
 				print_term(_("  +t, --with-tools           force show of tools\n"));
@@ -728,7 +728,7 @@
 	srand(time(NULL));
 
 #if 1
-	printf("%s %s, This is an alpha release.\n", GQ_APPNAME, VERSION);
+	log_printf("%s %s, This is an alpha release.\n", GQ_APPNAME, VERSION);
 #endif
 	parse_command_line_for_debug_option(argc, argv);
 
--- a/src/pixbuf-renderer.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/pixbuf-renderer.c	Fri May 16 12:16:49 2008 +0000
@@ -2102,7 +2102,7 @@
 			/* The other values are out of range */
 			break;
 		}
-//	printf("tile coord y:%f, ih:%d, th:%f ry:%f\n", tile_y, image_h, tile_h, *res_x);
+//	log_printf("tile coord y:%f, ih:%d, th:%f ry:%f\n", tile_y, image_h, tile_h, *res_x);
 }
 
 static void pr_tile_region_map_orientation(PixbufRenderer *pr,
@@ -2165,7 +2165,7 @@
 			/* The other values are out of range */
 			break;
 		}
-//	printf("inside y:%d, th:%d, ah:%d ry:%d\n", area_y, tile_h, area_h, *res_x);
+//	log_printf("inside y:%d, th:%d, ah:%d ry:%d\n", area_y, tile_h, area_h, *res_x);
 }
 
 static void pr_coords_map_orientation_reverse(PixbufRenderer *pr,
@@ -2986,7 +2986,7 @@
 static void pr_update_signal(PixbufRenderer *pr)
 {
 #if 0
-	printf("FIXME: send updated signal\n");
+	log_printf("FIXME: send updated signal\n");
 #endif
 	DEBUG_1("%s pixbuf renderer updated - started drawing %p", get_exec_time(), pr);
 	pr->debug_updated = TRUE;
--- a/src/pixbuf_util.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/pixbuf_util.c	Fri May 16 12:16:49 2008 +0000
@@ -37,7 +37,7 @@
 
 	if (error)
 		{
-		printf("Error saving png file: %s\n", error->message);
+		log_printf("Error saving png file: %s\n", error->message);
 		g_error_free(error);
 		}
 
@@ -61,7 +61,7 @@
 	if (quality == -1) quality = 75;
 	if (quality < 1 || quality > 100)
 		{
-		printf("Jpeg not saved, invalid quality %d\n", quality);
+		log_printf("Jpeg not saved, invalid quality %d\n", quality);
 		return FALSE;
 		}
 
@@ -71,7 +71,7 @@
 
 	if (error)
 		{
-		printf("Error saving jpeg to %s\n%s\n", filename, error->message);
+		log_printf("Error saving jpeg to %s\n%s\n", filename, error->message);
 		g_error_free(error);
 		}
 
@@ -125,7 +125,7 @@
 		i++;
 		}
 
-	printf("warning: inline pixbuf key \"%s\" not found.\n", key);
+	log_printf("warning: inline pixbuf key \"%s\" not found.\n", key);
 
 	return NULL;
 }
--- a/src/print.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/print.c	Fri May 16 12:16:49 2008 +0000
@@ -967,7 +967,7 @@
 
 	if (pipe_handler_data)
 		{
-		printf("warning SIGPIPE handler already in use\n");
+		log_printf("warning SIGPIPE handler already in use\n");
 		return NULL;
 		}
 
@@ -990,7 +990,7 @@
 static void pipe_handler_free(PipeError *pe)
 {
 	if (!pe) return;
-	if (pe != pipe_handler_data) printf("warning SIGPIPE handler not closing same data\n");
+	if (pe != pipe_handler_data) log_printf("warning SIGPIPE handler not closing same data\n");
 
 	/* restore the original signal handler */
 	sigaction(SIGPIPE, &pe->old_action, NULL);
@@ -1622,11 +1622,11 @@
 				{
 				if (dpi == 0.0)
 					{
-					printf("pango dpi unknown, assuming %.0f\n", fallback_dpi);
+					log_printf("pango dpi unknown, assuming %.0f\n", fallback_dpi);
 					}
 				else
 					{
-					printf("pango dpi reported as %.0f ignored, assuming %.0f\n", dpi, fallback_dpi);
+					log_printf("pango dpi reported as %.0f ignored, assuming %.0f\n", dpi, fallback_dpi);
 					}
 				warned = TRUE;
 				}
--- a/src/remote.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/remote.c	Fri May 16 12:16:49 2008 +0000
@@ -92,7 +92,7 @@
 
 		if (error)
 			{
-			printf("error reading socket: %s\n", error->message);
+			log_printf("error reading socket: %s\n", error->message);
 			g_error_free(error);
 			}
 
@@ -131,7 +131,7 @@
 
 	if (g_list_length(rc->clients) > SERVER_MAX_CLIENTS)
 		{
-		printf("maximum remote clients of %d exceeded, closing connection\n", SERVER_MAX_CLIENTS);
+		log_printf("maximum remote clients of %d exceeded, closing connection\n", SERVER_MAX_CLIENTS);
 		close(fd);
 		return;
 		}
@@ -172,7 +172,7 @@
 	fd = accept(rc->fd, NULL, &alen);
 	if (fd == -1)
 		{
-		printf("error accepting socket: %s\n", strerror(errno));
+		log_printf("error accepting socket: %s\n", strerror(errno));
 		return TRUE;
 		}
 
@@ -206,7 +206,7 @@
 
 	if (remote_server_exists(path))
 		{
-		printf("Address already in use: %s\n", path);
+		log_printf("Address already in use: %s\n", path);
 		return NULL;
 		}
 
@@ -219,7 +219,7 @@
 	if (bind(fd, &addr, sizeof(addr)) == -1 ||
 	    listen(fd, REMOTE_SERVER_BACKLOG) == -1)
 		{
-		printf("error subscribing to socket: %s\n", strerror(errno));
+		log_printf("error subscribing to socket: %s\n", strerror(errno));
 		close(fd);
 		return NULL;
 		}
@@ -314,11 +314,11 @@
 		{
 		if (sigpipe_occured)
 			{
-			printf("SIGPIPE writing to socket: %s\n", rc->path);
+			log_printf("SIGPIPE writing to socket: %s\n", rc->path);
 			}
 		else
 			{
-			printf("error writing to socket: %s\n", strerror(errno));
+			log_printf("error writing to socket: %s\n", strerror(errno));
 			}
 		ret = FALSE;;
 		}
@@ -493,7 +493,7 @@
 		}
 	else
 		{
-		printf("remote sent filename that does not exist:\"%s\"\n", filename);
+		log_printf("remote sent filename that does not exist:\"%s\"\n", filename);
 		}
 
 	g_free(filename);
@@ -644,7 +644,7 @@
 		}
 	else
 		{
-		printf("unknown remote command:%s\n", text);
+		log_printf("unknown remote command:%s\n", text);
 		}
 }
 
--- a/src/ui_bookmark.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/ui_bookmark.c	Fri May 16 12:16:49 2008 +0000
@@ -452,7 +452,7 @@
 
 	if (path_ptr && icon_ptr && icon_ptr < path_ptr)
 		{
-		printf("warning, bookmark icon must be after path\n");
+		log_printf("warning, bookmark icon must be after path\n");
 		return NULL;
 		}
 
@@ -1228,7 +1228,7 @@
 	hc = g_object_get_data(G_OBJECT(widget), "history_combo_data");
 	if (!hc)
 		{
-		printf("widget is not a history combo\n");
+		log_printf("widget is not a history combo\n");
 		return;
 		}
 
--- a/src/ui_fileops.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/ui_fileops.c	Fri May 16 12:16:49 2008 +0000
@@ -131,7 +131,7 @@
 	utf8 = g_filename_to_utf8(path, -1, NULL, NULL, &error);
 	if (error)
 		{
-		printf("Unable to convert filename to UTF-8:\n%s\n%s\n", path, error->message);
+		log_printf("Unable to convert filename to UTF-8:\n%s\n%s\n", path, error->message);
 		g_error_free(error);
 		encoding_dialog(path);
 		}
@@ -154,7 +154,7 @@
 	path = g_filename_from_utf8(utf8, -1, NULL, NULL, &error);
 	if (error)
 		{
-		printf("Unable to convert filename to locale from UTF-8:\n%s\n%s\n", utf8, error->message);
+		log_printf("Unable to convert filename to locale from UTF-8:\n%s\n%s\n", utf8, error->message);
 		g_error_free(error);
 		}
 	if (!path)
--- a/src/ui_spinner.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/ui_spinner.c	Fri May 16 12:16:49 2008 +0000
@@ -21,6 +21,7 @@
 
 #include <gtk/gtk.h>
 
+#include "main.h"
 #include "ui_spinner.h"
 
 #include "ui_icons.h"
@@ -199,7 +200,7 @@
 	sp = g_object_get_data(G_OBJECT(spinner), "spinner");
 	if (sp->timer_id != -1)
 		{
-		printf("spinner warning: attempt to step with timer set\n");
+		log_printf("spinner warning: attempt to step with timer set\n");
 		return;
 		}
 
--- a/src/ui_tabcomp.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/ui_tabcomp.c	Fri May 16 12:16:49 2008 +0000
@@ -778,7 +778,7 @@
 	TabCompData *td;
 	if (!entry)
 		{
-		printf("Tab completion error: entry != NULL\n");
+		log_printf("Tab completion error: entry != NULL\n");
 		return;
 		}
 
--- a/src/utilops.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/utilops.c	Fri May 16 12:16:49 2008 +0000
@@ -3028,7 +3028,7 @@
 	level++;
 	if (level > UTILITY_DELETE_MAX_DEPTH)
 		{
-		printf("folder recursion depth past %d, giving up\n", UTILITY_DELETE_MAX_DEPTH);
+		log_printf("folder recursion depth past %d, giving up\n", UTILITY_DELETE_MAX_DEPTH);
 		return file_data_ref(fd);
 		}
 
--- a/src/view_dir_tree.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/view_dir_tree.c	Fri May 16 12:16:49 2008 +0000
@@ -585,7 +585,7 @@
 			if (work == list)
 				{
 				/* should not happen */
-				printf("vdtree warning, root node not found\n");
+				log_printf("vdtree warning, root node not found\n");
 				parts_list_free(list);
 				vdtree_busy_pop(vd);
 				return NULL;
@@ -597,7 +597,7 @@
 			    !vdtree_populate_path_by_iter(vd, &parent_iter, force, path) ||
 			    (nd = vdtree_find_iter_by_name(vd, &parent_iter, pd->name, &iter)) == NULL)
 				{
-				printf("vdtree warning, aborted at %s\n", parent_pd->name);
+				log_printf("vdtree warning, aborted at %s\n", parent_pd->name);
 				parts_list_free(list);
 				vdtree_busy_pop(vd);
 				return NULL;
@@ -726,7 +726,7 @@
 
 const gchar *vdtree_row_get_path(ViewDir *vd, gint row)
 {
-	printf("FIXME: no get row path\n");
+	log_printf("FIXME: no get row path\n");
 	return NULL;
 }
 
--- a/src/window.c	Fri May 16 12:08:51 2008 +0000
+++ b/src/window.c	Fri May 16 12:16:49 2008 +0000
@@ -185,7 +185,7 @@
 
 	if (!result)
 		{
-		printf("Unable to detect an installed browser.\n");
+		log_printf("Unable to detect an installed browser.\n");
 		return;
 		}