/* Compile me with:
 * $ gcc $(pkg-config --libs --cflags gtk+-3.0) -o bug_ctrl_space_2 bug_ctrl_space_2.c
 */

#include <gtk/gtk.h>
#include <glib/gprintf.h>

static void
on_ctrl_space (void)
{
  g_printf ("on_ctrl_space()\n");
}

int
main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkAccelGroup *accel_group;
  GClosure *closure;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT (window),
                    "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);

  closure = g_cclosure_new (G_CALLBACK (on_ctrl_space), NULL, NULL);

  accel_group = gtk_accel_group_new ();
  gtk_accel_group_connect (accel_group,
                           GDK_KEY_space, GDK_CONTROL_MASK,
                           0, closure);

  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);

  gtk_widget_show_all (window);
  gtk_main ();
  return 0;
}
