[gtkmm-documentation] SignalIO example: Add Gio::Application::hold()



commit 2dd5ab7129cdbffc2e914b388811acd774cf2ae1
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Sat Nov 23 10:27:27 2013 +0100

    SignalIO example: Add Gio::Application::hold()
    
    * examples/book/input/main.cc: Add app->hold(). Necessary to keep
    the application running without a window.

 examples/book/input/main.cc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/examples/book/input/main.cc b/examples/book/input/main.cc
index f22ebea..a7733e3 100644
--- a/examples/book/input/main.cc
+++ b/examples/book/input/main.cc
@@ -29,7 +29,6 @@ Glib::RefPtr<Glib::IOChannel> iochannel;
 // and quit the program if the message was 'Q'.
 bool MyCallback(Glib::IOCondition io_condition)
 {
-
   if ((io_condition & Glib::IO_IN) == 0) {
     std::cerr << "Invalid fifo response" << std::endl;
   }
@@ -51,7 +50,7 @@ int main(int argc, char *argv[])
   app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
 
   if (access("testfifo", F_OK) == -1) {
-    // fifo doesn't exit - create it
+    // fifo doesn't exist - create it
     #ifdef HAVE_MKFIFO
     if (mkfifo("testfifo", 0666) != 0) {
       std::cerr << "error creating fifo" << std::endl;
@@ -77,6 +76,7 @@ int main(int argc, char *argv[])
   iochannel = Glib::IOChannel::create_from_fd(read_fd);
 
   // and last but not least - run the application main loop
+  app->hold(); // keep the application running without a window
   app->run();
 
   // now remove the temporary fifo


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