[recipes] Bug 778996 - match chef names when searching
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Bug 778996 - match chef names when searching
- Date: Sun, 5 Mar 2017 02:55:58 +0000 (UTC)
commit 26d81c0deaf99bcc89e0c1fa3aa65f19942a1302
Author: Paxana Amanda Xander <VeganBikePunk Gmail com>
Date: Sat Mar 4 14:12:18 2017 -0800
Bug 778996 - match chef names when searching
Added a get_chef_fullname function to pull the name of the chef for
the recipe, added that fullname to the list of things the search
function checks against.
src/gr-recipe.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index 7514c33..639b7e3 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -28,6 +28,7 @@
#include "gr-recipe.h"
#include "gr-images.h"
#include "gr-utils.h"
+#include "gr-app.h"
#include "types.h"
struct _GrRecipe
@@ -98,6 +99,8 @@ enum {
N_PROPS
};
+static char * gr_recipe_get_chef_fullname (GrRecipe *self);
+
static void
gr_recipe_finalize (GObject *object)
{
@@ -246,6 +249,29 @@ set_images (GrRecipe *self,
g_object_notify (G_OBJECT (self), "images");
}
+static char *
+gr_recipe_get_chef_fullname (GrRecipe *self)
+{
+ GrRecipeStore *store;
+ g_autoptr(GrChef) chef = NULL;
+ char * fullname;
+
+ store = gr_app_get_recipe_store (GR_APP(g_application_get_default()));
+ chef = gr_recipe_store_get_chef(store, self->author);
+ if (chef) {
+ fullname = (char *) gr_chef_get_fullname(chef);
+
+ if (fullname)
+ return g_utf8_casefold(fullname, -1);
+ else
+ return NULL;
+ }
+
+ else
+ return NULL;
+
+}
+
static void
gr_recipe_set_property (GObject *object,
guint prop_id,
@@ -691,6 +717,8 @@ gr_recipe_matches (GrRecipe *recipe,
const char **terms)
{
int i;
+ char * cf_fullname;
+ cf_fullname = gr_recipe_get_chef_fullname(recipe);
for (i = 0; terms[i]; i++) {
if (g_str_has_prefix (terms[i], "i+:")) {
@@ -780,6 +808,9 @@ gr_recipe_matches (GrRecipe *recipe,
if (recipe->cf_ingredients && strstr (recipe->cf_ingredients, terms[i]) != NULL)
continue;
+
+ if (cf_fullname && strstr(cf_fullname, terms[i]) != NULL)
+ continue;
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]