[maemo-commits] [maemo-commits] r18183 - in projects/haf/trunk/hildon-thumbnail: . daemon

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Apr 28 11:15:34 EEST 2009
Author: pvanhoof
Date: 2009-04-28 11:15:20 +0300 (Tue, 28 Apr 2009)
New Revision: 18183

Modified:
   projects/haf/trunk/hildon-thumbnail/ChangeLog
   projects/haf/trunk/hildon-thumbnail/daemon/thumb-hal.c
Log:
2009-04-28  Philip Van Hoof  <pvanhoof at codeminded.be>

        * daemon/thumb-hal.c: Bug# 99641: Putting a message for the
        thumbnailer that next startup it should sleep for 10 seconds before
        initiating. Keeps the thumbnailer from making a device that is being
        unmounted busy after short-after startup



Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-04-28 07:05:54 UTC (rev 18182)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2009-04-28 08:15:20 UTC (rev 18183)
@@ -1,3 +1,10 @@
+2009-04-28  Philip Van Hoof  <pvanhoof at codeminded.be>
+
+	* daemon/thumb-hal.c: Bug# 99641: Putting a message for the
+	thumbnailer that next startup it should sleep for 10 seconds before
+	initiating. Keeps the thumbnailer from making a device that is being
+	unmounted busy after short-after startup
+
 2009-04-27  Philip Van Hoof  <pvanhoof at codeminded.be>
 
 	* daemon/utils.c: Fixed memory leak. Fixes Bug# 113093

Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumb-hal.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/thumb-hal.c	2009-04-28 07:05:54 UTC (rev 18182)
+++ projects/haf/trunk/hildon-thumbnail/daemon/thumb-hal.c	2009-04-28 08:15:20 UTC (rev 18183)
@@ -1,8 +1,12 @@
 #include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
 
 #include "thumb-hal.h"
 #include "config.h"
 
+#define CHECK_FILE "/tmp/thumbnailer_please_wait"
+
 static GVolumeMonitor *monitor;
 
 static void
@@ -12,7 +16,19 @@
 {
 	GDrive *drive = g_mount_get_drive (mount);
 	if (g_drive_is_media_removable (drive)) {
+		FILE *filep;
+
 		g_object_unref (drive);
+
+		/* The idea here is that if we had to force-shutdown because of an
+		 * unmount event, that it's possible that we get soon-after more
+		 * items to process that are also on the removable device. So we 
+		 * leave a message for the next startup, to wait for 10 seconds
+		 * before we start for real. */
+
+		filep = fopen (CHECK_FILE, "w");
+		fclose (filep);
+
 		exit (0);
 	}
 	g_object_unref (drive);
@@ -21,6 +37,16 @@
 void
 thumb_hal_init (void)
 {
+	FILE *filep;
+
+	filep = fopen (CHECK_FILE, "r");
+	if (filep) {
+		/* See above */
+		sleep (10);
+		fclose (filep);
+		g_unlink (CHECK_FILE);
+	}
+
 	monitor = g_volume_monitor_get ();
 
 	g_signal_connect (G_OBJECT (monitor), "mount-pre-unmount", 


More information about the maemo-commits mailing list