Show an error message if the entry already exists or can not be created.

This commit is contained in:
Markus Koch 2018-03-25 18:38:09 +02:00
parent 8cee5b5188
commit 1287949669

View File

@ -1223,6 +1223,8 @@ void mainWindow_new_entry_clicked(GtkWidget *widget, gpointer user_data)
if (fd) { if (fd) {
fclose(fd); fclose(fd);
g_warning("File '%s' already exists.", path); g_warning("File '%s' already exists.", path);
mainWindow_show_info(mainWindow, "This entry already exists. Opening existing file instead.");
mainWindow_openExternalEditor(path);
} else { } else {
fd = fopen(path, "w"); fd = fopen(path, "w");
if (fd) { if (fd) {
@ -1239,6 +1241,7 @@ void mainWindow_new_entry_clicked(GtkWidget *widget, gpointer user_data)
mainWindow_openExternalEditor(path); mainWindow_openExternalEditor(path);
} else { } else {
g_warning("Could not open file '%s' for writing.", path); g_warning("Could not open file '%s' for writing.", path);
mainWindow_show_error(mainWindow, "Could not open file for writing.");
} }
} }
} }