r19254 - gnucash/trunk/src - Delegate transaction log enabling/disabling to the backends. Let only the xml backend enable logging.

Geert Janssens gjanssens at code.gnucash.org
Sat Jun 12 12:03:42 EDT 2010


Author: gjanssens
Date: 2010-06-12 12:03:42 -0400 (Sat, 12 Jun 2010)
New Revision: 19254
Trac: http://svn.gnucash.org/trac/changeset/19254

Modified:
   gnucash/trunk/src/backend/xml/gnc-backend-xml.c
   gnucash/trunk/src/gnc/mainwindow-file.cpp
   gnucash/trunk/src/gnome-utils/druid-gnc-xml-import.c
   gnucash/trunk/src/gnome-utils/gnc-file.c
Log:
Delegate transaction log enabling/disabling to the backends. Let only the xml backend enable logging.

Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.c	2010-06-12 15:51:53 UTC (rev 19253)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.c	2010-06-12 16:03:42 UTC (rev 19254)
@@ -297,10 +297,14 @@
         }
     }
 
+
     /* ---------------------------------------------------- */
     /* We should now have a fully resolved path name.
-     * Lets see if we can get a lock on it. */
+     * Let's start logging */
+    xaccLogSetBaseName (be->fullpath);
+    PINFO ("logpath=%s", be->fullpath ? be->fullpath : "(null)");
 
+    /* And let's see if we can get a lock on it. */
     be->lockfile = g_strconcat(be->fullpath, ".LCK", NULL);
 
     if (!ignore_lock && !gnc_xml_be_get_file_lock (be))
@@ -362,6 +366,9 @@
 static void
 xml_destroy_backend(QofBackend *be)
 {
+    /* Stop transactionlogging */
+    xaccLogSetBaseName (NULL);
+
     qof_backend_destroy(be);
     g_free(be);
 }

Modified: gnucash/trunk/src/gnc/mainwindow-file.cpp
===================================================================
--- gnucash/trunk/src/gnc/mainwindow-file.cpp	2010-06-12 15:51:53 UTC (rev 19253)
+++ gnucash/trunk/src/gnc/mainwindow-file.cpp	2010-06-12 16:03:42 UTC (rev 19254)
@@ -454,13 +454,6 @@
 
     if (!we_are_in_error)
     {
-        gchar *logpath = NULL;
-        if ( gnc_uri_is_file_uri ( newfile ) )
-            logpath = gnc_uri_get_path(newfile);
-        PINFO ("logpath=%s", logpath ? logpath : "(null)");
-        xaccLogSetBaseName (logpath);
-        g_free ( logpath );
-
         xaccLogDisable();
 
         {
@@ -665,19 +658,7 @@
         /* Whoa-ok. Blow away the previous file. */
     }
 
-    /* XXX Would logging make sense for databases as well (mysql/postgres) ?
-     * Currently the logpath is relative to the data file path.
-     * Databases don't have a file path, so no logging will be
-     * done for them in the current setup.
-     */
-    gchar *logpath = NULL;
-    if ( gnc_uri_is_file_uri ( newfile ) )
-        logpath = gnc_uri_get_path(newfile);
-    PINFO ("logpath=%s", logpath ? logpath : "(null)");
-    xaccLogSetBaseName (logpath);
-    g_free ( logpath );
 
-
     /* Prevent race condition between swapping the contents of the two
      * sessions, and actually installing the new session as the current
      * one. Any event callbacks that occur in this interval will have

Modified: gnucash/trunk/src/gnome-utils/druid-gnc-xml-import.c
===================================================================
--- gnucash/trunk/src/gnome-utils/druid-gnc-xml-import.c	2010-06-12 15:51:53 UTC (rev 19253)
+++ gnucash/trunk/src/gnome-utils/druid-gnc-xml-import.c	2010-06-12 16:03:42 UTC (rev 19254)
@@ -751,8 +751,6 @@
         goto cleanup_parse_file;
     }
 
-    logpath = gnc_uri_get_path (data->filename);
-    xaccLogSetBaseName (logpath);
     xaccLogDisable ();
     gxi_update_progress_bar (_("Reading file..."), 0.0);
     qof_session_load (session, gxi_update_progress_bar);

Modified: gnucash/trunk/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-file.c	2010-06-12 15:51:53 UTC (rev 19253)
+++ gnucash/trunk/src/gnome-utils/gnc-file.c	2010-06-12 16:03:42 UTC (rev 19254)
@@ -733,19 +733,7 @@
     if (!uh_oh)
     {
         Account *new_root;
-        gchar *logpath = NULL;
 
-        /* XXX Would logging make sense for databases as well (mysql/postgres) ?
-         * Currently the logpath is relative to the data file path.
-         * Databases don't have a file path, so no logging will be
-         * done for them in the current setup.
-         */
-        if ( gnc_uri_is_file_uri ( newfile ) )
-            logpath = gnc_uri_get_path(newfile);
-        PINFO ("logpath=%s", logpath ? logpath : "(null)");
-        xaccLogSetBaseName (logpath);
-        g_free ( logpath );
-
         /* If the new "file" is a database, attempt to store the password
          * in a keyring. GnuCash itself will not save it.
          */
@@ -1083,7 +1071,6 @@
     char *norm_file;
     char *newfile;
     const char *oldfile;
-    gchar *logpath = NULL;
 
     gchar *protocol=NULL;
     gchar *hostname=NULL;
@@ -1193,17 +1180,6 @@
         /* Whoa-ok. Blow away the previous file. */
     }
 
-    /* XXX Would logging make sense for databases as well (mysql/postgres) ?
-     * Currently the logpath is relative to the data file path.
-     * Databases don't have a file path, so no logging will be
-     * done for them in the current setup.
-     */
-    if ( gnc_uri_is_file_protocol ( protocol ) )
-        logpath = gnc_uri_get_path(newfile);
-    PINFO ("logpath=%s", logpath ? logpath : "(null)");
-    xaccLogSetBaseName (logpath);
-    g_free ( logpath );
-
     /* If the new "file" is a database, attempt to store the password
      * in a keyring. GnuCash itself will not save it.
      */



More information about the gnucash-changes mailing list