/*
* Geeqie
* (C) 2004 John Ellis
- * Copyright (C) 2008 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* Author: John Ellis
*
};
-static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd);
+static gboolean collection_save_confirmed(FileDialog *fd, gboolean overwrite, CollectionData *cd);
static void collection_confirm_ok_cb(GenericDialog *gd, gpointer data)
/* this is a no-op, so the cancel button is added */
}
-static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd)
+static gboolean collection_save_confirmed(FileDialog *fd, gboolean overwrite, CollectionData *cd)
{
gchar *buf;
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)
{
void collection_dialog_save_as(gchar *path, CollectionData *cd)
{
-#if 0
- if (!cd->list)
- {
- GtkWidget *parent = NULL;
- CollectWindow *cw;
-
- cw = collection_window_find(cd);
- if (cw) parent = cw->window;
- file_util_warning_dialog(_("Collection empty"),
- _("The current collection is empty, save aborted."),
- GTK_STOCK_DIALOG_INFO, parent);
- return;
- }
-#endif
-
if (!path) path = cd->path;
if (!path) path = cd->name;