/* cc `pkg-config --cflags gtk+-3.0` -o listboxtest listboxtest.c `pkg-config --libs gtk+-3.0` */
#include <gtk/gtk.h>

int
main (int argc, gchar *argv[])
{
  gtk_init (&argc, &argv);

  GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
  GtkWidget *lb = gtk_list_box_new ();
  gtk_list_box_set_selection_mode (GTK_LIST_BOX (lb), GTK_SELECTION_MULTIPLE);

  gint i;
  for (i = 0; i < 10; i++)
    {
      gchar *text = g_strdup_printf ("Row          %i", i);
      GtkWidget *label = gtk_label_new (text);
      gtk_list_box_insert (GTK_LIST_BOX (lb), gtk_label_new (text), -1);
      g_free (text);
    }

  gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Select and unselect rows with mouse clicks"));
  gtk_container_add (GTK_CONTAINER (vbox), lb);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  gtk_widget_show_all (window);

  gtk_main ();

  return 0;
}
