Code

cmd_select_all added
[ncmpc.git] / src / main.c
index c00b7ad68b6d358bd4fba2e5cd1f5442e8446c99..5e978409ff9c73cc3ba59afadf9f13ed69596884 100644 (file)
 #include "options.h"
 #include "conf.h"
 #include "command.h"
+#include "src_lyrics.h"
 #include "screen.h"
 #include "screen_utils.h"
 #include "strfsong.h"
+#include "splash.h"
 
 #define BUFSIZE 1024
 
@@ -123,6 +125,7 @@ exit_and_cleanup(void)
   g_free(options.password);
   g_free(options.list_format);
   g_free(options.status_format);
+  g_free(options.scroll_sep);
   if( timer )
     g_timer_destroy(timer);
 }
@@ -189,6 +192,8 @@ main(int argc, const char *argv[])
 #ifdef HAVE_LOCALE_H
   /* time and date formatting */
   setlocale(LC_TIME,"");
+  /* care about sorting order etc */
+  setlocale(LC_COLLATE,"");
   /* charset */
   setlocale(LC_CTYPE,"");
   /* initialize charset conversions */
@@ -259,9 +264,15 @@ main(int argc, const char *argv[])
        
   /* install exit function */
   atexit(exit_and_cleanup);
+  
+  ncurses_init();
+  if(options->show_splash == TRUE) draw_splash();
+
+  src_lyr_init ();
 
   /* connect to our music player daemon */
   mpd = mpdclient_new();
   if( mpdclient_connect(mpd, 
                        options->host, 
                        options->port, 
@@ -274,8 +285,11 @@ main(int argc, const char *argv[])
   /* if no password is used, but the mpd wants one, the connection
      might be established but no status information is avaiable */
   mpdclient_update(mpd);
-  if(!mpd->status)  
-    exit(EXIT_FAILURE);
+  if(!mpd->status)
+    {
+      screen_auth(mpd);
+    }
+  if(!mpd->status) exit(EXIT_FAILURE);
   
   connected = TRUE;
   D("Connected to MPD version %d.%d.%d\n",
@@ -296,7 +310,6 @@ main(int argc, const char *argv[])
 
   /* initialize curses */
   screen_init(mpd);
-
   /* install error callback function */
   mpdclient_install_error_callback(mpd, error_callback);
 
@@ -362,3 +375,4 @@ main(int argc, const char *argv[])
     }
   exit(EXIT_FAILURE);
 }
+