Abount the "missing" gtk_tree_model_iter_prev()



Is this the optimal way to implement a bi-directional search on a
liststore or there is something better that can be done?

    while(valid) {
        gchar *body;

        gtk_tree_model_get(m_model, &it,
                           Body, &body, -1);

        if ( (cs && strstr(body, match.c_str())) ||
             (!cs && strcasestr(body, match.c_str())))
                found = gtk_tree_model_get_path(m_model, &it);

        g_free(body);

        if (found)
            return found;

        if (searchdown)
            valid = gtk_tree_model_iter_next(m_model, &it);
        else {
            if ((valid = gtk_tree_path_prev(start)))
                valid = gtk_tree_model_get_iter(m_model, &it, start);
        }
    }


---
Bye,
 Gabry




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]