Code

list_window: scroll down exactly one page at PGDN
[ncmpc.git] / src / main.c
index fa16de1f46dc0e196059f217b12e725fff6689a5..51334f181413b0c5329d1361100b1bd52366e693 100644 (file)
@@ -240,7 +240,7 @@ settings_name(const struct mpd_settings *settings)
 {
        const char *host = mpd_settings_get_host(settings);
        if (host == NULL)
-               host = "unknown";
+               host = _("unknown");
 
        if (host[0] == '/')
                return g_strdup(host);
@@ -262,7 +262,7 @@ default_settings_name(void)
                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);
@@ -280,12 +280,18 @@ connection_settings_name(const struct mpd_connection *connection)
        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
 }
 
@@ -312,7 +318,7 @@ timer_reconnect(G_GNUC_UNUSED gpointer data)
        mpdclient_disconnect(mpd);
        success = mpdclient_connect(mpd,
                                    options.host, options.port,
-                                   1.5,
+                                   5000,
                                    options.password);
        if (!success) {
                /* try again in 5 seconds */
@@ -374,7 +380,7 @@ check_reconnect(void)
 
 /**
  * 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,
@@ -382,12 +388,10 @@ 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;
@@ -540,6 +544,9 @@ main(int argc, const char *argv[])
 {
        struct sigaction act;
 #ifdef ENABLE_LOCALE
+#ifndef ENABLE_NLS
+       G_GNUC_UNUSED
+#endif
        const char *charset = NULL;
 #endif
        GIOChannel *keyboard_channel;