Index: docs/reference/tmpl/buffer.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/buffer.sgml,v
retrieving revision 1.5
diff -u -r1.5 buffer.sgml
--- docs/reference/tmpl/buffer.sgml	8 Mar 2005 10:47:58 -0000	1.5
+++ docs/reference/tmpl/buffer.sgml	15 Jun 2005 12:11:09 -0000
@@ -39,9 +39,6 @@
 in a view widget.
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceBuffer ##### -->
 <para>
 
Index: docs/reference/tmpl/gtksourceview-unused.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/gtksourceview-unused.sgml,v
retrieving revision 1.3
diff -u -r1.3 gtksourceview-unused.sgml
--- docs/reference/tmpl/gtksourceview-unused.sgml	13 Oct 2004 09:16:11 -0000	1.3
+++ docs/reference/tmpl/gtksourceview-unused.sgml	15 Jun 2005 12:11:09 -0000
@@ -86,6 +86,10 @@
 </para>
 
 
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+
 <!-- ##### FUNCTION gtk_pattern_tag_get_type ##### -->
 <para>
 
Index: docs/reference/tmpl/iter.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/iter.sgml,v
retrieving revision 1.3
diff -u -r1.3 iter.sgml
--- docs/reference/tmpl/iter.sgml	8 Mar 2005 10:47:58 -0000	1.3
+++ docs/reference/tmpl/iter.sgml	15 Jun 2005 12:11:09 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GtkSourceSearchFlags ##### -->
 <para>
 
Index: docs/reference/tmpl/language.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/language.sgml,v
retrieving revision 1.4
diff -u -r1.4 language.sgml
--- docs/reference/tmpl/language.sgml	8 Mar 2005 10:47:58 -0000	1.4
+++ docs/reference/tmpl/language.sgml	15 Jun 2005 12:11:09 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceLanguage ##### -->
 <para>
 
Index: docs/reference/tmpl/languagesmanager.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/languagesmanager.sgml,v
retrieving revision 1.3
diff -u -r1.3 languagesmanager.sgml
--- docs/reference/tmpl/languagesmanager.sgml	8 Mar 2005 10:47:58 -0000	1.3
+++ docs/reference/tmpl/languagesmanager.sgml	15 Jun 2005 12:11:09 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceLanguagesManager ##### -->
 <para>
 
Index: docs/reference/tmpl/marker.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/marker.sgml,v
retrieving revision 1.2
diff -u -r1.2 marker.sgml
--- docs/reference/tmpl/marker.sgml	8 Mar 2005 10:47:58 -0000	1.2
+++ docs/reference/tmpl/marker.sgml	15 Jun 2005 12:11:09 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### TYPEDEF GtkSourceMarker ##### -->
 <para>
 
Index: docs/reference/tmpl/printjob.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/printjob.sgml,v
retrieving revision 1.6
diff -u -r1.6 printjob.sgml
--- docs/reference/tmpl/printjob.sgml	8 Mar 2005 10:47:58 -0000	1.6
+++ docs/reference/tmpl/printjob.sgml	15 Jun 2005 12:11:09 -0000
@@ -119,9 +119,6 @@
 documentation.
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourcePrintJob ##### -->
 <para>
 
Index: docs/reference/tmpl/stylescheme.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/stylescheme.sgml,v
retrieving revision 1.4
diff -u -r1.4 stylescheme.sgml
--- docs/reference/tmpl/stylescheme.sgml	8 Mar 2005 10:47:58 -0000	1.4
+++ docs/reference/tmpl/stylescheme.sgml	15 Jun 2005 12:11:09 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceStyleScheme ##### -->
 <para>
 
Index: docs/reference/tmpl/tag.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/tag.sgml,v
retrieving revision 1.4
diff -u -r1.4 tag.sgml
--- docs/reference/tmpl/tag.sgml	8 Mar 2005 10:47:58 -0000	1.4
+++ docs/reference/tmpl/tag.sgml	15 Jun 2005 12:11:10 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceTag ##### -->
 <para>
 
Index: docs/reference/tmpl/tagstyle.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/tagstyle.sgml,v
retrieving revision 1.2
diff -u -r1.2 tagstyle.sgml
--- docs/reference/tmpl/tagstyle.sgml	8 Mar 2005 10:47:58 -0000	1.2
+++ docs/reference/tmpl/tagstyle.sgml	15 Jun 2005 12:11:10 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceTagStyle ##### -->
 <para>
 
Index: docs/reference/tmpl/tagtable.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/tagtable.sgml,v
retrieving revision 1.3
diff -u -r1.3 tagtable.sgml
--- docs/reference/tmpl/tagtable.sgml	8 Mar 2005 10:47:58 -0000	1.3
+++ docs/reference/tmpl/tagtable.sgml	15 Jun 2005 12:11:10 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceTagTable ##### -->
 <para>
 
Index: docs/reference/tmpl/view.sgml
===================================================================
RCS file: /cvs/gnome/gtksourceview/docs/reference/tmpl/view.sgml,v
retrieving revision 1.4
diff -u -r1.4 view.sgml
--- docs/reference/tmpl/view.sgml	8 Mar 2005 10:47:58 -0000	1.4
+++ docs/reference/tmpl/view.sgml	15 Jun 2005 12:11:10 -0000
@@ -14,9 +14,6 @@
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GtkSourceView ##### -->
 <para>
 
Index: gtksourceview/gtksourcebuffer.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcebuffer.c,v
retrieving revision 1.38
diff -u -r1.38 gtksourcebuffer.c
--- gtksourceview/gtksourcebuffer.c	27 Feb 2005 19:01:50 -0000	1.38
+++ gtksourceview/gtksourcebuffer.c	15 Jun 2005 12:11:13 -0000
@@ -1326,6 +1326,46 @@
 }
 
 /**
+ * gtk_source_buffer_get_undo_action
+ * @buffer: a #GtkSourceBuffer.
+ * 
+ * Returns the action the source buffer would do if undo was called.
+ * Example: "deletion of 'foobar'"
+ *
+ * Most of the time, this is used in conjunction with an "Undo" label
+ *
+ * Return value: A string containing the action performed if undo is called.
+ *               The string should be freed when no longer needed.
+ **/
+gchar *
+gtk_source_buffer_get_undo_action (GtkSourceBuffer   *buffer)
+{
+	g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (buffer), NULL);
+
+	return gtk_source_undo_manager_get_undo_action (buffer->priv->undo_manager);
+}
+
+/**
+ * gtk_source_buffer_get_redo_action
+ * @buffer: a #GtkSourceBuffer.
+ * 
+ * Returns the action the source buffer would do if redo was called.
+ * Example: "typing of 'foobar'"
+ *
+ * Most of the time, this is used in conjunction with an "Redo" label
+ *
+ * Return value: A string containing the action performed if redo is called.
+ *               The string should be freed when no longer needed.
+ **/
+gchar *
+gtk_source_buffer_get_redo_action (GtkSourceBuffer   *buffer)
+{
+	g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (buffer), NULL);
+
+	return gtk_source_undo_manager_get_redo_action (buffer->priv->undo_manager);
+}
+
+/**
  * gtk_source_buffer_get_check_brackets:
  * @buffer: a #GtkSourceBuffer.
  * 
Index: gtksourceview/gtksourcebuffer.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcebuffer.h,v
retrieving revision 1.18
diff -u -r1.18 gtksourcebuffer.h
--- gtksourceview/gtksourcebuffer.h	6 Jun 2003 08:54:36 -0000	1.18
+++ gtksourceview/gtksourcebuffer.h	15 Jun 2005 12:11:13 -0000
@@ -114,6 +114,9 @@
 void			 gtk_source_buffer_begin_not_undoable_action (GtkSourceBuffer   *buffer);
 void			 gtk_source_buffer_end_not_undoable_action   (GtkSourceBuffer   *buffer);
 
+gchar *			 gtk_source_buffer_get_undo_action (GtkSourceBuffer   *buffer);
+gchar *			 gtk_source_buffer_get_redo_action (GtkSourceBuffer   *buffer);
+
 /* marker methods. */
 GtkSourceMarker         *gtk_source_buffer_create_marker        (GtkSourceBuffer        *buffer,
 								 const gchar            *name,
Index: gtksourceview/gtksourceundomanager.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourceundomanager.c,v
retrieving revision 1.8
diff -u -r1.8 gtksourceundomanager.c
--- gtksourceview/gtksourceundomanager.c	3 Feb 2005 17:55:16 -0000	1.8
+++ gtksourceview/gtksourceundomanager.c	15 Jun 2005 12:11:14 -0000
@@ -33,7 +33,7 @@
 
 #include "gtksourceundomanager.h"
 #include "gtksourceview-marshal.h"
-
+#include "gtksourceview-i18n.h"
 
 #define DEFAULT_MAX_UNDO_LEVELS		25
 
@@ -348,20 +348,20 @@
 		if (um->priv->can_undo)
 		{
 			um->priv->can_undo = FALSE;
-			g_signal_emit (G_OBJECT (um), 
+        }
+		g_signal_emit (G_OBJECT (um), 
 				       undo_manager_signals [CAN_UNDO], 
 				       0, 
-				       FALSE);
-		}
+				       um->priv->can_undo);
 
 		if (um->priv->can_redo)
 		{
 			um->priv->can_redo = FALSE;
-			g_signal_emit (G_OBJECT (um), 
+        }
+		g_signal_emit (G_OBJECT (um), 
 				       undo_manager_signals [CAN_REDO], 
 				       0, 
-				       FALSE);
-		}
+				       um->priv->can_redo);
 	}
 }
 
@@ -521,20 +521,20 @@
 	if (!um->priv->can_redo)
 	{
 		um->priv->can_redo = TRUE;
-		g_signal_emit (G_OBJECT (um), 
+	}
+    g_signal_emit (G_OBJECT (um), 
 			       undo_manager_signals [CAN_REDO], 
 			       0, 
-			       TRUE);
-	}
+			       um->priv->can_redo);
 
 	if (um->priv->next_redo >= (gint)(g_list_length (um->priv->actions) - 1))
 	{
 		um->priv->can_undo = FALSE;
-		g_signal_emit (G_OBJECT (um), 
+	}
+	g_signal_emit (G_OBJECT (um), 
 			       undo_manager_signals [CAN_UNDO], 
 			       0, 
-			       FALSE);
-	}
+			       um->priv->can_undo);
 }
 
 void 
@@ -614,14 +614,15 @@
 	if (um->priv->next_redo < 0)
 	{
 		um->priv->can_redo = FALSE;
-		g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, FALSE);
-	}
+    }
+	g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, um->priv->can_redo);
+	
 
 	if (!um->priv->can_undo)
 	{
 		um->priv->can_undo = TRUE;
-		g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, TRUE);
-	}
+    }
+	g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, um->priv->can_undo);
 
 }
 
@@ -796,14 +797,14 @@
 	if (!um->priv->can_undo)
 	{
 		um->priv->can_undo = TRUE;
-		g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, TRUE);
-	}
-
+    }
+	g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, um->priv->can_undo);
+	
 	if (um->priv->can_redo)
 	{
 		um->priv->can_redo = FALSE;
-		g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, FALSE);
-	}
+    }
+	g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, um->priv->can_redo);
 }
 
 static void 
@@ -906,7 +907,7 @@
  * the stack with a new undo action. So when we undo for example
  * typing, we can undo the whole word and not each letter by itself.
  * 
- * Return Value: %TRUE is merge was sucessful, %FALSE otherwise.²
+ * Return Value: %TRUE is merge was sucessful, %FALSE otherwise.Â²
  **/
 static gboolean 
 gtk_source_undo_manager_merge_action (GtkSourceUndoManager 	*um, 
@@ -1063,15 +1064,15 @@
 		if (um->priv->next_redo < 0 && um->priv->can_redo)
 		{
 			um->priv->can_redo = FALSE;
-			g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, FALSE);
-		}
+        }
+		g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, um->priv->can_redo);
 
 		if (um->priv->can_undo &&
 		    um->priv->next_redo >= (gint)(g_list_length (um->priv->actions) - 1))
 		{
 			um->priv->can_undo = FALSE;
-			g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, FALSE);
-		}
+        }
+		g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, um->priv->can_undo);
 	}
 }
 
@@ -1130,4 +1131,64 @@
 
 	action->modified = TRUE;
 	um->priv->modified_action = action;
+}
+
+static gchar *
+get_undo_redo_action_string (GtkSourceUndoAction *undo_action)
+{
+	switch (undo_action->action_type)
+	{
+		case GTK_SOURCE_UNDO_ACTION_DELETE:
+			if (g_ascii_strcasecmp (undo_action->action.delete.text, "\n") == 0)
+				return g_strdup (_("deletion of line feed"));
+			else if (g_ascii_strcasecmp (undo_action->action.delete.text, " ") == 0)
+				return g_strdup (_("deletion of space"));
+			else if (g_ascii_strcasecmp (undo_action->action.delete.text, "\t") == 0)
+				return g_strdup (_("deletion of tab"));
+				
+			return g_strdup_printf (_("deletion of '%s'"), undo_action->action.delete.text);
+			
+		case GTK_SOURCE_UNDO_ACTION_INSERT:
+			if (g_ascii_strcasecmp (undo_action->action.insert.text, "\n") == 0)
+				return g_strdup (_("typing of line feed"));
+			else if (g_ascii_strcasecmp (undo_action->action.insert.text, " ") == 0)
+				return g_strdup (_("typing of space"));
+			else if (g_ascii_strcasecmp (undo_action->action.insert.text, "\t") == 0)
+				return g_strdup (_("typing of tab"));
+				
+			return g_strdup_printf (_("typing of '%s'"), undo_action->action.insert.text);
+			
+		default:
+			g_return_val_if_reached (NULL);
+	}
+}
+
+gchar *
+gtk_source_undo_manager_get_undo_action (GtkSourceUndoManager *um)
+{
+	GtkSourceUndoAction *undo_action;
+	
+	g_return_val_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um), NULL);
+	g_return_val_if_fail (um->priv != NULL, NULL);
+	g_return_val_if_fail (um->priv->can_undo, NULL);
+
+	undo_action = g_list_nth_data (um->priv->actions, um->priv->next_redo + 1);
+	g_return_val_if_fail (undo_action != NULL, NULL);
+	
+	return get_undo_redo_action_string (undo_action);
+}
+
+gchar *
+gtk_source_undo_manager_get_redo_action (GtkSourceUndoManager *um)
+{
+	GtkSourceUndoAction *undo_action;
+	
+	g_return_val_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um), NULL);
+	g_return_val_if_fail (um->priv != NULL, NULL);
+	g_return_val_if_fail (um->priv->can_redo, NULL);
+
+	undo_action = g_list_nth_data (um->priv->actions, um->priv->next_redo);
+	g_return_val_if_fail (undo_action != NULL, NULL);
+	
+	return get_undo_redo_action_string (undo_action);
 }
Index: gtksourceview/gtksourceundomanager.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourceundomanager.h,v
retrieving revision 1.2
diff -u -r1.2 gtksourceundomanager.h
--- gtksourceview/gtksourceundomanager.h	2 May 2003 17:27:53 -0000	1.2
+++ gtksourceview/gtksourceundomanager.h	15 Jun 2005 12:11:15 -0000
@@ -78,6 +78,8 @@
 								(GtkSourceUndoManager 	*um,
 				  	     			 gint		 	 undo_levels);
 
+gchar *		gtk_source_undo_manager_get_undo_action (GtkSourceUndoManager *um);
+gchar *		gtk_source_undo_manager_get_redo_action (GtkSourceUndoManager *um);
 #endif /* __GTK_SOURCE_UNDO_MANAGER_H__ */
 
 
Index: tests/test-widget.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/tests/test-widget.c,v
retrieving revision 1.11
diff -u -r1.11 test-widget.c
--- tests/test-widget.c	8 Jan 2005 22:02:30 -0000	1.11
+++ tests/test-widget.c	15 Jun 2005 12:11:16 -0000
@@ -71,7 +71,10 @@
 						  gpointer         user_data);
 static void       print_preview_cb               (GtkAction       *action,
 						  gpointer         user_data);
-
+static void       undo_cb               (GtkAction       *action,
+						  gpointer         user_data);
+static void       redo_cb               (GtkAction       *action,
+						  gpointer         user_data); 
 static GtkWidget *create_view_window             (GtkSourceBuffer *buffer,
 						  GtkSourceView   *from);
 
@@ -79,10 +82,15 @@
 /* Actions & UI definition ---------------------------------------------------- */
 
 static GtkActionEntry buffer_action_entries[] = {
+	{ "EditMenu", NULL, "_Edit" },	
 	{ "Open", GTK_STOCK_OPEN, "_Open", "<control>O",
 	  "Open a file", G_CALLBACK (open_file_cb) },
 	{ "Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q",
 	  "Exit the application", G_CALLBACK (gtk_main_quit) },
+	{ "Undo", GTK_STOCK_UNDO, "_Undo", "<control>Z",
+	  "Undo Last operation", G_CALLBACK (undo_cb) },
+	{ "Redo", GTK_STOCK_REDO, "_Redo", "<control><shift>Z",
+	  "Redo last operation", G_CALLBACK (redo_cb) },
 };
 
 static GtkActionEntry view_action_entries[] = {
@@ -160,6 +168,11 @@
 "      <separator/>"
 "      <menuitem action=\"Quit\"/>"
 "    </menu>"
+"	 <menu action=\"EditMenu\">"
+"      <menuitem action=\"Undo\"/>"
+"      <menuitem action=\"Redo\"/>"
+"      <menuitem action=\"ShowLists\"/>"
+"    </menu>"
 "    <menu action=\"ViewMenu\">"
 "    </menu>"
 "  </menubar>"
@@ -568,6 +581,64 @@
 	gtk_widget_destroy (chooser);
 }
 
+static void 
+undo_cb (GtkAction *action, gpointer buffer)
+{
+	gtk_source_buffer_undo (GTK_SOURCE_BUFFER (buffer));
+}
+
+static void 
+redo_cb (GtkAction *action, gpointer buffer)
+{
+	gtk_source_buffer_redo (GTK_SOURCE_BUFFER (buffer));
+}
+
+static void
+can_undo (GtkSourceBuffer *doc, gboolean can, GtkActionGroup *group)
+{	
+	gtk_action_set_sensitive (gtk_action_group_get_action (group, "Undo"), can);
+}
+
+static void
+can_redo (GtkSourceBuffer *doc, gboolean can, GtkActionGroup *group)
+{	
+	gtk_action_set_sensitive (gtk_action_group_get_action (group, "Redo"), can);
+}
+
+typedef struct
+{
+	GtkActionGroup *group;
+	GtkSourceBuffer *doc;
+} UndoRedoData;
+
+static void
+update_undo_redo_actions_cb (GtkAction *action, UndoRedoData *data)
+{
+	gchar *undo; 
+	gchar *label;
+	
+	if (gtk_source_buffer_can_undo (data->doc))
+	{	undo = gtk_source_buffer_get_undo_action (data->doc);
+		label = g_strconcat ("Undo ", undo, NULL);
+		
+		g_object_set (gtk_action_group_get_action (data->group, "Undo"), "label", label, NULL);
+			
+		g_free (undo);
+		g_free (label);
+	}
+	
+	if (gtk_source_buffer_can_redo (data->doc))
+	{
+		undo = gtk_source_buffer_get_redo_action (data->doc);
+		label = g_strconcat ("Redo ", undo, NULL);
+		
+		g_object_set (gtk_action_group_get_action (data->group, "Redo"), "label", label, NULL);
+			
+		g_free (undo);
+		g_free (label);
+	}
+}
+
 
 /* View UI callbacks ------------------------------------------------------------------ */
 
@@ -906,6 +977,7 @@
 	GtkActionGroup *action_group;
 	GList *groups;
 	GError *error;
+	UndoRedoData *undoredo_data;
 	
 	window = create_view_window (buffer, NULL);
 	ui_manager = g_object_get_data (G_OBJECT (window), "ui_manager");
@@ -948,6 +1020,24 @@
 
 	action = gtk_action_group_get_action (action_group, "TabsWidth8");
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+	
+	/* Undo handling */
+	action_group = g_list_nth_data (groups, 1);
+	action = gtk_action_group_get_action (action_group, "Undo");
+	gtk_action_set_sensitive (action, gtk_source_buffer_can_undo (buffer));
+	
+	action = gtk_action_group_get_action (action_group, "Redo");
+	gtk_action_set_sensitive (action, gtk_source_buffer_can_redo (buffer));
+	
+	g_signal_connect (buffer, "can-undo", G_CALLBACK (can_undo), action_group);
+	g_signal_connect (buffer, "can-redo", G_CALLBACK (can_redo), action_group);
+	
+	undoredo_data = g_new0(UndoRedoData, 1);
+	undoredo_data->doc = buffer;
+	undoredo_data->group = action_group;
+	
+	action = gtk_action_group_get_action (action_group, "EditMenu");
+	g_signal_connect (action, "activate", G_CALLBACK (update_undo_redo_actions_cb), undoredo_data);
 	
 	return window;
 }
