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

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23783 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2014-01-31 20:02:37 +00:00
parent ce7df89dbf
commit ebdc4f89d2
3 changed files with 25 additions and 0 deletions

View File

@ -1259,6 +1259,13 @@ gnc_sx_instance_model_effect_change(GncSxInstanceModel *model,
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;

View File

@ -804,6 +804,12 @@ gnc_sx_sxsincelast_book_opened(void)
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 @@ gnc_sx_slr_model_effect_change(GncSxSlrTreeModelAdapter *model,
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);

View File

@ -549,6 +549,12 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
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);