comparison src/collect-dlg.c @ 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 0bea79d87065
children 8b89e3ff286b
comparison
equal deleted inserted replaced
1198:931ff871799f 1199:404168a124aa
116 } 116 }
117 117
118 static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append) 118 static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append)
119 { 119 {
120 CollectionData *cd = data; 120 CollectionData *cd = data;
121 121 gboolean err = FALSE;
122 if (!fd->dest_path || isdir(fd->dest_path)) return; 122 gchar *text = NULL;
123
124 if (!isname(fd->dest_path))
125 {
126 err = TRUE;
127 text = g_strdup_printf(_("No such file '%s'."), fd->dest_path);
128 }
129 if (!err && isdir(fd->dest_path))
130 {
131 err = TRUE;
132 text = g_strdup_printf(_("'%s' is a directory, not a collection file."), fd->dest_path);
133 }
134 if (!err && !access_file(fd->dest_path, R_OK))
135 {
136 err = TRUE;
137 text = g_strdup_printf(_("You do not have read permissions on the file '%s'."), fd->dest_path);
138 }
139
140 if (err) {
141 if (text)
142 {
143 file_util_warning_dialog(_("Can not open collection file"), text, GTK_STOCK_DIALOG_ERROR, NULL);
144 g_free(text);
145 }
146 return;
147 }
123 148
124 if (append) 149 if (append)
125 { 150 {
126 collection_load(cd, fd->dest_path, TRUE); 151 collection_load(cd, fd->dest_path, TRUE);
127 collection_unref(cd); 152 collection_unref(cd);