ag_window_back_action() goes to list only if the chart is saved

The user is prompted if they actually want to save or discard
This commit is contained in:
Gergely Polonkai 2014-08-02 20:00:56 +02:00
parent 8d76bdf1ef
commit 1049b933e8

View File

@ -1008,10 +1008,15 @@ ag_window_back_action(GSimpleAction *action,
AgWindow *window = AG_WINDOW(user_data); AgWindow *window = AG_WINDOW(user_data);
AgWindowPrivate *priv = ag_window_get_instance_private(window); AgWindowPrivate *priv = ag_window_get_instance_private(window);
/* TODO: Check for saving! */ if (ag_window_can_close(window, TRUE)) {
g_clear_object(&(priv->chart));
ag_db_save_data_free(priv->saved_data);
priv->saved_data = NULL;
ag_window_load_chart_list(window); ag_window_load_chart_list(window);
gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "list"); gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "list");
} }
}
static GActionEntry win_entries[] = { static GActionEntry win_entries[] = {
{ "close", ag_window_close_action, NULL, NULL, NULL }, { "close", ag_window_close_action, NULL, NULL, NULL },