summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1982b42)
raw | patch | inline | side by side (parent: 1982b42)
author | Max Kellermann <max@duempel.org> | |
Fri, 19 Sep 2008 14:24:37 +0000 (16:24 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Fri, 19 Sep 2008 14:24:37 +0000 (16:24 +0200) |
browser_get_selected() checks if there is a file list and a valid
selection, and returns the selected entry.
selection, and returns the selected entry.
src/screen_browser.c | patch | blob | history |
diff --git a/src/screen_browser.c b/src/screen_browser.c
index 40c63998062d32b48d6d29edefe29a8566a3c1b4..b01e70c7ac68e580e14e40c5c523e46c9c9579bf 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
return 0;
}
+static struct filelist_entry *
+browser_get_selected(const struct screen_browser *browser)
+{
+ if (browser->filelist == NULL)
+ return NULL;
+
+ return filelist_get(browser->filelist, browser->lw->selected);
+}
+
int
browser_handle_enter(struct screen_browser *browser, mpdclient_t *c)
{
- filelist_entry_t *entry;
+ struct filelist_entry *entry = browser_get_selected(browser);
mpd_InfoEntity *entity;
- if (browser->filelist == NULL)
- return -1;
-
- entry = filelist_get(browser->filelist, browser->lw->selected);
if( entry==NULL )
return -1;
int
browser_handle_select(struct screen_browser *browser, mpdclient_t *c)
{
- filelist_entry_t *entry;
+ struct filelist_entry *entry = browser_get_selected(browser);
- if (browser->filelist == NULL)
- return -1;
- entry = filelist_get(browser->filelist, browser->lw->selected);
if (entry == NULL || entry->entity == NULL)
return -1;