[recipes/shopping-list: 4/13] Slight format change for favorites.db
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/shopping-list: 4/13] Slight format change for favorites.db
- Date: Sat, 14 Jan 2017 14:22:27 +0000 (UTC)
commit 966a9f18b4519da2d3db0c3c1c2a198c64804106
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jan 8 08:09:09 2017 -0500
Slight format change for favorites.db
Use Recipes as key instead of Favorites. We handle the change
transparently.
src/gr-recipe-store.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index 61967fb..030c89b 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -579,6 +579,7 @@ load_favorites (GrRecipeStore *self,
g_autoptr(GKeyFile) keyfile = NULL;
g_autoptr(GError) error = NULL;
g_autofree char *tmp = NULL;
+ const char *key;
keyfile = g_key_file_new ();
@@ -594,7 +595,12 @@ load_favorites (GrRecipeStore *self,
g_message ("Load favorites db: %s", path);
- self->favorites = g_key_file_get_string_list (keyfile, "Content", "Favorites", NULL, &error);
+ if (g_key_file_has_key (keyfile, "Content", "Recipes", NULL))
+ key = "Recipes";
+ else
+ key = "Favorites";
+
+ self->favorites = g_key_file_get_string_list (keyfile, "Content", key, NULL, &error);
if (error) {
if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
g_warning ("Failed to load favorites: %s", error->message);
@@ -626,7 +632,7 @@ save_favorites (GrRecipeStore *self)
g_message ("Save favorites db: %s", path);
- g_key_file_set_string_list (keyfile, "Content", "Favorites", (const char * const *)self->favorites,
g_strv_length (self->favorites));
+ g_key_file_set_string_list (keyfile, "Content", "Recipes", (const char * const *)self->favorites,
g_strv_length (self->favorites));
if (self->favorite_change) {
g_autofree char *tmp = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]