aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-11-10lirc: refactored event handlerThomas Jansen1-45/+28
* 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
2008-11-07mpdclient: expect UTF-8 stringsMax Kellermann1-1/+5
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.
2008-11-07main: optimized error_msg()Max Kellermann1-1/+2
The pointer has already been checked for NULL, eliminate that check.
2008-11-07disable more features with --enable-miniMax Kellermann1-3/+22
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
2008-11-07native LIRC support for ncmpcThomas Jansen1-0/+57
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(...).
2008-10-06disable ncurses raw modeMax Kellermann1-4/+0
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...
2008-10-03store MPD_UPDATE_TIME as guintMax Kellermann1-3/+3
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.
2008-10-03don't initialize sigaction struct twiceMax Kellermann1-6/+3
Don't reset sa_mask and sa_flags after every sigaction() call. Do it once.
2008-10-03restart system call after SIGWINCHMax Kellermann1-1/+1
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.
2008-10-03typo: ignore SIGPIPE instead of SIGWINCHMax Kellermann1-2/+2
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.
2008-10-03screen: removed "painted" flagMax Kellermann1-2/+4
Repaint immediately instead of setting "painted=0".
2008-10-03options: don't pass the "options" pointer aroundMax Kellermann1-1/+1
Just make everybody use the global "options" variable. This eliminates namespace confusion and the NO_GLOBAL_OPTIONS hack.
2008-10-03code style, indent with tabs XIMax Kellermann1-3/+1
Follow the same code style als MPD itself.
2008-10-02fix compiler errors without locale.hMax Kellermann1-1/+3
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.
2008-10-02charset: charset_init() returns character setMax Kellermann1-1/+1
Don't pass "noconvert" to charset_init(). Let charset_init() determine that with g_get_charset() and return its name.
2008-10-02moved code to charset.cMax Kellermann1-1/+1
Move everything which deals with UTF-8 strings and character set conversion to charset.c, header charset.h.
2008-10-02moved macros from ncmpc.h to main.c and screen.cMax Kellermann1-0/+3
Moved constants which are only used in one source file. Remove several unused macros.
2008-10-02moved i18n macros to i18n.hMax Kellermann1-0/+1
Don't make everybody include ncmpc.h just to have generic features. Move generic i18n macros to a separate header.
2008-10-02removed the debugging function D()Max Kellermann1-21/+0
gdb is for debugging. We don't need D() calls littered all over.
2008-09-26ignore SIGPIPEMax Kellermann1-0/+9
Ignore SIGPIPE, and handle errno==EPIPE instead.
2008-09-25don't call lyrics_init if plugin is disabledMax Kellermann1-1/+6
If the lyrics screen is disabled at compile time, don't initialize the lyrics library in main().
2008-09-25fix miscellaneous sparse warningsMax Kellermann1-0/+2
Static variables, pointers vs integers, void function returning, ...
2008-09-22screen: moved code to ncu.cMax Kellermann1-1/+3
Moved basic libncurses initialization to ncu.c and ncu.h. Keep generic code out of screen.c.
2008-09-22main: free keyboard IO channelMax Kellermann1-2/+7
Before terminating ncmpc, free the keyboard GIOChannel object.
2008-09-19fix terminal resizing (SIGWINCH)Max Kellermann1-0/+33
When I replaced ncmpc's old main loop with g_main_loop from libglib, SIGWINCH (i.e. window resizing) stopped working. This regression was caused by the fact that ncurses' wgetch() function was only called when there was actually data on STDIN. wgetch() has several side effects besides reading data from STDIN, for example it checks whether there has been a window resize. Fix this with a custom SIGWINCH handler.
2008-09-18quit with g_main_loop_quit()Max Kellermann1-3/+5
Call g_main_loop_quit() on CMD_QUIT, instead of exit() with an atexit() handler.
2008-09-18use the glib main event loopMax Kellermann1-72/+154
This big patch replaces our custom main loop with the event based glib main loop. This has several advantages: we can make all the tiny code bits in the main loop independent from each others, we can add additional file descriptors for polling (e.g. the mpdclient socket). We don't need the ncurses timeout() anymore, because glib will poll stdin for us.
2008-09-18main: connect while UI is displayedMax Kellermann1-39/+21
Display the UI always, and show connection errors there. This fixes a lot of consistency problems: error messages used to be printed to stderr, but afterwards, the atexit() handlers deinitialized ncurses and the screen was cleared. This patch is still problematic, but constitutes a good step forward.
2008-09-17code style, indent with tabs IVMax Kellermann1-56/+56
Follow the same code style als MPD itself.
2008-09-17make several functions return voidMax Kellermann1-1/+1
2008-09-16lyrics: converted in-process plugins to external programsMax Kellermann1-2/+2
In-process plugins are very problematic. It is much easier and flexible to move the lyrics plugins to external programs, with a trivial protocol. This is work in progress, among the things missing: - protocol specification, including exit codes - plugin installation - plugin search directory - run-time configuration (currently hard coded) - automatic polling (using glib's main loop?) - better and more robust error handling
2008-09-16code style, indent with tabs IIMax Kellermann1-14/+11
Follow the same code style als MPD itself.
2008-09-15fix unused parameter warningsMax Kellermann1-6/+5
Add the "unused" attribute to all function parameters which are indeed going to be ignored.
2008-09-15don't declare local variable "options"Max Kellermann1-13/+12
In main.c, the global variable "options" is used all over, except in main(), which contains a shadowing declaration of it. Remove this local variable, and use the global "options" instead. Also don't pollute conf.c's namespace with the global variable with a CPP hack (to be removed when we have fixed more of ncmpc's namespace pollution).
2008-09-15include cleanupMax Kellermann1-8/+5
A header should include all headers which he needs. Move local includes on top, and let foo.c include foo.h in the first line, to automatically test its dependencies.
2008-09-15fix function prototypesMax Kellermann1-3/+4
Add missing prototypes, and fix wrong prototypes. Convert lots of functions to "static" when they are only used within the current source file.
2008-09-15const pointersMax Kellermann1-4/+4
Convert pointers to const whenever it is possible. Fixes all those -Wconst warnings.
2008-09-15use !NDEBUG instead of DEBUGMax Kellermann1-1/+1
NDEBUG is more commonly used than DEBUG, e.g. in assert.h. Convert all macros to NDEBUG, and declare NDEBUG when debugging is disabled.
2008-09-15code style, indent with tabsMax Kellermann1-195/+184
Follow the same code style als MPD itself. This patch only fixes parts of the code which are going to be touched in the following bunch of patches, i.e. there will be more "code style" patches in the future.
2008-09-15remove unused static functionsMax Kellermann1-7/+0
Also remove some commented code and unused function parameters.
2008-09-15splash: removed the useless splash screenMax Kellermann1-2/+0
The code looks strange and spews lots of warnings. Since it does nothing useful, and wastes the user's precious time, simply remove it.
2007-02-16way too much stuff to describe hereAndreas Obergrusberger1-0/+1
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5346 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-01lyrics updates, leoslyrics fixesAndreas Obergrusberger1-0/+1
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5314 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-05fix user plugin dir; code cleanupAndreas Obergrusberger1-1/+1
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5220 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-03added a plugin system for lyrics sourcesAndreas Obergrusberger1-0/+3
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5217 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-28filelist sorting improvedAndreas Obergrusberger1-0/+2
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4953 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-09-07due to bensonk's demand i added a splash screen.Andreas Obergrusberger1-3/+10
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4741 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-04the updated sourcesAndreas Obergrusberger1-1/+18
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4543 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-06-01Fixes #0000406, segfault if mpd wants a passwort but ncmpc connects withoutKalle Wallin1-0/+7
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3304 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-02-13Fixes bug #0000360Kalle Wallin1-1/+1
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@2948 09075e82-0dd4-0310-85a5-a0d7c8717e4f