#include <gtk/gtk.h>

static const gchar *menu_ui =
  "<?xml version=\"1.0\"?>\n"
  "<interface>\n"
  "  <!-- interface-requires gtk+ 3.0 -->\n"
  "  <menu id=\"dir-menu\">\n"
  "    <section>\n"
  "      <item>\n"
  "        <attribute name=\"label\" translatable=\"yes\">The Submenu Should be Just Below</attribute>\n"
  "      </item>\n"
  "    </section>\n"
  "    <submenu>\n"
  "      <attribute name=\"label\" translatable=\"yes\">_Filter</attribute>\n"
  "      <section>\n"
  "        <item>\n"
  "          <attribute name=\"label\" translatable=\"yes\">Show _Hidden</attribute>\n"
  "          <attribute name=\"action\">browser.show_hidden</attribute>\n"
  "        </item>\n"
  "        <item>\n"
  "          <attribute name=\"label\" translatable=\"yes\">Show _Binary</attribute>\n"
  "          <attribute name=\"action\">browser.show_binary</attribute>\n"
  "        </item>\n"
  "      </section>\n"
  "    </submenu>\n"
  "  </menu>\n"
  "</interface>";

int
main (void)
{
  GMenuModel *model;
  GtkWidget *menu;
  GtkBuilder *builder;

  gtk_init (NULL, NULL);

  builder = gtk_builder_new ();
  gtk_builder_add_from_string (builder, menu_ui, -1, NULL);

  model = G_MENU_MODEL (gtk_builder_get_object (builder, "dir-menu"));

  menu = gtk_menu_new_from_model (model);
  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, 0);

  gtk_main ();
  return 0;
}
