


#include <gtk/gtk.h>

GtkWidget *popover;

static void
click_cb ()
{
  gtk_widget_show_all (popover);
}


int
main (int argc, char **argv)
{
  gtk_init (&argc, &argv);

  GtkWidget *win  = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  GtkWidget *btn1 = gtk_button_new_with_label ("Test");
  GtkWidget *btn2 = gtk_button_new_with_label ("Test");
  GtkWidget *box  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
  popover = gtk_popover_new (btn1);
  gtk_popover_set_position (GTK_POPOVER (popover), GTK_POS_BOTTOM);
  GtkWidget *l = gtk_button_new_with_label ("Button");
  /*gtk_widget_set_tooltip_text (l, "Foo");*/
  gtk_container_add (GTK_CONTAINER (popover), l);

  g_signal_connect (G_OBJECT (btn1), "clicked", G_CALLBACK(click_cb), NULL);

  // XXX
  gtk_widget_set_tooltip_text (btn2, "This appears!");

  gtk_box_pack_start (GTK_BOX (box), btn1, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (box), btn2, FALSE, FALSE, 0);

  gtk_container_add (GTK_CONTAINER (win), box);
  gtk_widget_show_all (win);

  gtk_window_resize (GTK_WINDOW (win), 400, 400);
  gtk_main ();
  return 0;
}
