commit db9cc59ff361ea8aed74d9371fb66e678442d90c
Author: Matthijs Kooijman <matthijs@stdin.nl>
Date:   Sun Nov 21 17:09:00 2010 +0100

    Add bindings for running a qofquery on invoices.
    
    This adds a new typedef "gncInvoiceList" with the corresponding typemap,
    and adds two new functions qof_query_create_for_invoices and
    qof_query_run_for_invoices, which are trivial wrappers around
    qof_query_create_for and qof_query_run respectively.

diff --git a/src/engine/business-core.i b/src/engine/business-core.i
index 9da9116..4e01e4e 100644
--- a/src/engine/business-core.i
+++ b/src/engine/business-core.i
@@ -76,6 +76,7 @@ static GncEmployee * gncEmployeeLookupFlip(GncGUID g, QofBook *b)
 
 %}
 
+GLIST_HELPER_INOUT(gncInvoiceList, SWIGTYPE_p__gncInvoice);
 GLIST_HELPER_INOUT(EntryList, SWIGTYPE_p__gncEntry);
 GLIST_HELPER_INOUT(GncTaxTableEntryList, SWIGTYPE_p__gncTaxTableEntry);
 GLIST_HELPER_INOUT(OwnerList, SWIGTYPE_p__gncOwner);
@@ -127,6 +128,7 @@ GLIST_HELPER_INOUT(OwnerList, SWIGTYPE_p__gncOwner);
 %include <gncTaxTable.h>
 %include <gncVendor.h>
 %include <gncBusGuile.h>
+%include <libqof/qof/qofquery.h>
 
 #define URL_TYPE_CUSTOMER GNC_ID_CUSTOMER
 #define URL_TYPE_VENDOR GNC_ID_VENDOR
@@ -136,6 +138,16 @@ GLIST_HELPER_INOUT(OwnerList, SWIGTYPE_p__gncOwner);
 // not exactly clean
 #define URL_TYPE_OWNERREPORT "owner-report"
 
+%inline %{
+static QofQuery * qof_query_create_for_invoices(void) {
+  return qof_query_create_for(GNC_ID_INVOICE);
+}
+
+static gncInvoiceList * qof_query_run_for_invoices(QofQuery *q) {
+    return qof_query_run(q);
+}
+%}
+
 %init {
   {
     char tmp[100];
diff --git a/src/engine/gncInvoice.h b/src/engine/gncInvoice.h
index f6fddcc..69ae610 100644
--- a/src/engine/gncInvoice.h
+++ b/src/engine/gncInvoice.h
@@ -39,6 +39,7 @@ transaction and lot for the posted invoice.
 struct _gncInvoice;
 typedef struct _gncInvoice GncInvoice;
 typedef struct _gncInvoiceClass GncInvoiceClass;
+typedef GList gncInvoiceList;
 
 #include "gncBillTerm.h"
 #include "gncEntry.h"
