Index: idl/GNOME_Yelp.idl
===================================================================
RCS file: /cvs/gnome/yelp/idl/GNOME_Yelp.idl,v
retrieving revision 1.3
diff -u -r1.3 GNOME_Yelp.idl
--- idl/GNOME_Yelp.idl	3 Mar 2002 04:44:44 -0000	1.3
+++ idl/GNOME_Yelp.idl	8 Jan 2006 14:53:13 -0000
@@ -10,7 +10,7 @@
         interface Yelp : Bonobo::Unknown {
 		typedef sequence<string>  WindowList;
 
-                void       newWindow  (in string url);
+                void       newWindow  (in string url, in string time);
 		WindowList getWindows ();
         };
 };
Index: src/yelp-base.c
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-base.c,v
retrieving revision 1.52
diff -u -r1.52 yelp-base.c
--- src/yelp-base.c	16 May 2005 21:09:48 -0000	1.52
+++ src/yelp-base.c	8 Jan 2006 14:53:13 -0000
@@ -24,6 +24,7 @@
 
 #include <bonobo/bonobo-main.h>
 #include <libgnomevfs/gnome-vfs.h>
+#include <gdk/gdkx.h>
 
 #include <string.h>
 
@@ -61,13 +62,13 @@
 static void
 impl_Yelp_newWindow (PortableServer_Servant  servant,
 		     const CORBA_char       *url,
+		     const CORBA_char       *time,
 		     CORBA_Environment      *ev)
 {
 	YelpBase  *yelp_base;
-	
-	yelp_base = YELP_BASE (bonobo_object (servant));
 
-	yelp_base_new_window (yelp_base, url);
+	yelp_base = YELP_BASE (bonobo_object (servant));
+	yelp_base_new_window (yelp_base, url, time);
 }
 
 static GNOME_Yelp_WindowList *
@@ -143,8 +144,8 @@
 	g_return_if_fail (YELP_IS_WINDOW (window));
 	g_return_if_fail (YELP_IS_BASE (base));
 	
-	new_window = yelp_base_new_window (base, uri);
-	
+	new_window = yelp_base_new_window (base, uri, NULL);
+
 	gtk_widget_show (new_window);
 }
 
@@ -188,16 +189,25 @@
 }
 
 GtkWidget *
-yelp_base_new_window (YelpBase *base, const gchar *uri)
+yelp_base_new_window (YelpBase *base, const gchar *uri, const gchar *timestamp)
 {
 	YelpBasePriv *priv;
 	GtkWidget    *window;
+	guint32 real_time = 0; 
         
         g_return_val_if_fail (YELP_IS_BASE (base), NULL);
 
 	priv = base->priv;
         
         window = yelp_window_new (priv->toc_tree, priv->index);
+	gtk_widget_realize (GTK_WIDGET (window));
+
+	if (timestamp) {
+		gchar *time = strstr (timestamp, "_TIME");
+		time+=5;
+		real_time = g_ascii_strtod (time, NULL);
+		gdk_x11_window_set_user_time (window->window, real_time);
+	}
         
 	priv->windows = g_slist_prepend (priv->windows, window);
 
Index: src/yelp-base.h
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-base.h,v
retrieving revision 1.7
diff -u -r1.7 yelp-base.h
--- src/yelp-base.h	7 Oct 2004 08:43:03 -0000	1.7
+++ src/yelp-base.h	8 Jan 2006 14:53:13 -0000
@@ -54,6 +54,7 @@
 YelpBase *       yelp_base_new            (void);
 
 GtkWidget *      yelp_base_new_window     (YelpBase    *base,
-					   const gchar *uri);
+					   const gchar *uri,
+					   const gchar *timestamp);
 
 #endif /* __YELP_BASE_H__ */
Index: src/yelp-main.c
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-main.c,v
retrieving revision 1.39
diff -u -r1.39 yelp-main.c
--- src/yelp-main.c	11 Dec 2005 22:28:54 -0000	1.39
+++ src/yelp-main.c	8 Jan 2006 14:53:13 -0000
@@ -27,6 +27,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkwidget.h>
+#include <gdk/gdkx.h>
 #include <bonobo/bonobo-context.h>
 #include <bonobo/bonobo-exception.h>
 #include <bonobo/bonobo-generic-factory.h>
@@ -49,6 +50,7 @@
 gint         next_opt;
 gchar       *cache_dir;
 gchar       *open_urls;
+gchar       *timestamp;
 
 /*structure defining command line option.*/
 enum {
@@ -76,6 +78,8 @@
 					       gpointer              cdata);
 
 static gboolean	      main_restore_session    (void);
+static Time slowly_and_stupidly_obtain_timestamp (Display *xdisplay);
+
 
 struct poptOption options[] = {
 	{
@@ -142,12 +146,13 @@
 	
 	CORBA_exception_init (&ev);
 
-	GNOME_Yelp_newWindow (yelp_base, url, &ev);
+	GNOME_Yelp_newWindow (yelp_base, url, timestamp, &ev);
 
 	if (BONOBO_EX (&ev)) {
 		g_error (_("Could not open new window."));
 	}
 
+	g_free (timestamp);
 	CORBA_exception_free (&ev);
 }
 	
@@ -303,6 +308,57 @@
 	return FALSE;
 }
 
+/* Copied from libnautilus/nautilus-program-choosing.c; Needed in case
+ * we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
+ */
+static Time
+slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
+{
+	Window xwindow;
+	XEvent event;
+	
+	{
+		XSetWindowAttributes attrs;
+		Atom atom_name;
+		Atom atom_type;
+		gchar* name;
+		
+		attrs.override_redirect = True;
+		attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
+		
+		xwindow =
+			XCreateWindow (xdisplay,
+				       RootWindow (xdisplay, 0),
+				       -100, -100, 1, 1,
+				       0,
+				       CopyFromParent,
+				       CopyFromParent,
+				       CopyFromParent,
+				       CWOverrideRedirect | CWEventMask,
+				       &attrs);
+		
+		atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE);
+		g_assert (atom_name != None);
+		atom_type = XInternAtom (xdisplay, "STRING", TRUE);
+		g_assert (atom_type != None);
+		
+		name = "Fake Window";
+		XChangeProperty (xdisplay, 
+				 xwindow, atom_name,
+				 atom_type,
+				 8, PropModeReplace, name, strlen (name));
+	}
+	
+	XWindowEvent (xdisplay,
+		      xwindow,
+		      PropertyChangeMask,
+		      &event);
+	
+	XDestroyWindow(xdisplay, xwindow);
+	
+	return event.xproperty.time;
+}
+
 int
 main (int argc, char **argv) 
 {
@@ -312,10 +368,23 @@
 	GnomeClient   *client;
 	gboolean       session_started = FALSE;
 	const gchar  **args;
+	gchar *startup_id;
 
 	bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);  
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain(GETTEXT_PACKAGE);
+
+	startup_id = (gchar *) g_getenv ("DESKTOP_STARTUP_ID");
+	gtk_init (&argc, &argv);
+
+	if (startup_id != NULL && *startup_id != '\0') {
+		timestamp = g_strdup (startup_id);
+		putenv ("DESKTOP_STARTUP_ID=");
+	} else {
+		Time tmp;
+		tmp = slowly_and_stupidly_obtain_timestamp (gdk_display);
+		timestamp = g_strdup_printf ("_TIME%lu", tmp);
+	}
 
 	program = gnome_program_init (PACKAGE, VERSION,
 				      LIBGNOMEUI_MODULE, argc, argv,
