[Gnucash-changes] second attempt to add quickfill hooks

Linas Vepstas linas at cvs.gnucash.org
Mon May 31 19:28:58 EDT 2004


Log Message:
-----------
second attempt to add quickfill hooks

Tags:
----
gnucash-1-8-branch

Modified Files:
--------------
    gnucash/src/engine:
        gnc-book-p.h
        gnc-book.c
        gnc-book.h

Revision Data
-------------
Index: gnc-book.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Attic/gnc-book.c,v
retrieving revision 1.97.2.3
retrieving revision 1.97.2.4
diff -Lsrc/engine/gnc-book.c -Lsrc/engine/gnc-book.c -u -r1.97.2.3 -r1.97.2.4
--- src/engine/gnc-book.c
+++ src/engine/gnc-book.c
@@ -82,6 +82,7 @@
   book->topgroup = xaccMallocAccountGroup(book);
   book->pricedb = gnc_pricedb_create(book);
   book->shared_quickfill = NULL;
+  book->shared_quickfill_destroy = NULL;
 
   book->sched_xactions = NULL;
   book->sx_notsaved = FALSE;
@@ -126,6 +127,12 @@
   ENTER ("book=%p", book);
   gnc_engine_generate_event (&book->guid, GNC_EVENT_DESTROY);
 
+  if (book->shared_quickfill_destroy)
+  {
+    (book->shared_quickfill_destroy) (book,
+                        book->shared_quickfill);
+  }
+
   gncObjectBookEnd (book);
 
   xaccAccountGroupBeginEdit (book->topgroup);
@@ -229,10 +236,12 @@
 }
 
 void
-gnc_book_set_shared_quickfill_hack (GNCBook *book, gpointer qf)
+gnc_book_set_shared_quickfill_hack (GNCBook *book, gpointer qf,
+                                void (*fn) (GNCBook *, gpointer))
 {
   if (!book) return;
   book->shared_quickfill = qf;
+  book->shared_quickfill_destroy = fn;
 }
 
 /* ====================================================================== */
Index: gnc-book.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/gnc-book.h,v
retrieving revision 1.37.2.1
retrieving revision 1.37.2.2
diff -Lsrc/engine/gnc-book.h -Lsrc/engine/gnc-book.h -u -r1.37.2.1 -r1.37.2.2
--- src/engine/gnc-book.h
+++ src/engine/gnc-book.h
@@ -109,6 +109,7 @@
 #define BOOK_KVP		"kvp"
 
 gpointer gnc_book_get_shared_quickfill_hack (GNCBook *);
-void gnc_book_set_shared_quickfill_hack (GNCBook *, gpointer);
+void gnc_book_set_shared_quickfill_hack (GNCBook *, gpointer, 
+                                      void (*) (GNCBook *, gpointer));
 
 #endif /* GNC_BOOK_H */
Index: gnc-book-p.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Attic/gnc-book-p.h,v
retrieving revision 1.22.2.1
retrieving revision 1.22.2.2
diff -Lsrc/engine/gnc-book-p.h -Lsrc/engine/gnc-book-p.h -u -r1.22.2.1 -r1.22.2.2
--- src/engine/gnc-book-p.h
+++ src/engine/gnc-book-p.h
@@ -56,6 +56,7 @@
   AccountGroup *topgroup;
   GNCPriceDB *pricedb;
   gpointer shared_quickfill;
+  void (*shared_quickfill_destroy) (GNCBook *, gpointer);
 
   GList *sched_xactions;
   AccountGroup *template_group;


More information about the gnucash-changes mailing list