Here is an example program that I wrote a while ago that shows exactly how you can do this. This program is simultanously running the Gtk mainloop and is also an http daemon. Btw, it should be fairly easy to change the program to use XML-RPC. The key to this program is to add the daemon fileno to the mainloop of Gtk through the Gtk::Gdk::input_add(). To test the program below. Run it in the background, and connect with your webbrowser to the following URL: http://localhost:3333/hello/there The message hello/there should appear in the label. Regards, Dov On Wed, May 09, 2001 at 11:52:30PM -0500, gfricke hushmail com wrote:
All, I recently used glade to build my first perl program with a GUI interface. I have come across two problems that I haven't been able to figure out. My GTK experience is very minimal and my perl expertise is limited to just a few programs. Problem 1 - How do I send GTK to the background so that I can run a daemon loop listening for remote connections, yet having the GTK portion of the program still sending all the actions/signals to thier appropriate functions/handlers? If i enter my daemon loop after the Gtk->mainl command the loop never executes. Likewise if I insert the daemon loop before the Gtk->main call the window never appears. Problem 2 - How can I bind the window manager's destroy button "X" at the top right corner of the window to my exit function? My exit button currently displays an exit dialog window before exiting the application, and I would like the same dialog when the user clicks on the "X" at the top of the window. I tried using the delete_event signal handler with a call to my exit function, however, this method resulted in destroying the main window and then spawning my exit dialog window. Thanks in advance for any help. Greg Free, encrypted, secure Web-based email at www.hushmail.com
-- ___ Dov Grobgeld | Email: dov orbotech com /+ \ PCB Algorithms Group Leader, Orbotech | Phone: +972-8-9423882 \ +/ AOI POB 215, Yavne 81102, Israel | Fax: +972-8-9423775 __| | Disclaimer: All views above are mine alone. ____|
Attachment:
hello-http-server
Description: Text document