// Returns an iter on the chapter which should be selected, if any
Returns an iter on the chapter which should be selected, if any
Returns an iter on the chapter which should be selected if any
pub fn remove_selected_chapter(&mut self) -> Option<gtk::TreeIter> {
        match self.selected_iter.take() {
            Some(selected_iter) => {
                let prev_iter = selected_iter.clone();
                let (selected_end, next_selected_iter) = {
                    let selected_chapter = ChapterEntry::new(&self.store, &selected_iter);
                    let selected_end = selected_chapter.end();
                    if self.store.iter_previous(&prev_iter) {
                        // a chapter starting before currently selected chapter is available
                        // => update its end with the end of currently selected chapter
                        self.store.set(
                            &prev_iter,
                            &[END_COL, END_STR_COL],
                            &[&selected_end, &selected_chapter.end_str()],
                        );
                        (selected_end, Some(prev_iter))
                    } else {
                        // no chapter before => nothing to select
                        (selected_end, None)
                    }
                };
                let start = ChapterEntry::get_start(&self.store, &selected_iter);
                self.boundaries
                    .borrow_mut()
                    .remove_chapter(start, selected_end);
                self.store.remove(&selected_iter);
                self.selected_iter = next_selected_iter.clone();
                match next_selected_iter {
                    None =>
                        // No chapter before => rewind
                        self.rewind(),
                    Some(ref next_selected_iter) => self.iter = Some(next_selected_iter.clone()),
                }
                next_selected_iter
            }
            None => None,
        }
    }
pub fn remove_selected_chapter ( & mut self ) -> Option < gtk :: TreeIter > { match self . selected_iter . take ( ) { Some ( selected_iter ) => { let prev_iter = selected_iter . clone ( ) ; let ( selected_end , next_selected_iter ) = { let selected_chapter = ChapterEntry :: new ( & self . store , & selected_iter ) ; let selected_end = selected_chapter . end ( ) ; if self . store . iter_previous ( & prev_iter ) { // a chapter starting before currently selected chapter is available // => update its end with the end of currently selected chapter self . store . set ( & prev_iter , & [ END_COL , END_STR_COL ] , & [ & selected_end , & selected_chapter . end_str ( ) ] , ) ; ( selected_end , Some ( prev_iter ) ) } else { // no chapter before => nothing to select ( selected_end , None ) } } ; let start = ChapterEntry :: get_start ( & self . store , & selected_iter ) ; self . boundaries . borrow_mut ( ) . remove_chapter ( start , selected_end ) ; self . store . remove ( & selected_iter ) ; self . selected_iter = next_selected_iter . clone ( ) ; match next_selected_iter { None => // No chapter before => rewind self . rewind ( ) , Some ( ref next_selected_iter ) => self . iter = Some ( next_selected_iter . clone ( ) ) , } next_selected_iter } None => None , } }
Returns an iter on the chapter which should be selected, if any
Returns an iter on the chapter which should be selected if any
&mut self