C# Example
using System; using Gtk; class TestClose { public static void Main () { // Init Gtk# Application.Init (); // Create window Window win = new Window ("Test Close"); win.SetDefaultSize (300, 300); // Add button Button button = new Button ("Close Now"); button.Clicked += delegate { Application.Quit (); }; win.Add (button); // Delete event win.DeleteEvent += delegate (object o, DeleteEventArgs e) { // Cancel closing then the "Close" // button of the window is pressed e.RetVal = true; }; // Show window and run win.ShowAll (); Application.Run (); } }