| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
When the selected screen does not exist, return before calling
close().
|
|
|
|
|
| |
Since the number of screens is known at compile time, define a macro
which calculates this, instead of having a sentinel element.
|
|
|
|
|
| |
Screens which are not active have already been closed, or have never
been opened. Don't call close again on them.
|
|
|
|
|
|
| |
There can only be onle screen struct instance at a time. Declare it
as a static struct, instead of a pointer to the struct. This
simplifies all accesses, and avoids the dynamic allocation.
|
| |
|
|
|
|
|
| |
At startup, mode_fn is initialized with &screen_playlist, and it will
never be reset to NULL. Remove all checks.
|
|
|
|
|
| |
That seems to be a fn->paint was checked, then the code called
fn->update(). Fix this.
|
|
|
|
|
|
| |
If it is really important to set the curser, we should think of a
better way, instead of exporting one non-generic method. For now,
just set the cursor to the origin.
|
|
|
|
|
|
| |
Compile time initialization saves resources, compared to run-time
initialization. Declare all screen_function structs as global
variables, and remove all get functions.
|
|
|
|
| |
Follow the same code style als MPD itself.
|
|
|
|
|
|
| |
Instead of freeing the playlist with mpdclient_playlist_free(), call
playlist_clear() to empty the song list. This fixes a segmentation
fault which occured when you cleared the playlist.
|
|
|
|
|
| |
Due to a missing refresh() call, ncmpc painted the screen after one
second. Add refresh(), make ncmpc display immediately.
|
|
|
|
|
| |
Let us declare struct names in addition to typedef names, so we can
forward-declare them.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In-process plugins are very problematic. It is much easier and
flexible to move the lyrics plugins to external programs, with a
trivial protocol. This is work in progress, among the things missing:
- protocol specification, including exit codes
- plugin installation
- plugin search directory
- run-time configuration (currently hard coded)
- automatic polling (using glib's main loop?)
- better and more robust error handling
|
| |
|
|
|
|
|
|
| |
Added functions like playlist_length(), playlist_get(),
playlist_replace(), playlist_remove(). Don't access the
mpdclient_playlist struct directly.
|
|
|
|
|
|
| |
Moved code from mpdclient_new() and mpdclient_playlist_free(). In
mpdclient_disconnect(), call mpdclient_playlist_clear() instead of
mpdclient_playlist_free() (which is now called in mpdclient_free()).
|
|
|
|
|
|
|
|
|
|
| |
Move everything which manipulates the mpdclient_playlist struct to
playlist.c. Many of the functions get a mpdclient pointer instead of
a playlist; this will be changed later.
The functions mpdclient_playlist_update() and
mpdclient_playlist_update_changes() stay in mpdclient.c for now, since
they are tightly connected to the client code.
|
|
|
|
|
|
| |
Since we compile ncmpc with glib, we can use its slice allocator for
efficient song allocation. I have added a way to disable this with a
macro.
|
|
|
|
|
| |
Use a forward declared struct mpd_song instead of the typedef
mpd_Song.
|
|
|
|
|
| |
Move everything which manipulates the mpd_Song struct to song.c.
Thousands of lines of too much for libmpdclient.c!
|
|
|
|
|
|
|
| |
To relax the include dependencies, give all structs real names, in
addition to the typedef names. This way, other headers can
forward-declare them, and do not need to include mpdclient.h. In the
future, the typedefs will be removed.
|
|
|
|
| |
Pass const pointers whenever possible.
|
|
|
|
| |
Follow the same code style als MPD itself.
|
|
|
|
|
| |
Apparently, somebody was too lazy to derive the formulas for cursor
movement, and wrote lots of while loops.
|
|
|
|
| |
Include only headers which are really used.
|
|
|
|
| |
Fix the type of write_data() to fit curl_write_callback.
|
|
|
|
|
|
| |
Using a doubly linked list for the local playlist copy is a huge waste
of both memory and CPU cycles. Use GArray instead of GList, which is
much faster in this case.
|
|
|
|
|
|
| |
Memory leak: the function mpdclient_playlist_update_changes() did not
free the entity which was returned by mpd_getNextInfoEntity(). Add a
mpd_freeInfoEntity() call at the end of each iteration.
|
|
|
|
|
|
| |
There are many duplicated strings in the tag database, e.g. many songs
having the same artist. Don't allocate such strings twice, manage all
strings in a pool.
|
|
|
|
|
|
| |
If a host name starts with a slash, it is assumed to be a unix domain
socket path. The port is ignored. This code is disabled on WIN32,
until someone tests it.
|
|
|
|
| |
If get_text_line() fails, we should break from the loop.
|
|
|
|
|
|
| |
The variables "lyrics_text_rows" and "lw" were declared in
src_lyrics.h as static, but they were only actually used in
screen_lyrics.c. Move both there.
|
|
|
|
|
| |
Add the "unused" attribute to all function parameters which are indeed
going to be ignored.
|
|
|
|
| |
gcc.h contains a useful set of macros for setting attributes.
|
|
|
|
|
|
|
|
|
| |
In main.c, the global variable "options" is used all over, except in
main(), which contains a shadowing declaration of it. Remove this
local variable, and use the global "options" instead. Also don't
pollute conf.c's namespace with the global variable with a CPP hack
(to be removed when we have fixed more of ncmpc's namespace
pollution).
|
| |
|
|
|
|
|
| |
Although they are allowedd in C99, try to avoid them. Move variable
declarations to the top of the current scope.
|
|
|
|
|
| |
Rename local variables and function parameters, so they don't shadow
global variables.
|
|
|
|
|
|
| |
A header should include all headers which he needs. Move local
includes on top, and let foo.c include foo.h in the first line, to
automatically test its dependencies.
|
|
|
|
|
|
| |
screen_auth() returns an int, and its result is actually being used.
Only the "return" was missing in its implementation. Return
_screen_auth()'s result.
|
|
|
|
|
|
| |
Add missing prototypes, and fix wrong prototypes. Convert lots of
functions to "static" when they are only used within the current
source file.
|
|
|
|
|
| |
Convert pointers to const whenever it is possible. Fixes all those
-Wconst warnings.
|
|
|
|
|
|
| |
Uninitialized static variables are put into BSS, which is
automatically zeroed. Initializing doesn't hurt, but in this case,
there were elements missing, emitting a gcc warning.
|
|
|
|
|
|
| |
Nearly all of the code in paint_top_window() is on indent level 2,
just because it depends on a condition. Make this more readable and
move to indent level 1 by moving this code to a separate function.
|
|
|
|
|
| |
NDEBUG is more commonly used than DEBUG, e.g. in assert.h. Convert
all macros to NDEBUG, and declare NDEBUG when debugging is disabled.
|
|
|
|
|
|
|
| |
Follow the same code style als MPD itself. This patch only fixes
parts of the code which are going to be touched in the following bunch
of patches, i.e. there will be more "code style" patches in the
future.
|
|
|
|
| |
Also remove some commented code and unused function parameters.
|
|
|
|
|
| |
The code looks strange and spews lots of warnings. Since it does
nothing useful, and wastes the user's precious time, simply remove it.
|
|
|
|
| |
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@7141 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|