r23783 - gnucash/trunk/src - Bug #723373: Don't create any sx in the since-last-run dialog if this is a read-only file.

Christian Stimming cstim at code.gnucash.org
Fri Jan 31 15:02:37 EST 2014


Author: cstim
Date: 2014-01-31 15:02:37 -0500 (Fri, 31 Jan 2014)
New Revision: 23783
Trac: http://svn.gnucash.org/trac/changeset/23783

Modified:
   gnucash/trunk/src/app-utils/gnc-sx-instance-model.c
   gnucash/trunk/src/gnome/dialog-sx-since-last-run.c
   gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c
Log:
Bug #723373: Don't create any sx in the since-last-run dialog if this is a read-only file.

Modified: gnucash/trunk/src/app-utils/gnc-sx-instance-model.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-sx-instance-model.c	2014-01-30 20:19:31 UTC (rev 23782)
+++ gnucash/trunk/src/app-utils/gnc-sx-instance-model.c	2014-01-31 20:02:37 UTC (rev 23783)
@@ -1259,6 +1259,13 @@
                                     GList **creation_errors)
 {
     GList *iter;
+
+    if (qof_book_is_readonly(gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then don't change anything here. */
+        return;
+    }
+
     for (iter = model->sx_instance_list; iter != NULL; iter = iter->next)
     {
         GList *instance_iter;

Modified: gnucash/trunk/src/gnome/dialog-sx-since-last-run.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-since-last-run.c	2014-01-30 20:19:31 UTC (rev 23782)
+++ gnucash/trunk/src/gnome/dialog-sx-since-last-run.c	2014-01-31 20:02:37 UTC (rev 23783)
@@ -804,6 +804,12 @@
     if (!gnc_prefs_get_bool (GNC_PREFS_GROUP, GNC_PREF_SHOW_AT_FOPEN))
         return;
 
+    if (qof_book_is_readonly(gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then don't change anything here. */
+        return;
+    }
+
     inst_model = gnc_sx_get_current_instances();
     gnc_sx_instance_model_summarize(inst_model, &summary);
     gnc_sx_summary_print(&summary);
@@ -1132,6 +1138,12 @@
                                GList **created_transaction_guids,
                                GList **creation_errors)
 {
+    if (qof_book_is_readonly(gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then don't change anything here. */
+        return;
+    }
+
     g_signal_handler_block(model->instances, model->updated_cb_id);
     gnc_sx_instance_model_effect_change(model->instances, auto_create_only, created_transaction_guids, creation_errors);
     g_signal_handler_unblock(model->instances, model->updated_cb_id);

Modified: gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c	2014-01-30 20:19:31 UTC (rev 23782)
+++ gnucash/trunk/src/gnome/gnc-plugin-basic-commands.c	2014-01-31 20:02:37 UTC (rev 23783)
@@ -549,6 +549,12 @@
 
     window = data->window;
 
+    if (qof_book_is_readonly(gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then don't change anything here. */
+        return;
+    }
+
     sx_instances = gnc_sx_get_current_instances();
     gnc_sx_instance_model_summarize(sx_instances, &summary);
     gnc_sx_instance_model_effect_change(sx_instances, TRUE, &auto_created_txns, NULL);



More information about the gnucash-changes mailing list