summaryrefslogtreecommitdiff
path: root/nncmpp.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-10-10 11:13:52 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-10-10 11:13:52 +0200
commit01ab646b111a7d7f2fb4f73a9166ba2c63f9e2f0 (patch)
tree7a5d10b21467a63ed48fe0db2dfad6c31b1e9819 /nncmpp.c
parente513102318d87ca31d64ef8c1196ce0fc62c3763 (diff)
downloadnncmpp-01ab646b111a7d7f2fb4f73a9166ba2c63f9e2f0.tar.gz
nncmpp-01ab646b111a7d7f2fb4f73a9166ba2c63f9e2f0.tar.xz
nncmpp-01ab646b111a7d7f2fb4f73a9166ba2c63f9e2f0.zip
Clean up initialization a bit
Diffstat (limited to 'nncmpp.c')
-rw-r--r--nncmpp.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/nncmpp.c b/nncmpp.c
index 840d6e2..7d91490 100644
--- a/nncmpp.c
+++ b/nncmpp.c
@@ -1438,6 +1438,13 @@ app_move_selection (int diff)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void
+app_prepend_tab (struct tab *tab)
+{
+ LIST_PREPEND (g_ctx.tabs, tab);
+ app_invalidate ();
+}
+
+static void
app_switch_tab (struct tab *tab)
{
g_ctx.active_tab = tab;
@@ -2728,32 +2735,19 @@ main (int argc, char *argv[])
app_init_context ();
app_load_configuration ();
app_init_terminal ();
+ signals_setup_handlers ();
+ app_init_poller_events ();
- // Redirect all messages from liberty to a special tab so they're not lost
- struct tab *new_tab;
if (g_debug_mode)
- {
- new_tab = debug_tab_init ();
- LIST_PREPEND (g_ctx.tabs, new_tab);
- }
+ app_prepend_tab (debug_tab_init ());
+ // Redirect all messages from liberty to a special tab so they're not lost
g_log_message_real = app_log_handler;
- new_tab = info_tab_init ();
- LIST_PREPEND (g_ctx.tabs, new_tab);
-
+ app_prepend_tab (info_tab_init ());
if (g_ctx.streams.len)
- {
- new_tab = streams_tab_init ();
- LIST_PREPEND (g_ctx.tabs, new_tab);
- }
-
- g_ctx.help_tab = help_tab_init ();
- g_ctx.active_tab = g_ctx.help_tab;
-
- signals_setup_handlers ();
- app_init_poller_events ();
- app_invalidate ();
+ app_prepend_tab (streams_tab_init ());
+ app_switch_tab ((g_ctx.help_tab = help_tab_init ()));
g_ctx.polling = true;
while (g_ctx.polling)