/* Compile with:
 *   gcc -o test `pkg-config --libs --cflags gtk+-2.0` test.c
 */

#include <gtk/gtk.h>

GType
my_widget_get_type (void)
{
  static GType my_widget_type = 0;

  if (!my_widget_type)
    {
      static const GTypeInfo my_widget_info =
      {
        sizeof (GtkImageMenuItemClass),
	NULL,		/* base_init */
	NULL,		/* base_finalize */
        (GClassInitFunc) NULL,
	NULL,		/* class_finalize */
	NULL,		/* class_data */
        sizeof (GtkImageMenuItem),
	0,		/* n_preallocs */
        (GInstanceInitFunc) NULL,
      };

      my_widget_type =
	g_type_register_static (GTK_TYPE_MENU_ITEM, "MyWidgetButton",
				&my_widget_info, 0);
    }

  return my_widget_type;
}

int
main (int argc, char **argv)
{
  GtkWidget *win;
  GtkWidget *menubar;
  GtkWidget *menuitem;
  GtkWidget *label;
  GtkWidget *widget;
  
  gtk_init (&argc, &argv);

  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  /* quit on window close */
  g_signal_connect (G_OBJECT (win), "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  widget = g_object_new (my_widget_get_type (), NULL);

  menubar = gtk_menu_bar_new ();
  menuitem = gtk_menu_item_new_with_label ("GtkMenuItem");
  label = gtk_label_new ("GtkMenuItem-derived");

  gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);

  gtk_container_add (GTK_CONTAINER (widget), label);  
  gtk_menu_shell_append (GTK_MENU_SHELL (menubar), widget);
  gtk_container_add (GTK_CONTAINER (win), menubar);  

  gtk_widget_show_all (win);
  
  gtk_main ();
  
  return 0;
}
