? dia/data
? dia/uimgr-toolbox.diff
Index: dia/Makefile.am
===================================================================
RCS file: /cvs/gnome/dia/Makefile.am,v
retrieving revision 1.46
diff -a -u -p -r1.46 Makefile.am
--- dia/Makefile.am	12 Mar 2006 20:01:59 -0000	1.46
+++ dia/Makefile.am	7 May 2006 20:54:09 -0000
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = lib objects plug-ins shapes app samples po sheets doc
+SUBDIRS = lib objects plug-ins shapes app samples po sheets data doc
 
 gnomedatadir = $(datadir)
 
Index: dia/configure.in
===================================================================
RCS file: /cvs/gnome/dia/configure.in,v
retrieving revision 1.277
diff -a -u -p -r1.277 configure.in
--- dia/configure.in	19 Apr 2006 22:04:07 -0000	1.277
+++ dia/configure.in	7 May 2006 20:54:10 -0000
@@ -342,6 +342,11 @@ AC_SUBST(Z_LIBS)
 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
 LIBS="${LIBS} ${Z_LIBS}"
 
+
+dnl Path to UI resources
+AC_SUBST(uidatadir, '${pkgdatadir}/ui')
+
+
 dnl Platform-specific fixes.
 dnl 
 
@@ -507,6 +512,7 @@ plug-ins/wmf/Makefile
 plug-ins/wpg/Makefile
 plug-ins/xfig/Makefile
 plug-ins/xslt/Makefile
+data/Makefile
 doc/Makefile
 doc/en/Makefile
 doc/eu/Makefile
Index: dia/app/Makefile.am
===================================================================
RCS file: /cvs/gnome/dia/app/Makefile.am,v
retrieving revision 1.139
diff -a -u -p -r1.139 Makefile.am
--- dia/app/Makefile.am	3 Apr 2006 20:09:42 -0000	1.139
+++ dia/app/Makefile.am	7 May 2006 20:54:10 -0000
@@ -9,11 +9,12 @@ INCLUDES = \
 	$(DEBUG_FLAGS) \
 	$(GTK_CFLAGS) \
 	$(LIBART_CFLAGS) \
-        -DPREFIX=\""$(prefix)"\" \
-        -DSYSCONFDIR=\""$(sysconfdir)"\" \
-        -DDATADIR=\""$(datadir)"\" \
-        -DLIBDIR=\""$(libdir)"\" \
-	-DLOCALEDIR=\"$(localedir)\"
+	-DPREFIX=\""$(prefix)"\" \
+	-DSYSCONFDIR=\""$(sysconfdir)"\" \
+	-DDATADIR=\""$(datadir)"\" \
+	-DLIBDIR=\""$(libdir)"\" \
+	-DLOCALEDIR=\"$(localedir)\" \
+	-DUIDATADIR=\"$(uidatadir)\"
 
 
 print_files = \
Index: dia/app/dia_embedd.c
===================================================================
RCS file: /cvs/gnome/dia/app/dia_embedd.c,v
retrieving revision 1.14
diff -a -u -p -r1.14 dia_embedd.c
--- dia/app/dia_embedd.c	17 Nov 2003 21:41:24 -0000	1.14
+++ dia/app/dia_embedd.c	7 May 2006 20:54:11 -0000
@@ -378,24 +378,25 @@ main (int argc, char **argv)
   app_init(0, NULL);
   app_splash_done();
 
+/* TODO is this needed, what for?
 #ifdef GNOME
-  menuitem = menus_get_item_from_path("<Toolbox>/File/New diagram", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileNew");
   gtk_widget_hide(menuitem);
-  menuitem = menus_get_item_from_path("<Toolbox>/File/Open...", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileOpen");
   gtk_widget_hide(menuitem);
-  menuitem = menus_get_item_from_path("<Toolbox>/File/Exit", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileExit");
   gtk_widget_hide(menuitem);
 #else
-  menuitem = menus_get_item_from_path("<Toolbox>/File/New", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileNew");
   gtk_widget_hide(menuitem);
-  menuitem = menus_get_item_from_path("<Toolbox>/File/Open...", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileOpen");
   gtk_widget_hide(menuitem);
-  menuitem = menus_get_item_from_path("<Toolbox>/File/sep1", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileSep1");
   gtk_widget_hide(menuitem);
-  menuitem = menus_get_item_from_path("<Toolbox>/File/Quit", NULL);
+  menuitem = menus_get_item("/ToolboxMenu/File/FileQuit");
   gtk_widget_hide(menuitem);
 #endif
-
+*/
 
   g_signal_connect (GTK_OBJECT (bonobo_context_running_get ()),
 		      "last_unref",
Index: dia/app/diagram_tree_window.c
===================================================================
RCS file: /cvs/gnome/dia/app/diagram_tree_window.c,v
retrieving revision 1.9
diff -a -u -p -r1.9 diagram_tree_window.c
--- dia/app/diagram_tree_window.c	6 Nov 2004 09:08:59 -0000	1.9
+++ dia/app/diagram_tree_window.c	7 May 2006 20:54:11 -0000
@@ -35,7 +35,7 @@
 #include "persistence.h"
 
 static GtkWidget *diagwindow_ = NULL;
-static GtkCheckMenuItem *menu_item_ = NULL;
+static GtkToggleAction *toggle_action_ = NULL;
 static DiagramTree *diagtree_ = NULL;
 static DiagramTreeConfig *config_ = NULL;
 
@@ -43,7 +43,10 @@ static DiagramTreeConfig *config_ = NULL
 static void
 diagram_tree_window_hide(GtkWidget *window)
 {
-  if (menu_item_) menu_item_->active = FALSE;
+  if (toggle_action_ && 
+	  gtk_toggle_action_get_active(toggle_action_)) {
+	gtk_toggle_action_set_active(toggle_action_, FALSE);
+  }
   gtk_widget_hide(window);
 }
 
@@ -54,7 +57,11 @@ diagram_tree_window_destroyed(GtkWidget 
   diagwindow_ = NULL;
   g_free(diagtree_);
   diagtree_ = NULL;
-  if (menu_item_) menu_item_->active = FALSE;
+
+  if (toggle_action_ && 
+	  gtk_toggle_action_get_active(toggle_action_)) {
+	gtk_toggle_action_set_active(toggle_action_, FALSE);
+  }
 }
 
 /* create a diagram_tree_window window */
@@ -116,19 +123,19 @@ diagram_tree(void)
 }
 
 void
-create_diagram_tree_window(DiagramTreeConfig *config, GtkWidget *menuitem)
+create_diagram_tree_window(DiagramTreeConfig *config, GtkToggleAction *action)
 {
   config_ = config;
-  menu_item_ = GTK_CHECK_MENU_ITEM(menuitem);
+  toggle_action_ = action;
   if (!diagwindow_) {
     diagwindow_ = diagram_tree_window_new(config_);
   }
-  gtk_check_menu_item_set_active(menu_item_, GTK_WIDGET_REALIZED(diagwindow_));
+  gtk_toggle_action_set_active(action, GTK_WIDGET_REALIZED(diagwindow_));
 }
 
 /* menu callbacks */
 void
-diagtree_show_callback(gpointer data, guint action, GtkWidget *widget)
+diagtree_show_callback (GtkToggleAction *action, gpointer user_data)
 {
   if (!diagwindow_) {
     diagwindow_ = diagram_tree_window_new(config_);
@@ -139,11 +146,9 @@ diagtree_show_callback(gpointer data, gu
       open = g_list_next(open);
     }
   }
-  if (!menu_item_) menu_item_ = GTK_CHECK_MENU_ITEM(widget);
-  if (menu_item_->active)
+  if (!toggle_action_) toggle_action_ = action;
+  if (gtk_toggle_action_get_active (toggle_action_))
     gtk_widget_show(diagwindow_);
   else
     gtk_widget_hide(diagwindow_);
 }
-
-    
Index: dia/app/diagram_tree_window.h
===================================================================
RCS file: /cvs/gnome/dia/app/diagram_tree_window.h,v
retrieving revision 1.5
diff -a -u -p -r1.5 diagram_tree_window.h
--- dia/app/diagram_tree_window.h	6 Nov 2004 09:08:59 -0000	1.5
+++ dia/app/diagram_tree_window.h	7 May 2006 20:54:11 -0000
@@ -41,13 +41,11 @@ extern DiagramTree *
 diagram_tree(void);
 
 extern void
-create_diagram_tree_window(DiagramTreeConfig *config, GtkWidget *menuitem);
+create_diagram_tree_window(DiagramTreeConfig *config, GtkToggleAction *action);
 
 
 /* show the diagtree window (menu callback) */
 extern void
-diagtree_show_callback(gpointer data, guint action,
-		       GtkWidget *widget);
-
+diagtree_show_callback (GtkToggleAction *action, gpointer user_data);
 
 #endif /* DIAGRAM_TREE_WINDOW_H */
Index: dia/app/interface.c
===================================================================
RCS file: /cvs/gnome/dia/app/interface.c,v
retrieving revision 1.134
diff -a -u -p -r1.134 interface.c
--- dia/app/interface.c	26 Feb 2006 07:58:26 -0000	1.134
+++ dia/app/interface.c	7 May 2006 20:54:12 -0000
@@ -1334,9 +1334,8 @@ toolbox_hide(void)
 void
 create_tree_window(void)
 {
-  GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM
-    (menus_get_item_from_path("<Toolbox>/File/Diagram tree", NULL));
-  create_diagram_tree_window(&prefs.dia_tree, GTK_WIDGET(item));
+  GtkAction *action = menus_get_action ("FileTree");
+  create_diagram_tree_window(&prefs.dia_tree, GTK_TOGGLE_ACTION(action));
 }
 
 GtkWidget *
Index: dia/app/menus.c
===================================================================
RCS file: /cvs/gnome/dia/app/menus.c,v
retrieving revision 1.125
diff -a -u -p -r1.125 menus.c
--- dia/app/menus.c	5 Feb 2006 17:06:38 -0000	1.125
+++ dia/app/menus.c	7 May 2006 20:54:14 -0000
@@ -45,41 +45,25 @@ static void plugin_callback (GtkWidget *
 #define MRU_MENU_ENTRY_SIZE (strlen ("/File/MRU00 ") + 1)
 #define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
 
-static GtkItemFactoryEntry toolbox_menu_items[] =
-{
-  {N_("/_File"),               NULL,         NULL,       0,    "<Branch>" },
-  {   "/File/tearoff",         NULL,         NULL,       0,   "<Tearoff>" },
-  {N_("/File/_New"),           "<control>N", file_new_callback,         0,
-      "<StockItem>", GTK_STOCK_NEW },
-  {N_("/File/_Open..."),       "<control>O", file_open_callback,        0,
-      "<StockItem>", GTK_STOCK_OPEN },
-/*  {N_("/Open _Recent"),           NULL,         NULL,           0, "<Branch>"}, */
-/*  {   "/Open Recent/tearoff",     NULL,         NULL,         0, "<Tearoff>" }, */
-  {N_("/File/---"),            NULL,         NULL,       0, "<Separator>" },
-  {N_("/File/_Diagram tree"),  "F8",         diagtree_show_callback,    0,
-   "<ToggleItem>" },
-  {N_("/File/Sheets and Objects..."),
-                               "F9",         sheets_dialog_show_callback, 0 },
-  {N_("/File/---"),            NULL,         NULL,       0, "<Separator>" },
- {N_("/File/_Preferences..."),NULL,         file_preferences_callback, 0,
-      "<StockItem>", GTK_STOCK_PREFERENCES },
-   {N_("/File/P_lugins..."),   NULL,         file_plugins_callback,     0,
-      "<StockItem>", GTK_STOCK_EXECUTE },
-  {N_("/File/---"),            NULL,         NULL,       0, "<Separator>" },
-    /* recent file list is dynamically inserted here */
-  {N_("/File/---"),            NULL,         NULL,       0, "<Separator>" },
-  {N_("/File/_Quit"),          "<control>Q", file_quit_callback,        0,
-      "<StockItem>", GTK_STOCK_QUIT },
-  {N_("/_Help"),               NULL,         NULL,       0,    "<Branch>" },
-  {   "/Help/tearoff",         NULL,         NULL,       0,   "<Tearoff>" },
-  {N_("/Help/_Contents"),        "F1",         help_manual_callback,      0,
-      "<StockItem>", GTK_STOCK_HELP },
-  {N_("/Help/---"),            NULL,         NULL,       0, "<Separator>" },
-  {N_("/Help/_About..."),      NULL,         help_about_callback,       0 }
+static const GtkActionEntry toolbox_entries[] = {
+	{ "File", NULL, N_("_File") },
+		{ "FileNew", GTK_STOCK_NEW, NULL, "<control>N", NULL, G_CALLBACK (file_new_callback) },
+		{ "FileOpen", GTK_STOCK_OPEN, NULL, "<control>O", NULL, G_CALLBACK (file_open_callback) },
+		{ "FileSheets", NULL, N_("Sheets and Objects..."), "F9", NULL, G_CALLBACK (sheets_dialog_show_callback) },
+		{ "FilePrefs", GTK_STOCK_PREFERENCES, N_("_Preferences..."), NULL, NULL, G_CALLBACK (file_preferences_callback) },
+		{ "FilePlugins", NULL, N_("Plugins..."), NULL, NULL, G_CALLBACK (file_plugins_callback) },
+		{ "FileQuit", GTK_STOCK_QUIT, NULL, "<control>Q", NULL, G_CALLBACK (file_quit_callback) }, 
+	{ "Help", NULL, N_("_Help") },
+		{ "HelpContents", GTK_STOCK_HELP, NULL, NULL, NULL, G_CALLBACK (help_manual_callback) },
+		{ "HelpAbout", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK (help_about_callback) }
+};
+
+static const GtkToggleActionEntry toolbox_toggle_entries[] = {
+		{ "FileTree", NULL, N_("_Diagram tree..."), "F8", NULL, G_CALLBACK (diagtree_show_callback) }
 };
 
 /* calculate the number of menu_item's */
-static int toolbox_nmenu_items = sizeof(toolbox_menu_items) / sizeof(toolbox_menu_items[0]);
+/* static int toolbox_nmenu_items = sizeof(toolbox_menu_items) / sizeof(toolbox_menu_items[0]); */
 
 /* this one is needed while we create the menubar in GTK instead of Gnome */
 static GtkItemFactoryEntry display_menu_items[] =
@@ -277,12 +261,19 @@ static int display_nmenu_items = (sizeof
 static gboolean initialise = TRUE;
 
 /* the actual menus */
-static GtkWidget *toolbox_menubar = NULL;
+static GtkUIManager *toolbox_ui_manager = NULL;
+static GtkActionGroup *toolbox_actions = NULL;
 static GtkAccelGroup *toolbox_accels = NULL;
+static GtkWidget *toolbox_menubar = NULL;
+
+GtkActionGroup *recent_actions = NULL;
+static GSList *recent_merge_ids = NULL;
+
+GtkActionGroup *plugin_actions = NULL;
+
 static GtkWidget *display_menus = NULL;
 static GtkAccelGroup *display_accels = NULL;
 
-static GtkItemFactory *toolbox_item_factory = NULL;
 static GtkItemFactory *display_item_factory = NULL;
 
 #ifdef ENABLE_NLS
@@ -484,6 +475,7 @@ menus_init(void)
 {
   gchar *accelfilename;
   GList *cblist;
+  GError *error = NULL;
 
   if (!initialise)
     return;
@@ -491,22 +483,25 @@ menus_init(void)
   initialise = FALSE;
 
   /* the toolbox menu */
-  toolbox_accels = gtk_accel_group_new();
-  toolbox_item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<Toolbox>",
-					      toolbox_accels);
-  gtk_object_set_data (GTK_OBJECT (toolbox_item_factory), "factory_path",
-		       (gpointer) "toolbox");
-#ifdef ENABLE_NLS
-  gtk_item_factory_set_translate_func (toolbox_item_factory, menu_translate,
-				       "<Toolbox>", NULL);
-#endif
-  gtk_item_factory_create_items (toolbox_item_factory,
-				 toolbox_nmenu_items,
-				 toolbox_menu_items,
-				 NULL);
-  
-  toolbox_menubar = gtk_item_factory_get_widget(toolbox_item_factory,
-						"<Toolbox>");
+  toolbox_actions = gtk_action_group_new ("toolbox-actions");
+  gtk_action_group_set_translation_domain (toolbox_actions, NULL);
+  gtk_action_group_add_actions (toolbox_actions, toolbox_entries, 
+								G_N_ELEMENTS (toolbox_entries), NULL);
+  gtk_action_group_add_toggle_actions (toolbox_actions, toolbox_toggle_entries,
+									   G_N_ELEMENTS (toolbox_toggle_entries), 
+									   NULL);
+
+  toolbox_ui_manager = gtk_ui_manager_new ();
+  gtk_ui_manager_insert_action_group (toolbox_ui_manager, toolbox_actions, 0);
+  if (!gtk_ui_manager_add_ui_from_file (toolbox_ui_manager,
+										UIDATADIR"/dia-ui.xml",
+										&error)) {
+	g_warning ("building menus failed: %s", error->message);
+	g_error_free (error);
+  }
+
+  toolbox_accels = gtk_ui_manager_get_accel_group (toolbox_ui_manager);
+  toolbox_menubar = gtk_ui_manager_get_widget (toolbox_ui_manager, "/ToolboxMenu");
 
   /* the display menu */
   display_accels = gtk_accel_group_new();
@@ -529,18 +524,44 @@ menus_init(void)
 
   gtk_menu_set_title(GTK_MENU(display_menus), _("Diagram Menu"));
   
+  plugin_actions = gtk_action_group_new ("plugin-actions");
+  gtk_ui_manager_insert_action_group (toolbox_ui_manager, plugin_actions, 5 /* "back" */);
+
   /* initialize callbacks from plug-ins */
   for (cblist = filter_get_callbacks(); cblist; cblist = cblist->next) {
     DiaCallbackFilter *cbf = cblist->data;
     GtkWidget *newitem;
 
-    newitem = menus_add_path(cbf->menupath);
-    if (!newitem) {
-      g_warning("Don't know where to add \"%s\" menu entry.", cbf->menupath);
-      continue;
+	if (cbf->action != NULL) {
+
+		GtkAction *action;		
+		guint id;
+
+		action = gtk_action_new (cbf->action, cbf->description, 
+								 NULL, NULL);
+		g_signal_connect (G_OBJECT (action), "activate", 
+									G_CALLBACK (plugin_callback), 
+									(gpointer) cbf);
+		gtk_action_group_add_action (plugin_actions, action);
+
+		id = gtk_ui_manager_new_merge_id (toolbox_ui_manager);
+		gtk_ui_manager_add_ui (toolbox_ui_manager, id, 
+							   cbf->menupath, 
+							   cbf->description, 
+							   cbf->action, 
+							   GTK_UI_MANAGER_AUTO, 
+							   FALSE);
+	}
+	else {
+	  /* FIXME needed until all plugins are move over */
+      newitem = menus_add_path(cbf->menupath);
+      if (!newitem) {
+        g_warning("Don't know where to add \"%s\" menu entry.", cbf->menupath);
+        continue;
+      }
+      g_signal_connect(GTK_OBJECT(newitem), "activate",
+		       G_CALLBACK(plugin_callback), cbf);
     }
-    g_signal_connect(GTK_OBJECT(newitem), "activate",
-		     G_CALLBACK(plugin_callback), cbf);
   } /* for filter_callbacks */
 
   /* load accelerators and prepare to later save them */
@@ -619,10 +640,11 @@ menus_add_path (const gchar *path)
   if (strncmp(path, "<Display>/", strlen("<Display>/")) == 0) {
     item_factory = display_item_factory;
     new_entry.path = (gchar *) (path + strlen("<Display>"));
-  } else if (strncmp(path, "<Toolbox>/", strlen("<Toolbox>/")) == 0) {
+  } /* TODO rob: figure out how to offer this API to plugins
+    else if (strncmp(path, "<Toolbox>/", strlen("<Toolbox>/")) == 0) {
     item_factory = toolbox_item_factory;
     new_entry.path = (gchar *) (path + strlen("<Toolbox>"));
-  } else {
+  } */ else {
     g_warning("bad menu path `%s'", path);
     return NULL;
   }
@@ -631,6 +653,17 @@ menus_add_path (const gchar *path)
   return gtk_item_factory_get_widget(item_factory, path);
 }
 
+GtkAccelGroup *
+menus_get_accel_group ()
+{
+	return toolbox_accels;
+}
+
+GtkActionGroup *
+menus_get_action_group ()
+{
+	return toolbox_actions;
+}
 
 /*
   Get a menu item widget from a path. 
@@ -655,12 +688,6 @@ menus_get_item_from_path (char *path, Gt
     if (wid != NULL) widget = GTK_MENU_ITEM(wid);
   }
   
-  if (widget == NULL) {
-    wid = 
-      gtk_item_factory_get_item(toolbox_item_factory, path);
-    if (wid != NULL) widget = GTK_MENU_ITEM(wid);
-  }
-
   if (! widget) {
     g_warning(_("Can't find menu entry '%s'!\nThis is probably a i18n problem "
                 "(try LANG=C)."), path);
@@ -669,6 +696,66 @@ menus_get_item_from_path (char *path, Gt
   return widget;
 }
 
+GtkAction *
+menus_get_action (const gchar *name)
+{
+	return gtk_action_group_get_action (toolbox_actions, name);
+}
+
+void
+menus_set_recent (GtkActionGroup *actions)
+{
+	GList *list;
+	guint id;
+
+	if (recent_actions) {
+		menus_clear_recent ();
+	}
+
+	list = gtk_action_group_list_actions (actions);
+	g_return_if_fail (list);
+
+	recent_actions = actions;
+	g_object_ref (G_OBJECT (recent_actions));
+	gtk_ui_manager_insert_action_group (toolbox_ui_manager, 
+										recent_actions, 
+										10 /* insert at back */ );
+
+	do {
+
+		id = gtk_ui_manager_new_merge_id (toolbox_ui_manager);
+		recent_merge_ids = g_slist_prepend (recent_merge_ids, (gpointer) id);
+
+		gtk_ui_manager_add_ui (toolbox_ui_manager, id, 
+							   "/ToolboxMenu/File/FileRecentEnd", 
+							   gtk_action_get_name (GTK_ACTION (list->data)), 
+							   gtk_action_get_name (GTK_ACTION (list->data)), 
+							   GTK_UI_MANAGER_AUTO, 
+							   TRUE);
+
+	} while (NULL != (list = list->next));
+}
+
+void
+menus_clear_recent (void)
+{
+	GSList *id;
+
+	g_return_if_fail (recent_merge_ids);
+
+	id = recent_merge_ids;
+	do {
+		gtk_ui_manager_remove_ui (toolbox_ui_manager, (guint) id->data);
+
+	} while (NULL != (id = id->next));
+
+	g_slist_free (recent_merge_ids);
+	recent_merge_ids = NULL;
+
+	gtk_ui_manager_remove_action_group (toolbox_ui_manager, recent_actions);
+	g_object_unref (G_OBJECT (recent_actions));
+	recent_actions = NULL;
+}
 
 void
 menus_initialize_updatable_items (UpdatableMenuItems *items, 
Index: dia/app/menus.h
===================================================================
RCS file: /cvs/gnome/dia/app/menus.h,v
retrieving revision 1.20
diff -a -u -p -r1.20 menus.h
--- dia/app/menus.h	5 Feb 2006 17:06:38 -0000	1.20
+++ dia/app/menus.h	7 May 2006 20:54:14 -0000
@@ -69,6 +69,15 @@ void menus_get_toolbox_menubar (GtkWidge
 void menus_get_image_menu      (GtkWidget **menu,    GtkAccelGroup **accel);
 void menus_get_image_menubar   (GtkWidget **menu, GtkItemFactory **display_mbar_item_factory);
 
+/* GtkActionManager API, only covers toolbox for now */
+GtkAccelGroup  *menus_get_accel_group  (void);
+GtkActionGroup *menus_get_action_group (void);
+
+GtkAction      *menus_get_action       (const gchar *name);
+void            menus_set_recent       (GtkActionGroup *actions);
+void            menus_clear_recent     (void);
+/**/
+
 GtkMenuItem *menus_get_item_from_path(char *path, GtkItemFactory *item_factory);
 GtkWidget *menus_add_path           (const gchar *path);
 void menus_initialize_updatable_items (UpdatableMenuItems *items, 
Index: dia/app/recent_files.c
===================================================================
RCS file: /cvs/gnome/dia/app/recent_files.c,v
retrieving revision 1.21
diff -a -u -p -r1.21 recent_files.c
--- dia/app/recent_files.c	27 Jan 2006 23:27:54 -0000	1.21
+++ dia/app/recent_files.c	7 May 2006 20:54:14 -0000
@@ -52,98 +52,57 @@ static GtkTooltips *tooltips = 0;
 static void open_recent_file_callback (GtkWidget *widget, gpointer data);
 void recent_file_history_remove (const char *fname);
 
-static GtkWidget *
-recent_file_filemenu_get(void)
-{
-    /* Use the Plugins menu item to get a pointer to the File menu,
-       but any item on the File menu will do */
-    
-    return GTK_WIDGET(menus_get_item_from_path(N_("<Toolbox>/File/Plugins..."),
-					       NULL))->parent;
-}
-
 static void
 recent_file_history_clear_menu()
 {
-    GtkWidget *file_menu = recent_file_filemenu_get();
-    GList *menu_items = GTK_MENU_SHELL(file_menu)->children;
-    GList *next_item;
-    
-    for (;menu_items != NULL; menu_items = next_item) {
-	GtkMenuItem *item;
-	next_item = g_list_next(menu_items);
-	item = GTK_MENU_ITEM(menu_items->data);
-	if (g_signal_handler_find(G_OBJECT(item), G_SIGNAL_MATCH_FUNC,
-				  0, 0, NULL, open_recent_file_callback, NULL)) {
-	    gtk_container_remove (GTK_CONTAINER (file_menu), GTK_WIDGET(item));
-	}
-    }
+	menus_clear_recent ();
 }
 
-/** Create a single menu item at position pos in the recent files list.
- * Pos starts from 0.
+/** 
+ * Build and insert the recent files menu.
  */
 static void
-recent_file_menuitem_create(GtkWidget *menu, gchar *filename, 
-			    guint pos, guint offset)
-{
-    gchar *basename, *label;
-    GtkWidget *item;
-    GtkAccelGroup *accel_group;
-    /* FIXME: filename encoding, but we need utf-8 here */
-    basename = g_path_get_basename(filename);
-    
-    label = g_strdup_printf("%d. %s", pos+1, basename);
-    item = gtk_menu_item_new_with_label(label);
-    gtk_menu_insert(GTK_MENU(menu), item,
-		    pos + offset);
-    
-    g_signal_connect(GTK_OBJECT(item), "activate",
-		     G_CALLBACK(open_recent_file_callback), filename);
-    
-    gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), item,
-    			 filename, NULL);
-    
-    if (pos < 9)
-    {
-	accel_group = gtk_accel_group_new();
-	gtk_window_add_accel_group(GTK_WINDOW(interface_get_toolbox_shell()),
-				   accel_group);
-	gtk_widget_add_accelerator(item, "activate", accel_group,
-				   GDK_1 + pos,
-				   GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
-    }
-    
-    gtk_widget_show(item);
-    
-    g_free(basename);
-    /* gtk_label_set_text() g_strdup's our label, so... */
-    g_free(label);
-}
-
-/** Build and insert the recent files menu */
-static void
 recent_file_history_make_menu()
 {
-    guint i;
-
-    GList *items = persistent_list_get_glist("recent-files");
-
-    GtkWidget *file_menu = recent_file_filemenu_get();
-
-    GtkMenuItem *menu_item = 
-	menus_get_item_from_path(N_("<Toolbox>/File/Quit"), NULL);
-
-    GList *list_item = g_list_find(GTK_MENU_SHELL(file_menu)->children,
-				   (gpointer)menu_item);
-    
-    int offset = g_list_position(GTK_MENU_SHELL(file_menu)->children,
-			  list_item) - 1;  /* fudge factor */
+	GList *items;
+	GtkActionGroup *group;
+	GtkAction *action;
+	gchar *name;
+	gchar *file;
+	gchar *label;
+	gchar *accel;
+	gint i = 0;
+
+	items = persistent_list_get_glist ("recent-files");
+	g_return_if_fail (items != NULL);
+
+	group = gtk_action_group_new ("recent-files");
+
+	for (i = 0; 
+		 items != NULL && i < prefs.recent_documents_list_size; 
+		 items = g_list_next(items), i++) {
+
+		name = g_strdup_printf ("FileRecent_%d", i);
+		file = g_path_get_basename ((const gchar *) items->data);
+		label = g_strdup_printf ("_%d. %s", i + 1, file);
+
+		action = gtk_action_new (name, label, 
+								 (const gchar *) items->data, 
+								 NULL);
+		g_signal_connect (G_OBJECT (action), "activate", 
+						  G_CALLBACK (open_recent_file_callback), 
+						  items->data);
+
+		accel = g_strdup_printf ("<control>%d", i + 1);
+		gtk_action_group_add_action_with_accel (group, action, accel);
+		
+		g_free (name);  name = NULL;
+		g_free (file);  file = NULL;
+		g_free (label); label = NULL;
+		g_free (accel); accel = NULL;
+	}
 
-    for (i = 0; items != NULL && i < prefs.recent_documents_list_size;
-	 items = g_list_next(items), i++) {
-	recent_file_menuitem_create(file_menu, (gchar *)items->data, i, offset);
-    }
+	menus_set_recent (group);
 }
 
 /** Add a new item to the file history list.
Index: dia/lib/filter.h
===================================================================
RCS file: /cvs/gnome/dia/lib/filter.h,v
retrieving revision 1.10
diff -a -u -p -r1.10 filter.h
--- dia/lib/filter.h	4 Dec 2004 23:53:21 -0000	1.10
+++ dia/lib/filter.h	7 May 2006 20:54:15 -0000
@@ -68,6 +68,7 @@ typedef void (* DiaCallbackFunc) (Diagra
                                   void* user_data);
 
 struct _DiaCallbackFilter {
+  const gchar *action;
   const gchar *description;
   const gchar *menupath;
   DiaCallbackFunc callback;
Index: dia/plug-ins/python/diamodule.c
===================================================================
RCS file: /cvs/gnome/dia/plug-ins/python/diamodule.c,v
retrieving revision 1.22
diff -a -u -p -r1.22 diamodule.c
--- dia/plug-ins/python/diamodule.c	26 Jun 2005 18:51:19 -0000	1.22
+++ dia/plug-ins/python/diamodule.c	7 May 2006 20:54:16 -0000
@@ -383,6 +383,39 @@ PyDia_RegisterCallback(PyObject *self, P
 }
 
 static PyObject *
+PyDia_RegisterAction(PyObject *self, PyObject *args)
+{
+	gchar *action;
+    gchar *desc;
+    gchar *menupath;
+    PyObject *func;
+    DiaCallbackFilter *filter;
+
+    if (!PyArg_ParseTuple(args, "sssO:dia.register_action",
+			  &action, &desc, &menupath, &func))
+	return NULL;
+
+    if (!PyCallable_Check(func)) {
+        PyErr_SetString(PyExc_TypeError, "third parameter must be callable");
+        return NULL;
+    }
+
+    Py_INCREF(func); /* stay alive, where to kill ?? */
+
+    filter = g_new0 (DiaCallbackFilter, 1);
+	filter->action = g_strdup (action);
+    filter->description = g_strdup (desc);
+    filter->menupath = g_strdup (menupath);
+    filter->callback = &PyDia_callback_func;
+    filter->user_data = func;
+
+    filter_register_callback(filter);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject *
 PyDia_Message (PyObject *self, PyObject *args)
 {
     int type = 0;
@@ -428,6 +461,9 @@ static PyMethodDef dia_methods[] = {
       "allows to register an import filter written in Python, that is mainly a callback function which fills the"
       "given DiaDiagramData from the given filename" },
     { "register_callback", PyDia_RegisterCallback, METH_VARARGS,
+      "register a callback function which appears in the menu. Depending on the menu path used during registration"
+      "the callback gets called with the current DiaDiagramData object" },
+    { "register_action", PyDia_RegisterAction, METH_VARARGS,
       "register a callback function which appears in the menu. Depending on the menu path used during registration"
       "the callback gets called with the current DiaDiagramData object" },
     { NULL, NULL }
Index: dia/plug-ins/python/otypes.py
===================================================================
RCS file: /cvs/gnome/dia/plug-ins/python/otypes.py,v
retrieving revision 1.3
diff -a -u -p -r1.3 otypes.py
--- dia/plug-ins/python/otypes.py	1 Jun 2005 18:49:35 -0000	1.3
+++ dia/plug-ins/python/otypes.py	7 May 2006 20:54:17 -0000
@@ -172,6 +172,6 @@ def otypes_cb(data, flags) :
 	diagram.update_extents()
 	diagram.flush()
 
-dia.register_callback ("Dia Object Types", 
-                       "<Toolbox>/Help/Self Doc/Object Types", 
-                       otypes_cb)
+dia.register_action ("HelpOtypes", "Dia Object Types",
+                     "/ToolboxMenu/Help/HelpExtensionStart", 
+                     otypes_cb)
Index: dia/plug-ins/python/pydiadoc.py
===================================================================
RCS file: /cvs/gnome/dia/plug-ins/python/pydiadoc.py,v
retrieving revision 1.3
diff -a -u -p -r1.3 pydiadoc.py
--- dia/plug-ins/python/pydiadoc.py	1 Jan 2006 19:08:30 -0000	1.3
+++ dia/plug-ins/python/pydiadoc.py	7 May 2006 20:54:17 -0000
@@ -141,6 +141,6 @@ def autodoc_cb (data, flags) :
 	diagram.update_extents()
 	diagram.flush()
 
-dia.register_callback ("PyDia Auto Documentation", 
-                       "<Toolbox>/Help/Self Doc/PyDia Docs", 
+dia.register_action ("HelpPydia", "PyDia Docs", 
+                       "/ToolboxMenu/Help/HelpExtensionStart", 
                        autodoc_cb)
--- dia-orig/data/Makefile.am	1970-01-01 01:00:00.000000000 +0100
+++ dia/data/Makefile.am	2006-05-02 00:54:16.000000000 +0200
@@ -0,0 +1,7 @@
+
+uidir = $(uidatadir)
+ui_DATA = \
+	dia-ui.xml
+
+EXTRA_DIST = \
+	$(ui_DATA)
--- dia-orig/data/dia-ui.xml	1970-01-01 01:00:00.000000000 +0100
+++ dia/data/dia-ui.xml	2006-05-07 19:10:25.000000000 +0200
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ui>
+	<menubar name="ToolboxMenu">
+		<menu name="File" action="File">
+			<menuitem name="FileNew" action="FileNew" />
+			<menuitem name="FileOpen" action="FileOpen" />
+			<separator name="FileSep1" />
+			<menuitem name="FileTree" action="FileTree" />
+			<menuitem name="FileSheets" action="FileSheets" />
+			<separator name="FileSep2 "/>
+			<menuitem name="FilePrefs" action="FilePrefs" />
+			<menuitem name="FilePlugins" action="FilePlugins" />
+			<separator name="FileRecentStart"/>
+			<separator name="FileRecentEnd" />
+			<menuitem name="FileQuit" action="FileQuit" />
+		</menu>
+		<menu name="Help" action="Help">
+			<menuitem name="HelpContents" action="HelpContents" />
+			<separator name="HelpExtensionStart" expand="true" />
+			<separator name="HelpExtensionEnd" expand="true" />
+			<menuitem name="HelpAbout" action="HelpAbout" />
+		</menu>
+	</menubar>
+</ui>
