[Mono-docs-list] Adding event to monodoc

Nick Drochak ndrochak@gol.com
06 Nov 2002 23:38:57 +0900

Content-Type: text/plain
Content-Transfer-Encoding: 7bit


I noticed that gtk-monodoc doesn't end when you push the close window
button (the X in the top right corner).  I braved the wilds of GTK#
programming and added the event to make it do so. 

Of course, although it works, I'm not sure I did it the best way.  Since
there is already a OnQuitActivate for the menu, I thought there should
be some way to reuse that method, but since the signature is different,
it doesn't work for the Window_Delete event. 

Anyway, please let me know if there's a better way to do this, or
otherwise if I can commit my first gui patch. 

Nick D.

Content-Disposition: attachment; filename=main.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=main.patch; charset=ANSI_X3.4-1968

Index: main.cs
RCS file: /cvs/public/monodoc/doctools/gtk-monodoc/main.cs,v
retrieving revision 1.15
diff -u -r1.15 main.cs
--- main.cs	4 Nov 2002 02:32:12 -0000	1.15
+++ main.cs	6 Nov 2002 13:26:24 -0000
@@ -67,6 +67,14 @@
 	// last edit
 	Item last_edit =3D Item.Empty;
 	XmlNode last_node =3D null;
+	void Window_Delete (object obj, DeleteEventArgs args)
+	{
+		SignalArgs sa =3D (SignalArgs) args;
+		Application.Quit ();
+		sa.RetVal =3D true;=09
+	}
 	DocumentationEditor (string [] args)
@@ -74,6 +82,8 @@
 		gxml =3D new Glade.XML (null, "gtk-monodoc.glade", null, null);
 		LoadWidgetPointers ();
+		main_window.DeleteEvent +=3D new DeleteEventHandler (Window_Delete);
 		// Customize the TreeView