screen_file: set highlights after screen update
Due to a missing sync_highlights() call, highlights were gone when the
user pressed the "update" hot key.
Due to a missing sync_highlights() call, highlights were gone when the
user pressed the "update" hot key.
screen_artist: separate artist and album lists
"metalist" can have different meanings, depending on the mode.
Replace it with two separate variables "artist_list" and "album_list".
This way, we can optimize screen updates later.
"metalist" can have different meanings, depending on the mode.
Replace it with two separate variables "artist_list" and "album_list".
This way, we can optimize screen updates later.
screen_artist: replaced update_metalist()
Replaced update_metalist() with three specialized functions for mode
switching.
Replaced update_metalist() with three specialized functions for mode
switching.
screen_artist: added reload_lists()
Some callers of update_metalist() want to reload the list contents.
Add an optimized function reload_lists() which does not modify the
global variables "mode", "artist", "album".
Some callers of update_metalist() want to reload the list contents.
Add an optimized function reload_lists() which does not modify the
global variables "mode", "artist", "album".
screen_artist: splitted update_metalist()
Moved special cases for loading artist, album, song lists to separate
functions.
Moved special cases for loading artist, album, song lists to separate
functions.
screen_artist: convert metalist to GPtrArray
A linked list is quite uncomfortable here because there is a lot of
indexed access to the list. Use a GPtrArray of strings instead.
Note that mpdclient_get_artists_utf8() and mpdclient_get_albums_utf8()
return a linked list, and sorting is also performed on the linked
list. This will be optimized later.
A linked list is quite uncomfortable here because there is a lot of
indexed access to the list. Use a GPtrArray of strings instead.
Note that mpdclient_get_artists_utf8() and mpdclient_get_albums_utf8()
return a linked list, and sorting is also performed on the linked
list. This will be optimized later.
screen_artist: don't insert ".." and "all albums" into list
Generate these special list entries on the fly.
Generate these special list entries on the fly.
screen_artist: moved code to artist_lw_cmd()
To unify the code, wrap list_window_cmd() in artist_lw_cmd(), which
properly checks the current mode.
To unify the code, wrap list_window_cmd() in artist_lw_cmd(), which
properly checks the current mode.
screen_play: no song means id=-1
"prev_song_id" and "current_song_id" had value 0 if MPD was not
playing at all. This way, ncmpc cannot see the difference between
"song 0 playing" and "not playing". Change "not playing" to -1.
"prev_song_id" and "current_song_id" had value 0 if MPD was not
playing at all. This way, ncmpc cannot see the difference between
"song 0 playing" and "not playing". Change "not playing" to -1.
screen_play: repaint highlight when mpd starts playing
When deciding whether to repaint the current highlight, test if MPD is
actually playing. If MPD starts playing, repaint.
When deciding whether to repaint the current highlight, test if MPD is
actually playing. If MPD starts playing, repaint.
screen_play: repaint if current song has changed
The play_update() function was reduced too much: it didn't repaint the
screen when the current song changed. Add check for that.
Don't repaint the screen in center_playing_item(), make the caller do
it.
The play_update() function was reduced too much: it didn't repaint the
screen when the current song changed. Add check for that.
Don't repaint the screen in center_playing_item(), make the caller do
it.
ignore SIGPIPE
Ignore SIGPIPE, and handle errno==EPIPE instead.
Ignore SIGPIPE, and handle errno==EPIPE instead.
don't call lyrics_init if plugin is disabled
If the lyrics screen is disabled at compile time, don't initialize the
lyrics library in main().
If the lyrics screen is disabled at compile time, don't initialize the
lyrics library in main().
screen_browser: added hotkey for adding song
CMD_ADD ('a') appends a song to the playlist, no matter if it is
already there, i.e. unlike CMD_SELECT, it does not toggle the song.
CMD_ADD ('a') appends a song to the playlist, no matter if it is
already there, i.e. unlike CMD_SELECT, it does not toggle the song.
fix miscellaneous sparse warnings
Static variables, pointers vs integers, void function returning, ...
Static variables, pointers vs integers, void function returning, ...
Makefile: added "sparse-check" target
screen: removed screen.mode
Everything is now managed with a pointer to the screen_functions
struct.
Everything is now managed with a pointer to the screen_functions
struct.
screen: removed screen ids
Finally remove all screen ids, they are not used anymore.
Finally remove all screen ids, they are not used anymore.
screen: pass screen_functions pointer to switch_screen_mode()
Trying to get rid of the screen ids. A pointer to screen_functions is
better for identifying a screen.
Trying to get rid of the screen ids. A pointer to screen_functions is
better for identifying a screen.
screen: replaced get_cur_mode_id() with screen_is_visible()
Screen code shouldn't know anything about the screen ids (which will
be eliminated completely later). Instead of comparing ids, compare
the screen_functions pointer.
Screen code shouldn't know anything about the screen ids (which will
be eliminated completely later). Instead of comparing ids, compare
the screen_functions pointer.
screen: moved code to screen_list.c
Move the hard-coded screen list and everything which works with this
array to screen_list.c.
Move the hard-coded screen list and everything which works with this
array to screen_list.c.
screen: don't compile disabled sources
Instead of evaluating macros from config.h in the disabled source,
don't start the compiler on it at all.
Instead of evaluating macros from config.h in the disabled source,
don't start the compiler on it at all.
screen_utils: don't call wmove() twice
The second wmove() is redundant, because the cursor is already there
after waddstr(). This also repairs wide characters in the prompt.
The second wmove() is redundant, because the cursor is already there
after waddstr(). This also repairs wide characters in the prompt.
filelist: removed attribute "updated"
Since all screen updating is now on demand, we don't need this flag
anymore.
Since all screen updating is now on demand, we don't need this flag
anymore.
screen: don't pass screen pointer to method update()
play_update() is the only update() implementation left, and it does
not use the screen pointer. Remove it from the method signature.
play_update() is the only update() implementation left, and it does
not use the screen pointer. Remove it from the method signature.
screen_play: hide cursor with a timer
Instead of hiding the cursor in the update() callback, hide it with a
glib main loop timeout.
Instead of hiding the cursor in the update() callback, hide it with a
glib main loop timeout.
screen_search: removed update() method
Repaint the search screen on demand. No need for the update() method
anymore.
Repaint the search screen on demand. No need for the update() method
anymore.
screen_search: removed version check from paint() method
The check wasn't actually doing anything, except leaking memory.
Remove it.
The check wasn't actually doing anything, except leaking memory.
Remove it.
configure: updated automake options
New automake options are "gnu 1.6 dist-bzip2". Sync with Makefile.am.
New automake options are "gnu 1.6 dist-bzip2". Sync with Makefile.am.
lyrics: replaced "hd.py" with "hd.sh"
Replace the "hd" plugin with a trivial shell script.
Replace the "hd" plugin with a trivial shell script.
screen_file: removed update() method
Repaint the file screen on demand. No need for the update() method
anymore.
Repaint the file screen on demand. No need for the update() method
anymore.
screen_artist: removed update() method
Repaint the artist screen on demand. No need for the update() method
anymore.
Repaint the artist screen on demand. No need for the update() method
anymore.
screen_playlist: don't repaint in update()
Repaint the playlist window on demand. Don't repaint it
unconditionally in play_update().
Repaint the playlist window on demand. Don't repaint it
unconditionally in play_update().
list_window: removed property "repaint"
The property "repaint" is never read, since all callers repaint the
list window on demand.
The property "repaint" is never read, since all callers repaint the
list window on demand.
screen_lyrics: removed the "update" method
Automatically redraw the screen on demand, whenever data has changed.
Automatically redraw the screen on demand, whenever data has changed.
screen_lyrics: added lyrics_repaint()
lyrics_repaint() or lyrics_repaint_if_active() are called after data
has changed, and the screen needs an update.
lyrics_repaint() or lyrics_repaint_if_active() are called after data
has changed, and the screen needs an update.
screen_keydef: removed the update() method
Automatically redraw the list on demand, whenever data has changed.
Automatically redraw the list on demand, whenever data has changed.
screen: don't pass screen pointer to method paint()
None of the paint() implementations actually use the screen pointer -
remove it from the method signature.
None of the paint() implementations actually use the screen pointer -
remove it from the method signature.
screen: don't call wrefresh() in methods paint() and update()
screen_paint() and screen_update() are responsible for refreshing the
screen. We can remove all wrefresh() and wnoutrefresh() invocations
from all paint() and update() method implementations.
screen_paint() and screen_update() are responsible for refreshing the
screen. We can remove all wrefresh() and wnoutrefresh() invocations
from all paint() and update() method implementations.
list_window: removed property "clear"
Without clearing previous screen contents, there may be corruptions,
make this mandatory and optimize screen clearing.
Without clearing previous screen contents, there may be corruptions,
make this mandatory and optimize screen clearing.
code style, indent with tabs X
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
Makefile: don't install disabled lyrics plugins
Don't install the lyrics plugins if the lyrics screen is disabled.
Don't install the lyrics plugins if the lyrics screen is disabled.
configure: fix default lyrics plugin directory
When the user does not specify "--prefix", ${prefix} is "NONE". This
breaks the default lyrics plugin directory, which was
"${prefix}/lib/ncmpc/lyrics". Fall back to ${ac_default_prefix} if
${prefix} is NONE.
When the user does not specify "--prefix", ${prefix} is "NONE". This
breaks the default lyrics plugin directory, which was
"${prefix}/lib/ncmpc/lyrics". Fall back to ${ac_default_prefix} if
${prefix} is NONE.
Makefile: honor DESTDIR
When installing lyrics plugins, I forgot to honor $(DESTDIR) if set.
When installing lyrics plugins, I forgot to honor $(DESTDIR) if set.
lyrics: print text in UTF-8
Python defaults to sending ASCII characters, and aborts if there are
non-ASCII characters in the string. Unfortunately, due to "C.UTF-8"
being not defined, we cannot reliably make Python use UTF-8, without
further locale settings. Thus, work around this mess by manually
encoding the result to UTF-8 in the script.
Python defaults to sending ASCII characters, and aborts if there are
non-ASCII characters in the string. Unfortunately, due to "C.UTF-8"
being not defined, we cannot reliably make Python use UTF-8, without
further locale settings. Thus, work around this mess by manually
encoding the result to UTF-8 in the script.
screen_play: use list_window_check_selected()
Instead of manually adjusting the selection, let list_window.c do it.
Instead of manually adjusting the selection, let list_window.c do it.
list_window: converted several public functions to static
There are lots of functions not being used outside of list_window.c.
Make them static to make it easier for gcc to optimize.
There are lots of functions not being used outside of list_window.c.
Make them static to make it easier for gcc to optimize.
lyrics: configurable global plugin directory
The lyrics library loads all plugins from the directory configured
with "--with-lyrics-plugin-dir".
The lyrics library loads all plugins from the directory configured
with "--with-lyrics-plugin-dir".
configure: removed unused lyrics checks
Removed the commented checks for libraries which aren't being used
anymore by the new lyrics code.
Removed the commented checks for libraries which aren't being used
anymore by the new lyrics code.
configure: removed gthread test
Threading has been disabled when I overhauled lyrics support. Remove
all libgthread checks from configure.ac.
Threading has been disabled when I overhauled lyrics support. Remove
all libgthread checks from configure.ac.
lyrics: added callback
Instead of letting our caller poll lyrics_result(), call it back as
soon as we have the result.
Instead of letting our caller poll lyrics_result(), call it back as
soon as we have the result.
lyrics: reimplemented with aynchronous I/O
Instead of creating a thread for handling lyrics plugin data, register
a channel at the glib main loop.
Instead of creating a thread for handling lyrics plugin data, register
a channel at the glib main loop.
screen_lyrics: set current.song
The variable current.song was never set, thus the cache did not work.
Don't reset it in screen_lyrics_clear() (which is called from
screen_lyrics_set()).
The variable current.song was never set, thus the cache did not work.
Don't reset it in screen_lyrics_clear() (which is called from
screen_lyrics_set()).
autogen.sh: don't ignore errors
Set the shell option "-e" to abort when one of the tools fails.
Set the shell option "-e" to abort when one of the tools fails.
options: added constant option_table_size
Instead of checking for the sentinel at the end of the option table,
check the option_table_size constant.
Instead of checking for the sentinel at the end of the option table,
check the option_table_size constant.
options: constant options_table
Make the options_table constant, since it is never modified.
Make the options_table constant, since it is never modified.
screen_utils: simplified call to wreadln_masked()
If prompt is NULL, do not add a second call to wreadln_masked() with a
literal string, but assign this literal string to the variable
"prompt". This saves several bytes in the compiled binary.
If prompt is NULL, do not add a second call to wreadln_masked() with a
literal string, but assign this literal string to the variable
"prompt". This saves several bytes in the compiled binary.
screen_utils: hide cursor after screen_read_password()
The call to curs_set(0) in screen_read_password() was dead code,
because it was after the function return. Repair that.
The call to curs_set(0) in screen_read_password() was dead code,
because it was after the function return. Repair that.
screen: unsigned integers for screen dimensions
Store screen width and height as unsigned integer.
Store screen width and height as unsigned integer.
code style, indent with tabs IX
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
screen: simplified CMD_SCREEN_UPDATE handlers
Since screen.c has default code for CMD_SCREEN_UPDATE, return 0 from
the command handlers and let screen.c do the rest.
Since screen.c has default code for CMD_SCREEN_UPDATE, return 0 from
the command handlers and let screen.c do the rest.
screen: don't set list_window->repaint
Several screens ignore the attribute list_window->repaint. Don't set
it there. It will be replaced with a more intelligent repaint
algorithm later.
Several screens ignore the attribute list_window->repaint. Don't set
it there. It will be replaced with a more intelligent repaint
algorithm later.
screen: removed window.cur_action_id
The variable cur_action_id is not used at all.
The variable cur_action_id is not used at all.
screen: last_cmd should be a command_t
last_cmd stores the previous command sent to the screen. It is not a
timestamp, and its type should be command_t.
last_cmd stores the previous command sent to the screen. It is not a
timestamp, and its type should be command_t.
screen: moved input_timestamp to screen_play.c
Since the input_timestamp is only used by screen_play, move it there.
Since the input_timestamp is only used by screen_play, move it there.
screen: moved list_window mouse code to list_window.c
Move the portion of screen_get_mouse_event() which handles list_window
clicks to list_window.c. The code contained a NULL pointer
dereference, which is now fixed.
Move the portion of screen_get_mouse_event() which handles list_window
clicks to list_window.c. The code contained a NULL pointer
dereference, which is now fixed.
screen: moved code to ncu.c
Moved basic libncurses initialization to ncu.c and ncu.h. Keep
generic code out of screen.c.
Moved basic libncurses initialization to ncu.c and ncu.h. Keep
generic code out of screen.c.
main: free keyboard IO channel
Before terminating ncmpc, free the keyboard GIOChannel object.
Before terminating ncmpc, free the keyboard GIOChannel object.
configure: modern AC_INIT and AM_INIT_AUTOMAKE invocation
Provide program name and version in AC_INIT. Add the option
"dist-bzip2" to AM_INIT_AUTOMAKE.
Provide program name and version in AC_INIT. Add the option
"dist-bzip2" to AM_INIT_AUTOMAKE.
added option "welcome-screen-list"
"welcome-screen-list" shows the screen list in the top row shortly
after startup, and is enabled by default.
"welcome-screen-list" shows the screen list in the top row shortly
after startup, and is enabled by default.
browse: ensure that filelist!=NULL
There are several places where browser.filelist can become NULL.
Catch that everywhere and generate an empty filelist in this case.
There are several places where browser.filelist can become NULL.
Catch that everywhere and generate an empty filelist in this case.
browser: check if the selection is valid
Don't call filelist_get() with an invalid index.
Don't call filelist_get() with an invalid index.
support: added assertions
Check the function parameters.
Check the function parameters.
screen_artist: check if anything is selected
Don't try to call add_query() with no valid selection, this causes a
segfault. This usually happens when ncmpc isn't connected.
Don't try to call add_query() with no valid selection, this causes a
segfault. This usually happens when ncmpc isn't connected.
libmpdclient: added another connection->sock check
Check if connection->sock is valid in mpd_executeCommand().
Check if connection->sock is valid in mpd_executeCommand().
mpdclient: check errorCode only if MPD_ERROR_ACK is set
connection->errorCode has an undefined value when connection->error is
not MPD_ERROR_ACK. Read it only if MPD_ERROR_ACK is set, to make
valgrind happy.
connection->errorCode has an undefined value when connection->error is
not MPD_ERROR_ACK. Read it only if MPD_ERROR_ACK is set, to make
valgrind happy.
mpdclient: fix memory leak in mpdclient_finish_command()
During authentication, the message pointer was allocated, but never
freed. Allocate it only if it is really used (and freed).
During authentication, the message pointer was allocated, but never
freed. Allocate it only if it is really used (and freed).
code style, indent with tabs VIII
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
libmpdclient: check connection->sock >= 0
mpd_wait() must not be called when the socket is dead; add an
assertion there. In mpd_recv(), add a run-time check.
mpd_wait() must not be called when the socket is dead; add an
assertion there. In mpd_recv(), add a run-time check.
added optional bitrate display to status bar
If visible-bitrate is enabled, then the current bitrate will be drawn next
to the song time in the status bar. By default it will not be displayed.
If visible-bitrate is enabled, then the current bitrate will be drawn next
to the song time in the status bar. By default it will not be displayed.
wreadln: adding additional line editing binds
Adding some GNU readline-style binds. These are ^B/^F to move the cursor
back/forward, and ^N/^P to go to the next/previous line.
Adding some GNU readline-style binds. These are ^B/^F to move the cursor
back/forward, and ^N/^P to go to the next/previous line.
ncmpc.1: -k is the short version of --key-file, not -P
generate po/Makefile.in instead of bundling it
The previously bundled po/Makefile.in would use predefined variables that
should be set by the configure script. f.e., $prefix was defined as
/usr/local, and caused po files to always be installed there instead of in
the prefix given to ./configure.
The previously bundled po/Makefile.in would use predefined variables that
should be set by the configure script. f.e., $prefix was defined as
/usr/local, and caused po files to always be installed there instead of in
the prefix given to ./configure.
configure.ac: don't enable the lyrics screen by default
The configure help text already said the lyrics screen was disabled by
default. Now it actually will be.
The configure help text already said the lyrics screen was disabled by
default. Now it actually will be.
autogen: don't run ./configure if $NOCONFIGURE is set
mpdclient: don't call screen_status_message()
The caller should decide how to display error messages.
The caller should decide how to display error messages.
Adding crop feature in ncmpc
The "crop" command deletes all songs from the playlist, except the one
currently being played.
The "crop" command deletes all songs from the playlist, except the one
currently being played.
screen_help: removed update() method
Why redraw the help screen when nothing has changed? Redraw it only
after help_cmd(), and when explicitly requested (help_paint()).
Why redraw the help screen when nothing has changed? Redraw it only
after help_cmd(), and when explicitly requested (help_paint()).
filelist: fix segfault during filelist_sort()
When I converted the filelist from GList to GPtrArray, I missed that
the GCompareFunc does not actually get the pointers from
g_ptr_array_sort(), but pointers to the pointers... run
g_ptr_array_sort_with_data() instead with a wrapper function.
When I converted the filelist from GList to GPtrArray, I missed that
the GCompareFunc does not actually get the pointers from
g_ptr_array_sort(), but pointers to the pointers... run
g_ptr_array_sort_with_data() instead with a wrapper function.
filelist: free entries with g_slice_free()
Somehow I forgot about changing free() to g_slice_free() in the
previous patch...
Somehow I forgot about changing free() to g_slice_free() in the
previous patch...
filelist: allocate entries with g_slice_alloc()
In this case, slices are faster. Also fix a memory leak in
filelist_prepend() which I simply forgot about in the last patch set.
In this case, slices are faster. Also fix a memory leak in
filelist_prepend() which I simply forgot about in the last patch set.
properly configure M4 macro dir
Add information about the M4 macro dir ./m4/ to both configure.ac and
Makefile.am.
Add information about the M4 macro dir ./m4/ to both configure.ac and
Makefile.am.
filelist: use GPtrArray instead of GList
Since we do a lot of indexed accesses to the filelist, a linked list
doesn't seem appropriate. Use GPtrArray instead.
Since we do a lot of indexed accesses to the filelist, a linked list
doesn't seem appropriate. Use GPtrArray instead.
browser: added function browser_get_selected()
browser_get_selected() checks if there is a file list and a valid
selection, and returns the selected entry.
browser_get_selected() checks if there is a file list and a valid
selection, and returns the selected entry.
screen_search: free second file list
Fix a memory leak: the concatened list was never freed.
Fix a memory leak: the concatened list was never freed.
filelist: provide more functions for working with a filelist
Avoid direct accesses to the filelist struct, provide an API for that.
Avoid direct accesses to the filelist struct, provide an API for that.
filelist: drop "mpdclient" prefix
The separate filelist library does not depend on mpdclient, so the
prefix is superfluous.
The separate filelist library does not depend on mpdclient, so the
prefix is superfluous.
browser: use mpdclient_filelist_find_song() in set_highlight()
A song should not be twice in the browser. Simplify set_highlight()
by finding the entry with mpdclient_filelist_find_song().
A song should not be twice in the browser. Simplify set_highlight()
by finding the entry with mpdclient_filelist_find_song().
browser: song must not be NULL in set_highlight()
The caller must not pass NULL to set_highlight(). Replaced check with
assertion.
The caller must not pass NULL to set_highlight(). Replaced check with
assertion.
filelist: song must not be NULL
A caller must not pass NULL to mpdclient_filelist_find_song().
Replace the check with an assertion.
A caller must not pass NULL to mpdclient_filelist_find_song().
Replace the check with an assertion.