summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e0e1a6)
raw | patch | inline | side by side (parent: 4e0e1a6)
author | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 18:42:59 +0000 (20:42 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 18:42:59 +0000 (20:42 +0200) |
Use the "screen_file_" prefix.
src/screen_file.c | patch | blob | history |
diff --git a/src/screen_file.c b/src/screen_file.c
index f8d488306b9cf183014c21c59dd861f1000918bd..0295690aad7aa4614e3f7e9e2a049585e0bd6be3 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
static char *current_path;
static void
-browse_paint(void);
+screen_file_paint(void);
static void
-file_repaint(void)
+screen_file_repaint(void)
{
- browse_paint();
+ screen_file_paint();
wrefresh(browser.lw->w);
}
static void
-file_reload(struct mpdclient *c)
+screen_file_reload(struct mpdclient *c)
{
if (browser.filelist != NULL)
filelist_free(browser.filelist);
* Change to the specified absolute directory.
*/
static bool
-file_change_directory(struct mpdclient *c, const char *new_path)
+change_directory(struct mpdclient *c, const char *new_path)
{
g_free(current_path);
current_path = g_strdup(new_path);
- file_reload(c);
+ screen_file_reload(c);
#ifndef NCMPC_MINI
sync_highlights(c, browser.filelist);
* Change to the parent directory of the current directory.
*/
static bool
-file_change_to_parent(struct mpdclient *c)
+change_to_parent(struct mpdclient *c)
{
char *parent = g_path_get_dirname(current_path);
char *old_path;
old_path = current_path;
current_path = NULL;
- success = file_change_directory(c, parent);
+ success = change_directory(c, parent);
g_free(parent);
idx = success
* object.
*/
static bool
-file_change_to_entry(struct mpdclient *c, const struct filelist_entry *entry)
+change_to_entry(struct mpdclient *c, const struct filelist_entry *entry)
{
assert(entry != NULL);
if (entry->entity == NULL)
- return file_change_to_parent(c);
+ return change_to_parent(c);
else if (mpd_entity_get_type(entry->entity) == MPD_ENTITY_TYPE_DIRECTORY)
- return file_change_directory(c, mpd_directory_get_path(mpd_entity_get_directory(entry->entity)));
+ return change_directory(c, mpd_directory_get_path(mpd_entity_get_directory(entry->entity)));
else
return false;
}
static bool
-file_handle_enter(struct mpdclient *c)
+screen_file_handle_enter(struct mpdclient *c)
{
const struct filelist_entry *entry = browser_get_selected_entry(&browser);
if (entry == NULL)
return false;
- return file_change_to_entry(c, entry);
+ return change_to_entry(c, entry);
}
static int
}
static void
-browse_init(WINDOW *w, int cols, int rows)
+screen_file_init(WINDOW *w, int cols, int rows)
{
current_path = g_strdup("");
}
static void
-browse_resize(int cols, int rows)
+screen_file_resize(int cols, int rows)
{
browser.lw->cols = cols;
browser.lw->rows = rows;
}
static void
-browse_exit(void)
+screen_file_exit(void)
{
if (browser.filelist)
filelist_free(browser.filelist);
}
static void
-browse_open(struct mpdclient *c)
+screen_file_open(struct mpdclient *c)
{
- file_reload(c);
+ screen_file_reload(c);
}
static const char *
-browse_title(char *str, size_t size)
+screen_file_get_title(char *str, size_t size)
{
const char *path = NULL, *prev = NULL, *slash = current_path;
char *path_locale;
}
static void
-browse_paint(void)
+screen_file_paint(void)
{
list_window_paint(browser.lw, browser_lw_callback, browser.filelist);
}
{
if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST)) {
/* the db has changed -> update the filelist */
- file_reload(c);
+ screen_file_reload(c);
list_window_check_selected(browser.lw,
filelist_length(browser.filelist));
}
| MPD_IDLE_PLAYLIST
#endif
))
- file_repaint();
+ screen_file_repaint();
}
static bool
-browse_cmd(struct mpdclient *c, command_t cmd)
+screen_file_cmd(struct mpdclient *c, command_t cmd)
{
switch(cmd) {
case CMD_PLAY:
- if (file_handle_enter(c)) {
- file_repaint();
+ if (screen_file_handle_enter(c)) {
+ screen_file_repaint();
return true;
}
break;
case CMD_GO_ROOT_DIRECTORY:
- file_change_directory(c, "");
- file_repaint();
+ change_directory(c, "");
+ screen_file_repaint();
return true;
case CMD_GO_PARENT_DIRECTORY:
- file_change_to_parent(c);
- file_repaint();
+ change_to_parent(c);
+ screen_file_repaint();
return true;
case CMD_LOCATE:
case CMD_DELETE:
handle_delete(c);
- file_repaint();
+ screen_file_repaint();
break;
case CMD_SAVE_PLAYLIST:
handle_save(c);
break;
case CMD_SCREEN_UPDATE:
- file_reload(c);
+ screen_file_reload(c);
#ifndef NCMPC_MINI
sync_highlights(c, browser.filelist);
#endif
list_window_check_selected(browser.lw,
filelist_length(browser.filelist));
- file_repaint();
+ screen_file_repaint();
return false;
case CMD_DB_UPDATE:
if (browser_cmd(&browser, c, cmd)) {
if (screen_is_visible(&screen_browse))
- file_repaint();
+ screen_file_repaint();
return true;
}
}
const struct screen_functions screen_browse = {
- .init = browse_init,
- .exit = browse_exit,
- .open = browse_open,
- .resize = browse_resize,
- .paint = browse_paint,
+ .init = screen_file_init,
+ .exit = screen_file_exit,
+ .open = screen_file_open,
+ .resize = screen_file_resize,
+ .paint = screen_file_paint,
.update = screen_file_update,
- .cmd = browse_cmd,
- .get_title = browse_title,
+ .cmd = screen_file_cmd,
+ .get_title = screen_file_get_title,
};
bool
else
parent = "";
- ret = file_change_directory(c, parent);
+ ret = change_directory(c, parent);
g_free(allocated);
if (!ret)
return false;