[evolution-data-server] ESource changes not always written to a disk



commit cc7c2793751b52b84e6ca39bdba98717d21049b3
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 5 13:56:02 2014 +0100

    ESource changes not always written to a disk
    
    This is a regression after my commit 294ec486b3bcb82192844fba07a642a789d19e25,
    but if you look few lines above, how the save-to-disk works, then it's obvious
    that this could easily break. The actual problem here was that if there didn't
    change any of loaded extensions, then the source didn't change, due to avoided
    test of changes on unloaded extensions, which wasn't a problem before the above
    cited commit, because the code relied on false 'changed' notifications.

 libebackend/e-server-side-source.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/libebackend/e-server-side-source.c b/libebackend/e-server-side-source.c
index 8d895fe..dab1bb4 100644
--- a/libebackend/e-server-side-source.c
+++ b/libebackend/e-server-side-source.c
@@ -257,11 +257,24 @@ server_side_source_write_cb (EDBusSourceWritable *interface,
         *    4) The idle callback calls e_source_write_sync().
         *    5) e_source_write_sync() calls e_dbus_source_dup_data()
         *       and synchronously writes the resulting string to disk.
+        *
+        * XXX: This should be done more straigtforward, because rely
+        *      on two different signals and having actual data file
+        *      save in 5 steps is ridiculous, not talking that
+        *      the returned GError from this D-Bus call doesn't handle
+        *      errors from actual file save, which can also break, thus
+        *      the caller doesn't know about any real problem during saving
+        *      and thinks that everything went fine.
         */
 
-       if (error == NULL)
+       if (error == NULL) {
                e_dbus_source_set_data (dbus_source, data);
 
+               /* Make sure the ESource::changed signal is called, otherwise
+                  the above Q&A doesn't work and changed data are not saved. */
+               e_source_changed (source);
+       }
+
        if (error != NULL)
                g_dbus_method_invocation_take_error (invocation, error);
        else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]