diff --git a/src/main.c b/src/main.c
index fa16de1f46dc0e196059f217b12e725fff6689a5..51334f181413b0c5329d1361100b1bd52366e693 100644 (file)
--- a/src/main.c
+++ b/src/main.c
{
const char *host = mpd_settings_get_host(settings);
if (host == NULL)
- host = "unknown";
+ host = _("unknown");
if (host[0] == '/')
return g_strdup(host);
mpd_settings_new(options.host, options.port, 0,
NULL, options.password);
if (settings == NULL)
- return g_strdup("unknown");
+ return g_strdup(_("unknown"));
char *name = settings_name(settings);
mpd_settings_free(settings);
const struct mpd_settings *settings =
mpd_connection_get_settings(connection);
if (settings == NULL)
- return g_strdup("unknown");
+ return g_strdup(_("unknown"));
return settings_name(settings);
#else
(void)connection;
- return g_strdup(options.host);
+
+ /*
+ * localhost is actually not correct, we only know that
+ * mpd_connection_new() has connected to the "default host".
+ */
+ const char *name = options.host ?: "localhost";
+ return g_strdup(name);
#endif
}
mpdclient_disconnect(mpd);
success = mpdclient_connect(mpd,
options.host, options.port,
- 1.5,
+ 5000,
options.password);
if (!success) {
/* try again in 5 seconds */
/**
* This function is called by the gidle.c library when MPD sends us an
- * idle event (or when the connectiond dies).
+ * idle event (or when the connection dies).
*/
static void
idle_callback(enum mpd_error error, enum mpd_server_error server_error,
void *ctx)
{
struct mpdclient *c = ctx;
- struct mpd_connection *connection;
c->idle = false;
- connection = mpdclient_get_connection(c);
- assert(connection != NULL);
+ assert(mpdclient_is_connected(c));
if (error != MPD_ERROR_SUCCESS) {
char *allocated;
{
struct sigaction act;
#ifdef ENABLE_LOCALE
+#ifndef ENABLE_NLS
+ G_GNUC_UNUSED
+#endif
const char *charset = NULL;
#endif
GIOChannel *keyboard_channel;