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

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to