25 #include "gnc-addr-quickfill.h" 31 G_GNUC_UNUSED
static QofLogModule log_module = GNC_MOD_REGISTER;
38 QuickFillSort qf_sort;
45 gpointer user_data, gpointer event_data)
48 const char *addr2, *addr3, *addr4;
51 if (!GNC_IS_ADDRESS (entity))
57 if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
63 addr2 = gncAddressGetAddr2(GNC_ADDRESS(entity));
64 addr3 = gncAddressGetAddr3(GNC_ADDRESS(entity));
65 addr4 = gncAddressGetAddr4(GNC_ADDRESS(entity));
66 if (event_type & QOF_EVENT_MODIFY)
70 if (addr2 && strlen(addr2) > 0)
75 if (addr3 && strlen(addr3) > 0)
80 if (addr4 && strlen(addr4) > 0)
86 else if (event_type & QOF_EVENT_DESTROY)
88 if (addr2 && strlen(addr2) > 0)
93 if (addr3 && strlen(addr3) > 0)
98 if (addr4 && strlen(addr4) > 0)
107 shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
110 gnc_quickfill_destroy (qfb->qf_addr2);
111 gnc_quickfill_destroy (qfb->qf_addr3);
112 gnc_quickfill_destroy (qfb->qf_addr4);
117 static void address_cb(gpointer data, gpointer user_data)
123 gncAddressGetAddr2(address),
127 gncAddressGetAddr3(address),
131 gncAddressGetAddr4(address),
137 static QofQuery *new_query_for_address(QofBook *book)
139 QofQuery *query = qof_query_create_for (GNC_ID_ADDRESS);
148 static AddressQF* build_shared_quickfill (QofBook *book,
const char * key)
151 QofQuery *query = new_query_for_address(book);
158 result->qf_addr2 = gnc_quickfill_new();
159 result->qf_addr3 = gnc_quickfill_new();
160 result->qf_addr4 = gnc_quickfill_new();
161 result->qf_sort = QUICKFILL_ALPHA;
164 g_list_foreach (entries, address_cb, result);
188 qfb = build_shared_quickfill(book, key);
191 return qfb->qf_addr2;
205 qfb = build_shared_quickfill(book, key);
208 return qfb->qf_addr3;
222 qfb = build_shared_quickfill(book, key);
225 return qfb->qf_addr4;
void gnc_quickfill_insert(QuickFill *qf, const char *text, QuickFillSort sort)
Add the string "text" to the collection of searchable strings.
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.
QuickFill * gnc_get_shared_address_addr3_quickfill(QofBook *book, const char *key)
Create/fetch a quickfill GncAddress description strings on the Addr3 part.
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.
All type declarations for the whole Gnucash engine.
GList * qof_query_run(QofQuery *query)
Perform the query, return the results.
QuickFill * gnc_get_shared_address_addr2_quickfill(QofBook *book, const char *key)
Similar to the Account Names account name quickfill, we create a cached quickfill with the address li...
QuickFill * gnc_get_shared_address_addr4_quickfill(QofBook *book, const char *key)
Create/fetch a quickfill GncAddress description strings on the Addr4 part.
gpointer qof_book_get_data(const QofBook *book, const gchar *key)
Retrieves arbitrary pointers to structs stored by qof_book_set_data.