use g_ascii_strdown() instead of the custom lowerstr()
Don't duplicate code which is already provided by glib.
Don't duplicate code which is already provided by glib.
list_window: removed unused macro "LW_ROW"
screen_browser: added constant playlist_format
Moved the format string for playlist files to the constant
"playlist_format".
Moved the format string for playlist files to the constant
"playlist_format".
fix compiler errors without locale.h
The code did not compile when HAVE_LOCALE_H was not set. Also don't
compile all that code in charset.c, when there is no locale.h.
The code did not compile when HAVE_LOCALE_H was not set. Also don't
compile all that code in charset.c, when there is no locale.h.
screen_lyrics: character set conversion
Convert the lyrics to the current character set before displaying
them.
Convert the lyrics to the current character set before displaying
them.
charset: convert strings with fallback
Use g_convert_with_fallback() for charset conversion, and don't print
a status bar message on error.
Use g_convert_with_fallback() for charset conversion, and don't print
a status bar message on error.
charset: charset_init() returns character set
Don't pass "noconvert" to charset_init(). Let charset_init()
determine that with g_get_charset() and return its name.
Don't pass "noconvert" to charset_init(). Let charset_init()
determine that with g_get_charset() and return its name.
charset: renamed my_strlen() to utf8_width()
my_strlen() is a bad name for the function, since the return value is
not a length, but a visible width on the screen. Rename it to
utf8_width() and change its return type to "unsigned".
my_strlen() is a bad name for the function, since the return value is
not a length, but a visible width on the screen. Rename it to
utf8_width() and change its return type to "unsigned".
moved code to charset.c
Move everything which deals with UTF-8 strings and character set
conversion to charset.c, header charset.h.
Move everything which deals with UTF-8 strings and character set
conversion to charset.c, header charset.h.
moved macros from ncmpc.h to main.c and screen.c
Moved constants which are only used in one source file. Remove
several unused macros.
Moved constants which are only used in one source file. Remove
several unused macros.
removed LIST_FORMAT, STATUS_FORMAT
Use options.list_format and options.status_format directly instead of
these two macros.
Use options.list_format and options.status_format directly instead of
these two macros.
moved i18n macros to i18n.h
Don't make everybody include ncmpc.h just to have generic features.
Move generic i18n macros to a separate header.
Don't make everybody include ncmpc.h just to have generic features.
Move generic i18n macros to a separate header.
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.
Use the standard "bool" type instead of glib's "gboolean". This way,
options.h doesn't have to include the fat glib.h.
removed the deprecated easy_download library
This library isn't being used anymore, delete it.
This library isn't being used anymore, delete it.
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.
These macros are only used by options.c and conf.c. Move them to a
common internal header.
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.
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.
removed the debugging function D()
gdb is for debugging. We don't need D() calls littered all over.
gdb is for debugging. We don't need D() calls littered all over.
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.
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.
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.
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.
screen: export function screen_switch()
Provide an API for switching the currently displayed screen. Rename
switch_screen_mode() to screen_switch().
Provide an API for switching the currently displayed screen. Rename
switch_screen_mode() to screen_switch().
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.
Since the method types are used only once, we do not need typedefs for
that. Declare the method types within struct screen_functions.
screen_browser: added browser_cmd()
Merge a lot of code from the 3 browser screen into browser_cmd().
Merge a lot of code from the 3 browser screen into browser_cmd().
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.
By calling artist_lw_cmd() after the big switch, we can override
behaviour, and we can modify the command.
screen_artist: don't call wrefresh() twice
artist_repaint() calls wrefresh(), don't call it again after
that.
artist_repaint() calls wrefresh(), don't call it again after
that.
strfsong: constant pointers
Pass constant pointers to strfsong() and screen_lyrics_load().
Pass constant pointers to strfsong() and screen_lyrics_load().
screen: include config.h in screen.h
Since screen.h checks the macros from config.h, we have to include it.
Since screen.h checks the macros from config.h, we have to include it.
Makefile.am: don't use $(addprefix ...)
The function "addprefix" is a GNU extension, don't use it.
The function "addprefix" is a GNU extension, don't use it.
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.
The variable $(lyrics_plugin_dir) was already declared in
configure.ac, don't declare it again in Makefile.am.
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.
Everybody who uses the ENABLE_ macros has to include ncmpc.h. We're
better off defining those in config.h via configure.ac.
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.