#include <gtk/gtk.h>

const char ui[] = "<ui>"
  "  <menubar name=\"menubar1\">"
  "    <menu name=\"file\" action=\"file\">"
  "      <menuitem name=\"test1\" action=\"test1\"/>"
  "      <menuitem name=\"test2\" action=\"test2\"/>"
  "    </menu>" 
  "  </menubar>" 
  "</ui>";

int
main (int argc, char **argv)
{
  GObject *uimgr, *action, *actiongroup;
  GtkWidget *window, *menubar;

  gtk_init (&argc, &argv);
  uimgr = g_object_new (GTK_TYPE_UI_MANAGER, NULL);
  actiongroup = g_object_new (GTK_TYPE_ACTION_GROUP, NULL);
  gtk_ui_manager_insert_action_group (GTK_UI_MANAGER (uimgr),
				      GTK_ACTION_GROUP (actiongroup), 0);

  action = g_object_new (GTK_TYPE_ACTION, "name", "file",
			 "label", "_File", NULL);
  gtk_action_group_add_action (GTK_ACTION_GROUP (actiongroup),
			       GTK_ACTION (action));


  /* This does not work */
  action = g_object_new (GTK_TYPE_ACTION, "name", "test1",
			 "label", "Test 1",
			 "accelerator", "<control>t", NULL);
  gtk_action_group_add_action (GTK_ACTION_GROUP (actiongroup),
			       GTK_ACTION (action));


  /* While this, "old style" works just fine */
  action = g_object_new (GTK_TYPE_ACTION, "name", "test2",
			 "label", "Test 2", NULL);
  gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (actiongroup),
					  GTK_ACTION (action), "<shift>t");


  gtk_action_group_add_action (GTK_ACTION_GROUP (actiongroup),
			       GTK_ACTION (action));
  gtk_ui_manager_add_ui_from_string (GTK_UI_MANAGER (uimgr), ui, -1, NULL);
  window = g_object_new (GTK_TYPE_WINDOW, "default-width", 200,
			 "default-height", 32, NULL);

  menubar = gtk_ui_manager_get_widget (GTK_UI_MANAGER (uimgr), "ui/menubar1");
  gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (menubar));
  gtk_widget_show_all (GTK_WIDGET (window));
  gtk_main ();

}
