--- mousepad-0.2.16/src/file.c 2008-06-27 22:01:33.000000000 +0200 +++ mousepad-0.2.16/src/file.c.new 2009-08-01 17:36:37.065269081 +0200 @@ -149,6 +149,10 @@ gchar *str; gsize rbytes, wbytes; GError *err = NULL; +#if GTK_CHECK_VERSION(2,10,0) + GtkRecentData recent_data; + gchar *uri; +#endif GtkTextBuffer *textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); @@ -197,5 +201,24 @@ fclose(fp); g_free(str); +#if GTK_CHECK_VERSION(2,10,0) + /* generate the recently-used data */ + recent_data.display_name = NULL; + recent_data.description = NULL; + recent_data.mime_type = "text/plain"; + recent_data.app_name = "Mousepad Text Editor"; + recent_data.app_exec = "mousepad %f"; + recent_data.groups = NULL; + recent_data.is_private = FALSE; + + /* add the file to the recently-used database */ + uri = g_filename_to_uri(fi->filename, NULL, NULL); + if (G_LIKELY(uri != NULL)) + { + gtk_recent_manager_add_full(gtk_recent_manager_get_default(), uri, &recent_data); + g_free(uri); + } +#endif + return 0; }