? gnome-ditem-edit.loT
? t.tmp
Index: gnome-desktop-item.c
===================================================================
RCS file: /cvs/gnome/gnome-desktop/libgnome-desktop/gnome-desktop-item.c,v
retrieving revision 1.140
diff -u -p -r1.140 gnome-desktop-item.c
--- gnome-desktop-item.c	24 Dec 2004 08:29:44 -0000	1.140
+++ gnome-desktop-item.c	30 Jan 2005 11:46:41 -0000
@@ -87,6 +87,8 @@ struct _GnomeDesktopItem {
 	char *location;
 
 	time_t mtime;
+
+	guint32 launch_time;
 };
 
 /* If mtime is set to this, set_location won't update mtime,
@@ -418,6 +420,7 @@ gnome_desktop_item_copy (const GnomeDesk
 	retval->modified = item->modified;
 	retval->location = g_strdup (item->location);
 	retval->mtime = item->mtime;
+	retval->launch_time = item->launch_time;
 
 	/* Languages */
 	retval->languages = g_list_copy (item->languages);
@@ -1790,6 +1793,7 @@ ditem_execute (const GnomeDesktopItem *i
 #ifdef HAVE_STARTUP_NOTIFICATION
 		if (sn_context != NULL &&
 		    !sn_launcher_context_get_initiated (sn_context)) {
+			guint32 launch_time;
 
 			/* This means that we always use the first real_argv[0]
 			 * we select for the "binary name", but it's probably
@@ -1801,10 +1805,18 @@ ditem_execute (const GnomeDesktopItem *i
 			sn_launcher_context_set_binary_name (sn_context,
 							     real_argv[0]);
 			
+			if (item->launch_time > 0)
+				launch_time = item->launch_time;
+			else
+				launch_time = gtk_get_current_event_time ();
+
 			sn_launcher_context_initiate (sn_context,
 						      g_get_prgname () ? g_get_prgname () : "unknown",
 						      real_argv[0],
-						      gtk_get_current_event_time ());
+						      launch_time);
+
+			/* Don't allow accidental reuse of same timestamp */
+			((GnomeDesktopItem *)item)->launch_time = 0;
 
 			envp = make_spawn_environment_for_sn_context (sn_context, envp);
 			if (free_me)
@@ -2977,8 +2989,18 @@ gnome_desktop_item_set_boolean (GnomeDes
 	set (item, attr, value ? "true" : "false");
 }
 
+void
+gnome_desktop_item_set_launch_time (GnomeDesktopItem *item,
+				    guint32           timestamp)
+{
+	g_return_if_fail (item != NULL);
+	g_return_if_fail (timestamp > 0);
+
+	item->launch_time = timestamp;
+}
+
 /*
-* Clearing attributes
+ * Clearing attributes
  */
 void
 gnome_desktop_item_clear_section (GnomeDesktopItem *item,
Index: libgnome/gnome-desktop-item.h
===================================================================
RCS file: /cvs/gnome/gnome-desktop/libgnome-desktop/libgnome/gnome-desktop-item.h,v
retrieving revision 1.49
diff -u -p -r1.49 gnome-desktop-item.h
--- libgnome/gnome-desktop-item.h	28 Nov 2002 11:38:41 -0000	1.49
+++ libgnome/gnome-desktop-item.h	30 Jan 2005 11:46:41 -0000
@@ -286,6 +286,12 @@ void                    gnome_desktop_it
 							      gboolean                    value);
 
 /*
+ * Xserver time of user action that caused the application launch to start.
+ */
+void                    gnome_desktop_item_set_launch_time   (GnomeDesktopItem           *item,
+							      guint32                     timestamp);
+
+/*
  * Clearing attributes
  */
 #define                 gnome_desktop_item_clear_attr(item,attr) \
