static void book_sxes_setup(QofBook *book) { QofCollection *col; SchedXactions *sxes; col = qof_book_get_collection(book, GNC_ID_SCHEDXACTION); sxes = g_object_new (GNC_TYPE_SCHEDXACTIONS, NULL); g_assert(sxes); qof_instance_init_data(&sxes->inst, GNC_ID_SXES, book); sxes->sx_list = NULL; sxes->sx_notsaved = TRUE; qof_collection_set_data(col, sxes); }
static void book_sxes_end(QofBook* book) { QofCollection *col; SchedXactions *sxes; col = qof_book_get_collection(book, GNC_ID_SCHEDXACTION); sxes = qof_collection_get_data(col); if (sxes != NULL) { g_object_unref(sxes); qof_collection_set_data(col, NULL); } }
void qof_gobject_register_instance (QofBook *book, QofType type, GObject *gob) { QofCollection *coll; GSList *instance_list; if (!book || !type) return; coll = qof_book_get_collection (book, type); instance_list = qof_collection_get_data (coll); instance_list = g_slist_prepend (instance_list, gob); qof_collection_set_data (coll, instance_list); }
static void gnc_collection_set_template_root (QofCollection *col, Account *templateRoot) { Account *old_root; if (!col) return; old_root = gnc_collection_get_template_root (col); if (old_root == templateRoot) return; qof_collection_set_data (col, templateRoot); if (old_root) { xaccAccountBeginEdit (old_root); xaccAccountDestroy (old_root); } }