Adjust index usage
Previously we used prev_index everywhere, which could
get confusing - it's not really the "previous" index
until we've moved. So, only page_changed_cb () refers
to it as prev_index. Everywhere else it's called
current_model_index.
In accordance with this change, we can get rid
of a call to current_page() and index_of()
since we already know the index of the current page.
We also now use binary search in calls to index_of()
instead of a linear search.
Edited by Christopher Davis