[grilo-plugins] filesystem: Implement search all elements
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] filesystem: Implement search all elements
- Date: Mon, 7 Feb 2011 20:41:59 +0000 (UTC)
commit f3feff4039a6084cd5d1d010a2d11edb8b76062e
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Wed Feb 2 09:53:41 2011 +0100
filesystem: Implement search all elements
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
src/filesystem/grl-filesystem.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c
index a6f7674..eb3df03 100644
--- a/src/filesystem/grl-filesystem.c
+++ b/src/filesystem/grl-filesystem.c
@@ -684,7 +684,10 @@ compare_and_return_file (SearchOperation *operation,
GFileEnumerator *enumerator,
GFileInfo *file_info)
{
- gchar *needle, *haystack, *normalized_needle, *normalized_haystack;
+ gchar *needle = NULL;
+ gchar *haystack = NULL;
+ gchar *normalized_needle = NULL;
+ gchar *normalized_haystack = NULL;
GrlMediaSourceSearchSpec *ss = operation->ss;
GRL_DEBUG ("compare_and_return_file");
@@ -692,13 +695,16 @@ compare_and_return_file (SearchOperation *operation,
if (ss == NULL)
return FALSE;
- haystack = g_utf8_casefold (g_file_info_get_display_name (file_info), -1);
- normalized_haystack = g_utf8_normalize (haystack, -1, G_NORMALIZE_ALL);
+ if (ss->text) {
+ haystack = g_utf8_casefold (g_file_info_get_display_name (file_info), -1);
+ normalized_haystack = g_utf8_normalize (haystack, -1, G_NORMALIZE_ALL);
- needle = g_utf8_casefold (ss->text, -1);
- normalized_needle = g_utf8_normalize (needle, -1, G_NORMALIZE_ALL);
+ needle = g_utf8_casefold (ss->text, -1);
+ normalized_needle = g_utf8_normalize (needle, -1, G_NORMALIZE_ALL);
+ }
- if (strstr (normalized_haystack, normalized_needle)) {
+ if (!ss->text ||
+ strstr (normalized_haystack, normalized_needle)) {
GrlMedia *media = NULL;
GFile *dir, *file;
gchar *path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]