Code

ncmpc.git
16 years agoMakefile.am: removed superfluous $(docdir) variable
Max Kellermann [Mon, 17 Nov 2008 21:00:35 +0000 (22:00 +0100)]
Makefile.am: removed superfluous $(docdir) variable

16 years agoremoved ChangeLog, added release dates to NEWS
Max Kellermann [Mon, 17 Nov 2008 21:00:31 +0000 (22:00 +0100)]
removed ChangeLog, added release dates to NEWS

The ChangeLog is useless, because it hasn't been updated in a while,
and due to the nature of git, the log will never be lost.

Switch to automake "foreign" mode, because "gnu" mandates the presence
of ChangeLog.

16 years agoREADME, TODO: removed outdated documentation
Max Kellermann [Mon, 17 Nov 2008 21:00:27 +0000 (22:00 +0100)]
README, TODO: removed outdated documentation

Removed the "Upgrading to ncmpc-0.11.0" section from README.  Deleted
the TODO file.

16 years agoINSTALL: mention C99 compiler requirements
Max Kellermann [Mon, 17 Nov 2008 21:00:26 +0000 (22:00 +0100)]
INSTALL: mention C99 compiler requirements

ncmpc uses C99 features.

16 years agoINSTALL: replaced generic instructions
Max Kellermann [Mon, 17 Nov 2008 21:00:03 +0000 (22:00 +0100)]
INSTALL: replaced generic instructions

Removed the generic GNU installation instructions, nobody will ever
bother to read this lengthy document.  Moved installation instructions
from README.

16 years agoNEWS update for 0.12~alpha1
Max Kellermann [Mon, 17 Nov 2008 20:52:46 +0000 (21:52 +0100)]
NEWS update for 0.12~alpha1

16 years agoconfigure.ac: enable artist screen by default
Max Kellermann [Mon, 17 Nov 2008 20:52:34 +0000 (21:52 +0100)]
configure.ac: enable artist screen by default

The artist screen has matured, and everybody should have it by
default.

16 years agoMakefile.am: added screen_play.h to $(ncmpc_headers)
Max Kellermann [Mon, 17 Nov 2008 20:52:00 +0000 (21:52 +0100)]
Makefile.am: added screen_play.h to $(ncmpc_headers)

screen_play.h was missing in the tarball.

16 years agopo: regenerated ncmpc.pot
Max Kellermann [Mon, 17 Nov 2008 20:51:03 +0000 (21:51 +0100)]
po: regenerated ncmpc.pot

16 years agopo: updated POTFILES.in
Max Kellermann [Mon, 17 Nov 2008 19:07:22 +0000 (20:07 +0100)]
po: updated POTFILES.in

Added new sources, removed screen_clock.c.

16 years agopo: improved russian translation
Max Arnold [Mon, 17 Nov 2008 18:03:06 +0000 (19:03 +0100)]
po: improved russian translation

16 years agoscreen_utils: check for NULL password
Max Kellermann [Mon, 17 Nov 2008 17:28:57 +0000 (18:28 +0100)]
screen_utils: check for NULL password

Fix a NULL pointer dereference and a memory leak: check if
screen_read_password() returns NULL, and don't call
mpd_sendPasswordCommand(NULL) in this case.  Free the password
when done.

16 years agolirc: refactored event handler
Thomas Jansen [Mon, 10 Nov 2008 13:13:46 +0000 (14:13 +0100)]
lirc: refactored event handler

 * moved lirc_event to lirc.c and split out the parts that depend on
   variables in main.c into three separate functions
 * changed keyboard_event accordingly to avoid duplicate code
 * merged lirc_event with ncmpc_lirc_get_command

16 years agoconfigure.ac: require autoconf 2.60
Max Kellermann [Fri, 7 Nov 2008 16:13:00 +0000 (17:13 +0100)]
configure.ac: require autoconf 2.60

16 years agompdclient: use g_utf8_collate()
Max Kellermann [Fri, 7 Nov 2008 15:37:32 +0000 (16:37 +0100)]
mpdclient: use g_utf8_collate()

Use one g_utf8_collate() call instead of g_utf8_collate_key() twice
plus strcmp().

16 years agowreadln: return NULL instead of empty string
Max Kellermann [Fri, 7 Nov 2008 15:17:21 +0000 (16:17 +0100)]
wreadln: return NULL instead of empty string

No wreadln() caller cares about an empty string.  Simplify the callers
by returning NULL instead of an allocated empty string.  This fixes
several memory leaks.

16 years agompdclient: removed _utf8 suffix from function names
Max Kellermann [Fri, 7 Nov 2008 15:17:21 +0000 (16:17 +0100)]
mpdclient: removed _utf8 suffix from function names

All functions must receive UTF-8 file names.  Delete all which still
work with locale strings, and remove the _utf8 suffix from the others.

16 years agompdclient: expect UTF-8 strings
Max Kellermann [Fri, 7 Nov 2008 15:14:39 +0000 (16:14 +0100)]
mpdclient: expect UTF-8 strings

Don't convert the character set of strings to and from the current
locale.  This library cannot know what the strings are going to be
used for, so it should not mess with them.

16 years agoscreen_search: fixed 2 memory leaks
Max Kellermann [Fri, 7 Nov 2008 15:14:32 +0000 (16:14 +0100)]
screen_search: fixed 2 memory leaks

Free the old pattern before prompting for a new one.  Free the old
filelist object before retrieving the new one.

16 years agoscreen_play: free the wreadln() return value
Max Kellermann [Fri, 7 Nov 2008 15:13:40 +0000 (16:13 +0100)]
screen_play: free the wreadln() return value

16 years agoscreen_browser: free g_path_get_dirname() return value
Max Kellermann [Fri, 7 Nov 2008 14:28:56 +0000 (15:28 +0100)]
screen_browser: free g_path_get_dirname() return value

The function browser_change_directory() did not free the return value
of g_path_get_dirname().

16 years agoscreen_file: optimized title formula
Max Kellermann [Fri, 7 Nov 2008 14:20:35 +0000 (15:20 +0100)]
screen_file: optimized title formula

Don't allocate and copy memory.

16 years agomain: optimized error_msg()
Max Kellermann [Fri, 7 Nov 2008 13:01:06 +0000 (14:01 +0100)]
main: optimized error_msg()

The pointer has already been checked for NULL, eliminate that check.

16 years agoMakefile.am: added custom rule with -fwhole-program
Max Kellermann [Fri, 7 Nov 2008 12:42:31 +0000 (13:42 +0100)]
Makefile.am: added custom rule with -fwhole-program

To make the ncmpc binary even smaller, you can compile all sources at
once with "--combine -fwhole-program".  Unfortunately, automake does
not support this mode.  For further experiments, this patch adds a
custom rule which creates the binary named "ncmpc-tiny" this way.

16 years agoconfigure.ac, Makefile.am: removed subversion keywords
Max Kellermann [Fri, 7 Nov 2008 12:37:58 +0000 (13:37 +0100)]
configure.ac, Makefile.am: removed subversion keywords

Removed $Id$.

16 years agodisable more features with --enable-mini
Max Kellermann [Fri, 7 Nov 2008 12:27:31 +0000 (13:27 +0100)]
disable more features with --enable-mini

Disable lots of smaller features which don't have a separate configure
option:
- xterm title
- screen list
- horizontal scrolling
- MPD version number check
- key binding checks
- character set conversion
- bitrate display
- highlighting in the file browser
- completion / history

16 years agoconfigure.ac: remove misplaced comma
Max Kellermann [Fri, 7 Nov 2008 12:27:29 +0000 (13:27 +0100)]
configure.ac: remove misplaced comma

16 years agocommand.h: include config.h
Max Kellermann [Fri, 7 Nov 2008 12:23:24 +0000 (13:23 +0100)]
command.h: include config.h

The source command.h checks for configure.ac options, so it needs to
include config.h.

16 years agocharset: don't allocate GError
Max Kellermann [Fri, 7 Nov 2008 12:22:45 +0000 (13:22 +0100)]
charset: don't allocate GError

Since the GError return value of g_convert_*() is ignored by ncmpc, we
don't need to retrieve it at all.

16 years agooptions: don't store disabled options
Max Kellermann [Fri, 7 Nov 2008 07:30:18 +0000 (08:30 +0100)]
options: don't store disabled options

Options which are disabled at compile time shouldn't reserve space for
their values in the options struct.

16 years agooptions: static initialization if possible
Max Kellermann [Fri, 7 Nov 2008 07:29:23 +0000 (08:29 +0100)]
options: static initialization if possible

Initialize the options struct statically.

16 years agooptions: removed deprecated options
Max Kellermann [Fri, 7 Nov 2008 07:28:53 +0000 (08:28 +0100)]
options: removed deprecated options

"reconnect" is always enabled.  "debug" code has been removed.

16 years agoconfigure.ac: added --disable-help-screen
Max Kellermann [Fri, 7 Nov 2008 07:27:14 +0000 (08:27 +0100)]
configure.ac: added --disable-help-screen

16 years agoconfigure.ac: added --disable-nls
Max Kellermann [Fri, 7 Nov 2008 07:25:51 +0000 (08:25 +0100)]
configure.ac: added --disable-nls

Option --disable-nls disables all NLS features, even if the system
supports it.

16 years agoconfigure.ac: added option --enable-mini
Max Kellermann [Fri, 7 Nov 2008 07:24:13 +0000 (08:24 +0100)]
configure.ac: added option --enable-mini

The option --enable-mini disables lots of features, and tries to
create a ncmpc binary which fits on very small machines.

16 years agoconfigure.ac: renamed $use_wide to $enable_wide
Max Kellermann [Fri, 7 Nov 2008 07:17:04 +0000 (08:17 +0100)]
configure.ac: renamed $use_wide to $enable_wide

16 years agoconfigure.ac: removed deprecated result line
Max Kellermann [Fri, 7 Nov 2008 07:17:01 +0000 (08:17 +0100)]
configure.ac: removed deprecated result line

16 years agoconfigure.ac: added LIRC configure switch
Max Kellermann [Fri, 7 Nov 2008 07:16:53 +0000 (08:16 +0100)]
configure.ac: added LIRC configure switch

Detect liblircclient with pkg-config.

16 years agolirc: pass writable string to lirc_init()
Max Kellermann [Fri, 7 Nov 2008 07:16:46 +0000 (08:16 +0100)]
lirc: pass writable string to lirc_init()

The "prog" argument of lirc_init() expects a non-const string.
Pass a local string variable.

16 years agonative LIRC support for ncmpc
Thomas Jansen [Fri, 7 Nov 2008 07:16:41 +0000 (08:16 +0100)]
native LIRC support for ncmpc

The attachment includes the patch and a sample .lircrc config for
testing purposes (i. e. only a few commands are mapped to IR events).
The config is rather simple to write: For each button add a block like
this to ~/.lircrc:

begin
     button = <button name from /etc/lircd.conf>
     prog = ncmpc
     config = <command name from src/command.c>
end

The patch is not finished, there are several problems that still need to
be solved:

1. the configure.ac modifications are just for testing purposes and
should be made optional with a parameter like --enable-lirc
for ./configure. Unfortunately I'm not an expert on autoconfig tools.

2. LIRC example code [1] suggests looping over lirc_code2char, probably
to have multiple actions that can be triggered from one button. Perhaps
lirc_event(...) should be moved to lirc.c and be heavily modified, no
longer being a mere copy of keyboard_event(...).

16 years agoMakefile.am: require automake 1.9
Max Kellermann [Fri, 7 Nov 2008 07:16:39 +0000 (08:16 +0100)]
Makefile.am: require automake 1.9

Makefile.am uses several features which are not available in the
ancient automake version 1.6.  Let's just raise the bar to 1.9.

16 years agoconfigure.ac: disable libtool
Max Kellermann [Fri, 7 Nov 2008 07:11:20 +0000 (08:11 +0100)]
configure.ac: disable libtool

libtool isn't required for the ncmpc build process, it only causes
massive slowdown.

16 years agoconfigure.ac: disabled the C++ and fortran checks
Max Kellermann [Tue, 14 Oct 2008 20:48:54 +0000 (22:48 +0200)]
configure.ac: disabled the C++ and fortran checks

Why check for C++ and fortran compilers?  This hack was borrowed from
Qball's gmpc git repository.

16 years agoscreen_browser: fix warning when lyrics screen is disabled
Max Kellermann [Wed, 8 Oct 2008 10:44:45 +0000 (12:44 +0200)]
screen_browser: fix warning when lyrics screen is disabled

A local variable was only used by the lyrics screen code.  Put #ifdef
around its declaration.

16 years agowreadln: support wide characters
Max Kellermann [Mon, 6 Oct 2008 15:03:31 +0000 (17:03 +0200)]
wreadln: support wide characters

wreadln() didn't distinguish narrow from wide characters, which
resulted in display corruption.  This patch adds a lot of internal
conversions between byte positions, screen positions and character
position, which hopefully fixes all these bugs.  Since these
conversions are quite expensive, the code should be revised and
optimized.

16 years agowreadln: wait for complete multibyte sequence in wreadln_insert_byte()
Max Kellermann [Mon, 6 Oct 2008 14:57:44 +0000 (16:57 +0200)]
wreadln: wait for complete multibyte sequence in wreadln_insert_byte()

For multibyte input, we should use wget_wch(), but this function isn't
supported properly on some platforms.  Add a patch which completes a
multibyte character with multiple non-blocking reads.  We'll see how
portable this hack is...

16 years agowreadln: don't use cursor_move_right() in insert_byte()
Max Kellermann [Mon, 6 Oct 2008 14:55:35 +0000 (16:55 +0200)]
wreadln: don't use cursor_move_right() in insert_byte()

After a byte has been inserted, move the cursor right by just one
byte, not one character.  The byte may have been the first one in a
multibyte character.

16 years agoconfigure.ac: added option --disable-wide
Max Kellermann [Mon, 6 Oct 2008 14:54:54 +0000 (16:54 +0200)]
configure.ac: added option --disable-wide

The configure option "--disable-wide" disables wide character support.
This simplifies lots of internal calculations and makes the ncmpc
binary leaner.

16 years agoinclude ncursesw/ncurses.h if available
Max Kellermann [Mon, 6 Oct 2008 14:03:24 +0000 (16:03 +0200)]
include ncursesw/ncurses.h if available

When compiling with libncursesw, include <ncursesw/ncurses.h> instead
of <ncurses.h> (if available).

16 years agowreadln: optimize wreadln_delete_char() with memmove()
Max Kellermann [Mon, 6 Oct 2008 12:56:18 +0000 (14:56 +0200)]
wreadln: optimize wreadln_delete_char() with memmove()

Let memmove() do the dirty work on overlapping buffers..

16 years agowreadln: moved code to wreadln_delete()
Max Kellermann [Mon, 6 Oct 2008 12:56:15 +0000 (14:56 +0200)]
wreadln: moved code to wreadln_delete()

Remove some more clutter from wreadln() by merging the duplicate
character deletion code to wreadln_delete_char().

16 years agowreadln: return early from cursor movement functions
Max Kellermann [Mon, 6 Oct 2008 12:56:13 +0000 (14:56 +0200)]
wreadln: return early from cursor movement functions

Unclutter these functions by removing one indent level.

16 years agowreadln: use unsigned integers and size_t
Max Kellermann [Mon, 6 Oct 2008 12:56:08 +0000 (14:56 +0200)]
wreadln: use unsigned integers and size_t

Declare all screen position variables as "unsigned", and all buffer
positions as "size_t".  We don't need signed values.

16 years agowreadln: use memcpy() for both cases
Max Kellermann [Mon, 6 Oct 2008 12:55:31 +0000 (14:55 +0200)]
wreadln: use memcpy() for both cases

Use memcpy() even when the cursor is at the end.  It copies only the
trailing null terminator in this case.

The constant "length" is declared here in preparation for the "wide
character" patches.

16 years agowreadln: use memmove() instead of an temporary buffer
Max Kellermann [Mon, 6 Oct 2008 12:55:31 +0000 (14:55 +0200)]
wreadln: use memmove() instead of an temporary buffer

memmove() handles overlapping buffers well, we can use it to get room
for the inserted character.

16 years agowreadln: moved code to insert_byte()
Max Kellermann [Mon, 6 Oct 2008 12:55:31 +0000 (14:55 +0200)]
wreadln: moved code to insert_byte()

Remove some clutter from wreadln(), isolate some code into a function.

16 years agowreadln: static buffer
Max Kellermann [Mon, 6 Oct 2008 12:55:20 +0000 (14:55 +0200)]
wreadln: static buffer

Since the buffer size is already known at compile time, don't do a
second malloc() for it, declare it statically in struct wreadln.  This
way, it is going to be allocated on the stack.

16 years agowreadln: added struct wreadln
Max Kellermann [Mon, 6 Oct 2008 12:55:01 +0000 (14:55 +0200)]
wreadln: added struct wreadln

Don't pass a dozen of parameters to all internal functions; pass a
pointer to the wreadln struct instead.

16 years agowreadln: removed parameter "x1"
Max Kellermann [Mon, 6 Oct 2008 12:38:22 +0000 (14:38 +0200)]
wreadln: removed parameter "x1"

Several internal functions calculate the width of the input field by
subtracting "x0" from "x1", although the width is already being passed
to them.  Eliminate the parameter "x1" in all functions, and use
"width" instead.

16 years agowreadln: convert public globals to local constants
Max Kellermann [Mon, 6 Oct 2008 12:36:29 +0000 (14:36 +0200)]
wreadln: convert public globals to local constants

Convert wrln_max_line_size and wrln_max_history_length to local
constants.  They have no real use outside of wreadln.c.

16 years agowreadln: import screen_bell() from screen_utils.h
Max Kellermann [Mon, 6 Oct 2008 12:34:49 +0000 (14:34 +0200)]
wreadln: import screen_bell() from screen_utils.h

Don't use "extern" outside of the headers, include the proper header
instead.

16 years agocode style, indent with tabs XII
Max Kellermann [Mon, 6 Oct 2008 12:34:09 +0000 (14:34 +0200)]
code style, indent with tabs XII

Follow the same code style als MPD itself.

16 years agoremoved my_wgetch(), switch to wgetch()
Max Kellermann [Mon, 6 Oct 2008 12:32:29 +0000 (14:32 +0200)]
removed my_wgetch(), switch to wgetch()

There are no special cases left for my_wgetch() to handle.  We can
remove it and use the original wgetch() instead.

16 years agodisable ncurses raw mode
Max Kellermann [Mon, 6 Oct 2008 12:31:33 +0000 (14:31 +0200)]
disable ncurses raw mode

We're better off doing our own signal handling, instead of switching
ncurses to raw mode.  Anyway, it was commented out and didn't work...

16 years agowreadln: removed the disabled ncursesw code
Max Kellermann [Mon, 6 Oct 2008 12:30:14 +0000 (14:30 +0200)]
wreadln: removed the disabled ncursesw code

The wide character version of wreadln() is currently a non-functional
mess.  Remove it for now, I will reimplement that later.

16 years agoscreen: declare time constants as GTime
Max Kellermann [Sat, 4 Oct 2008 10:23:51 +0000 (12:23 +0200)]
screen: declare time constants as GTime

Variables which store integer seconds should be declared as GTime.
This fixes a gcc warning.

16 years agoDo not include libgen.h, it is unneeded after commit 44ecb.
Emanuele Giaquinta [Sat, 4 Oct 2008 10:23:47 +0000 (12:23 +0200)]
Do not include libgen.h, it is unneeded after commit 44ecb.

16 years agouse g_basename() instead of basename()
Max Kellermann [Sat, 4 Oct 2008 10:23:29 +0000 (12:23 +0200)]
use g_basename() instead of basename()

Another occurence of the non-portable basename() wasn't converted to
glib yet.

16 years agostore MPD_UPDATE_TIME as guint
Max Kellermann [Fri, 3 Oct 2008 13:35:58 +0000 (15:35 +0200)]
store MPD_UPDATE_TIME as guint

The glib function g_timeout_add() wants the interval as guint in
milliseconds.  Store the update interval in this form, instead of
having to multiply MPD_UPDATE_TIME with 1000.

16 years agodon't initialize sigaction struct twice
Max Kellermann [Fri, 3 Oct 2008 13:24:01 +0000 (15:24 +0200)]
don't initialize sigaction struct twice

Don't reset sa_mask and sa_flags after every sigaction() call.  Do it
once.

16 years agorestart system call after SIGWINCH
Max Kellermann [Fri, 3 Oct 2008 13:23:51 +0000 (15:23 +0200)]
restart system call after SIGWINCH

Set option SA_RESTART for the SIGWINCH handler.  The screen resizer
function is called by the glib main loop anyway, no need to interrupt
any random system call here.

16 years agotypo: ignore SIGPIPE instead of SIGWINCH
Max Kellermann [Fri, 3 Oct 2008 13:23:46 +0000 (15:23 +0200)]
typo: ignore SIGPIPE instead of SIGWINCH

Somehow the "ignore SIGPIPE" patch had a fatal typo: instead of
ignoring SIGPIPE, it ignored SIGWINCH.  Somehow ncurses managed to
hide the bug's symptoms, but a recent patch finally broke it.  Repair
the typo.

16 years agoscreen: export the global variable "screen"
Max Kellermann [Fri, 3 Oct 2008 12:31:00 +0000 (14:31 +0200)]
screen: export the global variable "screen"

screen_t is a singleton.  We do not have to pass it around
everywhere.  Export the one global variable.

16 years agoscreen: don't pass mpdclient pointer to method paint()
Max Kellermann [Fri, 3 Oct 2008 12:30:59 +0000 (14:30 +0200)]
screen: don't pass mpdclient pointer to method paint()

None of the paint() implementations acutally uses the mpdclient
pointer.  Remove it from the method signature.

16 years agoscreen_play: remember playlist
Max Kellermann [Fri, 3 Oct 2008 12:30:08 +0000 (14:30 +0200)]
screen_play: remember playlist

Remove the last paint() dependency on the mpdclient pointer: remember
a pointer to the playlist object, and don't take it from mpdclient
every time we paint.  Also add the variable "current_song_id" which is
calculated in update().

16 years agoscreen: removed "painted" flag
Max Kellermann [Fri, 3 Oct 2008 12:28:49 +0000 (14:28 +0200)]
screen: removed "painted" flag

Repaint immediately instead of setting "painted=0".

16 years agoremoved KEY_RESIZE
Max Kellermann [Fri, 3 Oct 2008 12:28:43 +0000 (14:28 +0200)]
removed KEY_RESIZE

Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE
from ncurses.  Remove it.

16 years agoscreen_search: array index is tag id
Max Kellermann [Fri, 3 Oct 2008 12:28:42 +0000 (14:28 +0200)]
screen_search: array index is tag id

Save some bytes again: remove search_tag.id, make the array index
equal to the tag id.

16 years agodon't import mpdclient_finish_command() twice
Max Kellermann [Fri, 3 Oct 2008 12:26:29 +0000 (14:26 +0200)]
don't import mpdclient_finish_command() twice

mpdclient_finish_command() is already imported by mpdclient.h, don't
do it again in the sources.

16 years agoscreen_search: removed the FUTURE macro
Max Kellermann [Fri, 3 Oct 2008 12:26:27 +0000 (14:26 +0200)]
screen_search: removed the FUTURE macro

The future is now!

16 years agooptions: don't initialize with memset(0)
Max Kellermann [Fri, 3 Oct 2008 12:26:00 +0000 (14:26 +0200)]
options: don't initialize with memset(0)

Global variables are already initialized with zero when the program
starts, don't memset(0) again.

16 years agooptions: don't pass the "options" pointer around
Max Kellermann [Fri, 3 Oct 2008 12:25:45 +0000 (14:25 +0200)]
options: don't pass the "options" pointer around

Just make everybody use the global "options" variable.  This
eliminates namespace confusion and the NO_GLOBAL_OPTIONS hack.

16 years agocolors: make color support optional at compile time
Max Kellermann [Fri, 3 Oct 2008 12:25:00 +0000 (14:25 +0200)]
colors: make color support optional at compile time

Default is colors disabled.  Those who love colorful terminals have
the option to enable it with --enable-colors.

16 years agooptions: print one big string in --version screen
Max Kellermann [Fri, 3 Oct 2008 12:24:31 +0000 (14:24 +0200)]
options: print one big string in --version screen

Instead of calling printf() multiple times for every compile time
option, build the whole string at compile time and print it with
puts().

16 years agocolors: color id is the index of the "colors" array
Max Kellermann [Fri, 3 Oct 2008 12:24:28 +0000 (14:24 +0200)]
colors: color id is the index of the "colors" array

The color ids are sequential, and we can save some bytes if we use it
for the array index.

16 years agocolors: added enum color_t
Max Kellermann [Fri, 3 Oct 2008 10:57:31 +0000 (12:57 +0200)]
colors: added enum color_t

Instead of declaring a bunch of CPP macros, use a C enum for
identifying colors.

16 years agocode style, indent with tabs XI
Max Kellermann [Fri, 3 Oct 2008 10:57:30 +0000 (12:57 +0200)]
code style, indent with tabs XI

Follow the same code style als MPD itself.

16 years agoscreen_artist: better screen title
Max Kellermann [Fri, 3 Oct 2008 09:57:00 +0000 (11:57 +0200)]
screen_artist: better screen title

The artist screen shouldn't be marked "experimental" anymore.
Describe the current state of the screen in the title, instead of
always writing "Artist".

16 years agolist_window: remove list_window_state_t
Max Kellermann [Fri, 3 Oct 2008 09:56:00 +0000 (11:56 +0200)]
list_window: remove list_window_state_t

We do not need to save a stack of list window states.  When we return
to a parent directory, we just have to find the directory which we
come from in the parent list.  Note that this patch resets the cursor
when going to the root directory, but I think it's not that important,
and I will deal with that later.

16 years agofilelist: added filelist_find_directory()
Max Kellermann [Fri, 3 Oct 2008 09:53:55 +0000 (11:53 +0200)]
filelist: added filelist_find_directory()

The function filelist_find_directory() will be useful for the
following patch.

16 years agoscreen_artist: fix reload in "All tracks"
Max Kellermann [Fri, 3 Oct 2008 09:53:28 +0000 (11:53 +0200)]
screen_artist: fix reload in "All tracks"

The variable "album" was set to _("All tracks") when it was empty.
When reloading the songs, ncmpc was trying to find an album named "All
tracks", which didn't seem to work.  Leave "album" in its canonical
form and generate the title text on demand.

16 years agocharset: pass -1 instead of strlen()
Max Kellermann [Fri, 3 Oct 2008 09:52:13 +0000 (11:52 +0200)]
charset: pass -1 instead of strlen()

The GTK charset functions accept "-1" if the parameter is null
terminated.

16 years agosupport: removed unused function remove_trailing_slash()
Max Kellermann [Fri, 3 Oct 2008 09:51:53 +0000 (11:51 +0200)]
support: removed unused function remove_trailing_slash()

16 years agouse g_basename() instead of basename()
Max Kellermann [Fri, 3 Oct 2008 09:51:32 +0000 (11:51 +0200)]
use g_basename() instead of basename()

g_basename() is always available, no need to implement a fallback.
Also use g_path_get_dirname(), g_path_get_basename().

16 years agouse g_ascii_isspace() instead of IS_WHITESPACE()
Max Kellermann [Fri, 3 Oct 2008 09:50:42 +0000 (11:50 +0200)]
use g_ascii_isspace() instead of IS_WHITESPACE()

Don't duplicate code which is already provided by glib.

16 years agouse g_ascii_strdown() instead of the custom lowerstr()
Max Kellermann [Fri, 3 Oct 2008 09:50:30 +0000 (11:50 +0200)]
use g_ascii_strdown() instead of the custom lowerstr()

Don't duplicate code which is already provided by glib.

16 years agolist_window: removed unused macro "LW_ROW"
Max Kellermann [Thu, 2 Oct 2008 17:12:45 +0000 (19:12 +0200)]
list_window: removed unused macro "LW_ROW"

16 years agoscreen_browser: added constant playlist_format
Max Kellermann [Thu, 2 Oct 2008 17:11:15 +0000 (19:11 +0200)]
screen_browser: added constant playlist_format

Moved the format string for playlist files to the constant
"playlist_format".

16 years agofix compiler errors without locale.h
Max Kellermann [Thu, 2 Oct 2008 17:02:07 +0000 (19:02 +0200)]
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.

16 years agoscreen_lyrics: character set conversion
Max Kellermann [Thu, 2 Oct 2008 17:01:30 +0000 (19:01 +0200)]
screen_lyrics: character set conversion

Convert the lyrics to the current character set before displaying
them.