diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-03 14:58:01 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-03 15:04:30 +0200 |
commit | b5e48c29f9c111b0ff9bc7d58d850125db82b203 (patch) | |
tree | ab0251f2684d125a80f49f05c5ba2c447be48a9d | |
parent | eaa19be1c84a772eb17356fd9e7bef673b76d477 (diff) | |
download | nncmpp-b5e48c29f9c111b0ff9bc7d58d850125db82b203.tar.gz nncmpp-b5e48c29f9c111b0ff9bc7d58d850125db82b203.tar.xz nncmpp-b5e48c29f9c111b0ff9bc7d58d850125db82b203.zip |
Put connecting/disconnected messages in status bar
Those are general status messages, and seem to belong to the bottom.
Partially motivated by the status bar being empty when disconnected.
And add a missing window invalidation.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | nncmpp.c | 30 |
2 files changed, 14 insertions, 18 deletions
@@ -12,6 +12,8 @@ Unreleased * Made it possible to adjust the spectrum analyzer's FPS limit + * Moved "Disconnected" and "Connecting..." messages to the status bar + * Fixed possibility of connection timeouts with PulseAudio integration @@ -1982,28 +1982,17 @@ app_layout_tabs (void) static void app_layout_header (void) { + if (g.client.state == MPD_CONNECTED) { - struct layout l = {}; - app_push_fill (&l, g.ui->padding (APP_ATTR (NORMAL), 0, 0.125)); - app_flush_layout (&l); - } + struct layout lt = {}; + app_push_fill (<, g.ui->padding (APP_ATTR (NORMAL), 0, 0.125)); + app_flush_layout (<); - switch (g.client.state) - { - case MPD_CONNECTED: app_layout_status (); - break; - case MPD_CONNECTING: - app_layout_text ("Connecting to MPD...", APP_ATTR (NORMAL)); - break; - case MPD_DISCONNECTED: - app_layout_text ("Disconnected", APP_ATTR (NORMAL)); - } - { - struct layout l = {}; - app_push_fill (&l, g.ui->padding (APP_ATTR (NORMAL), 0, 0.125)); - app_flush_layout (&l); + struct layout lb = {}; + app_push_fill (&lb, g.ui->padding (APP_ATTR (NORMAL), 0, 0.125)); + app_flush_layout (&lb); } app_layout_tabs (); @@ -2273,6 +2262,10 @@ app_layout_statusbar (void) } else if (g.client.state == MPD_CONNECTED) app_layout_mpd_status (); + else if (g.client.state == MPD_CONNECTING) + app_layout_text ("Connecting to MPD...", attrs[0]); + else if (g.client.state == MPD_DISCONNECTED) + app_layout_text ("Disconnected", attrs[0]); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -5010,6 +5003,7 @@ app_on_reconnect (void *user_data) mpd_queue_reconnect (); } free (address); + app_invalidate (); } // --- TUI --------------------------------------------------------------------- |