r14885 - gnucash/branches/2.0 - Do not complain about non-existent files if we save to a new file. In

Derek Atkins warlord at cvs.gnucash.org
Fri Sep 22 23:09:29 EDT 2006


Author: warlord
Date: 2006-09-22 23:09:26 -0400 (Fri, 22 Sep 2006)
New Revision: 14885
Trac: http://svn.gnucash.org/trac/changeset/14885

Modified:
   gnucash/branches/2.0/
   gnucash/branches/2.0/ChangeLog
   gnucash/branches/2.0/src/backend/file/gnc-backend-file.c
   gnucash/branches/2.0/src/gnome-utils/gnc-file.c
Log:
Do not complain about non-existent files if we save to a new file. In
pass one we ignore the error returned by stat and call qof_session_begin
with create_if_nonexistent=TRUE for a second run.

Merge from r14865.



Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
   - d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13335
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
   + d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13336
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282

Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog	2006-09-23 03:09:09 UTC (rev 14884)
+++ gnucash/branches/2.0/ChangeLog	2006-09-23 03:09:26 UTC (rev 14885)
@@ -1,3 +1,11 @@
+2006-09-19  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/backend/file/gnc-backend-file.c:
+	* src/gnome-utils/gnc-file.c: Do not complain about non-existent
+	  files if we save to a new file. In pass one we ignore the error
+	  returned by stat and call qof_session_begin with
+	  create_if_nonexistent=TRUE for a second run.
+
 2006-09-03  Christian Stimming  <stimming at tuhh.de>
 
 	* lib/libqof/qof/qofbackend.h, src/gnome-utils/gnc-file.c,

Modified: gnucash/branches/2.0/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/branches/2.0/src/backend/file/gnc-backend-file.c	2006-09-23 03:09:09 UTC (rev 14884)
+++ gnucash/branches/2.0/src/backend/file/gnc-backend-file.c	2006-09-23 03:09:26 UTC (rev 14885)
@@ -230,7 +230,7 @@
 
 	/* Now check whether we can stat(2) the file itself */
         rc = stat (be->fullpath, &statbuf);
-        if (rc != 0)
+        if ((rc != 0) && (!create_if_nonexistent))
         {
 	    /* Error on stat means the file doesn't exist */
             qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);

Modified: gnucash/branches/2.0/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/gnc-file.c	2006-09-23 03:09:09 UTC (rev 14884)
+++ gnucash/branches/2.0/src/gnome-utils/gnc-file.c	2006-09-23 03:09:26 UTC (rev 14885)
@@ -416,8 +416,12 @@
       break;
 
     case ERR_FILEIO_FILE_NOT_FOUND:
-      fmt = _("The file %s could not be found.");
-      gnc_error_dialog (parent, fmt, newfile);
+      if (type == GNC_FILE_DIALOG_SAVE) {
+        uh_oh = FALSE;
+      } else {
+        fmt = _("The file %s could not be found.");
+        gnc_error_dialog (parent, fmt, newfile);
+      }
       break;
 
     case ERR_FILEIO_FILE_TOO_OLD:
@@ -1068,7 +1072,8 @@
   }
 
   /* if the database doesn't exist, ask the user ... */
-  else if ((ERR_BACKEND_NO_SUCH_DB == io_err) ||
+  else if ((ERR_FILEIO_FILE_NOT_FOUND == io_err) ||
+           (ERR_BACKEND_NO_SUCH_DB == io_err) ||
            (ERR_SQL_DB_TOO_OLD == io_err))
   {
     if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))



More information about the gnucash-changes mailing list