Skip to content

Commit

Permalink
move tree_search_matches() down
Browse files Browse the repository at this point in the history
need static functions declared above in next commits
  • Loading branch information
weisslj authored and flyingmutant committed Sep 3, 2011
1 parent 504963f commit 547083d
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,7 @@ static inline struct tree_track *iter_to_tree_search_track(const struct iter *it
return iter->data1;
}

static int tree_search_matches(void *data, struct iter *iter, const char *text)
{
struct tree_track *track;
struct iter tmpiter;
unsigned int flags = TI_MATCH_ARTIST | TI_MATCH_ALBUM | TI_MATCH_ALBUMARTIST;

if (!search_restricted)
flags |= TI_MATCH_TITLE;
track = iter_to_tree_search_track(iter);
if (!track_info_matches(tree_track_info(track), text, flags))
return 0;
track->album->artist->expanded = 1;
album_to_iter(track->album, &tmpiter);
window_set_sel(lib_tree_win, &tmpiter);

tree_track_to_iter(track, &tmpiter);
window_set_sel(lib_track_win, &tmpiter);
return 1;
}
static int tree_search_matches(void *data, struct iter *iter, const char *text);

static const struct searchable_ops tree_search_ops = {
.get_prev = tree_search_get_prev,
Expand Down Expand Up @@ -573,6 +555,28 @@ static struct artist *do_find_artist(const struct artist *artist,
return NULL;
}

/* search (tree) {{{ */
static int tree_search_matches(void *data, struct iter *iter, const char *text)
{
struct tree_track *track;
struct iter tmpiter;
unsigned int flags = TI_MATCH_ARTIST | TI_MATCH_ALBUM | TI_MATCH_ALBUMARTIST;

if (!search_restricted)
flags |= TI_MATCH_TITLE;
track = iter_to_tree_search_track(iter);
if (!track_info_matches(tree_track_info(track), text, flags))
return 0;
track->album->artist->expanded = 1;
album_to_iter(track->album, &tmpiter);
window_set_sel(lib_tree_win, &tmpiter);

tree_track_to_iter(track, &tmpiter);
window_set_sel(lib_track_win, &tmpiter);
return 1;
}
/* search (tree) }}} */

static void insert_artist(struct artist *artist, struct rb_root *root)
{
struct rb_node **new = &(root->rb_node), *parent = NULL;
Expand Down

0 comments on commit 547083d

Please sign in to comment.