[rygel] media-export: Allow search for object.container objects



commit b3b41a893369c0b257f9ba0feed677be671c1af6
Author: Regis Merlino <regis merlino intel com>
Date:   Mon Dec 17 16:34:57 2012 +0100

    media-export: Allow search for object.container objects
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690360

 .../rygel-media-export-media-cache.vala            |   23 +++++++++++++++----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala b/src/plugins/media-export/rygel-media-export-media-cache.vala
index f63f24f..cf2533b 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -921,9 +921,16 @@ public class Rygel.MediaExport.MediaCache : Object {
             case SearchCriteriaOp.LEQ:
             case SearchCriteriaOp.GREATER:
             case SearchCriteriaOp.GEQ:
-                v = exp.operand2;
-                operator = new SqlOperator.from_search_criteria_op
-                                        (exp.op, column, collate);
+                if (column == "m.class" &&
+                    exp.op == SearchCriteriaOp.EQ &&
+                    exp.operand2 == "object.container") {
+                    operator = new SqlOperator ("=", "o.type_fk");
+                    v = (int) ObjectType.CONTAINER;
+                } else {
+                    v = exp.operand2;
+                    operator = new SqlOperator.from_search_criteria_op
+                                            (exp.op, column, collate);
+                }
                 break;
             case SearchCriteriaOp.CONTAINS:
                 operator = new SqlFunction ("contains", column);
@@ -934,8 +941,14 @@ public class Rygel.MediaExport.MediaCache : Object {
                 v = exp.operand2;
                 break;
             case SearchCriteriaOp.DERIVED_FROM:
-                operator = new SqlOperator ("LIKE", column);
-                v = "%s%%".printf (exp.operand2);
+                if (column == "m.class" &&
+                    exp.operand2.has_prefix("object.container")) {
+                    operator = new SqlOperator ("=", "o.type_fk");
+                    v = (int) ObjectType.CONTAINER;
+                } else {
+                    operator = new SqlOperator ("LIKE", column);
+                    v = "%s%%".printf (exp.operand2);
+                }
                 break;
             default:
                 warning ("Unsupported op %d", exp.op);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]