Mercurial > geeqie.yaz
changeset 1199:404168a124aa
Display error dialog with appropriate message when user is trying to open an invalid collection file.
author | zas_ |
---|---|
date | Mon, 08 Dec 2008 21:34:32 +0000 |
parents | 931ff871799f |
children | 6eeefdb30618 |
files | src/collect-dlg.c |
diffstat | 1 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/collect-dlg.c Mon Dec 08 21:33:14 2008 +0000 +++ b/src/collect-dlg.c Mon Dec 08 21:34:32 2008 +0000 @@ -118,8 +118,33 @@ static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append) { CollectionData *cd = data; + gboolean err = FALSE; + gchar *text = NULL; - if (!fd->dest_path || isdir(fd->dest_path)) return; + if (!isname(fd->dest_path)) + { + err = TRUE; + text = g_strdup_printf(_("No such file '%s'."), fd->dest_path); + } + if (!err && isdir(fd->dest_path)) + { + err = TRUE; + text = g_strdup_printf(_("'%s' is a directory, not a collection file."), fd->dest_path); + } + if (!err && !access_file(fd->dest_path, R_OK)) + { + err = TRUE; + text = g_strdup_printf(_("You do not have read permissions on the file '%s'."), fd->dest_path); + } + + if (err) { + if (text) + { + file_util_warning_dialog(_("Can not open collection file"), text, GTK_STOCK_DIALOG_ERROR, NULL); + g_free(text); + } + return; + } if (append) {