static void address_cb(gpointer data, gpointer user_data) { const GncAddress* address = data; AddressQF *s = (AddressQF *) user_data; gnc_quickfill_insert (s->qf_addr2, gncAddressGetAddr2(address), s->qf_sort); gnc_quickfill_insert (s->qf_addr3, gncAddressGetAddr3(address), s->qf_sort); gnc_quickfill_insert (s->qf_addr4, gncAddressGetAddr4(address), s->qf_sort); }
static void listen_for_gncentry_events(QofInstance *entity, QofEventId event_type, gpointer user_data, gpointer event_data) { EntryQF *qfb = user_data; QuickFill *qf = qfb->qf; const char *desc; /* We only listen for GncEntry events */ if(!entity) return; if(typeid(*entity) != typeid(GncEntry)) return; // if (!GNC_IS_ENTRY (entity)) // return; /* We listen for MODIFY (if the description was changed into * something non-empty, so we add the string to the quickfill) and * DESTROY (to remove the description from the quickfill). */ if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY))) return; /* g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */ /* entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */ GncEntry * entry = dynamic_cast<GncEntry*>(entity); desc = gncEntryGetDescription(entry); if (event_type & QOF_EVENT_MODIFY) { /* If the description was changed into something non-empty, so * we add the string to the quickfill */ if (!desc || strlen(desc) == 0) return; /* Add the new string to the quickfill */ gnc_quickfill_insert (qf, desc, QUICKFILL_LIFO); } else if (event_type & QOF_EVENT_DESTROY) { if (!desc || strlen(desc) == 0) return; /* Remove the description from the quickfill */ gnc_quickfill_insert (qf, desc, QUICKFILL_LIFO); } }
static void entry_cb(gpointer data, gpointer user_data) { const GncEntry* entry = data; EntryQF *s = (EntryQF *) user_data; if (s->using_invoices == (gncEntryGetInvAccount(entry) != NULL)) { gnc_quickfill_insert (s->qf, gncEntryGetDescription(entry), s->qf_sort); } }
static void listen_for_gncaddress_events(QofInstance *entity, QofEventId event_type, gpointer user_data, gpointer event_data) { AddressQF *qfb = user_data; const char *addr2, *addr3, *addr4; /* We only listen for GncAddress events */ if (!GNC_IS_ADDRESS (entity)) return; /* We listen for MODIFY (if the description was changed into * something non-empty, so we add the string to the quickfill) and * DESTROY (to remove the description from the quickfill). */ if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY))) return; /* g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */ /* entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */ addr2 = gncAddressGetAddr2(GNC_ADDRESS(entity)); addr3 = gncAddressGetAddr3(GNC_ADDRESS(entity)); addr4 = gncAddressGetAddr4(GNC_ADDRESS(entity)); if (event_type & QOF_EVENT_MODIFY) { /* If the description was changed into something non-empty, so * we add the string to the quickfill */ if (addr2 && strlen(addr2) > 0) { /* Add the new string to the quickfill */ gnc_quickfill_insert (qfb->qf_addr2, addr2, QUICKFILL_LIFO); } if (addr3 && strlen(addr3) > 0) { /* Add the new string to the quickfill */ gnc_quickfill_insert (qfb->qf_addr3, addr3, QUICKFILL_LIFO); } if (addr4 && strlen(addr4) > 0) { /* Add the new string to the quickfill */ gnc_quickfill_insert (qfb->qf_addr4, addr4, QUICKFILL_LIFO); } } else if (event_type & QOF_EVENT_DESTROY) { if (addr2 && strlen(addr2) > 0) { /* Remove the description from the quickfill */ gnc_quickfill_insert (qfb->qf_addr2, addr2, QUICKFILL_LIFO); } if (addr3 && strlen(addr3) > 0) { /* Remove the description from the quickfill */ gnc_quickfill_insert (qfb->qf_addr3, addr3, QUICKFILL_LIFO); } if (addr4 && strlen(addr4) > 0) { /* Remove the description from the quickfill */ gnc_quickfill_insert (qfb->qf_addr4, addr4, QUICKFILL_LIFO); } } }