From db9e15ae0d3cc319b9c61c7fa49279360769b374 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 4 Mar 2012 18:37:53 +1030 Subject: [PATCH 3/3] glib demo: make ctrl-q quit the demo --- glib/demo/main.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/glib/demo/main.c b/glib/demo/main.c index 9e11577..f52c5b8 100644 --- a/glib/demo/main.c +++ b/glib/demo/main.c @@ -296,6 +296,8 @@ gint main (gint argc, gchar **argv) gchar *uri; GTimer *timer; GError *error = NULL; + GtkAccelGroup *gtk_accel; + GClosure *closure; if (argc != 2) { g_print ("Usage: poppler-glib-demo FILE\n"); @@ -364,6 +366,13 @@ gint main (gint argc, gchar **argv) g_signal_connect (G_OBJECT (win), "delete-event", G_CALLBACK (gtk_main_quit), NULL); + gtk_accel = gtk_accel_group_new (); + closure = g_cclosure_new (G_CALLBACK (gtk_main_quit), NULL, NULL); + gtk_accel_group_connect (gtk_accel, gdk_keyval_from_name ("q"), + GDK_CONTROL_MASK, 0, closure); + g_closure_unref (closure); + gtk_window_add_accel_group (GTK_WINDOW(win), gtk_accel); + hbox = gtk_hbox_new (FALSE, 6); treeview = pgd_demo_list_create (); -- 1.7.5.4