Index: ChangeLog
===================================================================
RCS file: /export/cvs/head/libegg/ChangeLog,v
retrieving revision 1.390
diff -p -u -5 -r1.390 ChangeLog
--- ChangeLog	18 Aug 2005 19:24:34 -0000	1.390
+++ ChangeLog	22 Aug 2005 07:02:40 -0000
@@ -1,5 +1,16 @@
+2005-08-21  Dinoop Thomas  <dinoop.thomas@wipro.com>
+	
+	* libegg/recent-files/egg-recent-model.c:
+	(egg_recent_model_monitor): If the FAM support is unavailable,
+	manually poll the .recently-used file. 
+	(egg_recent_model_poll_timeout): Poll the file after every
+	3 seconds.
+	(egg_recent_model_init): initialize poll_timeout and the last modified 
+	time to zero.
+	(egg_recent_model_finalize): remove the poll timeout.
+ 
 2005-08-18  Emmanuele Bassi  <ebassi@cvs.gnome.org>
 
 	* libegg/recent-files/egg-recent-view-gtk.c:
 	(egg_recent_view_gtk_new_separator),
 	(egg_recent_view_gtk_set_empty_list),
Index: libegg/recent-files/egg-recent-model.c
===================================================================
RCS file: /export/cvs/head/libegg/libegg/recent-files/egg-recent-model.c,v
retrieving revision 1.40
diff -p -u -5 -r1.40 egg-recent-model.c
--- libegg/recent-files/egg-recent-model.c	16 Aug 2005 06:47:41 -0000	1.40
+++ libegg/recent-files/egg-recent-model.c	22 Aug 2005 07:03:05 -0000
@@ -27,10 +27,11 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/time.h>
+#include <sys/stat.h>
 #include <time.h>
 #include <gtk/gtk.h>
 #include <libgnomevfs/gnome-vfs.h>
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 #include <gconf/gconf-client.h>
@@ -41,10 +42,11 @@
 #define EGG_RECENT_MODEL_BUFFER_SIZE 8192
 
 #define EGG_RECENT_MODEL_MAX_ITEMS 500
 #define EGG_RECENT_MODEL_DEFAULT_LIMIT 10
 #define EGG_RECENT_MODEL_TIMEOUT_LENGTH 200
+#define EGG_RECENT_MODEL_POLL_TIME 3
 
 #define EGG_RECENT_MODEL_KEY_DIR "/desktop/gnome/recent_files"
 #define EGG_RECENT_MODEL_DEFAULT_LIMIT_KEY EGG_RECENT_MODEL_KEY_DIR "/default_limit"
 #define EGG_RECENT_MODEL_EXPIRE_KEY EGG_RECENT_MODEL_KEY_DIR "/expire"
 
@@ -69,10 +71,12 @@ struct _EggRecentModelPrivate {
 
 	guint limit_change_notify_id;
 	guint expiration_change_notify_id;
 
 	guint changed_timeout;
+	guint poll_timeout;
+	time_t last_mtime;
 };
 
 /* signals */
 enum {
 	CHANGED,
@@ -730,29 +734,64 @@ egg_recent_model_monitor_cb (GnomeVFSMon
 			(GSourceFunc)egg_recent_model_changed_timeout,
 			model);
 	}
 }
 
+static gboolean
+egg_recent_model_poll_timeout (gpointer user_data)
+{
+	EggRecentModel *model;
+	struct stat stat_buf;
+	int stat_res;
+
+	model = EGG_RECENT_MODEL (user_data);
+	stat_res = stat (model->priv->path, &stat_buf);
+
+	if (!stat_res && stat_buf.st_mtime &&  
+	    stat_buf.st_mtime != model->priv->last_mtime) {
+		model->priv->last_mtime = stat_buf.st_mtime;
+		
+		if (model->priv->changed_timeout > 0)
+			g_source_remove (model->priv->changed_timeout);
+		
+		model->priv->changed_timeout = g_timeout_add (
+			EGG_RECENT_MODEL_TIMEOUT_LENGTH,
+			(GSourceFunc)egg_recent_model_changed_timeout,
+			model);
+	}
+	return TRUE;
+}
+
 static void
 egg_recent_model_monitor (EggRecentModel *model, gboolean should_monitor)
 {
 	if (should_monitor && model->priv->monitor == NULL) {
 		char *uri;
+		GnomeVFSResult result;
 
 		uri = gnome_vfs_get_uri_from_local_path (model->priv->path);
 
-		gnome_vfs_monitor_add (&model->priv->monitor,
-				       uri,
-				       GNOME_VFS_MONITOR_FILE,
-				       egg_recent_model_monitor_cb,
-				       model);
+		result = gnome_vfs_monitor_add (&model->priv->monitor,
+				       		uri,
+				       		GNOME_VFS_MONITOR_FILE,
+				       		egg_recent_model_monitor_cb,
+				       		model);
 
 		g_free (uri);
 
 		/* if the above fails, don't worry about it.
 		 * local notifications will still happen
 		 */
+		if (result == GNOME_VFS_ERROR_NOT_SUPPORTED) {
+			if (model->priv->poll_timeout > 0)
+				g_source_remove (model->priv->poll_timeout);
+			
+			model->priv->poll_timeout = g_timeout_add (
+				EGG_RECENT_MODEL_POLL_TIME * 1000,
+				egg_recent_model_poll_timeout,
+				model);
+		}
 
 	} else if (!should_monitor && model->priv->monitor != NULL) {
 		gnome_vfs_monitor_cancel (model->priv->monitor);
 		model->priv->monitor = NULL;
 	}
@@ -1038,10 +1077,13 @@ egg_recent_model_finalize (GObject *obje
 	model->priv->path = NULL;
 	
 	g_hash_table_destroy (model->priv->monitors);
 	model->priv->monitors = NULL;
 
+	if (model->priv->poll_timeout > 0)
+		g_source_remove (model->priv->poll_timeout);
+	model->priv->poll_timeout =0;
 
 	g_free (model->priv);
 
 	parent_class->finalize (object);
 }
@@ -1288,10 +1330,12 @@ egg_recent_model_init (EggRecentModel * 
 					g_str_hash, g_str_equal,
 					(GDestroyNotify) g_free,
 					(GDestroyNotify) gnome_vfs_monitor_cancel);
 
 	model->priv->monitor = NULL;
+	model->priv->poll_timeout = 0;
+	model->priv->last_mtime = 0;
 	egg_recent_model_monitor (model, TRUE);
 }
 
 
 /**
