diff --git a/src/screen_browser.c b/src/screen_browser.c
index 52d76f1a7e5bb2a22799872813c113445b4e7708..6c802f6e87aaa2a0654a0ce7b42c2d88d4598cdb 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
/* ncmpc (Ncurses MPD Client)
/* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
* Project homepage: http://musicpd.org
* Project homepage: http://musicpd.org
-
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
+ */
+#include "config.h"
#include "screen_browser.h"
#include "screen_file.h"
#include "screen_song.h"
#include "screen_lyrics.h"
#include "screen_browser.h"
#include "screen_file.h"
#include "screen_song.h"
#include "screen_lyrics.h"
-#include "screen_message.h"
+#include "screen_status.h"
#include "screen_find.h"
#include "screen.h"
#include "i18n.h"
#include "screen_find.h"
#include "screen.h"
#include "i18n.h"
#define HIGHLIGHT (0x01)
#endif
#define HIGHLIGHT (0x01)
#endif
-static const char playlist_format[] = "*%s*";
-
#ifndef NCMPC_MINI
/* sync highlight flags with playlist */
#ifndef NCMPC_MINI
/* sync highlight flags with playlist */
mpd_entity_get_playlist(entity);
char *filename = utf8_to_locale(g_basename(mpd_playlist_get_path(playlist)));
mpd_entity_get_playlist(entity);
char *filename = utf8_to_locale(g_basename(mpd_playlist_get_path(playlist)));
- g_snprintf(buf, BUFSIZE, playlist_format, filename);
+ g_strlcpy(buf, filename, sizeof(buf));
g_free(filename);
return buf;
}
g_free(filename);
return buf;
}
enqueue_and_play(struct mpdclient *c, struct filelist_entry *entry)
{
struct mpd_connection *connection = mpdclient_get_connection(c);
enqueue_and_play(struct mpdclient *c, struct filelist_entry *entry)
{
struct mpd_connection *connection = mpdclient_get_connection(c);
+ if (connection == NULL)
+ return false;
+
const struct mpd_song *song = mpd_entity_get_song(entry->entity);
int id;
const struct mpd_song *song = mpd_entity_get_song(entry->entity);
int id;
entry->flags |= HIGHLIGHT;
#endif
strfsong(buf, BUFSIZE, options.list_format, song);
entry->flags |= HIGHLIGHT;
#endif
strfsong(buf, BUFSIZE, options.list_format, song);
- screen_status_printf(_("Adding \'%s\' to playlist"), buf);
+ screen_status_printf(_("Adding \'%s\' to queue"), buf);
}
if (!mpd_run_play_id(connection, id)) {
}
if (!mpd_run_play_id(connection, id)) {
static bool
browser_select_entry(struct mpdclient *c, struct filelist_entry *entry,
static bool
browser_select_entry(struct mpdclient *c, struct filelist_entry *entry,
- G_GNUC_UNUSED gboolean toggle)
+ gcc_unused gboolean toggle)
{
assert(entry != NULL);
assert(entry->entity != NULL);
{
assert(entry != NULL);
assert(entry->entity != NULL);
if (mpdclient_cmd_add_path(c, mpd_directory_get_path(dir))) {
char *tmp = utf8_to_locale(mpd_directory_get_path(dir));
if (mpdclient_cmd_add_path(c, mpd_directory_get_path(dir))) {
char *tmp = utf8_to_locale(mpd_directory_get_path(dir));
- screen_status_printf(_("Adding \'%s\' to playlist"), tmp);
+ screen_status_printf(_("Adding \'%s\' to queue"), tmp);
g_free(tmp);
}
g_free(tmp);
}
char buf[BUFSIZE];
strfsong(buf, BUFSIZE, options.list_format, song);
char buf[BUFSIZE];
strfsong(buf, BUFSIZE, options.list_format, song);
- screen_status_printf(_("Adding \'%s\' to playlist"), buf);
+ screen_status_printf(_("Adding \'%s\' to queue"), buf);
}
#ifndef NCMPC_MINI
} else {
}
#ifndef NCMPC_MINI
} else {
{
struct list_window_range range;
struct filelist_entry *entry;
{
struct list_window_range range;
struct filelist_entry *entry;
- bool success;
+ bool success = false;
list_window_get_range(browser->lw, &range);
for (unsigned i = range.start; i < range.end; ++i) {
entry = browser_get_index(browser, i);
if (entry != NULL && entry->entity != NULL)
list_window_get_range(browser->lw, &range);
for (unsigned i = range.start; i < range.end; ++i) {
entry = browser_get_index(browser, i);
if (entry != NULL && entry->entity != NULL)
- success = browser_select_entry(c, entry, FALSE);
+ success = browser_select_entry(c, entry, FALSE) ||
+ success;
}
return range.end == range.start + 1 && success;
}
return range.end == range.start + 1 && success;
return false;
}
return false;
}
-static void
+void
screen_browser_paint_directory(WINDOW *w, unsigned width,
bool selected, const char *name)
{
screen_browser_paint_directory(WINDOW *w, unsigned width,
bool selected, const char *name)
{
highlight = false;
#endif
highlight = false;
#endif
- if (highlight)
- colors_use(w, COLOR_LIST_BOLD);
- else
- colors_use(w, COLOR_LIST);
-
switch (mpd_entity_get_type(entity)) {
case MPD_ENTITY_TYPE_DIRECTORY:
directory = mpd_entity_get_directory(entity);
switch (mpd_entity_get_type(entity)) {
case MPD_ENTITY_TYPE_DIRECTORY:
directory = mpd_entity_get_directory(entity);
break;
default:
break;
default:
- waddstr(w, "<unknown>");
+ row_paint_text(w, width, highlight ? COLOR_LIST_BOLD : COLOR_LIST,
+ selected, "<unknown>");
}
}
-
- whline(w, ' ', width);
-
- if (selected)
- wattroff(w, A_REVERSE);
}
void
}
void