[recipes] Persist the image changes when the recipe is saved or not
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Persist the image changes when the recipe is saved or not
- Date: Sun, 19 Feb 2017 01:11:25 +0000 (UTC)
commit 6fa46b94b713b5661ac64a9a00bf35fa4c27cc42
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 18 18:11:27 2017 -0500
Persist the image changes when the recipe is saved or not
We call the new image viewer api when the recipe is saved,
or when we navigate away from the edit page without saving.
src/gr-edit-page.c | 11 ++++++++++-
src/gr-window.c | 4 ++++
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index 3978e87..b026d02 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -1748,6 +1748,11 @@ gr_edit_page_clear (GrEditPage *page)
GArray *images;
GrRecipeStore *store;
+ gr_image_viewer_revert_changes (GR_IMAGE_VIEWER (page->images));
+
+ if (!page->recipe)
+ return;
+
store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
gtk_label_set_label (GTK_LABEL (page->name_label), _("Name Your Recipe"));
@@ -1898,6 +1903,8 @@ gr_edit_page_edit (GrEditPage *page,
g_autoptr(GrChef) chef = NULL;
GrRecipeStore *store;
+ gr_image_viewer_revert_changes (GR_IMAGE_VIEWER (page->images));
+
store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
name = gr_recipe_get_name (recipe);
@@ -2074,11 +2081,14 @@ gr_edit_page_save (GrEditPage *page)
}
if (ret) {
+ gr_image_viewer_persist_changes (GR_IMAGE_VIEWER (page->images));
gr_recipe_tile_recreate_css ();
return TRUE;
}
+ gr_image_viewer_revert_changes (GR_IMAGE_VIEWER (page->images));
+
gtk_label_set_label (GTK_LABEL (page->error_label), error->message);
gtk_revealer_set_reveal_child (GTK_REVEALER (page->error_revealer), TRUE);
@@ -2096,4 +2106,3 @@ gr_edit_page_get_recipe (GrEditPage *page)
{
return page->recipe;
}
-
diff --git a/src/gr-window.c b/src/gr-window.c
index 9d5262a..c9d1a52 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -269,6 +269,10 @@ visible_page_changed (GrWindow *window)
gr_list_page_clear (GR_LIST_PAGE (window->list_page));
}
+ if (strcmp (visible, "edit") != 0) {
+ gr_edit_page_clear (GR_EDIT_PAGE (window->edit_page));
+ }
+
if (strcmp (visible, "recipes") == 0) {
gr_recipes_page_refresh (GR_RECIPES_PAGE (window->recipes_page));
gr_recipes_page_unexpand (GR_RECIPES_PAGE (window->recipes_page));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]