| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
browser_get_selected() checks if there is a file list and a valid
selection, and returns the selected entry.
|
|
|
|
| |
Fix a memory leak: the concatened list was never freed.
|
|
|
|
| |
Avoid direct accesses to the filelist struct, provide an API for that.
|
|
|
|
|
| |
The separate filelist library does not depend on mpdclient, so the
prefix is superfluous.
|
|
|
|
|
| |
A song should not be twice in the browser. Simplify set_highlight()
by finding the entry with mpdclient_filelist_find_song().
|
|
|
|
|
| |
The caller must not pass NULL to set_highlight(). Replaced check with
assertion.
|
|
|
|
|
| |
A caller must not pass NULL to mpdclient_filelist_find_song().
Replace the check with an assertion.
|
|
|
|
|
|
|
|
| |
Move everything which is solely filelist related to filelist.c and
filelist.h. Fix the indentation of that file, and provide the struct
name "filelist". Don't clear data in mpdclient_filelist_free() before
calling g_free(). Constify the "song" parameter to
mpdclient_filelist_find_song().
|
|
|
|
| |
Follow the same code style als MPD itself.
|
|
|
|
|
|
|
|
|
|
|
| |
When I replaced ncmpc's old main loop with g_main_loop from libglib,
SIGWINCH (i.e. window resizing) stopped working. This regression was
caused by the fact that ncurses' wgetch() function was only called
when there was actually data on STDIN. wgetch() has several side
effects besides reading data from STDIN, for example it checks whether
there has been a window resize.
Fix this with a custom SIGWINCH handler.
|
|
|
|
| |
Why should an audio player display a large clock?
|
|
|
|
|
| |
It is guaranteed that the "song" attribute is not NULL, remove the
check.
|
|
|
|
|
|
| |
browser_select_entry() checked the entry's "highlight" flag twice: the
first time, it was toggled, and the second time, action was performed
based on the flag. Merge the two checks.
|
|
|
|
|
| |
The function browser_select_entry() returns early when the entity type
is not "SONG". No need to double check that.
|
|
|
|
|
|
| |
Moved code from browser_handle_select(). Call this new function also
from browser_handle_select_all(). This fixes a bug in select_all():
it actually did not select all, but stopped after the first song.
|
| |
|
|
|
|
|
| |
Merge code from all 3 browser screens into one generic browser
function.
|
|
|
|
| |
Isolate the generic browser code from the directory browser.
|
|
|
|
|
| |
We are going to separate the browser functions from screen_file.c.
Move all variables which are going to be needed by this code.
|
| |
|
|
|
|
| |
Follow the same code style als MPD itself.
|
|
|
|
|
|
|
|
| |
This patch was taken from bug 476, author unknown
(http://www.musicpd.org/mantis/view.php?id=476). It changes the
definition of my_strlen(): instead of returning the number of UTF-8
characters, it counts the number of terminal cells occupied by a
string.
|
|
|
|
| |
Follow the same code style als MPD itself.
|
|
|
|
|
|
|
|
|
|
| |
CMD_PLAY is mapped to the Enter key by default. Some screens
(mis-)use it for navigation, for entering a directory. The playlist
screen actually plays the file under the cursor. On all other
screens, pressing Enter may be confusing, since it is more of a
"confirmation" key instead of "play". We should probaby add
CMD_CONFIRM later, but for now, disable the general CMD_PLAY handler
in screen.c. This fixes bug 240.
|
|
|
|
|
|
|
| |
The resolver library provides unified access to all resolvers
(getaddrinfo(), gethostbyname(), Unix domain sockets). Like
getaddrinfo(), it can return more than one address for a host name.
This fixes bug 1517 (http://www.musicpd.org/mantis/view.php?id=1517).
|
|
|
|
|
| |
Call g_main_loop_quit() on CMD_QUIT, instead of exit() with an
atexit() handler.
|
|
|
|
|
|
| |
The playlist is reset when the connection to the MPD server is
closed. After a successful reconnect, we have to reload the full
playlist. To remember this, also reset the id attribute.
|
|
|
|
|
| |
The caller may check the playlist.id instead of checking the old
"updated" flag.
|
|
|
|
|
|
|
|
|
|
| |
This big patch replaces our custom main loop with the event based glib
main loop. This has several advantages: we can make all the tiny code
bits in the main loop independent from each others, we can add
additional file descriptors for polling (e.g. the mpdclient socket).
We don't need the ncurses timeout() anymore, because glib will poll
stdin for us.
|
|
|
|
|
|
| |
Fix several segmentation faults: when the connection to the MPD server
is lost, there were NULL pointer dereferences because
client->status==NULL. Check before accessing it.
|
|
|
|
|
|
| |
Move all command handlers which need a connection to the MPD server to
screen_client_cmd(). This will allow us to unify error handling
later.
|
|
|
|
|
|
|
|
| |
Display the UI always, and show connection errors there. This fixes a
lot of consistency problems: error messages used to be printed to
stderr, but afterwards, the atexit() handlers deinitialized ncurses
and the screen was cleared. This patch is still problematic, but
constitutes a good step forward.
|
|
|
|
|
|
| |
Create generic utility functions for doint I/O: two wait functions,
and mpd_recv() fills the input buffer. These functions are used in
mpd_newConnection() and mpd_getNextReturnElement().
|
|
|
|
|
| |
Even for large responses, 16kB should be enough. There is no
performance gain for larger buffers, even if MPD is local.
|
|
|
|
|
|
|
| |
512 characters should be well enough for error messages which are
actually being displayed somewhere. Use sizeof(errorStr) instead of
MPD_BUFFER_MAX_LENGTH everywhere. Do proper length checking when
copying the output buffer to errorStr.
|
|
|
|
|
|
|
| |
In general, don't treat the input buffer as a null-terminated string:
don't append '\0', don't use strchr() and strtok(). To delete
consumed portions of the buffer, strcpy() is bad anyway, because it
does not allow overlapping buffers.
|
|
|
|
|
| |
Why bother duplicating the buffer, when we can simply parse the
response directly from the input buffer?
|
|
|
|
|
|
| |
When working with buffer lengths and recv() results, we should declare
size_t and ssize_t variables, otherwise the code may fail on 64 bit
machines.
|
|
|
|
|
| |
Declaring empty methods is of no use. If a method is empty, we should
set it to NULL in the screen_functions struct.
|
|
|
|
|
| |
Since the screen's initialization is guaranteed, we can remove the
NULL check in center_playing_item().
|
|
|
|
|
|
| |
Unfortunately when I fixed the GCC warnings and refactored lots of the
code, the "artist" screen was disabled. This patch applies all API
changes and fixes all warnings.
|
|
|
|
| |
Follow the same code style als MPD itself.
|
|
|
|
|
| |
When deselecting a song in the file browser, the local variable "idx"
was initialized and overwritten. Remove the initialization.
|
|
|
|
|
|
|
|
|
|
| |
playlist_remove_reuse() removes a song from the playlist, but does not
free it.
Use this function in mpdclient_cmd_delete() to fix a segmentation
fault: the song pointer was still used after it was freed, by passing
it to mpdclient_playlist_callback(). Free the song manually now.
Reorganize and simply some code in mpdclient_cmd_delete().
|
| |
|
| |
|
|
|
|
|
| |
Since the list_window code sets highlight to 0 before it calls the
list_callback, the callback itself doesn't have to reset the flag.
|
|
|
|
|
| |
current.lines is always initialized, and cannot be NULL, no need to
check it.
|
| |
|
|
|
|
|
| |
Why bother counting the elements of help_text[] (with sentinel) at
runtime, when the compiler can do it at compile time?
|