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

mdrework
Markus Koch 2018-03-25 18:38:09 +02:00
parent 8cee5b5188
commit 1287949669
1 changed files with 3 additions and 0 deletions

View File

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