No longer lose changes if the file could not be saved when closing the window
This commit is contained in:
parent
de167fa668
commit
c09540098b
@ -399,8 +399,8 @@ gboolean editor_close(Editor * editor)
|
|||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
if(res == GTK_RESPONSE_CANCEL)
|
if(res == GTK_RESPONSE_CANCEL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else if(res == GTK_RESPONSE_ACCEPT)
|
else if(res == GTK_RESPONSE_ACCEPT && editor_save(editor) != TRUE)
|
||||||
editor_save(editor);
|
return TRUE;
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -603,10 +603,7 @@ gboolean editor_save(Editor * editor)
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if(editor->filename == NULL)
|
if(editor->filename == NULL)
|
||||||
{
|
return editor_save_as_dialog(editor);
|
||||||
editor_save_as_dialog(editor);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if((fp = fopen(editor->filename, "w")) == NULL)
|
if((fp = fopen(editor->filename, "w")) == NULL)
|
||||||
{
|
{
|
||||||
buf = g_strdup_printf("%s: %s", editor->filename, strerror(
|
buf = g_strdup_printf("%s: %s", editor->filename, strerror(
|
||||||
|
Loading…
Reference in New Issue
Block a user