gthumb r2450 - in trunk: . libgthumb
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2450 - in trunk: . libgthumb
- Date: Wed, 19 Nov 2008 20:08:00 +0000 (UTC)
Author: mjc
Date: Wed Nov 19 20:08:00 2008
New Revision: 2450
URL: http://svn.gnome.org/viewvc/gthumb?rev=2450&view=rev
Log:
Merged 2448:2449 from gthumb-2-10.
Modified:
trunk/ (props changed)
trunk/ChangeLog
trunk/libgthumb/gth-filter.c
Modified: trunk/libgthumb/gth-filter.c
==============================================================================
--- trunk/libgthumb/gth-filter.c (original)
+++ trunk/libgthumb/gth-filter.c Wed Nov 19 20:08:00 2008
@@ -26,6 +26,7 @@
#include <glib.h>
#include "gth-filter.h"
#include "gth-exif-utils.h"
+#include "search.h"
/* GthTest */
@@ -41,7 +42,8 @@
int i;
GDate *date;
} data;
- GPatternSpec *pattern;
+ GPatternSpec *pattern;
+ char **patterns;
};
@@ -144,6 +146,10 @@
}
if (test->pattern != NULL)
g_pattern_spec_free (test->pattern);
+ if (test->patterns != NULL) {
+ g_strfreev (test->patterns);
+ test->patterns = NULL;
+ }
g_free (test);
}
@@ -227,24 +233,29 @@
int keywords_n)
{
gboolean result;
- int i;
+ int p, i;
if ((test->data.s == NULL) || (keywords == NULL) || (keywords_n == 0))
return test->negative;
- if ((test->op != GTH_TEST_OP_CONTAINS)
- && (test->op != GTH_TEST_OP_CONTAINS_ALL))
+ if ((test->op != GTH_TEST_OP_CONTAINS) && (test->op != GTH_TEST_OP_CONTAINS_ALL))
return test->negative;
- result = (test->op == GTH_TEST_OP_CONTAINS_ALL);
- for (i = 0; i < keywords_n; i++) {
- char *value2 = g_utf8_casefold (keywords[i], -1);
- gboolean partial_result;
-
- partial_result = g_utf8_collate (value2, test->data.s) == 0;
- g_free (value2);
+ if (test->patterns == NULL)
+ test->patterns = search_util_get_patterns (test->data.s, TRUE);
- if (partial_result) {
+ result = (test->op == GTH_TEST_OP_CONTAINS_ALL);
+ for (p = 0; test->patterns[p] != NULL; p++) {
+ gboolean keyword_present = FALSE;
+
+ for (i = 0; ! keyword_present && (i < keywords_n); i++) {
+ char *value2 = g_utf8_casefold (keywords[i], -1);
+
+ keyword_present = g_utf8_collate (value2, test->patterns[p]) == 0;
+ g_free (value2);
+ }
+
+ if (keyword_present) {
if (test->op == GTH_TEST_OP_CONTAINS) {
result = TRUE;
break;
@@ -255,7 +266,7 @@
break;
}
}
-
+
if (test->negative)
result = ! result;
@@ -336,6 +347,7 @@
break;
case GTH_TEST_SCOPE_KEYWORDS:
+ file_data_load_comment_data (fdata);
if (fdata->comment_data != NULL)
result = test_keywords (test, fdata->comment_data->keywords, fdata->comment_data->keywords_n);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]