[recipes] Fix some oversights in recipe loading
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Fix some oversights in recipe loading
- Date: Wed, 21 Dec 2016 01:09:36 +0000 (UTC)
commit 9b12f821f402fab7f9567c8dec6182fe54929ec6
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 20 20:08:47 2016 -0500
Fix some oversights in recipe loading
We want to be able to only add notes to readonly recipes,
so make it possible to load recipe fragments like that.
src/gr-recipe-store.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index 9175c29..400376d 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -127,9 +127,12 @@ load_recipes (GrRecipeStore *self,
id = groups[i];
name = g_key_file_get_string (keyfile, groups[i], "Name", &error);
if (error) {
- g_warning ("Failed to load recipe %s: %s", groups[i], error->message);
+ if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+ g_warning ("Failed to load recipe %s: %s", groups[i], error->message);
+ continue;
+ }
+ name = g_strdup ("unknown");
g_clear_error (&error);
- continue;
}
author = g_key_file_get_string (keyfile, groups[i], "Author", &error);
if (error) {
@@ -182,9 +185,11 @@ load_recipes (GrRecipeStore *self,
}
cook_time = g_key_file_get_string (keyfile, groups[i], "CookTime", &error);
if (error) {
- g_warning ("Failed to load recipe %s: %s", groups[i], error->message);
+ if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+ g_warning ("Failed to load recipe %s: %s", groups[i], error->message);
+ continue;
+ }
g_clear_error (&error);
- continue;
}
ingredients = g_key_file_get_string (keyfile, groups[i], "Ingredients", &error);
if (error) {
@@ -348,7 +353,6 @@ load_recipes (GrRecipeStore *self,
recipe = g_hash_table_lookup (self->recipes, id);
if (recipe) {
- // FIXME: only notes should be set here
if (gr_recipe_is_readonly (recipe))
g_object_set (recipe,
"notes", notes,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]