Пример #1
0
bool DBSearchPanel::update()
{
    bool is_working = false;
    if (_searcher)
    {
        base::MutexLock search_lock(_searcher->get_search_result_mutex());
        is_working = _searcher->is_working(); 
        if (_searcher->is_paused())
        {
            _progress_label.set_text("Paused");        
            //            _progress_bar.stop();
        }
        else
        {
            //            _progress_bar.start();
            _progress_bar.set_value(_searcher->get_progress());
            _progress_label.set_text(_searcher->get_state());
            std::string matches = base::strfmt("%i rows matched in %i searched tables", 
                                                _searcher->matched_rows(),
                                                _searcher->searched_table_count());
            _matches_label.set_text(matches);
            load_model(_results_tree.root_node());
        }
    }
    if (!is_working)
    {
      _searcher.reset();
      _progress_label.show(false);
      _progress_box.show(false);
    }
    return is_working;
}
Пример #2
0
int search_next(struct searchable *s, const char *text, enum search_direction dir)
{
	struct iter iter;
	int ret;

	search_lock();
	if (!s->ops.get_current(s->data, &iter)) {
		search_unlock();
		return 0;
	}
	ret = do_search(s, &iter, text, dir, 1);
	search_unlock();
	return ret;
}
Пример #3
0
int search(struct searchable *s, const char *text, enum search_direction dir, int beginning)
{
	struct iter iter;
	int ret;

	search_lock();
	if (beginning) {
		/* first or last item */
		iter = s->head;
		if (dir == SEARCH_FORWARD) {
			ret = s->ops.get_next(&iter);
		} else {
			ret = s->ops.get_prev(&iter);
		}
	} else {
		/* selected item */
		ret = s->ops.get_current(s->data, &iter);
	}
	if (ret)
		ret = do_search(s, &iter, text, dir, 0);
	search_unlock();
	return ret;
}