diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-07-21 20:42:51 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-07-21 21:04:17 +0200 |
commit | 20502200d9450cbbf6701ac726af247c3d5f63c6 (patch) | |
tree | 4d843881be753187f987eae282b394dafe823835 | |
parent | e6de4f11e76abc0386fdf321b8a2f7a38899a47e (diff) | |
download | nncmpp-20502200d9450cbbf6701ac726af247c3d5f63c6.tar.gz nncmpp-20502200d9450cbbf6701ac726af247c3d5f63c6.tar.xz nncmpp-20502200d9450cbbf6701ac726af247c3d5f63c6.zip |
Make global search indicate the search terms
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | nncmpp.c | 19 |
3 files changed, 17 insertions, 9 deletions
@@ -1,4 +1,4 @@ -Copyright (c) 2016 - 2023, Přemysl Eric Janouch <p@janouch.name> +Copyright (c) 2016 - 2024, Přemysl Eric Janouch <p@janouch.name> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. @@ -1,3 +1,8 @@ +Unreleased + + * Made global search indicate the search terms + + 2.1.1 (2024-02-27) * Fixed installation of Info tab plugins @@ -1,7 +1,7 @@ /* * nncmpp -- the MPD client you never knew you needed * - * Copyright (c) 2016 - 2023, Přemysl Eric Janouch <p@janouch.name> + * Copyright (c) 2016 - 2024, Přemysl Eric Janouch <p@janouch.name> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted. @@ -3599,17 +3599,21 @@ static void library_tab_on_search_data (const struct mpd_response *response, const struct strv *data, void *user_data) { - (void) user_data; + char *filter = user_data; if (!g_library_tab.searching) - return; + goto out; if (!response->success) - { print_error ("cannot search: %s", response->message_text); - return; + else + { + cstr_set (&g_library_tab.super.header, + xstrdup_printf ("%s: %s", "Global search", filter)); + library_tab_load_data (data); } - library_tab_load_data (data); +out: + free (filter); } static void @@ -3620,9 +3624,8 @@ search_on_changed (void) size_t len; char *u8 = (char *) u32_to_u8 (g.editor.line, g.editor.len + 1, NULL, &len); mpd_client_send_command (c, "search", "any", u8, NULL); - free (u8); - mpd_client_add_task (c, library_tab_on_search_data, NULL); + mpd_client_add_task (c, library_tab_on_search_data, u8); mpd_client_idle (c, 0); } |