/*
 * gcc -Wall `pkg-config --cflags gtk+-2.0` -o testgtknotebook testgtknotebook.c `pkg-config --libs gtk+-2.0`
 */
#include <gtk/gtkwindow.h>
#include <gtk/gtknotebook.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkmain.h>

const char *msg_text = "First and third tabs are labels in an eventbox.\n"
                       "The second tab is just a label.\n\n"
		       "The eventbox is quite visible.";
int
main(int argc, char **argv)
{
	GtkWidget *window;
	GtkWidget *notebook;
	GtkWidget *tab_label, *msg_label;
	GtkWidget *eventbox;

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_signal_connect (G_OBJECT (window), "delete_event", 
			  G_CALLBACK (gtk_main_quit), NULL);

	notebook = gtk_notebook_new ();
	gtk_container_add (GTK_CONTAINER (window), notebook);

	/* first tab with label in an eventbox */
	tab_label = gtk_label_new ("First");
	gtk_widget_show (tab_label);
	eventbox = gtk_event_box_new ();
	gtk_container_add (GTK_CONTAINER (eventbox), tab_label);
	msg_label = gtk_label_new (msg_text);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), 
			          msg_label, eventbox);

	/* second tab without eventbox, for comparison */
	tab_label = gtk_label_new ("Second");
	gtk_widget_show (tab_label);
	msg_label = gtk_label_new (msg_text);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), 
			          msg_label, tab_label);

	/* third tab with label in an eventbox */
	tab_label = gtk_label_new ("Third");
	gtk_widget_show (tab_label);
	eventbox = gtk_event_box_new ();
	/* exaggerating with the border to make the bug more visible */
	gtk_container_set_border_width (GTK_CONTAINER (eventbox), 15);
	gtk_container_add (GTK_CONTAINER (eventbox), tab_label);
	msg_label = gtk_label_new (msg_text);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), 
			          msg_label, eventbox);

	gtk_widget_show_all (window);
	gtk_main ();

	return 0;
}
