/* gcc flowbox.c $(pkg-config --cflags --libs gtk+-3.0 glib-2.0) */

#include <gtk/gtk.h>

static void
selected_children_changed_cb (GtkFlowBox *flow_box)
{
  g_message ("selected_children_changed_cb: %d",
             gtk_widget_in_destruction (GTK_WIDGET (flow_box)));
}

int
main (void)
{
  GtkWidget *label;
  GtkWidget *flow_box;
  GtkWidget *window;

  gtk_init (NULL, NULL);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "delete-event", gtk_main_quit, NULL);

  flow_box = gtk_flow_box_new ();
  gtk_container_add (GTK_CONTAINER (window), flow_box);

  label = gtk_label_new ("hello world");
  gtk_container_add (GTK_CONTAINER (flow_box), label);

  label = gtk_label_new ("hello world");
  gtk_container_add (GTK_CONTAINER (flow_box), label);

  g_signal_connect (flow_box,
                    "selected-children-changed",
                    G_CALLBACK (selected_children_changed_cb),
                    NULL);

  gtk_widget_show_all (window);
  gtk_main ();

  return 0;
}
