? panel-recent.c.clear
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/ChangeLog,v
retrieving revision 1.2328
diff -u -r1.2328 ChangeLog
--- ChangeLog	4 Feb 2004 17:36:07 -0000	1.2328
+++ ChangeLog	4 Feb 2004 19:12:21 -0000
@@ -1,3 +1,8 @@
+2004-01-23  William Jon McCann  <mccann@jhu.edu>
+
+	* panel-recent.c (recent_documents_clear_cb): add item
+	to Recent Documents menu to clear the history.
+
 ==================== 2.5.4 ====================
 
 2004-02-04  Mark McLoughlin  <mark@skynet.ie>
Index: panel-recent.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-recent.c,v
retrieving revision 1.14
diff -u -r1.14 panel-recent.c
--- panel-recent.c	4 Feb 2004 13:05:46 -0000	1.14
+++ panel-recent.c	4 Feb 2004 19:12:21 -0000
@@ -159,6 +159,56 @@
 	g_free (mime_type);
 }
 
+static void
+panel_recent_menu_activate_cb (GtkMenuItem *menu_item, gpointer *data)
+{
+	EggRecentModel *model = (EggRecentModel *)data;
+	GList *recent_list = NULL;
+	GtkWidget *submenu;
+
+	recent_list = egg_recent_model_get_list (model);
+	submenu = gtk_menu_item_get_submenu (menu_item);
+	if (recent_list == NULL) {
+		gtk_widget_set_sensitive (submenu, FALSE);
+	} else {
+		gtk_widget_set_sensitive (submenu, TRUE);
+	}
+}
+
+static void
+recent_documents_clear_cb (GtkMenuItem *menuitem, gpointer *data)
+{
+	EggRecentModel *model = (EggRecentModel *)data;
+        GtkWidget *dialog;
+        gint response;
+       
+        dialog = gtk_message_dialog_new (NULL,
+                                         0 /* flags */,
+                                         GTK_MESSAGE_QUESTION,
+                                         GTK_BUTTONS_NONE,
+                                         "<span size=\"larger\" weight=\"bold\">%s</span>\n\n<span>%s</span>",
+                                         _("Clear recent document history?"),
+                                         _("This will clear the contents of the Recent Documents menu."));
+        gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                _("C_lear"), GTK_RESPONSE_ACCEPT,
+                                NULL);
+        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+        gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+        gtk_label_set_use_markup
+          (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), TRUE);
+        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (dialog),
+                               gtk_widget_get_screen (GTK_WIDGET (menuitem)));
+        gtk_window_stick (GTK_WINDOW (dialog));
+        response = gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+ 
+        if (response != GTK_RESPONSE_ACCEPT)
+          return;
+ 	egg_recent_model_clear (model);
+}
+
 void
 panel_recent_append_documents_menu (GtkWidget *top_menu)
 {
@@ -184,9 +234,25 @@
 	
 	/* a model that shows the global recent doc list */
 	model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
+	g_signal_connect (G_OBJECT (menu_item), "activate",
+			  G_CALLBACK (panel_recent_menu_activate_cb), model);
 
 	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 (),
+			       NULL,
+			       _("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),
 			  menu);
