Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/ChangeLog,v
retrieving revision 1.2376
diff -p -u -r1.2376 ChangeLog
--- ChangeLog	22 May 2004 18:10:01 -0000	1.2376
+++ ChangeLog	27 May 2004 19:13:37 -0000
@@ -1,0 +1,8 @@
+2004-05-27  William Jon McCann  <mccann@jhu.edu>
+
+	* panel-recent.c (recent_documents_clear_cb):
+	(panel_recent_append_documents_menu): 
+	Add item to Recent Documents menu to clear the history.
+	(panel_recent_model_changed_cb): Make the menu insensitive
+	if no recent items are available.
+
Index: panel-recent.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-recent.c,v
retrieving revision 1.14
diff -p -u -r1.14 panel-recent.c
--- panel-recent.c	4 Feb 2004 13:05:46 -0000	1.14
+++ panel-recent.c	27 May 2004 19:13:37 -0000
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * panel-recent.c
  *
@@ -159,6 +160,72 @@ recent_documents_activate_cb (EggRecentV
 	g_free (mime_type);
 }
 
+static void
+panel_recent_model_changed_cb (EggRecentModel *model,
+                               GList          *list,
+                               GtkWidget      *menu_item)
+{
+	GList *recent_list = NULL;
+
+	recent_list = egg_recent_model_get_list (model);
+	if (recent_list)
+		gtk_widget_set_sensitive (menu_item, TRUE);
+	else
+		gtk_widget_set_sensitive (menu_item, FALSE);
+}
+
+static void
+recent_documents_clear_cb (GtkMenuItem    *menuitem,
+                           EggRecentModel *model)
+{
+	GtkWidget *dialog;
+	GtkWidget *button;
+	GtkWidget *hbox;
+	GtkWidget *label;
+	int        response;
+
+	dialog = gtk_message_dialog_new_with_markup (NULL,
+						     0 /* flags */,
+						     GTK_MESSAGE_QUESTION,
+						     GTK_BUTTONS_NONE,
+						     "<big><b>%s</b></big>\n\n%s",
+						     _("Clear recent document history?"),
+						     _("This will clear the contents of the Recent Documents menu."));
+
+	gtk_dialog_add_button (GTK_DIALOG (dialog),
+			       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+
+	/* Cannot use GTK_STOCK_CLEAR because it also uses the mnemonic c */
+	button = gtk_button_new ();
+	label = gtk_alignment_new (0.5, 0.5, 0, 0);
+	gtk_container_add (GTK_CONTAINER (button), label);
+	hbox = gtk_hbox_new (FALSE, 2);
+	gtk_container_add (GTK_CONTAINER (label), hbox);
+	label = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_BUTTON);
+	gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+	label = gtk_label_new_with_mnemonic (_("C_lear"));
+	gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+	gtk_widget_show_all (button);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+				      button,
+				      GTK_RESPONSE_ACCEPT);
+
+	gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+
+	gtk_window_set_screen (GTK_WINDOW (dialog),
+			       gtk_widget_get_screen (GTK_WIDGET (menuitem)));
+	gtk_window_stick (GTK_WINDOW (dialog));
+
+	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+	response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
+
+        if (response == GTK_RESPONSE_ACCEPT)
+		egg_recent_model_clear (model);
+}
+
 void
 panel_recent_append_documents_menu (GtkWidget *top_menu)
 {
@@ -184,8 +251,25 @@ panel_recent_append_documents_menu (GtkW
 	
 	/* a model that shows the global recent doc list */
 	model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
+	g_signal_connect (model, "changed",
+			  G_CALLBACK (panel_recent_model_changed_cb),
+			  menu_item);
 
 	view = egg_recent_view_gtk_new (menu, NULL);
+
+	menu_item = gtk_separator_menu_item_new ();
+	gtk_menu_append (menu, menu_item);
+
+	menu_item = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menu_item,
+			       panel_menu_icon_get_size (),
+			       GTK_STOCK_CLEAR,
+			       _("Clear Recent Documents"),
+			       TRUE);
+	gtk_menu_append (menu, menu_item);
+	g_signal_connect (menu_item, "activate",
+			  G_CALLBACK (recent_documents_clear_cb),
+			  model);
 
 	g_signal_connect (view, "activate",
 			  G_CALLBACK (recent_documents_activate_cb),
