>From 82fa2be1ba05b879339459383acfe9658de02a8e Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@schampijer.de>
Date: Fri, 24 Jun 2011 14:29:10 +0200
Subject: [PATCH sugar] Journal detail view: sync updates of elements SL #2926
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>

If you did click on the favorite icon and had typed something in the
description field before this was lost. We now make sure everything is
synced before writing to disk.
---
 src/jarabe/journal/expandedentry.py |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index fe2f320..2182fb6 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -378,12 +378,10 @@ class ExpandedEntry(hippo.CanvasBox):
     def _tags_focus_out_event_cb(self, text_view, event):
         self._update_entry()
 
-    def _update_entry(self):
+    def _update_entry(self, needs_update=False):
         if not model.is_editable(self._metadata):
             return
 
-        needs_update = False
-
         old_title = self._metadata.get('title', None)
         new_title = self._title.props.widget.props.text
         if old_title != new_title:
@@ -414,14 +412,12 @@ class ExpandedEntry(hippo.CanvasBox):
         return int(self._metadata.get('keep', 0)) == 1
 
     def _keep_icon_activated_cb(self, keep_icon):
-        if not model.is_editable(self._metadata):
-            return
         if self.get_keep():
             self._metadata['keep'] = 0
         else:
             self._metadata['keep'] = 1
-        model.write(self._metadata, update_mtime=False)
 
+        self._update_entry(needs_update=True)
         keep_icon.props.keep = self.get_keep()
 
     def _icon_button_release_event_cb(self, button, event):
-- 
1.7.4.4

