X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fmain.c;h=15ecf45322c7fba25a4d46e8d5951b8dc190dd43;hb=9b2d077c7f5dca6e4013f04318f7b83531fac387;hp=bb3740b62aff1d50cd66159d9a81acf2321acc8d;hpb=225e70a38b68cba219aeb7cb239f426ca739ed7d;p=ncmpc.git diff --git a/src/main.c b/src/main.c index bb3740b..15ecf45 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,7 @@ #include #include "config.h" +#include "ncmpc.h" #include "libmpdclient.h" #include "support.h" #include "mpc.h" @@ -31,13 +32,6 @@ #include "screen.h" #include "conf.h" -/* time in seconds between mpd updates (double) */ -#define MPD_UPDATE_TIME 0.5 - -/* timout in seconds before trying to reconnect (int) */ -#define MPD_RECONNECT_TIMEOUT 3 - - static mpd_client_t *mpc = NULL; static GTimer *timer = NULL; @@ -62,7 +56,7 @@ exit_and_cleanup(void) void catch_sigint( int sig ) { - printf( "\nExiting...\n"); + printf( _("\nExiting...\n")); exit(EXIT_SUCCESS); } @@ -73,6 +67,13 @@ main(int argc, const char *argv[]) struct sigaction act; gboolean connected; + /* initialize i18n support */ +#ifdef ENABLE_NLS + setlocale(LC_MESSAGES, ""); + bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR); + textdomain(GETTEXT_PACKAGE); +#endif + /* initialize options */ options = options_init(); @@ -85,7 +86,7 @@ main(int argc, const char *argv[]) /* check key bindings */ if( check_key_bindings() ) { - fprintf(stderr, "Confusing key bindings - exiting!\n"); + fprintf(stderr, _("Confusing key bindings - exiting!\n")); exit(EXIT_FAILURE); } @@ -149,7 +150,7 @@ main(int argc, const char *argv[]) } else if( mpc_error(mpc) ) { - screen_status_printf("Lost connection to %s", options->host); + screen_status_printf(_("Lost connection to %s"), options->host); connected = FALSE; doupdate(); mpd_clearError(mpc->connection); @@ -179,14 +180,14 @@ main(int argc, const char *argv[]) else if( options->reconnect ) { sleep(MPD_RECONNECT_TIMEOUT); - screen_status_printf("Connecting to %s... [Press Ctrl-C to abort]", + screen_status_printf(_("Connecting to %s... [Press Ctrl-C to abort]"), options->host); if( mpc_reconnect(mpc, options->host, options->port, options->password) == 0 ) { - screen_status_printf("Connected to %s!", options->host); + screen_status_printf(_("Connected to %s!"), options->host); connected = TRUE; } doupdate();