Example #1
0
static gboolean
filter_model_visible_func (GtkTreeModel *model, GtkTreeIter *iter, PraghaFilterDialog *fdialog)
{
	gchar *haystack = NULL, *haystackd = NULL, *needle = NULL;
	gboolean approximate, visible = FALSE;

	if(!fdialog->filter_string)
		return TRUE;

	gtk_tree_model_get(model, iter, 1, &haystack, -1);

	needle = fdialog->filter_string;

	haystackd = g_utf8_strdown (haystack, -1);

	approximate = pragha_preferences_get_approximate_search(fdialog->preferences);

	if(g_strstr_lv(haystackd, needle, approximate ? 1 : 0))
		visible = TRUE;

	g_free(haystack);
	g_free(haystackd);

	return visible;
}
Example #2
0
gchar *
pragha_strstr_lv(gchar *haystack, gchar *needle, PraghaPreferences *preferences)
{
	gboolean aproximate_search;
	aproximate_search = pragha_preferences_get_approximate_search(preferences);

	return g_strstr_lv(haystack, needle,
			   aproximate_search ? 1 : 0);
}