From f1fba37d0d0c47b03ca746ff6abf91eb8ac24cca Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sat, 2 Aug 2014 19:59:21 +0200 Subject: [PATCH] ag_window_save_action() now only saves if needed --- src/ag-window.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ag-window.c b/src/ag-window.c index ecc373f..6dcb6dd 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -250,11 +250,10 @@ ag_window_save_action(GSimpleAction *action, recalculate_chart(window); - old_id = (priv->saved_data) ? priv->saved_data->db_id : -1; + if (!ag_window_can_close(window, FALSE)) { + old_id = (priv->saved_data) ? priv->saved_data->db_id : -1; + save_data = ag_chart_get_db_save(priv->chart, old_id); - save_data = ag_chart_get_db_save(priv->chart, old_id); - - if (!ag_db_save_identical(priv->saved_data, save_data)) { if (!ag_db_save_chart(db, save_data, &err)) { ag_app_message_dialog( GTK_WIDGET(window), @@ -266,8 +265,6 @@ ag_window_save_action(GSimpleAction *action, ag_db_save_data_free(priv->saved_data); priv->saved_data = save_data; - } else { - ag_db_save_data_free(save_data); } }