25 #include "gnc-entry-quickfill.h" 30 G_GNUC_UNUSED
static QofLogModule log_module = GNC_MOD_REGISTER;
35 QuickFillSort qf_sort;
38 gboolean using_invoices;
43 gpointer user_data, gpointer event_data)
46 QuickFill *qf = qfb->qf;
50 if (!GNC_IS_ENTRY (entity))
56 if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
62 desc = gncEntryGetDescription(GNC_ENTRY(entity));
63 if (event_type & QOF_EVENT_MODIFY)
67 if (!desc || strlen(desc) == 0)
73 else if (event_type & QOF_EVENT_DESTROY)
75 if (!desc || strlen(desc) == 0)
84 shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
87 gnc_quickfill_destroy (qfb->qf);
92 static void entry_cb(gpointer data, gpointer user_data)
94 const GncEntry* entry = data;
96 if (s->using_invoices == (gncEntryGetInvAccount(entry) != NULL))
99 gncEntryGetDescription(entry),
106 static QofQuery *new_query_for_entrys(QofBook *book)
108 GSList *primary_sort_params = NULL;
109 QofQuery *query = qof_query_create_for (GNC_ID_ENTRY);
115 primary_sort_params = qof_query_build_param_list(ENTRY_DATE_ENTERED, NULL);
122 static EntryQF* build_shared_quickfill (QofBook *book,
const char * key, gboolean use_invoices)
125 QofQuery *query = new_query_for_entrys(book);
132 result->using_invoices = use_invoices;
133 result->qf = gnc_quickfill_new();
134 result->qf_sort = QUICKFILL_LIFO;
137 g_list_foreach (entries, entry_cb, result);
151 const char * key, gboolean use_invoices)
162 qfb = build_shared_quickfill(book, key, use_invoices);
165 g_assert(use_invoices == qfb->using_invoices);
void gnc_quickfill_insert(QuickFill *qf, const char *text, QuickFillSort sort)
Add the string "text" to the collection of searchable strings.
void qof_query_set_sort_order(QofQuery *q, QofQueryParamList *params1, QofQueryParamList *params2, QofQueryParamList *params3)
When a query is run, the results are sorted before being returned.
void qof_query_set_sort_increasing(QofQuery *q, gboolean prim_inc, gboolean sec_inc, gboolean tert_inc)
When a query is run, the results are sorted before being returned.
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
void qof_query_destroy(QofQuery *query)
Frees the resources associate with a Query object.
gint QofEventId
Define the type of events allowed.
void qof_query_set_book(QofQuery *query, QofBook *book)
Set the book to be searched.
void qof_book_set_data_fin(QofBook *book, const gchar *key, gpointer data, QofBookFinalCB)
Same as qof_book_set_data(), except that the callback will be called when the book is destroyed...
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
Additional event handling code.
GList * qof_query_run(QofQuery *query)
Perform the query, return the results.
QuickFill * gnc_get_shared_entry_desc_quickfill(QofBook *book, const char *key, gboolean use_invoices)
Similar to the Account Names account name quickfill, we create a cached quickfill with the descriptio...
Business Entry Interface.
gpointer qof_book_get_data(const QofBook *book, const gchar *key)
Retrieves arbitrary pointers to structs stored by qof_book_set_data.