[recipes] Define search terms for spiciness



commit 5a7f3e9f1137f1423c0119d1feb57bbf45de13e6
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 6 16:24:04 2017 +0100

    Define search terms for spiciness
    
    This lays the groundwork for searching by spiciness.

 src/gr-recipe.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index 3567ee6..ab01cea 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <stdlib.h>
 #include <string.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
@@ -733,9 +734,28 @@ gr_recipe_matches (GrRecipe    *recipe,
                 else if (g_str_has_prefix (terms[i], "na:")) {
                         if (recipe->cf_name && strstr (recipe->cf_name, terms[i] + 3) == NULL)
                                 return FALSE;
+
                         continue;
 
                 }
+                else if (g_str_has_prefix (terms[i], "s+:")) {
+                        int level;
+
+                        level = atoi (terms[i] + 3);
+                        if (recipe->spiciness < level)
+                                return FALSE;
+
+                        continue;
+                }
+                else if (g_str_has_prefix (terms[i], "s-:")) {
+                        int level;
+
+                        level = atoi (terms[i] + 3);
+                        if (recipe->spiciness >= level)
+                                return FALSE;
+
+                        continue;
+                }
 
                 if (recipe->cf_name && strstr (recipe->cf_name, terms[i]) != NULL)
                         continue;


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