summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3737363)
raw | patch | inline | side by side (parent: 3737363)
author | Max Kellermann <max.kellermann@gmail.com> | |
Wed, 2 Aug 2017 07:26:04 +0000 (09:26 +0200) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Wed, 2 Aug 2017 07:35:39 +0000 (09:35 +0200) |
src/screen_queue.c | patch | blob | history |
diff --git a/src/screen_queue.c b/src/screen_queue.c
index a5383fa19927d6536db98f7f60cc0aff7450415a..7bb30aefd79973a292d74c63a5739fd97ae3f763 100644 (file)
--- a/src/screen_queue.c
+++ b/src/screen_queue.c
static struct list_window *lw;
static guint timer_hide_cursor_id;
+static struct queue_screen_data {
+ unsigned last_connection_id;
+ char *connection_name;
+} queue_screen;
+
static void
screen_queue_paint(void);
screen_queue_exit(void)
{
list_window_free(lw);
-}
-
-/**
- * Extract the host portion (without the optional password) from the
- * MPD_HOST string.
- */
-static const char *
-host_without_password(const char *host)
-{
- const char *separator = strchr(host, '@');
- if (separator != NULL && separator != host && separator[1] != 0)
- host = separator + 1;
-
- return host;
+ g_free(queue_screen.connection_name);
}
static const char *
screen_queue_title(char *str, size_t size)
{
- if (options.host == NULL)
- return _("Queue");
-
- g_snprintf(str, size, _("Queue on %s"),
- host_without_password(options.host));
+ g_snprintf(str, size, _("Queue on %s"), queue_screen.connection_name);
return str;
}
static void
screen_queue_update(struct mpdclient *c)
{
+ if (c->connection_id != queue_screen.last_connection_id) {
+ queue_screen.last_connection_id = c->connection_id;
+ g_free(queue_screen.connection_name);
+ queue_screen.connection_name = mpdclient_settings_name(c);
+ }
+
if (c->events & MPD_IDLE_QUEUE)
screen_queue_restore_selection();
else