[2636] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[PATCH 3/3] Move zephyr and ncurses shutdown into main

daemon@ATHENA.MIT.EDU (David Benjamin)
Sat Sep 18 03:02:42 2010

From: David Benjamin <davidben@MIT.EDU>
To: barnowl-dev@mit.edu
Date: Sat, 18 Sep 2010 03:00:31 -0400
In-Reply-To: <1284793231-20249-1-git-send-email-davidben@mit.edu>

They are initialized in main, so they may as well be tore down there.
Although, we'll probably want to move both elsewhere sometime.
---
 functions.c |    9 ---------
 owl.c       |    9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/functions.c b/functions.c
index 658d78f..59b7a6b 100644
--- a/functions.c
+++ b/functions.c
@@ -959,21 +959,12 @@ void owl_function_quit(void)
   if (owl_global_get_newmsgproc_pid(&g)) {
     kill(owl_global_get_newmsgproc_pid(&g), SIGHUP);
   }
-
-  /* Quit zephyr */
-  owl_zephyr_shutdown();
   
   /* Quit AIM */
   if (owl_global_is_aimloggedin(&g)) {
     owl_aim_logout();
   }
 
-  /* done with curses */
-  endwin();
-
-  /* restore terminal settings */
-  tcsetattr(0, TCSAFLUSH, owl_global_get_startup_tio(&g));
-
   owl_function_debugmsg("Quitting Owl");
   owl_select_quit_loop();
 }
diff --git a/owl.c b/owl.c
index 850d09f..9656b8f 100644
--- a/owl.c
+++ b/owl.c
@@ -148,6 +148,11 @@ void owl_start_curses(void) {
   owl_start_color();
 }
 
+void owl_shutdown_curses(void) {
+  endwin();
+  /* restore terminal settings */
+  tcsetattr(0, TCSAFLUSH, owl_global_get_startup_tio(&g));
+}
 
 /*
  * Process a new message passed to us on the message queue from some
@@ -584,5 +589,9 @@ int main(int argc, char **argv, char **env)
 
   owl_function_debugmsg("startup: entering main loop");
   owl_select_run_loop();
+
+  /* Shut down everything. */
+  owl_zephyr_shutdown();
+  owl_shutdown_curses();
   return 0;
 }
-- 
1.7.2.1.45.gb1c4


home help back first fref pref prev next nref lref last post