#include <stdio.h>
#include <gtk/gtk.h>

void
create_window (const gchar *title) {
  GtkWidget *window, *notebook, *tab, *content, *menu;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), title);
  gtk_widget_set_size_request (window, 320, 240);

  notebook = gtk_notebook_new ();
  gtk_notebook_set_group (GTK_NOTEBOOK (notebook), "badgers");
  gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook));
  gtk_container_add (GTK_CONTAINER (window), notebook);

  content = gtk_label_new (title);
  tab = gtk_label_new (title);

  menu = gtk_hbox_new (FALSE, 3);
  gtk_container_add (GTK_CONTAINER (menu),
    gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
  gtk_container_add (GTK_CONTAINER (menu),
    gtk_label_new (title));

  gtk_notebook_append_page_menu (GTK_NOTEBOOK (notebook), content, tab, menu);
  gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), content, TRUE);

  gtk_widget_show_all (window);
  gtk_widget_show_all (menu);
  gtk_widget_show_all (tab);
}

int
main (int argc, char **argv)
{
  gtk_init (&argc, &argv);

  create_window("Misc");
  create_window("Other");

  gtk_main ();

  return 0;
}
