[gtk+] testgmenu: Quit on delete-event



commit e0c235255b98b69a3d835997ab6f65b81079e9cf
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 21 09:58:37 2011 -0500

    testgmenu: Quit on delete-event

 tests/testgmenu.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/tests/testgmenu.c b/tests/testgmenu.c
index 1908402..4674362 100644
--- a/tests/testgmenu.c
+++ b/tests/testgmenu.c
@@ -921,6 +921,15 @@ button_clicked (GtkButton  *button,
 #define BUS_NAME "org.gtk.TestMenus"
 #define OBJ_PATH "/org/gtk/TestMenus"
 
+static gboolean
+on_delete_event (GtkWidget   *widget,
+		 GdkEvent    *event,
+		 gpointer     user_data)
+{
+  gtk_main_quit ();
+  return TRUE;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -951,6 +960,7 @@ main (int argc, char *argv[])
     }
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  g_signal_connect (window, "delete-event", G_CALLBACK(on_delete_event), NULL);
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_add (GTK_CONTAINER (window), box);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]