r15571 - gnucash/branches/remove-group2/src - Get QIF import working again. One bad function conversion when

David Hampton hampton at cvs.gnucash.org
Mon Feb 12 00:04:15 EST 2007


Author: hampton
Date: 2007-02-12 00:04:13 -0500 (Mon, 12 Feb 2007)
New Revision: 15571
Trac: http://svn.gnucash.org/trac/changeset/15571

Modified:
   gnucash/branches/remove-group2/src/engine/Account.c
   gnucash/branches/remove-group2/src/engine/Account.h
   gnucash/branches/remove-group2/src/engine/engine.i
   gnucash/branches/remove-group2/src/import-export/qif-import/qif-dialog-utils.scm
   gnucash/branches/remove-group2/src/import-export/qif-import/qif-merge-groups.scm
   gnucash/branches/remove-group2/src/import-export/qif-import/qif-to-gnc.scm
Log:
Get QIF import working again.  One bad function conversion when
removing the Group structure.  Mostly scheme function calls with wrong
names, and some swigification issues.


Modified: gnucash/branches/remove-group2/src/engine/Account.c
===================================================================
--- gnucash/branches/remove-group2/src/engine/Account.c	2007-02-11 23:53:38 UTC (rev 15570)
+++ gnucash/branches/remove-group2/src/engine/Account.c	2007-02-12 05:04:13 UTC (rev 15571)
@@ -149,6 +149,12 @@
   LEAVE ("account=%p\n", acc);
 }
 
+QofBook *
+gnc_account_get_book(const Account *account)
+{
+  return qof_instance_get_book(QOF_INSTANCE(account));
+}
+
 /********************************************************************\
 \********************************************************************/
 
@@ -3169,8 +3175,7 @@
 void 
 gnc_account_merge_children (Account *parent)
 {
-  GList *node_a;
-  GList *node_b;
+  GList *node_a, *node_b, *work, *worker;
 
   if (!parent) return;
 
@@ -3198,8 +3203,11 @@
 
       /* consolidate children */
       if (acc_b->children) {
-	acc_a->children = g_list_concat(acc_a->children, acc_b->children);
-	acc_b->children = NULL;
+	work = g_list_copy(acc_b->children);
+	for (worker = work; worker; worker = g_list_next(worker))
+	  gnc_account_append_child (acc_a, (Account *)worker->data);
+	g_list_free(work);
+
 	qof_event_gen (&acc_a->inst.entity, QOF_EVENT_MODIFY, NULL);
 	qof_event_gen (&acc_b->inst.entity, QOF_EVENT_MODIFY, NULL);
       }

Modified: gnucash/branches/remove-group2/src/engine/Account.h
===================================================================
--- gnucash/branches/remove-group2/src/engine/Account.h	2007-02-11 23:53:38 UTC (rev 15570)
+++ gnucash/branches/remove-group2/src/engine/Account.h	2007-02-12 05:04:13 UTC (rev 15571)
@@ -216,7 +216,6 @@
 void gnc_book_set_root_account(QofBook *book, Account *root);
 
 /** @deprecated */
-#define gnc_account_get_book(X)   qof_instance_get_book(QOF_INSTANCE(X))
 #define xaccAccountGetGUID(X)     qof_entity_get_guid(QOF_ENTITY(X))
 #define xaccAccountReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
 
@@ -233,6 +232,7 @@
 /** @name Account general setters/getters 
  @{ */
 
+QofBook *gnc_account_get_book(const Account *account);
 /** Set the account's type */
 void xaccAccountSetType (Account *account, GNCAccountType);
 /** Set the account's name */

Modified: gnucash/branches/remove-group2/src/engine/engine.i
===================================================================
--- gnucash/branches/remove-group2/src/engine/engine.i	2007-02-11 23:53:38 UTC (rev 15570)
+++ gnucash/branches/remove-group2/src/engine/engine.i	2007-02-12 05:04:13 UTC (rev 15571)
@@ -85,6 +85,10 @@
 
 %include <Split.h>
 %include <engine-helpers.h>
+AccountList * gnc_account_get_children (const Account *account);
+AccountList * gnc_account_get_descendants (const Account *account);
+%ignore gnc_account_get_children;
+%ignore gnc_account_get_descendants;
 %include <Account.h>
 %include <Transaction.h>
 %include <gnc-pricedb.h>

Modified: gnucash/branches/remove-group2/src/import-export/qif-import/qif-dialog-utils.scm
===================================================================
--- gnucash/branches/remove-group2/src/import-export/qif-import/qif-dialog-utils.scm	2007-02-11 23:53:38 UTC (rev 15570)
+++ gnucash/branches/remove-group2/src/import-export/qif-import/qif-dialog-utils.scm	2007-02-12 05:04:13 UTC (rev 15571)
@@ -606,7 +606,7 @@
               (not (hash-ref stock-hash stock-name)))
              (let* ((separator (string-ref (gnc-get-account-separator-string) 0))
                     (existing-gnc-acct 
-                     (gnc-get-account-from-full-name 
+                     (gnc-account-lookup-by-full-name 
                       (gnc-get-current-root-account)
                       (qif-map-entry:gnc-name map-entry)))
 		    (book (gnc-account-get-book (gnc:get-current-root-account)))

Modified: gnucash/branches/remove-group2/src/import-export/qif-import/qif-merge-groups.scm
===================================================================
--- gnucash/branches/remove-group2/src/import-export/qif-import/qif-merge-groups.scm	2007-02-11 23:53:38 UTC (rev 15570)
+++ gnucash/branches/remove-group2/src/import-export/qif-import/qif-merge-groups.scm	2007-02-12 05:04:13 UTC (rev 15571)
@@ -87,7 +87,7 @@
                 ;; query won't find anything.  optimize this later.
                 (xaccQueryAddSingleAccountMatch
                  sq 
-                 (gnc-get-account-from-full-name
+                 (gnc-account-lookup-by-full-name
                   old-root (gnc-account-get-full-name
                              (xaccSplitGetAccount split)))
                  QOF-QUERY-AND)
@@ -158,7 +158,7 @@
 
 (define (gnc:account-tree-catenate-and-merge old-root new-root)
   ;; stuff the new accounts into the old account tree and merge the accounts
-  (gnc:account-join-children old-root new-root)
-  (gnc:account-begin-edit new-root)
-  (gnc:account-destroy new-root)
-  (gnc:account-merge-children old-root))
+  (gnc-account-join-children old-root new-root)
+  (xaccAccountBeginEdit new-root)
+  (xaccAccountDestroy new-root)
+  (gnc-account-merge-children old-root))

Modified: gnucash/branches/remove-group2/src/import-export/qif-import/qif-to-gnc.scm
===================================================================
--- gnucash/branches/remove-group2/src/import-export/qif-import/qif-to-gnc.scm	2007-02-11 23:53:38 UTC (rev 15570)
+++ gnucash/branches/remove-group2/src/import-export/qif-import/qif-to-gnc.scm	2007-02-12 05:04:13 UTC (rev 15571)
@@ -19,7 +19,7 @@
          (gnc-name (qif-map-entry:gnc-name acct-info))
          (existing-account (hash-ref gnc-acct-hash gnc-name))
          (same-gnc-account 
-          (gnc-get-account-from-full-name old-root gnc-name))
+          (gnc-account-lookup-by-full-name old-root gnc-name))
          (allowed-types 
           (qif-map-entry:allowed-types acct-info))
          (make-new-acct #f)
@@ -38,12 +38,12 @@
 	     #t))))
     
     (define (make-unique-name-variant long-name short-name)
-      (if (not (null? (gnc-get-account-from-full-name old-root long-name)))
+      (if (not (null? (gnc-account-lookup-by-full-name old-root long-name)))
           (let loop ((count 2))
             (let* ((test-name 
                     (string-append long-name (sprintf #f " %a" count)))
                    (test-acct 
-                    (gnc-get-account-from-full-name old-root test-name)))
+                    (gnc-account-lookup-by-full-name old-root test-name)))
               (if (and (not (null? test-acct)) (not (compatible? test-acct)))
                   (loop (+ 1 count))
                   (string-append short-name (sprintf #f " %a" count)))))
@@ -158,8 +158,8 @@
                                    pinfo #t default-currency #f default-currency
                                    gnc-acct-hash old-root new-root))))
           (if (and parent-acct (not (null? parent-acct)))
-              (gnc:account-append-child parent-acct new-acct)
-              (gnc:account-append-child new-root new-acct))
+              (gnc-account-append-child parent-acct new-acct)
+              (gnc-account-append-child new-root new-acct))
           
           (hash-set! gnc-acct-hash gnc-name new-acct)
           new-acct))))



More information about the gnucash-changes mailing list