#include <gtk/gtk.h>

static GtkWidget *
create_combo (gfloat xalign)
{
  GtkWidget *combo;
  GtkCellRenderer *renderer;

  /* Create combo and add renderers */  
  combo = gtk_combo_box_new ();

  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", 0);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (G_OBJECT (renderer), "xalign", xalign, NULL);
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", 1);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (G_OBJECT (renderer), "xalign", xalign, NULL);
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", 1);

  gtk_widget_show (combo);

  return combo;
}

int
main (int argc, char **argv)
{
  GtkWidget *window, *combo, *box;
  GtkListStore *store;
  GtkTreeIter iter;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  /* Populate store */
  store = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 0, 1, 1, "one", -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 0, 2, 1, "two", -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 0, 3, 1, "three", -1);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, 0, 4, 1, "four", -1);


  /* Add combo box views */
  box = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (box);
  gtk_container_add (GTK_CONTAINER (window), box);

  combo = create_combo (0.0F);
  gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
  gtk_box_pack_start (GTK_BOX (box), combo, TRUE, TRUE, 0);

  combo = create_combo (0.5F);
  gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
  gtk_box_pack_start (GTK_BOX (box), combo, TRUE, TRUE, 0);

  combo = create_combo (1.0F);
  gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
  gtk_box_pack_start (GTK_BOX (box), combo, TRUE, TRUE, 0);



  gtk_window_present (GTK_WINDOW (window));

  gtk_main ();

  return 0;
}
