r21795 - gnucash/trunk/src/libqof/qof - Read-only mode: When using qof_session_swap_data, don't swap the read_only flag but only the rest of the QofBook.

Christian Stimming cstim at code.gnucash.org
Thu Dec 29 17:14:43 EST 2011


Author: cstim
Date: 2011-12-29 17:14:43 -0500 (Thu, 29 Dec 2011)
New Revision: 21795
Trac: http://svn.gnucash.org/trac/changeset/21795

Modified:
   gnucash/trunk/src/libqof/qof/qofsession.c
Log:
Read-only mode: When using qof_session_swap_data, don't swap the read_only flag but only the rest of the QofBook.

Otherwise the temporary new session during "Save As" is read-only where in reality
it shouldn't be (but the old session should).

This makes "Save As" work correctly, but many UI elements don't get updated
to reflect the fact we've now got a read-write book again. (E.g., all open registers.)

Modified: gnucash/trunk/src/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsession.c	2011-12-29 21:58:51 UTC (rev 21794)
+++ gnucash/trunk/src/libqof/qof/qofsession.c	2011-12-29 22:14:43 UTC (rev 21795)
@@ -818,6 +818,7 @@
 qof_session_swap_data (QofSession *session_1, QofSession *session_2)
 {
     QofBook *book_1, *book_2;
+    gboolean tmp;
 
     if (session_1 == session_2) return;
     if (!session_1 || !session_2) return;
@@ -827,6 +828,11 @@
     book_1 = session_1->book;
     book_2 = session_2->book;
 
+    // Swap the read_only flags backwards.
+    tmp = book_1->read_only;
+    book_1->read_only = book_2->read_only;
+    book_2->read_only = tmp;
+
     session_1->book = book_2;
     session_2->book = book_1;
 



More information about the gnucash-changes mailing list