#include <gtk/gtk.h>
#include "gtkcellrenderercombo.h"

static void destroy (GtkWidget *widget, gpointer data)
{
  gtk_main_quit ();
}


int main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *treeview;
  GtkListStore *store;
  GtkTreeViewColumn *column;
  GtkTreeIter iter;
  GtkCellRenderer *renderer;
  gint i;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);

  store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
  
  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 0, "John", 1, "", -1);
  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 0, "Peter", 1, "", -1);
  
  treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "mode", GTK_CELL_RENDERER_MODE_EDITABLE,
		"editable", TRUE, NULL);
  column = gtk_tree_view_column_new_with_attributes ("RendererText", renderer,
						     "text", 0, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);

  renderer = gtk_cell_renderer_combo_new ();
  g_object_set (renderer, "mode", GTK_CELL_RENDERER_MODE_EDITABLE,
		"editable", TRUE, NULL);
  column = gtk_tree_view_column_new_with_attributes ("RendererComboEntry",
						     renderer,
						     "text", 1, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);

  gtk_container_add (GTK_CONTAINER (window), treeview);

  gtk_widget_show_all (window);
 
  gtk_main ();

  return 0;
}
