Index: gedit/Makefile.am
===================================================================
RCS file: /cvs/gnome/gedit/gedit/Makefile.am,v
retrieving revision 1.120
diff -u -p -u -p -r1.120 Makefile.am
--- gedit/Makefile.am	13 Jun 2006 18:55:30 -0000	1.120
+++ gedit/Makefile.am	3 Aug 2006 10:14:36 -0000
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-SUBDIRS = dialogs recent-files
+SUBDIRS = dialogs
 
 bin_PROGRAMS = gedit
 
@@ -37,8 +37,7 @@ libgedit_la_LDFLAGS = -export-dynamic -n
 
 libgedit_la_LIBADD =			\
 	$(GEDIT_LIBS)			\
-	dialogs/libdialogs.la		\
-	recent-files/librecent.la
+	dialogs/libdialogs.la
 
 if ENABLE_PYTHON
 libgedit_la_LIBADD += \
@@ -95,7 +94,6 @@ INST_H_FILES =				\
 	gedit-print.h			\
 	gedit-print-job-preview.h	\
 	gedit-progress-message-area.h	\
-	gedit-recent.h			\
 	gedit-statusbar.h		\
 	gedit-tab.h 			\
 	gedit-utils.h 			\
@@ -144,7 +142,6 @@ libgedit_la_SOURCES = 			\
 	gedit-print.c			\
 	gedit-print-job-preview.c	\
 	gedit-progress-message-area.c	\
-	gedit-recent.c			\
 	gedit-session.c			\
 	gedit-spinner.c			\
 	gedit-statusbar.c		\
Index: gedit/gedit-commands-file.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-commands-file.c,v
retrieving revision 1.10
diff -u -p -u -p -r1.10 gedit-commands-file.c
--- gedit/gedit-commands-file.c	31 May 2006 15:40:12 -0000	1.10
+++ gedit/gedit-commands-file.c	3 Aug 2006 10:14:37 -0000
@@ -46,7 +46,6 @@
 #include "gedit-statusbar.h"
 #include "gedit-debug.h"
 #include "gedit-utils.h"
-#include "gedit-recent.h"
 #include "dialogs/gedit-close-confirmation-dialog.h"
 #include "dialogs/gedit-open-location-dialog.h"
 #include "gedit-file-chooser-dialog.h"
@@ -494,26 +493,6 @@ _gedit_cmd_file_open_uri (GtkAction   *a
 			  window);
 
 	gtk_widget_show (dlg);
-}
-
-void
-_gedit_cmd_file_open_recent (EggRecentItem *item,
-			     GeditWindow   *window)
-{
-	GSList *uris = NULL;
-	gchar  *uri;
-
-	gedit_debug (DEBUG_COMMANDS);
-
-	uri = egg_recent_item_get_uri (item);
-
-	uris = g_slist_prepend (uris, uri);
-
-	if (gedit_commands_load_uris (window, uris, NULL, 0) != 1)
-		gedit_recent_remove (uri);
-
-	g_slist_foreach (uris, (GFunc) g_free, NULL);
-	g_slist_free (uris);
 }
 
 /* File saving */
Index: gedit/gedit-commands.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-commands.h,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 gedit-commands.h
--- gedit/gedit-commands.h	18 Jun 2006 09:05:20 -0000	1.17
+++ gedit/gedit-commands.h	3 Aug 2006 10:14:37 -0000
@@ -35,7 +35,6 @@
 #define __GEDIT_COMMANDS_H__
 
 #include <gtk/gtkaction.h>
-#include "recent-files/egg-recent-item.h"
 #include "gedit-window.h"
 
 G_BEGIN_DECLS
@@ -69,8 +68,6 @@ gint		_gedit_cmd_load_files_from_prompt	
 void		_gedit_cmd_file_new			(GtkAction   *action,
 							 GeditWindow *window);
 void		_gedit_cmd_file_open			(GtkAction   *action,
-							 GeditWindow *window);
-void		_gedit_cmd_file_open_recent		(EggRecentItem *item,
 							 GeditWindow *window);
 void		_gedit_cmd_file_save			(GtkAction   *action,
 							 GeditWindow *window);
Index: gedit/gedit-prefs-manager-app.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-prefs-manager-app.c,v
retrieving revision 1.13
diff -u -p -u -p -r1.13 gedit-prefs-manager-app.c
--- gedit/gedit-prefs-manager-app.c	11 Jun 2006 14:17:15 -0000	1.13
+++ gedit/gedit-prefs-manager-app.c	3 Aug 2006 10:14:37 -0000
@@ -45,7 +45,6 @@
 #include "gedit-view.h"
 #include "gedit-window.h"
 #include "gedit-window-private.h"
-#include "gedit-recent.h"
 
 static void gedit_prefs_manager_editor_font_changed	(GConfClient *client,
 		   				 	 guint        cnxn_id,
@@ -1079,7 +1078,7 @@ gedit_prefs_manager_max_recents_changed 
 
 	if (strcmp (entry->key, GPM_MAX_RECENTS) == 0)
 	{
-		EggRecentModel *model;
+		const GList *windows;
 		gint max;
 
 		if (entry->value->type == GCONF_VALUE_INT)
@@ -1092,9 +1091,19 @@ gedit_prefs_manager_max_recents_changed 
 		else
 			max = GPM_DEFAULT_MAX_RECENTS;
 
-		model = gedit_recent_get_model ();
+		windows = gedit_app_get_windows (gedit_app_get_default ());
+		while (windows != NULL)
+		{
+			GeditWindow *w = windows->data;
+
+			gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (w->priv->toolbar_recent_menu),
+						      max);
+
+			windows = g_list_next (windows);
+		}
 
-		egg_recent_model_set_limit (model, max);
+		/* FIXME: we have no way at the moment to trigger the
+		 * update of the inline recents in the File menu */
 	}
 }
 
Index: gedit/gedit-tab.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-tab.c,v
retrieving revision 1.13
diff -u -p -u -p -r1.13 gedit-tab.c
--- gedit/gedit-tab.c	15 Jun 2006 14:09:55 -0000	1.13
+++ gedit/gedit-tab.c	3 Aug 2006 10:14:39 -0000
@@ -46,7 +46,6 @@
 #include "gedit-progress-message-area.h"
 #include "gedit-debug.h"
 #include "gedit-prefs-manager-app.h"
-#include "gedit-recent.h"
 #include "gedit-convert.h"
 #include "gedit-enum-types.h"
 
@@ -507,7 +506,7 @@ recoverable_loading_error_message_area_r
 	}
 	else
 	{
-		gedit_recent_remove (uri);
+		_gedit_recent_remove (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), uri);
 		
 		unrecoverable_loading_error_message_area_response (message_area,
 								   response_id,
@@ -920,7 +919,7 @@ document_loaded (GeditDocument *document
 			}
 			else
 			{
-				gedit_recent_remove (uri);
+				_gedit_recent_remove (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), uri);
 
 				if (tab->priv->state == GEDIT_TAB_STATE_LOADING_ERROR)
 				{
@@ -976,12 +975,17 @@ document_loaded (GeditDocument *document
 	}
 	else
 	{
+		gchar *mime;
 		GList *all_documents;
 		GList *l;
 
 		g_return_if_fail (uri != NULL);
-		
-		gedit_recent_add (uri);
+
+		mime = gedit_document_get_mime_type (document);
+		_gedit_recent_add (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))),
+				   uri,
+				   mime);
+		g_free (mime);
 
 		all_documents = gedit_app_get_documents (gedit_app_get_default ());
 
@@ -1300,8 +1304,9 @@ document_saved (GeditDocument *document,
 			else
 			{
 				/* These errors are _NOT_ recoverable */
-				gedit_recent_remove (tab->priv->tmp_save_uri);
-				
+				_gedit_recent_remove  (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))),
+						       tab->priv->tmp_save_uri);
+
 				emsg = gedit_unrecoverable_saving_error_message_area_new (tab->priv->tmp_save_uri, 
 									  error);
 				g_return_if_fail (emsg != NULL);
@@ -1340,8 +1345,13 @@ document_saved (GeditDocument *document,
 	}
 	else
 	{
-		gedit_recent_add (tab->priv->tmp_save_uri);
-		
+		gchar *mime = gedit_document_get_mime_type (document);
+
+		_gedit_recent_add (GEDIT_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))),
+				   tab->priv->tmp_save_uri,
+				   mime);
+		g_free (mime);
+
 		if (tab->priv->print_preview != NULL)
 			gedit_tab_set_state (tab, GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW);
 		else
Index: gedit/gedit-window-private.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-window-private.h,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 gedit-window-private.h
--- gedit/gedit-window-private.h	14 Dec 2005 17:25:12 -0000	1.3
+++ gedit/gedit-window-private.h	3 Aug 2006 10:14:39 -0000
@@ -33,7 +33,6 @@
 
 #include "gedit/gedit-window.h"
 #include "gedit-prefs-manager.h"
-#include "recent-files/egg-recent-view-uimanager.h"
 
 G_BEGIN_DECLS
 
@@ -66,7 +65,10 @@ struct _GeditWindowPrivate
 	GtkWidget      *toolbar_recent_menu;
 	GeditToolbarSetting toolbar_style;
 
-	EggRecentViewUIManager *recent_view_uim;
+	/* recent files */
+	GtkRecentManager *recent_manager;
+	GtkActionGroup *recents_action_group;
+	guint           recents_menu_ui_id;
 
 	GeditTab       *active_tab;
 	gint            num_tabs;
Index: gedit/gedit-window.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-window.c,v
retrieving revision 1.30
diff -u -p -u -p -r1.30 gedit-window.c
--- gedit/gedit-window.c	18 Jun 2006 09:05:20 -0000	1.30
+++ gedit/gedit-window.c	3 Aug 2006 10:14:41 -0000
@@ -58,11 +58,6 @@
 #include "gedit-plugins-engine.h"
 #include "gedit-enum-types.h"
 
-#include "recent-files/egg-recent-model.h"
-#include "recent-files/egg-recent-view.h"
-#include "recent-files/egg-recent-view-gtk.h"
-#include "recent-files/egg-recent-view-uimanager.h"
-
 #define GEDIT_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),\
 					 GEDIT_TYPE_WINDOW,                    \
 					 GeditWindowPrivate))
@@ -102,6 +97,9 @@ static void	app_lockdown_changed	(GeditA
 					 GParamSpec  *param,
 					 GeditWindow *window);
 
+static void	recent_manager_changed	(GtkRecentManager *manager,
+					 GeditWindow *window);
+
 static void
 gedit_window_get_property (GObject    *object,
 			   guint       prop_id,
@@ -166,15 +164,6 @@ gedit_window_destroy (GtkObject *object)
 			gedit_prefs_manager_set_bottom_panel_size (
 					window->priv->bottom_panel_size);
 
-	/* do it here, because recent_view_uim finalization
-	 * requires that widgets are still there
-	 */
-	if (window->priv->recent_view_uim != NULL)
-	{
-		g_object_unref (window->priv->recent_view_uim);
-		window->priv->recent_view_uim = NULL;
-	}
-	
 	gedit_plugins_engine_garbage_collect();
 
 	GTK_OBJECT_CLASS (gedit_window_parent_class)->destroy (object);
@@ -245,6 +234,36 @@ gedit_window_key_press_event (GtkWidget 
 }
 
 static void
+gedit_window_screen_changed (GtkWidget *widget,
+			     GdkScreen *old_screen)
+{
+	GeditWindowPrivate *priv = GEDIT_WINDOW (widget)->priv;
+	GdkScreen *screen;
+
+	screen = gtk_widget_get_screen (widget);
+
+	/* FIXME: this seems to be happening when then spinner is destroyed!? */
+	if (old_screen == screen)
+		return;
+
+	if (old_screen != NULL)
+	{
+		g_signal_handlers_disconnect_by_func
+			(gtk_recent_manager_get_for_screen (old_screen),
+			 G_CALLBACK (recent_manager_changed), widget);
+	}
+
+	priv->recent_manager = gtk_recent_manager_get_for_screen (screen);
+	g_signal_connect (priv->recent_manager,
+			  "changed",
+			  G_CALLBACK (recent_manager_changed),
+			  widget);
+
+	if (GTK_WIDGET_CLASS (gedit_window_parent_class)->screen_changed)
+		GTK_WIDGET_CLASS (gedit_window_parent_class)->screen_changed (widget, old_screen);
+}
+
+static void
 gedit_window_tab_removed (GeditWindow         *window,
 			      GeditTab *tab) 
 {
@@ -268,6 +287,7 @@ gedit_window_class_init (GeditWindowClas
 	widget_class->window_state_event = gedit_window_window_state_event;
 	widget_class->configure_event = gedit_window_configure_event;
 	widget_class->key_press_event = gedit_window_key_press_event;
+	widget_class->screen_changed = gedit_window_screen_changed;
 
 	signals[TAB_ADDED] =
 		g_signal_new ("tab_added",
@@ -892,117 +912,231 @@ update_languages_menu (GeditWindow *wind
 	g_free (escaped_lang_name);
 }
 
-static void
-open_recent_gtk (EggRecentViewGtk *view, 
-		 EggRecentItem    *item,
-		 GeditWindow      *window)
+void
+_gedit_recent_add (GeditWindow *window,
+		   const gchar *uri,
+		   const gchar *mime)
 {
-	_gedit_cmd_file_open_recent (item, window);
-}
+	GtkRecentData *recent_data;
 
-static void
-open_recent_uim (GtkAction   *action, 
-		 GeditWindow *window)
-{
-	EggRecentItem *item;
+	static gchar *groups[2] = {
+		"gedit",
+		NULL
+	};
+
+	recent_data = g_slice_new (GtkRecentData);
+
+	recent_data->display_name = NULL;
+	recent_data->description = NULL;
+	recent_data->mime_type = (gchar *) mime;
+	recent_data->app_name = (gchar *) g_get_application_name ();
+	recent_data->app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL);
+	recent_data->groups = groups;
+	recent_data->is_private = FALSE;
 
-	item = egg_recent_view_uimanager_get_item (window->priv->recent_view_uim,
-						   action);
-	g_return_if_fail (item != NULL);
+	gtk_recent_manager_add_full (window->priv->recent_manager,
+				     uri,
+				     recent_data);
 
-	_gedit_cmd_file_open_recent (item, window);
+	g_free (recent_data->app_exec);
+
+	g_slice_free (GtkRecentData, recent_data);
 }
 
-#define TIP_MAX_URI_LEN 100
+void
+_gedit_recent_remove (GeditWindow *window,
+		      const gchar *uri)
+{
+	gtk_recent_manager_remove_item (window->priv->recent_manager,
+					uri,
+					NULL);
+}
 
 static void
-recent_tooltip_func_gtk (GtkTooltips   *tooltips,
-			 GtkWidget     *menu,
-			 EggRecentItem *item,
-			 gpointer       user_data)
+open_recent_file (const gchar *uri,
+		  GeditWindow *window)
 {
-	gchar *tip;
-	gchar *uri_for_display;
-	gchar *trunc_uri;
+	GSList *uris = NULL;
 
-	uri_for_display = gedit_utils_format_uri_for_display (egg_recent_item_peek_uri (item));
-	g_return_if_fail (uri_for_display != NULL);
+	uris = g_slist_prepend (uris, (gpointer) uri);
+
+	if (gedit_commands_load_uris (window, uris, NULL, 0) != 1)
+	{
+		_gedit_recent_remove (window, uri);
+	}
 
-	trunc_uri = gedit_utils_str_middle_truncate (uri_for_display,
-						     TIP_MAX_URI_LEN);
-	g_free (uri_for_display);
+	g_slist_free (uris);
+}
 
-	/* Translators: %s is a URI */
-	tip = g_strdup_printf (_("Open '%s'"), trunc_uri);
+static void
+recent_chooser_item_activated (GtkRecentChooser *chooser,
+			       GeditWindow      *window)
+{
+	gchar *uri;
 
-	g_free (trunc_uri);
+	uri = gtk_recent_chooser_get_current_uri (chooser);
 
-	gtk_tooltips_set_tip (tooltips, GTK_WIDGET (menu), tip, NULL);
+	open_recent_file (uri, window);
 
-	g_free (tip);
+	g_free (uri);
 }
 
-static char *
-recent_tooltip_func_uim (EggRecentItem *item,
-			 gpointer       user_data)
+static void
+recents_menu_activate (GtkAction   *action,
+		       GeditWindow *window)
 {
-	gchar *tip;
-	gchar *uri_for_display;
-	gchar *trunc_uri;
+	GtkRecentInfo *info;
+	const gchar *uri;
+
+	info = g_object_get_data (G_OBJECT (action), "gtk-recent-info");
+	g_return_if_fail (info != NULL);
 
-	uri_for_display = gedit_utils_format_uri_for_display (egg_recent_item_peek_uri (item));
-	g_return_val_if_fail (uri_for_display != NULL, NULL);
+	uri = gtk_recent_info_get_uri (info);
 
-	trunc_uri = gedit_utils_str_middle_truncate (uri_for_display,
-						     TIP_MAX_URI_LEN);
-	g_free (uri_for_display);
+	open_recent_file (uri, window);
+}
 
-	/* Translators: %s is a URI */
-	tip = g_strdup_printf (_("Open '%s'"), trunc_uri);
+static gint
+sort_recents_mru (GtkRecentInfo *a, GtkRecentInfo *b)
+{
+	return (gtk_recent_info_get_modified (a) < gtk_recent_info_get_modified (b));
+}
 
-	g_free (trunc_uri);
+static void	update_recent_files_menu (GeditWindow *window);
 
-	return tip;
+static void
+recent_manager_changed (GtkRecentManager *manager,
+			GeditWindow      *window)
+{
+	/* regenerate the menu when the model changes */
+	update_recent_files_menu (window);
 }
 
-#undef TIP_MAX_URI_LEN
+#define TIP_MAX_URI_LEN 100
 
+/*
+ * Manually construct the inline recents list in the File menu.
+ * Hopefully gtk 2.12 will add support for it.
+ */
 static void
-build_recent_tool_menu (GtkMenuToolButton *button,
-			GeditWindow       *window)
+update_recent_files_menu (GeditWindow *window)
 {
-	EggRecentViewGtk *view;
-	EggRecentModel *model;
+	GeditWindowPrivate *p = window->priv;
+	gint max_recents;
+	guint merge_id;
+	GList *actions, *l, *items;
+	gint i;
 
-	model = gedit_recent_get_model ();
-	view = egg_recent_view_gtk_new (window->priv->toolbar_recent_menu,
-					NULL);
+	gedit_debug (DEBUG_WINDOW);
 
-	egg_recent_view_gtk_show_icons (view, TRUE);
-	egg_recent_view_gtk_show_numbers (view, FALSE);
+	max_recents = gedit_prefs_manager_get_max_recents ();
 
-	/* elipsize if if gets too large */
-	egg_recent_view_gtk_set_label_width (view, 50);
+	g_return_if_fail (p->recents_action_group != NULL);
 
-	egg_recent_view_gtk_set_tooltip_func (view, recent_tooltip_func_gtk, NULL);
+	if (p->recents_menu_ui_id != 0)
+		gtk_ui_manager_remove_ui (p->manager,
+					  p->recents_menu_ui_id);
 
-	egg_recent_view_set_model (EGG_RECENT_VIEW (view), model);
+	actions = gtk_action_group_list_actions (p->recents_action_group);
+	for (l = actions; l != NULL; l = l->next)
+	{
+		g_signal_handlers_disconnect_by_func (GTK_ACTION (l->data),
+						      G_CALLBACK (recents_menu_activate),
+						      window);
+ 		gtk_action_group_remove_action (p->recents_action_group,
+						GTK_ACTION (l->data));
+	}
+	g_list_free (actions);
 
-	g_signal_connect (view,
-			  "activate",
-			  G_CALLBACK (open_recent_gtk),
-			  window);
+	merge_id = gtk_ui_manager_new_merge_id (p->manager);
 
-	gtk_widget_show (window->priv->toolbar_recent_menu);
+	items = gtk_recent_manager_get_items (p->recent_manager);
 
-	/* this callback must run just once for lazy initialization:
-	 * we can now disconnect it
-	 */
-	g_signal_handlers_disconnect_by_func (button,
-					      G_CALLBACK (build_recent_tool_menu),
-					      window);
+	items = g_list_sort (items, (GCompareFunc) sort_recents_mru);
+
+	i = 0;
+	for (l = items; l != NULL; l = l->next)
+	{
+		gchar *action_name;
+		const gchar *display_name;
+		gchar *escaped;
+		gchar *label;
+		gchar *uri;
+		gchar *trunc_uri;
+		gchar *tip;
+		GtkAction *action;
+		GtkRecentInfo *info = l->data;
+
+		/* clamp */
+		if (i >= max_recents)
+			break;
+
+		/* filter */
+		if (!gtk_recent_info_has_group (info, "gedit"))
+			continue;
+
+		i++;
+
+		action_name = g_strdup_printf ("recent-info-%d", i);
+
+		display_name = gtk_recent_info_get_display_name (info);
+		escaped = gedit_utils_escape_underscores (display_name, -1);
+		if (i >= 10)
+			label = g_strdup_printf ("%d.  %s",
+						 i, 
+						 escaped);
+		else
+			label = g_strdup_printf ("_%d.  %s",
+						 i, 
+						 escaped);
+		g_free (escaped);
+
+		uri = gtk_recent_info_get_uri_display (info);
+		trunc_uri = gedit_utils_str_middle_truncate (uri,
+							     TIP_MAX_URI_LEN);
+		g_free (uri);
+
+		/* Translators: %s is a URI */
+		tip = g_strdup_printf (_("Open '%s'"), trunc_uri);
+		g_free (trunc_uri);
+
+		action = gtk_action_new (action_name,
+					 label,
+					 tip,
+					 NULL);
+
+		g_object_set_data_full (G_OBJECT (action),
+					"gtk-recent-info",
+					gtk_recent_info_ref (info),
+					(GDestroyNotify) gtk_recent_info_unref);
+
+		g_signal_connect (action,
+				  "activate",
+				  G_CALLBACK (recents_menu_activate),
+				  window);
+
+		gtk_action_group_add_action (p->recents_action_group,
+					     action);
+
+		gtk_ui_manager_add_ui (p->manager,
+				       merge_id,
+				       "/MenuBar/FileMenu/FileRecentsPlaceholder",
+				       action_name,
+				       action_name,
+				       GTK_UI_MANAGER_MENUITEM,
+				       FALSE);
+
+		g_free (action_name);
+		g_free (label);
+		g_free (tip);
+	}
+
+	g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL);
+	g_list_free (items);
 }
 
+#undef TIP_MAX_URI_LEN
+
 static void
 set_non_homogeneus (GtkWidget *widget, gpointer data)
 {
@@ -1036,9 +1170,9 @@ create_menu_bar_and_toolbar (GeditWindow
 	GtkAction *action;
 	GtkUIManager *manager;
 	GtkWidget *menubar;
-	EggRecentModel *recent_model;
-	EggRecentViewUIManager *recent_view;
 	GtkToolItem *open_button;
+	GdkScreen *screen;
+	GtkRecentFilter *filter;
 	GError *error = NULL;
 	GeditLockdownMask lockdown;
 
@@ -1130,19 +1264,42 @@ create_menu_bar_and_toolbar (GeditWindow
 	gtk_action_set_sensitive (action, 
 				  !(lockdown & GEDIT_LOCKDOWN_PRINT_SETUP));
 
-
 	/* recent files menu */
-	recent_model = gedit_recent_get_model ();
-	recent_view = egg_recent_view_uimanager_new (manager,
-						     "/MenuBar/FileMenu/FileRecentsPlaceholder",
-						     G_CALLBACK (open_recent_uim),
-						     window);
-	window->priv->recent_view_uim = recent_view;
-	egg_recent_view_uimanager_show_icons (recent_view, FALSE);
-	egg_recent_view_uimanager_set_tooltip_func (recent_view,
-						    recent_tooltip_func_uim,
-						    window);
-	egg_recent_view_set_model (EGG_RECENT_VIEW (recent_view), recent_model);
+	action_group = gtk_action_group_new ("RecentFilesActions");
+	gtk_action_group_set_translation_domain (action_group, NULL);
+	window->priv->recents_action_group = action_group;
+	gtk_ui_manager_insert_action_group (manager, action_group, 0);
+	g_object_unref (action_group);
+
+	screen = gtk_widget_get_screen (GTK_WIDGET (window));
+	window->priv->recent_manager = gtk_recent_manager_get_for_screen (screen);
+
+	g_signal_connect (window->priv->recent_manager,
+			  "changed",
+			  G_CALLBACK (recent_manager_changed),
+			  window);
+
+	update_recent_files_menu (window);
+
+	/* recent files menu tool button */
+	window->priv->toolbar_recent_menu = gtk_recent_chooser_menu_new_for_manager (window->priv->recent_manager);
+
+	gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (window->priv->toolbar_recent_menu),
+					   FALSE);
+	gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (window->priv->toolbar_recent_menu),
+					  GTK_RECENT_SORT_MRU);
+	gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->toolbar_recent_menu),
+				      gedit_prefs_manager_get_max_recents ());
+
+	filter = gtk_recent_filter_new ();
+	gtk_recent_filter_add_group (filter, "gedit");
+	gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (window->priv->toolbar_recent_menu),
+				       filter);
+
+	g_signal_connect (GTK_RECENT_CHOOSER (window->priv->toolbar_recent_menu),
+			  "item_activated",
+			  G_CALLBACK (recent_chooser_item_activated),
+			  window);
 
 	/* languages menu */
 	action_group = gtk_action_group_new ("LanguagesActions");
@@ -1173,17 +1330,12 @@ create_menu_bar_and_toolbar (GeditWindow
 			    FALSE,
 			    0);
 
+	set_toolbar_style (window, NULL);
+
 	/* add the custom Open button to the toolbar */
 	open_button = gtk_menu_tool_button_new_from_stock (GTK_STOCK_OPEN);
-
-	/* the popup menu is actually built the first time it's showed */
-	window->priv->toolbar_recent_menu = gtk_menu_new ();
 	gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (open_button),
 				       window->priv->toolbar_recent_menu);
-	g_signal_connect (open_button,
-			  "show-menu",
-			  G_CALLBACK (build_recent_tool_menu),
-			  window);
 
 	/* not very nice the way we access the tooltops object
 	 * but I can't see a better way and I don't want a differen GtkTooltip
@@ -1206,9 +1358,9 @@ create_menu_bar_and_toolbar (GeditWindow
 		      NULL);
 	gtk_action_connect_proxy (action, GTK_WIDGET (open_button));
 
-	gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar), open_button, 1);
-	
-	set_toolbar_style (window, NULL);
+	gtk_toolbar_insert (GTK_TOOLBAR (window->priv->toolbar),
+			    open_button,
+			    1);
 
 	gtk_container_foreach (GTK_CONTAINER (window->priv->toolbar),
 			       (GtkCallback)set_non_homogeneus,
Index: gedit/gedit-window.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-window.h,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 gedit-window.h
--- gedit/gedit-window.h	31 May 2006 15:40:12 -0000	1.6
+++ gedit/gedit-window.h	3 Aug 2006 10:14:41 -0000
@@ -166,7 +166,14 @@ G_CONST_RETURN gchar
 
 void		 _gedit_window_set_saving_session_state	(GeditWindow         *window,
 							 gboolean             saving_session);
-							 
+
+/* these are in gedit-window because of screen safety */
+void		 _gedit_recent_add			(GeditWindow	     *window,
+							 const gchar         *uri,
+							 const gchar         *mime);
+void		 _gedit_recent_remove			(GeditWindow         *window,
+							 const gchar         *uri);
+
 G_END_DECLS
 
 #endif  /* __GEDIT_WINDOW_H__  */
Index: gedit/gedit.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit.c,v
retrieving revision 1.140
diff -u -p -u -p -r1.140 gedit.c
--- gedit/gedit.c	29 May 2006 10:14:28 -0000	1.140
+++ gedit/gedit.c	3 Aug 2006 10:14:41 -0000
@@ -50,7 +50,6 @@
 #include "gedit-metadata-manager.h"
 #include "gedit-plugins-engine.h"
 #include "gedit-prefs-manager-app.h"
-#include "gedit-recent.h"
 #include "gedit-session.h"
 #include "gedit-utils.h"
 #include "gedit-window.h"
@@ -507,9 +506,6 @@ main (int argc, char *argv[])
 	/* Load user preferences */
 	gedit_debug_message (DEBUG_APP, "Init prefs manager");
 	gedit_prefs_manager_app_init ();
-
-	gedit_debug_message (DEBUG_APP, "Init recent files");
-	gedit_recent_init ();
 
 	/* Init plugins engine */
 	gedit_debug_message (DEBUG_APP, "Init plugins");	
