---
 Kill libegg and replace it by GtkRecentManager

 Makefile.am               |    1 
 configure.in              |    2 
 data/ui/main-window.ui    |    3 -
 po/POTFILES.in            |    2 
 po/POTFILES.skip          |    2 
 src/Makefile.am           |    1 
 src/planner-application.c |   20 ++-----
 src/planner-application.h |    9 +--
 src/planner-main.c        |    3 +
 src/planner-window.c      |  125 ++++++++++++++++++++++++++++------------------
 tests/Makefile.am         |    1 
 11 files changed, 95 insertions(+), 74 deletions(-)

Index: b/configure.in
===================================================================
--- a/configure.in	(révision 940)
+++ b/configure.in	(copie de travail)
@@ -309,8 +309,6 @@
 AC_CONFIG_FILES([
 Makefile
 libplanner/Makefile
-libegg/Makefile
-libegg/recent-files/Makefile
 src/Makefile
 docs/Makefile
 docs/libplanner/Makefile
Index: b/src/planner-application.c
===================================================================
--- a/src/planner-application.c	(révision 940)
+++ b/src/planner-application.c	(copie de travail)
@@ -22,21 +22,20 @@
  */
 
 #include <config.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkstock.h>
+
 #include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
 #include "planner-window.h"
 #include "planner-application.h"
 
-
-
 #define d(x) 
 
 struct _PlannerApplicationPriv {
 	GList *windows;
 
 	/* recent file stuff */
-	EggRecentModel *recent_model;
+	GtkRecentManager *recent_model;
 };
 
 
@@ -181,15 +180,8 @@
 
 	priv->windows = NULL;
 	
-	priv->recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
-	egg_recent_model_set_filter_mime_types (priv->recent_model,
-						"application/x-planner",
-						"application/x-mrproject",
-						NULL);
-	egg_recent_model_set_filter_uri_schemes (priv->recent_model, "file", NULL);
+	priv->recent_model = gtk_recent_manager_get_default ();
 
-	g_object_set (priv->recent_model, "limit", 5, NULL);
-
 	app->priv = priv;
 }
 
@@ -282,7 +274,7 @@
 	g_list_free (list_cpy);
 }
 
-EggRecentModel *
+GtkRecentManager *
 planner_application_get_recent_model (PlannerApplication *app)
 {
 	g_return_val_if_fail (PLANNER_IS_APPLICATION (app), NULL);
Index: b/src/planner-application.h
===================================================================
--- a/src/planner-application.h	(révision 940)
+++ b/src/planner-application.h	(copie de travail)
@@ -24,9 +24,10 @@
 #ifndef __PLANNER_APPLICATION_H__
 #define __PLANNER_APPLICATION_H__
 
+#include <gtk/gtk.h>
+
 #include <libplanner/mrp-application.h>
 #include <libplanner/mrp-project.h>
-#include <libegg/recent-files/egg-recent-model.h>
 
 #define PLANNER_TYPE_APPLICATION                (planner_application_get_type ())
 #define PLANNER_APPLICATION(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLANNER_TYPE_APPLICATION, PlannerApplication))
@@ -51,9 +52,9 @@
 };
 
 GType                 planner_application_get_type         (void) G_GNUC_CONST;
-PlannerApplication   *planner_application_new              (void);
-GtkWidget       *     planner_application_new_window       (PlannerApplication *app);
+PlannerApplication  * planner_application_new              (void);
+GtkWidget           * planner_application_new_window       (PlannerApplication *app);
 void                  planner_application_exit             (PlannerApplication *app);
-EggRecentModel  *     planner_application_get_recent_model (PlannerApplication *app);
+GtkRecentManager    * planner_application_get_recent_model (PlannerApplication *app);
 
 #endif /* __PLANNER_APPLICATION_H__ */
Index: b/src/planner-window.c
===================================================================
--- a/src/planner-window.c	(révision 940)
+++ b/src/planner-window.c	(copie de travail)
@@ -22,19 +22,19 @@
  */
 
 #include <config.h>
+
 #include <string.h>
 #include <math.h>
-#include <locale.h>
+
 #include <glib/gi18n.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
 #include <glade/glade.h>
+
 #include <libplanner/mrp-error.h>
 #include <libplanner/mrp-project.h>
 #include <libplanner/mrp-paths.h>
-#include <libegg/recent-files/egg-recent-view.h>
-#include <libegg/recent-files/egg-recent-view-uimanager.h>
-#include <libegg/recent-files/egg-recent-util.h>
+
 #include "planner-marshal.h"
 #include "planner-conf.h"
 #include "planner-sidebar.h"
@@ -80,7 +80,7 @@
 	GList               *plugins;
 	GTimer              *last_saved;
 
-	EggRecentViewUIManager *recent_view;
+	GtkWidget           *recent_view;
 };
 
 /* Drop targets. */
@@ -183,8 +183,8 @@
 static void       window_update_title                    (PlannerWindow                *window);
 static GtkWidget *window_create_dialog_button            (const gchar                  *icon_name,
 							  const gchar                  *text);
-static gchar *    window_recent_tooltip_func             (EggRecentItem                *item,
-							  gpointer                      user_data);
+static void       window_recent_add_item                 (PlannerWindow                *window,
+							  const gchar                  *uri);
 static void       window_save_state                      (PlannerWindow *window);
 static void       window_restore_state                   (PlannerWindow *window);
 
@@ -233,10 +233,12 @@
 	{ "FileOpen",
 	  GTK_STOCK_OPEN,          N_("_Open..."),                 "F3",                N_("Open a project"),
 	  G_CALLBACK (window_open_cb) },
+	{ "FileOpenRecent",
+	  GTK_STOCK_OPEN,          N_("Open Recent..."),           NULL,                NULL,
+	  NULL },
 	{ "Import",
 	  NULL,                    N_("_Import"),                  NULL,                NULL,
 	  NULL },
-
 	{ "FileSave",
 	  GTK_STOCK_SAVE,          N_("_Save"),                    "<Control>s",        N_("Save the current project"),
 	  G_CALLBACK (window_save_cb) },
@@ -426,16 +428,22 @@
 }
 
 static void
-planner_window_open_recent_cb (GtkAction     *action,
-			       PlannerWindow *window)
+recent_chooser_item_activated (GtkRecentChooser *chooser, gpointer user_data)
 {
-	const EggRecentItem *item;
-	const gchar         *uri;
-
-	item = egg_recent_view_uimanager_get_item (window->priv->recent_view, action);
-	uri = egg_recent_item_peek_uri (item);
-
-	planner_window_open_in_existing_or_new (window, uri, FALSE);
+	gchar *uri;
+	PlannerWindow *window;
+	PlannerWindowPriv *priv;
+	
+	g_return_if_fail (PLANNER_IS_WINDOW (user_data));
+	
+	window = PLANNER_WINDOW (user_data);
+	priv = window->priv;
+	
+	uri = gtk_recent_chooser_get_current_uri (chooser);
+	if (uri != NULL) {
+                planner_window_open_in_existing_or_new (window, uri, FALSE);
+                g_free (uri);
+        }
 }
 
 static void
@@ -606,17 +614,33 @@
 		      NULL);
 
 	/* Handle recent file stuff. */
-	priv->recent_view = egg_recent_view_uimanager_new (priv->ui_manager,
+	priv->recent_view = gtk_recent_chooser_menu_new_for_manager (
+		planner_application_get_recent_model (priv->application));
+	/*priv->recent_view = egg_recent_view_uimanager_new (priv->ui_manager,
 							   "/MenuBar/File/OpenRecent",
 							   G_CALLBACK (planner_window_open_recent_cb),
-							   window);
+							   window);*/
+	GtkRecentFilter *filter;
+	filter = gtk_recent_filter_new ();
+	gtk_recent_filter_add_mime_type (filter, "application/x-planner");
+	gtk_recent_filter_add_mime_type (filter, "application/x-mrproject");
+	gtk_recent_filter_add_group (filter, "planner");
+	gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (priv->recent_view), filter);
 
-	egg_recent_view_set_model (EGG_RECENT_VIEW (priv->recent_view),
-				   planner_application_get_recent_model (priv->application));
-	egg_recent_view_uimanager_set_tooltip_func (priv->recent_view,
-						    window_recent_tooltip_func,
-						    NULL);
-
+	g_signal_connect (priv->recent_view,
+			  "item_activated",
+			  G_CALLBACK (recent_chooser_item_activated),
+			  window);
+	
+	gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (priv->recent_view), GTK_RECENT_SORT_MRU);
+	gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (priv->recent_view), TRUE);
+	gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (priv->recent_view), 5);
+	gtk_recent_chooser_menu_set_show_numbers (GTK_RECENT_CHOOSER_MENU (priv->recent_view), TRUE);
+	
+	GtkWidget *open_recent;
+	open_recent = gtk_ui_manager_get_widget (priv->ui_manager, "/MenuBar/File/FileOpenRecent");
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (open_recent), priv->recent_view);
+	
 	hbox = gtk_hbox_new (FALSE, 0);
 
 	priv->sidebar = planner_sidebar_new ();
@@ -1515,7 +1539,6 @@
 	gint              response;
 	gchar            *filename = NULL;
 	gchar            *last_dir;
-	EggRecentItem    *item;
 
 	priv = window->priv;
 
@@ -1583,10 +1606,7 @@
 
 		if (success) {
 			/* Add the file to the recent list */
-			item = egg_recent_item_new_from_uri (mrp_project_get_uri (priv->project));
-			egg_recent_item_set_mime_type (item, "application/x-planner");
-			egg_recent_model_add_full (planner_application_get_recent_model (priv->application), item);
-			egg_recent_item_unref (item);
+			window_recent_add_item (window, mrp_project_get_uri (priv->project));
 		} else {
 			GtkWidget *dialog;
 			
@@ -1686,7 +1706,6 @@
 	PlannerWindowPriv *priv;
 	GError           *error = NULL;
 	GtkWidget        *dialog;
-	EggRecentItem    *item;
 	
 	g_return_val_if_fail (PLANNER_IS_WINDOW (window), FALSE);
 	g_return_val_if_fail (uri != NULL, FALSE);
@@ -1710,11 +1729,7 @@
 
 	if (!internal) {
 		/* Add the file to the recent list */
-		item = egg_recent_item_new_from_uri (uri);
-		egg_recent_item_set_mime_type (item, "application/x-planner");
-		egg_recent_model_add_full (planner_application_get_recent_model (priv->application), item);
-		egg_recent_item_unref (item);
-		
+		window_recent_add_item (window, uri);
 		window_update_title (window);
 	}
 	
@@ -1943,23 +1958,37 @@
 	}
 }
 
-static gchar *
-window_recent_tooltip_func (EggRecentItem *item,
-			    gpointer user_data)
+static void
+window_recent_add_item (PlannerWindow *window, const gchar *uri)
 {
-	gchar *uri;
-	gchar *escaped;
-	gchar *tooltip;
+	PlannerWindowPriv *priv;
+	GtkRecentData *recent_data;
+	static gchar *groups[2] = {
+		"planner",
+		NULL
+	};
 
-	uri = egg_recent_item_get_uri_for_display (item);
+	g_return_if_fail (PLANNER_IS_WINDOW (window));
+	
+	priv = window->priv;	
+	recent_data = g_slice_new (GtkRecentData);
 
-	escaped = egg_recent_util_escape_underlines (uri);
-	tooltip = g_strdup_printf (_("Open '%s'"), escaped);
+	recent_data->display_name = g_filename_display_basename (uri);
+	recent_data->description = NULL;
+	recent_data->mime_type = "application/x-planner";
+	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;
 
-	g_free (uri);
-	g_free (escaped);
+	/* FIXME: does this leak ? */
+	gtk_recent_manager_add_full (planner_application_get_recent_model (priv->application),
+				     g_filename_to_uri (uri, NULL, NULL),
+				     recent_data);
 
-	return tooltip;
+	g_free (recent_data->display_name);
+	g_free (recent_data->app_exec);
+	g_slice_free (GtkRecentData, recent_data);
 }
 
 PlannerCmdManager *
Index: b/src/Makefile.am
===================================================================
--- a/src/Makefile.am	(révision 940)
+++ b/src/Makefile.am	(copie de travail)
@@ -21,7 +21,6 @@
 planner_LDADD = \
 	libplannerapp.la \
 	$(top_builddir)/libplanner/libplanner-1.la \
-	$(top_builddir)/libegg/recent-files/libeggrecent.la \
 	$(PLANNER_LIBS)
 
 
Index: b/src/planner-main.c
===================================================================
--- a/src/planner-main.c	(révision 940)
+++ b/src/planner-main.c	(copie de travail)
@@ -22,7 +22,9 @@
  */
 
 #include <config.h>
+
 #include <string.h>
+
 #include <gtk/gtkwidget.h>
 #include <gtk/gtkmain.h>
 #include <glib/gi18n.h>
@@ -33,6 +35,7 @@
 #ifdef WIN32
 #include <gtk/gtkicontheme.h>
 #endif
+
 #include "libplanner/mrp-paths.h"
 #include "planner-application.h"
 #include "planner-window.h"
Index: b/tests/Makefile.am
===================================================================
--- a/tests/Makefile.am	(révision 940)
+++ b/tests/Makefile.am	(copie de travail)
@@ -10,7 +10,6 @@
 LDADD =	\
 	$(top_builddir)/src/libplannerapp.la \
 	$(top_builddir)/libplanner/libplanner-1.la \
-	$(top_builddir)/libegg/recent-files/libeggrecent.la \
 	$(PLANNER_LIBS)
 
 check_LTLIBRARIES = libselfcheck.la
Index: b/data/ui/main-window.ui
===================================================================
--- a/data/ui/main-window.ui	(révision 940)
+++ b/data/ui/main-window.ui	(copie de travail)
@@ -3,6 +3,7 @@
     <menu            action="File">
       <menuitem      action="FileNew"/>
       <menuitem      action="FileOpen"/>
+      <menuitem      action="FileOpenRecent"/>
       <menu          action="Import">
         <placeholder name="Import placeholder"/>
       </menu>
@@ -17,8 +18,6 @@
       <menuitem      action="FilePrint"/>
       <menuitem      action="FilePrintPreview"/>
       <separator/>
-      <placeholder   name="OpenRecent"/>
-      <separator/>
       <menuitem      action="FileClose"/>
       <menuitem      action="FileExit"/>
     </menu>
Index: b/Makefile.am
===================================================================
--- a/Makefile.am	(révision 940)
+++ b/Makefile.am	(copie de travail)
@@ -14,7 +14,6 @@
 SUBDIRS = \
 	po 				\
 	libplanner			\
-	libegg				\
 	src				\
 	data				\
 	docs				\
Index: b/po/POTFILES.in
===================================================================
--- a/po/POTFILES.in	(révision 940)
+++ b/po/POTFILES.in	(copie de travail)
@@ -22,7 +22,6 @@
 data/planner.desktop.in.in
 data/planner.schemas.in
 data/stylesheets/localizable.xml
-libegg/recent-files/egg-recent-vfs-utils.c
 
 libplanner/mrp-assignment.c
 libplanner/mrp-calendar.c
@@ -102,3 +101,4 @@
 eds-backend/e-cal-backend-planner.c
 eds-backend/planner-source/planner-source.c
 
+src/planner-print-job.c
Index: b/po/POTFILES.skip
===================================================================
--- a/po/POTFILES.skip	(révision 940)
+++ b/po/POTFILES.skip	(copie de travail)
@@ -10,3 +10,5 @@
 eds-backend/planner-source/planner-source.c
 
 src/planner-usage-print.c
+
+libegg/recent-files/egg-recent-vfs-utils.c
