diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-09-30 14:09:32 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-09-30 14:09:32 +0200 |
commit | 0537caaf4af94a9ead8b292679f6b34c90b55e06 (patch) | |
tree | 6761cfdf959926be7af3147cf770e7f253390fe8 /src/searches/SearchBoolean.vala | |
parent | eca5837e235a356c8db9416bbbc13577db3e6f76 (diff) | |
parent | 5e9f4eea451a77ba3b93db3747841ed2bd969e9f (diff) |
Update upstream source from tag 'upstream/0.30.1'
Update to upstream version '0.30.1'
with Debian dir dc242531effff8d9c6fab093414edee28b403c6a
Diffstat (limited to 'src/searches/SearchBoolean.vala')
-rw-r--r-- | src/searches/SearchBoolean.vala | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/searches/SearchBoolean.vala b/src/searches/SearchBoolean.vala index 1c6a5f3..2be8302 100644 --- a/src/searches/SearchBoolean.vala +++ b/src/searches/SearchBoolean.vala @@ -52,6 +52,9 @@ public abstract class SearchCondition { TAG, EVENT_NAME, FILE_NAME, +#if ENABLE_FACES + FACE, +#endif MEDIA_TYPE, FLAG_STATE, MODIFIED_STATE, @@ -62,7 +65,10 @@ public abstract class SearchCondition { public static SearchType[] as_array() { return { ANY_TEXT, TITLE, TAG, COMMENT, EVENT_NAME, FILE_NAME, - MEDIA_TYPE, FLAG_STATE, MODIFIED_STATE, RATING, DATE }; +#if ENABLE_FACES + FACE, +#endif + MEDIA_TYPE, FLAG_STATE, MODIFIED_STATE, RATING, DATE }; } // Sorts an array alphabetically by display name. @@ -92,7 +98,10 @@ public abstract class SearchCondition { case SearchType.FILE_NAME: return "FILE_NAME"; - +#if ENABLE_FACES + case SearchType.FACE: + return "FACE"; +#endif case SearchType.MEDIA_TYPE: return "MEDIA_TYPE"; @@ -131,7 +140,10 @@ public abstract class SearchCondition { else if (str == "FILE_NAME") return SearchType.FILE_NAME; - +#if ENABLE_FACES + else if (str == "FACE") + return SearchType.FACE; +#endif else if (str == "MEDIA_TYPE") return SearchType.MEDIA_TYPE; @@ -170,7 +182,10 @@ public abstract class SearchCondition { case SearchType.FILE_NAME: return _("File name"); - +#if ENABLE_FACES + case SearchType.FACE: + return _("Face"); +#endif case SearchType.MEDIA_TYPE: return _("Media type"); @@ -346,6 +361,19 @@ public class SearchConditionText : SearchCondition { ret |= string_match(text, String.remove_diacritics(source.get_basename().down())); } +#if ENABLE_FACES + if (SearchType.ANY_TEXT == search_type || SearchType.FACE == search_type) { + Gee.List<Face>? face_list = Face.global.fetch_for_source(source); + if (null != face_list) { + foreach (Face face in face_list) { + ret |= string_match(text, face.get_name().down()); + } + } else { + ret |= string_match(text, null); // for IS_NOT_SET + } + } +#endif + return (context == Context.DOES_NOT_CONTAIN) ? !ret : ret; } } |