Revision: 1294
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1294&view=rev
Author:   zas_
Date:     2008-12-08 21:34:32 +0000 (Mon, 08 Dec 2008)

Log Message:
-----------
Display error dialog with appropriate message when user is trying to open an 
invalid collection file.

Modified Paths:
--------------
    trunk/src/collect-dlg.c

Modified: trunk/src/collect-dlg.c
===================================================================
--- trunk/src/collect-dlg.c     2008-12-08 21:33:14 UTC (rev 1293)
+++ trunk/src/collect-dlg.c     2008-12-08 21:34:32 UTC (rev 1294)
@@ -118,9 +118,34 @@
 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)
                {
                collection_load(cd, fd->dest_path, TRUE);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to