File gnome-desktop2-recently-used-apps.patch of Package gnome-desktop2
Index: gnome-desktop-2.28.1/libgnome-desktop/gnome-desktop-item.c
===================================================================
--- gnome-desktop-2.28.1.orig/libgnome-desktop/gnome-desktop-item.c
+++ gnome-desktop-2.28.1/libgnome-desktop/gnome-desktop-item.c
@@ -52,6 +52,8 @@
#include <gtk/gtk.h>
#endif
+#include <gtk/gtkrecentmanager.h>
+
#define sure_string(s) ((s)!=NULL?(s):"")
#define GNOME_DESKTOP_USE_UNSTABLE_API
@@ -136,6 +138,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)
{
@@ -2111,6 +2115,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;
}
@@ -3873,3 +3879,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);
+}