[Gnucash-changes] Handle the moving gnc-hooks to src/engine.

Derek Atkins warlord at cvs.gnucash.org
Sat Jun 11 15:10:21 EDT 2005


Log Message:
-----------
Handle the moving gnc-hooks to src/engine.

	* src/core-utils/Makefile.am
	  Removed gnc-hooks to src/engine.
	* src/core-utils/gw-core-utils-spec.scm:
	  Removed gnc-hooks
	* src/engine/gnc-hooks.[ch]:
	  gnc-hooks are here, so it can deal with QofEntity handling.
	  Changed the API to take a GFunc and a cbarg.
	* src/engine/gw-engine-spec.scm:
	  added gnc-hooks wrapper

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/core-utils:
        Makefile.am
        gw-core-utils-spec.scm
    gnucash/src/engine:
        Makefile.am
        gnc-hooks.c
        gnc-hooks.h
        gw-engine-spec.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.223
retrieving revision 1.1487.2.224
diff -LChangeLog -LChangeLog -u -r1.1487.2.223 -r1.1487.2.224
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,15 @@
+2005-06-11  Derek Atkins  <derek at ihtfp.com>
+
+	* src/core-utils/Makefile.am
+	  Removed gnc-hooks to src/engine.
+	* src/core-utils/gw-core-utils-spec.scm:
+	  Removed gnc-hooks
+	* src/engine/gnc-hooks.[ch]:
+	  gnc-hooks are here, so it can deal with QofEntity handling.
+	  Changed the API to take a GFunc and a cbarg.
+	* src/engine/gw-engine-spec.scm:
+	  added gnc-hooks wrapper
+
 2005-06-10  David Hampton  <hampton at employees.org>
 
 	* configure.in: Break out gtk from gnome to get access to a
Index: Makefile.am
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/core-utils/Makefile.am,v
retrieving revision 1.7.4.3
retrieving revision 1.7.4.4
diff -Lsrc/core-utils/Makefile.am -Lsrc/core-utils/Makefile.am -u -r1.7.4.3 -r1.7.4.4
--- src/core-utils/Makefile.am
+++ src/core-utils/Makefile.am
@@ -4,8 +4,7 @@
 libcore_utils_la_SOURCES = \
   core-utils.c \
   gnc-gconf-utils.c \
-  gnc-gobject-utils.c \
-  gnc-hooks.c
+  gnc-gobject-utils.c
 
 libcore_utils_la_LDFLAGS = -module
 
@@ -26,7 +25,6 @@
   core-utils.h \
   gnc-gconf-utils.h \
   gnc-gobject-utils.h \
-  gnc-hooks.h \
   gw-core-utils.h
 
 EXTRA_DIST = .cvsignore ${gwmod_DATA}
Index: gw-core-utils-spec.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/core-utils/gw-core-utils-spec.scm,v
retrieving revision 1.2.4.2
retrieving revision 1.2.4.3
diff -Lsrc/core-utils/gw-core-utils-spec.scm -Lsrc/core-utils/gw-core-utils-spec.scm -u -r1.2.4.2 -r1.2.4.3
--- src/core-utils/gw-core-utils-spec.scm
+++ src/core-utils/gw-core-utils-spec.scm
@@ -25,8 +25,7 @@
    (lambda (wrapset client-wrapset)
      (list
       "#include <core-utils.h>\n"
-      "#include <gnc-gconf-utils.h>\n"
-      "#include <gnc-hooks.h>\n")))
+      "#include <gnc-gconf-utils.h>\n")))
 
   (gw:wrap-function
    ws
@@ -36,12 +35,4 @@
    '(((<gw:mchars> caller-owned) section)
      ((<gw:mchars> caller-owned) name))
    "Get a boolean value from gconf.")
-
-  (gw:wrap-function
-   ws
-   'gnc:run-c-hook
-   '<gw:void>
-   "gnc_hook_run"
-   '(((<gw:mchars> caller-owned) name) (<gw:void*> data))
-   "Run a callback hook in the C domain.")
 )
Index: gw-engine-spec.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/gw-engine-spec.scm,v
retrieving revision 1.53.4.8
retrieving revision 1.53.4.9
diff -Lsrc/engine/gw-engine-spec.scm -Lsrc/engine/gw-engine-spec.scm -u -r1.53.4.8 -r1.53.4.9
--- src/engine/gw-engine-spec.scm
+++ src/engine/gw-engine-spec.scm
@@ -38,6 +38,7 @@
     "#include <qofbackend.h>\n"
     "#include <qofbook.h>\n"
     "#include <qofsession.h>\n"
+    "#include <gnc-hooks.h>\n"
     "#include <engine-helpers.h>\n")))
 
 (gw:wrapset-add-cs-initializers!
@@ -2489,3 +2490,11 @@
  "gnc_quote_source_set_fq_installed"
  '(((gw:glist-of (<gw:mchars> callee-owned) callee-owned) choices))
  "Takes a list of installed Finance::Quote souces and records it internally.")
+
+  (gw:wrap-function
+   ws
+   'gnc:run-c-hook
+   '<gw:void>
+   "gnc_hook_run"
+   '(((<gw:mchars> caller-owned) name) (<gw:void*> data))
+   "Run a callback hook in the C domain.")
Index: gnc-hooks.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Attic/gnc-hooks.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -Lsrc/engine/gnc-hooks.h -Lsrc/engine/gnc-hooks.h -u -r1.1.2.3 -r1.1.2.4
--- src/engine/gnc-hooks.h
+++ src/engine/gnc-hooks.h
@@ -38,10 +38,11 @@
 const gchar * gnc_hook_get_description(const gchar *name);
 
 /**
- * add and remove C-style dangers from a hook
+ * add and remove C-style dangers from a hook.  The callback is called
+ *   function(hook_run_data, cb_data)
  */
-void gnc_hook_add_dangler(const gchar *name, GHookFunc callback);
-void gnc_hook_remove_dangler(const gchar *name, GHookFunc callback);
+void gnc_hook_add_dangler(const gchar *name, GFunc callback, gpointer cb_data);
+void gnc_hook_remove_dangler(const gchar *name, GFunc callback);
 
 #if 0
 /**
Index: gnc-hooks.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Attic/gnc-hooks.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -Lsrc/engine/gnc-hooks.c -Lsrc/engine/gnc-hooks.c -u -r1.1.2.2 -r1.1.2.3
--- src/engine/gnc-hooks.c
+++ src/engine/gnc-hooks.c
@@ -94,7 +94,7 @@
 }
 
 void
-gnc_hook_add_dangler (const gchar *name, GHookFunc callback)
+gnc_hook_add_dangler (const gchar *name, GFunc callback, gpointer cb_arg)
 {
   GncHook *gnc_hook;
   GHook *hook;
@@ -104,6 +104,8 @@
   g_return_if_fail(gnc_hook != NULL);
   hook = g_hook_alloc(gnc_hook->c_danglers);
   hook->func = callback;
+  hook->data = cb_arg;
+  hook->destroy = NULL;
   g_hook_append(gnc_hook->c_danglers, hook);
   //printf("Leave %s:  \n", __FUNCTION__);
 }
@@ -115,7 +117,7 @@
 }
 
 void
-gnc_hook_remove_dangler (const gchar *name, GHookFunc callback)
+gnc_hook_remove_dangler (const gchar *name, GFunc callback)
 {
   GncHook *gnc_hook;
   GHook *hook;
@@ -142,7 +144,7 @@
 call_c_hook (GHook *hook, gpointer data)
 {
   //printf("Enter %s: hook %p (func %p), data %p\n", __FUNCTION__, hook, hook->func, data);
-  ((GHookFunc)hook->func)(data);
+  ((GFunc)hook->func)(data, hook->data);
   //printf("Leave %s:  \n", __FUNCTION__);
 }
 
Index: Makefile.am
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Makefile.am,v
retrieving revision 1.94.2.8
retrieving revision 1.94.2.9
diff -Lsrc/engine/Makefile.am -Lsrc/engine/Makefile.am -u -r1.94.2.8 -r1.94.2.9
--- src/engine/Makefile.am
+++ src/engine/Makefile.am
@@ -40,6 +40,7 @@
   gnc-engine.c \
   gnc-event.c \
   gnc-filepath-utils.c \
+  gnc-hooks.c \
   gnc-lot.c \
   gnc-numeric.c \
   gnc-pricedb.c \
@@ -100,6 +101,7 @@
   gnc-engine.h \
   gnc-event.h \
   gnc-filepath-utils.h \
+  gnc-hooks.h \
   gnc-numeric.h \
   gnc-pricedb.h \
   gnc-session.h \


More information about the gnucash-changes mailing list