diff -Naurp gnome-desktop-2.22.1/libgnome-desktop/gnome-desktop-item.c gnome-desktop-2.22.1-patched/libgnome-desktop/gnome-desktop-item.c --- gnome-desktop-2.22.1/libgnome-desktop/gnome-desktop-item.c 2008-04-21 12:09:49.695084000 +0200 +++ gnome-desktop-2.22.1-patched/libgnome-desktop/gnome-desktop-item.c 2008-04-21 12:24:25.530379000 +0200 @@ -55,6 +55,8 @@ #include #endif +#include + #define sure_string(s) ((s)!=NULL?(s):"") #undef GNOME_DISABLE_DEPRECATED @@ -135,6 +137,8 @@ static GnomeDesktopItem *gnome_desktop_i GnomeDesktopItemLoadFlags flags, GError **error); +static void update_recently_used_apps (const GnomeDesktopItem *item); + static int readbuf_getc (ReadBuf *rb) { @@ -2116,6 +2120,8 @@ gnome_desktop_item_launch_on_screen_with (flags & GNOME_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD), error); + update_recently_used_apps (item); + return ret; } @@ -4155,3 +4161,39 @@ gnome_desktop_item_error_quark (void) return q; } + +static void +update_recently_used_apps (const GnomeDesktopItem *item) +{ + GtkRecentManager *manager; + GtkRecentData recent_data; + + if (!item || !gnome_desktop_item_get_location (item)) + return; + + manager = gtk_recent_manager_get_default (); + + if (!manager) + return; + + recent_data.display_name = gnome_desktop_item_get_localestring (item, GNOME_DESKTOP_ITEM_NAME); + recent_data.description = gnome_desktop_item_get_localestring (item, GNOME_DESKTOP_ITEM_COMMENT); + recent_data.mime_type = "application/x-desktop"; + recent_data.is_private = TRUE; + + recent_data.app_name = g_get_application_name (); + if (!recent_data.app_name) + recent_data.app_name = "libgnomedesktop"; + + recent_data.app_exec = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_EXEC); + if (!recent_data.app_exec) + recent_data.app_exec = "gnome-open %u"; + + recent_data.groups = g_new0 (gchar *, 2); + recent_data.groups [0] = "recently-used-apps"; + recent_data.groups [1] = NULL; + + gtk_recent_manager_add_full (manager, gnome_desktop_item_get_location (item), &recent_data); + + g_free (recent_data.groups); +}