#include <gtk/gtk.h>

GtkTreeModel *model;
GtkTreeIter iter;

int tableFocusIn (GtkWidget* widget, gpointer data) {
	gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
}

int main (int argc, char** argv) {
	GtkWidget *shellHandle, *buttonHandle, *tableHandle, *vboxHandle;
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *column;

	gtk_init_check (&argc, &argv);
	shellHandle = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	vboxHandle = gtk_vbox_new (FALSE, 8);
	buttonHandle  = gtk_button_new_with_label ("Button");

	model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
	gtk_list_store_append (GTK_LIST_STORE (model), &iter);
	gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, "click me", -1);
	tableHandle = gtk_tree_view_new_with_model (model);
	g_object_unref (model);

	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes ("Column", renderer, "text", 0, NULL);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
	gtk_tree_view_column_set_fixed_width (column, 60);
	gtk_tree_view_append_column (GTK_TREE_VIEW (tableHandle), column);

	g_signal_connect (G_OBJECT (shellHandle), "destroy", G_CALLBACK (gtk_main_quit), NULL);
	g_signal_connect (G_OBJECT (shellHandle), "delete_event",G_CALLBACK (gtk_main_quit), NULL);
	g_signal_connect (G_OBJECT (tableHandle), "focus_in_event",G_CALLBACK (tableFocusIn), NULL);

	gtk_container_add (GTK_CONTAINER (shellHandle), vboxHandle);
	gtk_container_add (GTK_CONTAINER (vboxHandle), buttonHandle);
	gtk_container_add (GTK_CONTAINER (vboxHandle), tableHandle);
	gtk_window_set_default_size (GTK_WINDOW (shellHandle), 280, 250);
	gtk_widget_show_all (shellHandle);
	gtk_main();

}
