ag_window_save_action() now only saves if needed

This commit is contained in:
Gergely Polonkai 2014-08-02 19:59:21 +02:00
parent d2d67534b3
commit f1fba37d0d

View File

@ -250,11 +250,10 @@ ag_window_save_action(GSimpleAction *action,
recalculate_chart(window); 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)) { if (!ag_db_save_chart(db, save_data, &err)) {
ag_app_message_dialog( ag_app_message_dialog(
GTK_WIDGET(window), GTK_WIDGET(window),
@ -266,8 +265,6 @@ ag_window_save_action(GSimpleAction *action,
ag_db_save_data_free(priv->saved_data); ag_db_save_data_free(priv->saved_data);
priv->saved_data = save_data; priv->saved_data = save_data;
} else {
ag_db_save_data_free(save_data);
} }
} }