aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_browser.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-19 16:23:31 +0200
committerMax Kellermann <max@duempel.org>2008-09-19 16:23:31 +0200
commitd1c31cf66398447b5ba0d0a60de5b92ad162675c (patch)
tree3e8b8868d7078e70408a96a9795acd9b19d7008c /src/screen_browser.c
parente3b42caa5d39d084ba511aee43fada91e367ae3e (diff)
downloadmpd-d1c31cf66398447b5ba0d0a60de5b92ad162675c.tar.gz
mpd-d1c31cf66398447b5ba0d0a60de5b92ad162675c.tar.xz
mpd-d1c31cf66398447b5ba0d0a60de5b92ad162675c.zip
filelist: provide more functions for working with a filelist
Avoid direct accesses to the filelist struct, provide an API for that.
Diffstat (limited to 'src/screen_browser.c')
-rw-r--r--src/screen_browser.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/screen_browser.c b/src/screen_browser.c
index 47fda6abe..40c639980 100644
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
@@ -125,7 +125,8 @@ browser_lw_callback(unsigned idx, int *highlight, void *data)
filelist_entry_t *entry;
mpd_InfoEntity *entity;
- if( (entry=(filelist_entry_t *)g_list_nth_data(fl->list,idx))==NULL )
+ entry = filelist_get(fl, idx);
+ if (entry == NULL)
return NULL;
entity = entry->entity;
@@ -204,7 +205,7 @@ browser_change_directory(struct screen_browser *browser, mpdclient_t *c,
filelist_free(browser->filelist);
browser->filelist = mpdclient_filelist_get(c, path);
sync_highlights(c, browser->filelist);
- list_window_check_selected(browser->lw, browser->filelist->length);
+ list_window_check_selected(browser->lw, filelist_length(browser->filelist));
g_free(path);
return 0;
}
@@ -254,8 +255,8 @@ browser_handle_enter(struct screen_browser *browser, mpdclient_t *c)
if (browser->filelist == NULL)
return -1;
- entry = (filelist_entry_t *) g_list_nth_data(browser->filelist->list,
- browser->lw->selected);
+
+ entry = filelist_get(browser->filelist, browser->lw->selected);
if( entry==NULL )
return -1;
@@ -382,7 +383,7 @@ browser_handle_select(struct screen_browser *browser, mpdclient_t *c)
if (browser->filelist == NULL)
return -1;
- entry = g_list_nth_data(browser->filelist->list, browser->lw->selected);
+ entry = filelist_get(browser->filelist, browser->lw->selected);
if (entry == NULL || entry->entity == NULL)
return -1;
@@ -419,7 +420,7 @@ browser_handle_mouse_event(struct screen_browser *browser, mpdclient_t *c)
int length;
if (browser->filelist)
- length = browser->filelist->length;
+ length = filelist_length(browser->filelist);
else
length = 0;