Code

ncmpc.git
16 years agooptions: use stdbool
Max Kellermann [Thu, 2 Oct 2008 15:47:01 +0000 (17:47 +0200)]
options: use stdbool

Use the standard "bool" type instead of glib's "gboolean".  This way,
options.h doesn't have to include the fat glib.h.

16 years agoremoved the deprecated easy_download library
Max Kellermann [Thu, 2 Oct 2008 14:52:26 +0000 (16:52 +0200)]
removed the deprecated easy_download library

This library isn't being used anymore, delete it.

16 years agomoved default value macros to defaults.h
Max Kellermann [Thu, 2 Oct 2008 14:52:25 +0000 (16:52 +0200)]
moved default value macros to defaults.h

These macros are only used by options.c and conf.c.  Move them to a
common internal header.

16 years agooptions: initialize options.list_format
Max Kellermann [Thu, 2 Oct 2008 14:15:56 +0000 (16:15 +0200)]
options: initialize options.list_format

Instead of checking whether options.list_format is set in the
LIST_FORMAT macro, initialize it once with options.list_format.  Same
for options.status_format / STATUS_FORMAT.

16 years agoremoved the debugging function D()
Max Kellermann [Thu, 2 Oct 2008 13:44:21 +0000 (15:44 +0200)]
removed the debugging function D()

gdb is for debugging.  We don't need D() calls littered all over.

16 years agoscreen_browser: unexport command implementations
Max Kellermann [Thu, 2 Oct 2008 13:30:47 +0000 (15:30 +0200)]
screen_browser: unexport command implementations

When we created created browser_cmd(), several functions of the
screen_browser API weren't used by other sources anymore.  We can now
unexport them.

16 years agoscreen_lyrics: add screen_lyrics_switch()
Max Kellermann [Thu, 2 Oct 2008 13:20:19 +0000 (15:20 +0200)]
screen_lyrics: add screen_lyrics_switch()

screen_lyrics_switch() opens the lyrics screen and displays the lyrics
of the specified song.  This way, the user may view the lyrics of any
song in the database browser.

16 years agoscreen: export function screen_switch()
Max Kellermann [Thu, 2 Oct 2008 13:20:18 +0000 (15:20 +0200)]
screen: export function screen_switch()

Provide an API for switching the currently displayed screen.  Rename
switch_screen_mode() to screen_switch().

16 years agoscreen: no typedefs for methods
Max Kellermann [Thu, 2 Oct 2008 13:20:18 +0000 (15:20 +0200)]
screen: no typedefs for methods

Since the method types are used only once, we do not need typedefs for
that.  Declare the method types within struct screen_functions.

16 years agoscreen_browser: added browser_cmd()
Max Kellermann [Thu, 2 Oct 2008 13:20:18 +0000 (15:20 +0200)]
screen_browser: added browser_cmd()

Merge a lot of code from the 3 browser screen into browser_cmd().

16 years agoscreen_artist: call artist_lw_cmd() at the end of artist_cmd()
Max Kellermann [Thu, 2 Oct 2008 13:20:18 +0000 (15:20 +0200)]
screen_artist: call artist_lw_cmd() at the end of artist_cmd()

By calling artist_lw_cmd() after the big switch, we can override
behaviour, and we can modify the command.

16 years agoscreen_artist: don't call wrefresh() twice
Max Kellermann [Thu, 2 Oct 2008 13:20:18 +0000 (15:20 +0200)]
screen_artist: don't call wrefresh() twice

artist_repaint() calls wrefresh(), don't call it again after
that.

16 years agostrfsong: constant pointers
Max Kellermann [Thu, 2 Oct 2008 13:20:18 +0000 (15:20 +0200)]
strfsong: constant pointers

Pass constant pointers to strfsong() and screen_lyrics_load().

16 years agoscreen: include config.h in screen.h
Max Kellermann [Thu, 2 Oct 2008 13:20:16 +0000 (15:20 +0200)]
screen: include config.h in screen.h

Since screen.h checks the macros from config.h, we have to include it.

16 years agoMakefile.am: don't use $(addprefix ...)
Max Kellermann [Thu, 2 Oct 2008 13:05:47 +0000 (15:05 +0200)]
Makefile.am: don't use $(addprefix ...)

The function "addprefix" is a GNU extension, don't use it.

16 years agoMakefile.am: don't declare $(lyrics_plugin_dir) twice
Max Kellermann [Thu, 2 Oct 2008 13:04:32 +0000 (15:04 +0200)]
Makefile.am: don't declare $(lyrics_plugin_dir) twice

The variable $(lyrics_plugin_dir) was already declared in
configure.ac, don't declare it again in Makefile.am.

16 years agoconfigure.ac: define ENABLE_x_SCREEN instead of DISABLE_x_SCREEN
Max Kellermann [Thu, 2 Oct 2008 12:57:42 +0000 (14:57 +0200)]
configure.ac: define ENABLE_x_SCREEN instead of DISABLE_x_SCREEN

Everybody who uses the ENABLE_ macros has to include ncmpc.h.  We're
better off defining those in config.h via configure.ac.

16 years agoscreen_file: set highlights after screen update
Max Kellermann [Wed, 1 Oct 2008 07:45:05 +0000 (09:45 +0200)]
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.

16 years agoscreen_artist: separate artist and album lists
Max Kellermann [Wed, 1 Oct 2008 07:38:45 +0000 (09:38 +0200)]
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.

16 years agoscreen_artist: replaced update_metalist()
Max Kellermann [Wed, 1 Oct 2008 07:38:27 +0000 (09:38 +0200)]
screen_artist: replaced update_metalist()

Replaced update_metalist() with three specialized functions for mode
switching.

16 years agoscreen_artist: added reload_lists()
Max Kellermann [Wed, 1 Oct 2008 07:38:25 +0000 (09:38 +0200)]
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".

16 years agoscreen_artist: splitted update_metalist()
Max Kellermann [Wed, 1 Oct 2008 07:38:24 +0000 (09:38 +0200)]
screen_artist: splitted update_metalist()

Moved special cases for loading artist, album, song lists to separate
functions.

16 years agoscreen_artist: convert metalist to GPtrArray
Max Kellermann [Wed, 1 Oct 2008 07:37:51 +0000 (09:37 +0200)]
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.

16 years agoscreen_artist: don't insert ".." and "all albums" into list
Max Kellermann [Wed, 1 Oct 2008 07:25:01 +0000 (09:25 +0200)]
screen_artist: don't insert ".." and "all albums" into list

Generate these special list entries on the fly.

16 years agoscreen_artist: moved code to artist_lw_cmd()
Max Kellermann [Wed, 1 Oct 2008 07:24:59 +0000 (09:24 +0200)]
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.

16 years agoscreen_play: no song means id=-1
Max Kellermann [Sun, 28 Sep 2008 08:57:11 +0000 (10:57 +0200)]
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.

16 years agoscreen_play: repaint highlight when mpd starts playing
Max Kellermann [Sun, 28 Sep 2008 08:56:27 +0000 (10:56 +0200)]
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.

16 years agoscreen_play: repaint if current song has changed
Max Kellermann [Fri, 26 Sep 2008 06:48:31 +0000 (08:48 +0200)]
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.

16 years agoignore SIGPIPE
Max Kellermann [Fri, 26 Sep 2008 06:27:54 +0000 (08:27 +0200)]
ignore SIGPIPE

Ignore SIGPIPE, and handle errno==EPIPE instead.

16 years agodon't call lyrics_init if plugin is disabled
Max Kellermann [Thu, 25 Sep 2008 19:51:20 +0000 (21:51 +0200)]
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().

16 years agoscreen_browser: added hotkey for adding song
Max Kellermann [Thu, 25 Sep 2008 19:35:06 +0000 (21:35 +0200)]
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.

16 years agofix miscellaneous sparse warnings
Max Kellermann [Thu, 25 Sep 2008 19:24:58 +0000 (21:24 +0200)]
fix miscellaneous sparse warnings

Static variables, pointers vs integers, void function returning, ...

16 years agoMakefile: added "sparse-check" target
Max Kellermann [Thu, 25 Sep 2008 19:24:57 +0000 (21:24 +0200)]
Makefile: added "sparse-check" target

16 years agoscreen: removed screen.mode
Max Kellermann [Thu, 25 Sep 2008 19:21:29 +0000 (21:21 +0200)]
screen: removed screen.mode

Everything is now managed with a pointer to the screen_functions
struct.

16 years agoscreen: removed screen ids
Max Kellermann [Thu, 25 Sep 2008 19:21:27 +0000 (21:21 +0200)]
screen: removed screen ids

Finally remove all screen ids, they are not used anymore.

16 years agoscreen: pass screen_functions pointer to switch_screen_mode()
Max Kellermann [Thu, 25 Sep 2008 19:21:00 +0000 (21:21 +0200)]
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.

16 years agoscreen: replaced get_cur_mode_id() with screen_is_visible()
Max Kellermann [Thu, 25 Sep 2008 19:20:10 +0000 (21:20 +0200)]
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.

16 years agoscreen: moved code to screen_list.c
Max Kellermann [Thu, 25 Sep 2008 19:20:06 +0000 (21:20 +0200)]
screen: moved code to screen_list.c

Move the hard-coded screen list and everything which works with this
array to screen_list.c.

16 years agoscreen: don't compile disabled sources
Max Kellermann [Thu, 25 Sep 2008 18:00:03 +0000 (20:00 +0200)]
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.

16 years agoscreen_utils: don't call wmove() twice
Max Kellermann [Thu, 25 Sep 2008 17:19:39 +0000 (19:19 +0200)]
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.

16 years agofilelist: removed attribute "updated"
Max Kellermann [Thu, 25 Sep 2008 17:19:37 +0000 (19:19 +0200)]
filelist: removed attribute "updated"

Since all screen updating is now on demand, we don't need this flag
anymore.

16 years agoscreen: don't pass screen pointer to method update()
Max Kellermann [Thu, 25 Sep 2008 16:43:50 +0000 (18:43 +0200)]
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.

16 years agoscreen_play: hide cursor with a timer
Max Kellermann [Thu, 25 Sep 2008 16:42:48 +0000 (18:42 +0200)]
screen_play: hide cursor with a timer

Instead of hiding the cursor in the update() callback, hide it with a
glib main loop timeout.

16 years agoscreen_search: removed update() method
Max Kellermann [Thu, 25 Sep 2008 16:42:44 +0000 (18:42 +0200)]
screen_search: removed update() method

Repaint the search screen on demand.  No need for the update() method
anymore.

16 years agoscreen_search: removed version check from paint() method
Max Kellermann [Thu, 25 Sep 2008 16:38:27 +0000 (18:38 +0200)]
screen_search: removed version check from paint() method

The check wasn't actually doing anything, except leaking memory.
Remove it.

16 years agoconfigure: updated automake options
Max Kellermann [Thu, 25 Sep 2008 15:52:22 +0000 (17:52 +0200)]
configure: updated automake options

New automake options are "gnu 1.6 dist-bzip2".  Sync with Makefile.am.

16 years agolyrics: replaced "hd.py" with "hd.sh"
Max Kellermann [Thu, 25 Sep 2008 15:49:56 +0000 (17:49 +0200)]
lyrics: replaced "hd.py" with "hd.sh"

Replace the "hd" plugin with a trivial shell script.

16 years agoscreen_file: removed update() method
Max Kellermann [Thu, 25 Sep 2008 15:44:57 +0000 (17:44 +0200)]
screen_file: removed update() method

Repaint the file screen on demand.  No need for the update() method
anymore.

16 years agoscreen_artist: removed update() method
Max Kellermann [Thu, 25 Sep 2008 15:44:48 +0000 (17:44 +0200)]
screen_artist: removed update() method

Repaint the artist screen on demand.  No need for the update() method
anymore.

16 years agoscreen_playlist: don't repaint in update()
Max Kellermann [Thu, 25 Sep 2008 15:44:47 +0000 (17:44 +0200)]
screen_playlist: don't repaint in update()

Repaint the playlist window on demand.  Don't repaint it
unconditionally in play_update().

16 years agolist_window: removed property "repaint"
Max Kellermann [Thu, 25 Sep 2008 15:42:57 +0000 (17:42 +0200)]
list_window: removed property "repaint"

The property "repaint" is never read, since all callers repaint the
list window on demand.

16 years agoscreen_lyrics: removed the "update" method
Max Kellermann [Thu, 25 Sep 2008 15:42:55 +0000 (17:42 +0200)]
screen_lyrics: removed the "update" method

Automatically redraw the screen on demand, whenever data has changed.

16 years agoscreen_lyrics: added lyrics_repaint()
Max Kellermann [Thu, 25 Sep 2008 15:42:30 +0000 (17:42 +0200)]
screen_lyrics: added lyrics_repaint()

lyrics_repaint() or lyrics_repaint_if_active() are called after data
has changed, and the screen needs an update.

16 years agoscreen_keydef: removed the update() method
Max Kellermann [Thu, 25 Sep 2008 15:41:01 +0000 (17:41 +0200)]
screen_keydef: removed the update() method

Automatically redraw the list on demand, whenever data has changed.

16 years agoscreen: don't pass screen pointer to method paint()
Max Kellermann [Thu, 25 Sep 2008 15:40:59 +0000 (17:40 +0200)]
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.

16 years agoscreen: don't call wrefresh() in methods paint() and update()
Max Kellermann [Thu, 25 Sep 2008 15:40:36 +0000 (17:40 +0200)]
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.

16 years agolist_window: removed property "clear"
Max Kellermann [Thu, 25 Sep 2008 15:40:29 +0000 (17:40 +0200)]
list_window: removed property "clear"

Without clearing previous screen contents, there may be corruptions,
make this mandatory and optimize screen clearing.

16 years agocode style, indent with tabs X
Max Kellermann [Thu, 25 Sep 2008 15:40:28 +0000 (17:40 +0200)]
code style, indent with tabs X

Follow the same code style als MPD itself.

16 years agoMakefile: don't install disabled lyrics plugins
Max Kellermann [Thu, 25 Sep 2008 14:03:44 +0000 (16:03 +0200)]
Makefile: don't install disabled lyrics plugins

Don't install the lyrics plugins if the lyrics screen is disabled.

16 years agoconfigure: fix default lyrics plugin directory
Max Kellermann [Thu, 25 Sep 2008 13:42:17 +0000 (15:42 +0200)]
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.

16 years agoMakefile: honor DESTDIR
Max Kellermann [Thu, 25 Sep 2008 13:25:09 +0000 (15:25 +0200)]
Makefile: honor DESTDIR

When installing lyrics plugins, I forgot to honor $(DESTDIR) if set.

16 years agolyrics: print text in UTF-8
Max Kellermann [Tue, 23 Sep 2008 11:41:49 +0000 (13:41 +0200)]
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.

16 years agoscreen_play: use list_window_check_selected()
Max Kellermann [Tue, 23 Sep 2008 11:29:25 +0000 (13:29 +0200)]
screen_play: use list_window_check_selected()

Instead of manually adjusting the selection, let list_window.c do it.

16 years agolist_window: converted several public functions to static
Max Kellermann [Tue, 23 Sep 2008 11:29:25 +0000 (13:29 +0200)]
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.

16 years agolyrics: configurable global plugin directory
Max Kellermann [Tue, 23 Sep 2008 11:15:42 +0000 (13:15 +0200)]
lyrics: configurable global plugin directory

The lyrics library loads all plugins from the directory configured
with "--with-lyrics-plugin-dir".

16 years agoconfigure: removed unused lyrics checks
Max Kellermann [Tue, 23 Sep 2008 10:26:18 +0000 (12:26 +0200)]
configure: removed unused lyrics checks

Removed the commented checks for libraries which aren't being used
anymore by the new lyrics code.

16 years agoconfigure: removed gthread test
Max Kellermann [Tue, 23 Sep 2008 10:14:18 +0000 (12:14 +0200)]
configure: removed gthread test

Threading has been disabled when I overhauled lyrics support.  Remove
all libgthread checks from configure.ac.

16 years agolyrics: added callback
Max Kellermann [Tue, 23 Sep 2008 10:08:53 +0000 (12:08 +0200)]
lyrics: added callback

Instead of letting our caller poll lyrics_result(), call it back as
soon as we have the result.

16 years agolyrics: reimplemented with aynchronous I/O
Max Kellermann [Tue, 23 Sep 2008 10:08:16 +0000 (12:08 +0200)]
lyrics: reimplemented with aynchronous I/O

Instead of creating a thread for handling lyrics plugin data, register
a channel at the glib main loop.

16 years agoscreen_lyrics: set current.song
Max Kellermann [Tue, 23 Sep 2008 10:08:14 +0000 (12:08 +0200)]
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()).

16 years agoautogen.sh: don't ignore errors
Max Kellermann [Mon, 22 Sep 2008 08:58:53 +0000 (10:58 +0200)]
autogen.sh: don't ignore errors

Set the shell option "-e" to abort when one of the tools fails.

16 years agooptions: added constant option_table_size
Max Kellermann [Mon, 22 Sep 2008 08:39:01 +0000 (10:39 +0200)]
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.

16 years agooptions: constant options_table
Max Kellermann [Mon, 22 Sep 2008 08:39:01 +0000 (10:39 +0200)]
options: constant options_table

Make the options_table constant, since it is never modified.

16 years agoscreen_utils: simplified call to wreadln_masked()
Max Kellermann [Mon, 22 Sep 2008 08:39:01 +0000 (10:39 +0200)]
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.

16 years agoscreen_utils: hide cursor after screen_read_password()
Max Kellermann [Mon, 22 Sep 2008 08:39:01 +0000 (10:39 +0200)]
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.

16 years agoscreen: unsigned integers for screen dimensions
Max Kellermann [Mon, 22 Sep 2008 08:39:01 +0000 (10:39 +0200)]
screen: unsigned integers for screen dimensions

Store screen width and height as unsigned integer.

16 years agocode style, indent with tabs IX
Max Kellermann [Mon, 22 Sep 2008 08:38:58 +0000 (10:38 +0200)]
code style, indent with tabs IX

Follow the same code style als MPD itself.

16 years agoscreen: simplified CMD_SCREEN_UPDATE handlers
Max Kellermann [Mon, 22 Sep 2008 08:21:34 +0000 (10:21 +0200)]
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.

16 years agoscreen: don't set list_window->repaint
Max Kellermann [Mon, 22 Sep 2008 08:20:57 +0000 (10:20 +0200)]
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.

16 years agoscreen: removed window.cur_action_id
Max Kellermann [Mon, 22 Sep 2008 08:07:00 +0000 (10:07 +0200)]
screen: removed window.cur_action_id

The variable cur_action_id is not used at all.

16 years agoscreen: last_cmd should be a command_t
Max Kellermann [Mon, 22 Sep 2008 08:05:52 +0000 (10:05 +0200)]
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.

16 years agoscreen: moved input_timestamp to screen_play.c
Max Kellermann [Mon, 22 Sep 2008 08:05:48 +0000 (10:05 +0200)]
screen: moved input_timestamp to screen_play.c

Since the input_timestamp is only used by screen_play, move it there.

16 years agoscreen: moved list_window mouse code to list_window.c
Max Kellermann [Mon, 22 Sep 2008 08:04:46 +0000 (10:04 +0200)]
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.

16 years agoscreen: moved code to ncu.c
Max Kellermann [Mon, 22 Sep 2008 08:04:39 +0000 (10:04 +0200)]
screen: moved code to ncu.c

Moved basic libncurses initialization to ncu.c and ncu.h.  Keep
generic code out of screen.c.

16 years agomain: free keyboard IO channel
Max Kellermann [Mon, 22 Sep 2008 08:04:33 +0000 (10:04 +0200)]
main: free keyboard IO channel

Before terminating ncmpc, free the keyboard GIOChannel object.

16 years agoconfigure: modern AC_INIT and AM_INIT_AUTOMAKE invocation
Max Kellermann [Mon, 22 Sep 2008 08:04:32 +0000 (10:04 +0200)]
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.

16 years agoadded option "welcome-screen-list"
David Shakaryan [Mon, 22 Sep 2008 03:59:56 +0000 (05:59 +0200)]
added option "welcome-screen-list"

"welcome-screen-list" shows the screen list in the top row shortly
after startup, and is enabled by default.

16 years agobrowse: ensure that filelist!=NULL
Max Kellermann [Sun, 21 Sep 2008 20:45:08 +0000 (22:45 +0200)]
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.

16 years agobrowser: check if the selection is valid
Max Kellermann [Sun, 21 Sep 2008 20:45:04 +0000 (22:45 +0200)]
browser: check if the selection is valid

Don't call filelist_get() with an invalid index.

16 years agosupport: added assertions
Max Kellermann [Sun, 21 Sep 2008 20:44:47 +0000 (22:44 +0200)]
support: added assertions

Check the function parameters.

16 years agoscreen_artist: check if anything is selected
Max Kellermann [Sun, 21 Sep 2008 20:44:04 +0000 (22:44 +0200)]
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.

16 years agolibmpdclient: added another connection->sock check
Max Kellermann [Sun, 21 Sep 2008 20:43:57 +0000 (22:43 +0200)]
libmpdclient: added another connection->sock check

Check if connection->sock is valid in mpd_executeCommand().

16 years agompdclient: check errorCode only if MPD_ERROR_ACK is set
Max Kellermann [Sun, 21 Sep 2008 20:42:52 +0000 (22:42 +0200)]
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.

16 years agompdclient: fix memory leak in mpdclient_finish_command()
Max Kellermann [Sun, 21 Sep 2008 20:42:51 +0000 (22:42 +0200)]
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).

16 years agocode style, indent with tabs VIII
Max Kellermann [Sun, 21 Sep 2008 20:39:11 +0000 (22:39 +0200)]
code style, indent with tabs VIII

Follow the same code style als MPD itself.

16 years agolibmpdclient: check connection->sock >= 0
Max Kellermann [Sun, 21 Sep 2008 17:48:39 +0000 (19:48 +0200)]
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.

16 years agoadded optional bitrate display to status bar
J. Alexander Treuman [Sun, 21 Sep 2008 17:37:43 +0000 (19:37 +0200)]
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.

16 years agowreadln: adding additional line editing binds
J. Alexander Treuman [Sun, 21 Sep 2008 19:37:42 +0000 (21:37 +0200)]
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.

16 years agoncmpc.1: -k is the short version of --key-file, not -P
J. Alexander Treuman [Sun, 21 Sep 2008 19:37:25 +0000 (21:37 +0200)]
ncmpc.1: -k is the short version of --key-file, not -P

16 years agogenerate po/Makefile.in instead of bundling it
J. Alexander Treuman [Sun, 21 Sep 2008 19:37:03 +0000 (21:37 +0200)]
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.