Index: gtk/gtkrecentmanager.c
===================================================================
--- gtk/gtkrecentmanager.c	(revision 21069)
+++ gtk/gtkrecentmanager.c	(working copy)
@@ -41,8 +41,67 @@
 #include "gtkmarshalers.h"
 #include "gtkalias.h"
 
+/**
+ * SECTION:gtk-recent-manager
+ * @short_description: Managing Recently Used Files
+ * @include: gtk/gtk.h
+ * @see_also: #GtkRecentChooser
+ *
+ * #GtkRecentManager provides a facility for adding, removing and
+ * looking up recently used files.  Each recently used file is
+ * identified by its URI, and has meta-data associated to it, like
+ * the names and command lines of the applications that have
+ * registered it, the number of time each application has registered
+ * the same file, the mime type of the file and whether the file
+ * should be displayed only by the applications that have
+ * registered it.
+ *
+ * The #GtkRecentManager acts like a database of all the recently
+ * used files.  You can create new #GtkRecentManager objects, but
+ * it is more efficient to use the default recent manager:
+ *
+ * |[
+ * GtkRecentManager *manager;
+ *
+ * manager = gtk_recent_manager_get_default ();
+ * gtk_recent_manager_add_item (manager, file_uri);
+ * ]|
+ *
+ * A new URI can be added to the recently used files list using
+ * gtk_recent_manager_add_item() or gtk_recent_manager_add_full(); the
+ * former requires just the URI for the file and tries to guess the
+ * rest of the meta-data, while the latter uses the meta-data provided
+ * by the application itself by filling out a #GtkRecentData structure
+ *
+ * You can use gtk_recent_manager_lookup_item() to retrieve the
+ * meta-data of any recently used file:
+ *
+ * |[
+ * GtkRecentManager *manager;
+ * GtkRecentInfo *info;
+ * GError *error = NULL;
+ *
+ * manager = gtk_recent_manager_get_default ();
+ * info = gtk_recent_manager_lookup_item (manager, file_uri, &amp;error);
+ * if (error)
+ *   {
+ *     g_warning ("Could not find the file `&percnt;s': &percnt;s",
+ *                file_uri,
+ *                error-&gt;message);
+ *     g_error_free (error);
+ *   }
+ * else
+ *   {
+ *     /&ast; use the GtkRecentInfo object, the free it &ast;/
+ *     gtk_recent_info_unref (info);
+ *   }
+ * ]|
+ *
+ * Recently used files are supported since GTK+ 2.10.
+ */
+
 /* the file where we store the recently used items */
-#define GTK_RECENTLY_USED_FILE	".recently-used.xbel"
+#define GTK_RECENTLY_USED_FILE	"recently-used.xbel"
 
 /* return all items by default */
 #define DEFAULT_LIMIT	-1
@@ -399,10 +458,12 @@ gtk_recent_manager_real_changed (GtkRece
           else if (age == 0)
             {
               g_bookmark_file_free (priv->recent_items);
-              priv->recent_items = NULL;
 
               priv->recent_items = g_bookmark_file_new ();
+              priv->size = 0;
             }
+          else
+            priv->size = g_bookmark_file_get_size (priv->recent_items);
         }
 
       write_error = NULL;
@@ -503,7 +564,7 @@ gtk_recent_manager_set_filename (GtkRece
   else
     {
       if (!filename || *filename == '\0')
-        priv->filename = g_build_filename (g_get_home_dir (),
+        priv->filename = g_build_filename (g_get_user_data_dir (),
                                            GTK_RECENTLY_USED_FILE,
                                            NULL);
       else
@@ -710,9 +771,15 @@ gtk_recent_manager_set_limit (GtkRecentM
   GtkRecentManagerPrivate *priv;
   
   g_return_if_fail (GTK_IS_RECENT_MANAGER (manager));
-  
+
   priv = manager->priv;
-  priv->limit = limit;
+
+  if (priv->limit != limit)
+    {
+      priv->limit = limit;
+
+      g_object_notify (G_OBJECT (manager), "limit");
+    }
 }
 
 /**
@@ -729,12 +796,9 @@ gtk_recent_manager_set_limit (GtkRecentM
 gint
 gtk_recent_manager_get_limit (GtkRecentManager *manager)
 {
-  GtkRecentManagerPrivate *priv;
-  
   g_return_val_if_fail (GTK_IS_RECENT_MANAGER (manager), DEFAULT_LIMIT);
   
-  priv = manager->priv;
-  return priv->limit;
+  return manager->priv->limit;
 }
 
 static void
@@ -1368,6 +1432,8 @@ gtk_recent_manager_purge_items (GtkRecen
   
   purged = count - g_bookmark_file_get_size (priv->recent_items);
 
+  g_object_notify (G_OBJECT (manager), "size");
+
   return purged;
 }
 
@@ -1406,6 +1472,10 @@ gtk_recent_manager_clamp_to_age (GtkRece
     }
 
   g_strfreev (uris);
+
+  priv->size = g_bookmark_file_get_size (priv->recent_items);
+
+  g_object_notify (G_OBJECT (manager), "size");
 }
 
 /*****************
@@ -1431,7 +1501,7 @@ gtk_recent_info_new (const gchar *uri)
 
   g_assert (uri != NULL);
 
-  info = g_new0 (GtkRecentInfo, 1);
+  info = g_slice_new0 (GtkRecentInfo);
   info->uri = g_strdup (uri);
   
   info->applications = NULL;
@@ -1481,7 +1551,7 @@ gtk_recent_info_free (GtkRecentInfo *rec
   if (recent_info->icon)
     g_object_unref (recent_info->icon);
 
-  g_free (recent_info);
+  g_slice_free (GtkRecentInfo, recent_info);
 }
 
 /**
@@ -1883,6 +1953,23 @@ gtk_recent_info_last_application (GtkRec
   return g_strdup (name);
 }
 
+static GIcon *
+get_gicon_for_mime_type (const char *mime_type)
+{
+  char *content_type;
+  GIcon *retval;
+
+  content_type = g_content_type_from_mime_type (mime_type);
+  if (!content_type)
+    return NULL;
+
+  retval = g_content_type_get_icon (content_type);
+
+  g_free (content_type);
+
+  return retval;
+}
+
 static GdkPixbuf *
 get_icon_for_mime_type (const char *mime_type,
 			gint        pixel_size)
@@ -1893,19 +1980,15 @@ get_icon_for_mime_type (const char *mime
   GtkIconInfo *info;
   GdkPixbuf *pixbuf;
 
-  icon_theme = gtk_icon_theme_get_default ();
-
-  content_type = g_content_type_from_mime_type (mime_type);
-
-  if (!content_type)
+  icon = get_gicon_for_mime_type (mime_type);
+  if (!icon)
     return NULL;
 
-  icon = g_content_type_get_icon (content_type);
+  icon_theme = gtk_icon_theme_get_default ();
   info = gtk_icon_theme_lookup_by_gicon (icon_theme, 
                                          icon, 
                                          pixel_size, 
                                          GTK_ICON_LOOKUP_USE_BUILTIN);
-  g_free (content_type);
   g_object_unref (icon);
 
   if (!info)
@@ -1972,6 +2055,93 @@ gtk_recent_info_get_icon (GtkRecentInfo 
 }
 
 /**
+ * gtk_recent_info_get_gicon:
+ * @info: a #GtkRecentInfo
+ *
+ * Retrieves the #GIcon associated to the resource MIME type.
+ *
+ * Return value: a #GIcon, or %NULL. Use g_object_unref() when finished
+ *   using the icon
+ *
+ * Since: 2.14
+ */
+GIcon *
+gtk_recent_info_get_gicon (GtkRecentInfo *info)
+{
+  g_return_val_if_fail (info != NULL, NULL);
+
+  if (info->mime_type)
+    return get_gicon_for_mime_type (info->mime_type);
+
+  return NULL;
+}
+
+/**
+ * gtk_recent_info_get_thumbnail:
+ * @info: a #GtkRecentInfo
+ *
+ * Retrieves the thumbnail for the URI of @info.
+ *
+ * Return value: a #GdkPixbuf containing the thumbnail, or %NULL.
+ *   Use g_object_unref() when done using the thumnail
+ *
+ * Since: 2.14
+ */
+GdkPixbuf *
+gtk_recent_info_get_thumbnail (GtkRecentInfo *info)
+{
+  GFile *file;
+  GFileInfo *info;
+  gboolean is_failed;
+  gchar *path;
+  GError *error;
+  GdkPixbuf *retval = NULL;
+
+  g_return_val_if_fail (info != NULL, NULL);
+
+  file = g_file_new_for_uri (info->uri);
+
+  error = NULL;
+  info = g_file_query_info (file,
+                            G_FILE_ATTRIBUTE_THUMBNAIL_PATH ","
+                            G_FILE_ATTRIBUTE_THUMBNAIL_FAILED,
+                            0,
+                            NULL,
+                            &error);
+  if (error)
+    {
+      g_warning ("Unable to retrieve the thumbnail: %s", error->message);
+      g_error_free (error);
+      goto out;
+    }
+
+  is_failed = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_THUMBNAIL_FAILED);
+  if (is_failed)
+    goto out;
+
+  path = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
+  if (!path)
+    goto out;
+
+  retval = gdk_pixbuf_new_from_file (path, &error);
+  if (error)
+    {
+      g_warning ("Unable to open the thumbnail: %s", error->message);
+      g_error_free (error);
+      goto out;
+    }
+
+out:
+  if (info)
+    g_object_unref (info);
+
+  if (file)
+    g_object_unref (file);
+
+  return retval;
+}
+
+/**
  * gtk_recent_info_is_local:
  * @info: a #GtkRecentInfo
  *
Index: gtk/gtkrecentmanager.h
===================================================================
--- gtk/gtkrecentmanager.h	(revision 21069)
+++ gtk/gtkrecentmanager.h	(working copy)
@@ -200,6 +200,8 @@ gboolean              gtk_recent_info_ha
 							    const gchar    *group_name);
 GdkPixbuf *           gtk_recent_info_get_icon             (GtkRecentInfo  *info,
 							    gint            size);
+GIcon *               gtk_recent_info_get_gicon            (GtkRecentInfo  *info);
+GdkPixbuf *           gtk_recent_info_get_thumbnail        (GtkRecentInfo  *info);
 gchar *               gtk_recent_info_get_short_name       (GtkRecentInfo  *info) G_GNUC_MALLOC;
 gchar *               gtk_recent_info_get_uri_display      (GtkRecentInfo  *info) G_GNUC_MALLOC;
 gint                  gtk_recent_info_get_age              (GtkRecentInfo  *info);
