Movie filter: add match_title method
authorPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 5 Jan 2010 17:51:31 +0000 (18:51 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 6 Jan 2010 16:36:38 +0000 (17:36 +0100)
src/movie-filter.vala

index 0368ba6..08663be 100644 (file)
@@ -22,4 +22,15 @@ public class MovieFilter : Object {
        public int year_max;
        public int rating_min;
        public Genres genres;
+
+       public bool matches_title (string _title) {
+               if (title == null)
+                       return true;
+
+               if ("*" in title) {
+                       return PatternSpec.match_simple (title, _title);
+               } else {
+                       return (_title.ascii_ncasecmp (title, title.length) == 0);
+               }
+       }
 }