Some routines are normal routines, and some routines use the gobject structure to allow different implementations by different object types.
Per-instance routine: gboolean qof_instance_refers_to_object(QofInstance* A, QofInstance* B) - returns TRUE/FALSE whether object A contains a reference to object B.
Normal routine: GList* qof_instance_get_referring_object_list_from_collection(QofCollection* c, QofInstance* B) - Calls qof_instance_refers_to_object() for each object in the collection, and returns a list of the objects which contain a reference to B.
Per-instance routine: GList* qof_instance_get_typed_referring_object_list(QofInstance* A, QofInstance* B) - returns a list of all objects of the same type as A which contain a reference to B. Being per-instance allows an object to use knowledge to avoid scanning cases where there are no references (e.g. billterms do not contain references to splits), or a scan is not needed (references from splits to an account can be determined using xaccAccountGetSplitList()). This routine can do a scan by calling qof_instnace_get_referring_object_list_from_collection().
Normal routine: qof_instance_get_referring_object_list(QofInstance* A) - For all collections in the book, gets an instance and calls its qof_instance_get_typed_referring_object_list() routine, concatenating all of the returned lists. This is the routine that external code can call to get a list of all objects with references to an object A. The list must be freed by the caller but the contents must not.
Per-instance routine: gchar* qof_instance_get_display_name(QofInstance* A) - returns a string which can identify object A to the user. This could be used to display a list of the objects returned by qof_instance_get_referring_object_list() ("Invoice 0004 for customer C") so that the user can modify those objects to remove the references. Note that this is going to require internationalization, which has not been implemented yet. If not overridden by the object class, the default string is "Object <type> <address>" e.g. "Object gncCustomer 0x12345678".
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18893 57a11ea4-9604-0410-9ed3-97b8803252fd
The Qt Undo framework is almost like magic. We just have to create a
command object instead of directly manipulating the value, and suddenly
the undo/redo just works. This is fun!
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18889 57a11ea4-9604-0410-9ed3-97b8803252fd
Also, change many main window slots to make use of the auto-connection
feature because it makes the slot intention much easier to read.
Also, note how we store the Tab position, title, isEnabled state
in dynamically allocated properties in the Tab widget itself -
this is a rather cool feature of QObject here (see reallyRemoveTab()
and viewOrHideTab()).
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18886 57a11ea4-9604-0410-9ed3-97b8803252fd
Apply Bob's patch after fixing the whitespace. This patch may cause issues on Windows
(a previous version of the patch did). If the next Windows nightly build exhibits
the missing register tab names again, it will have to be reverted again
and improved upon.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18881 57a11ea4-9604-0410-9ed3-97b8803252fd
I simply removed the obsolete test cases. More work is still needed to add new valid tests.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18879 57a11ea4-9604-0410-9ed3-97b8803252fd
- Replace trunc() by floor()
- Provide a round() workaround implementation for MSVC
- Use g_strcasecmp instead of the libc one
- Add include for libc replacements
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18876 57a11ea4-9604-0410-9ed3-97b8803252fd
In particular, the formatting of a gnc_numeric is defined there.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18869 57a11ea4-9604-0410-9ed3-97b8803252fd
Date and values/amounts can follow next, once those types are suitably
wrapped into C++ as well.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18868 57a11ea4-9604-0410-9ed3-97b8803252fd
Also, more symbols of libguile/gc.h need explicit declspec on MSVC.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18864 57a11ea4-9604-0410-9ed3-97b8803252fd
This is helpful in order to understand Qt's Model/View structure, so both
(list and tree) are still available.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18862 57a11ea4-9604-0410-9ed3-97b8803252fd
SCM files still refered to gnc-book-get-slots which had been removed. gnc-book-get-slots was replaced everywhere by qof-book-get-slots.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18859 57a11ea4-9604-0410-9ed3-97b8803252fd
Remove child column from billterm table because it duplicates info in the parent column and just complicates loading objects.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18857 57a11ea4-9604-0410-9ed3-97b8803252fd
MSVC doesn't accept the syntax with an inlined block,
x = ({ foo; bar; value;}). Hence, this is being replaced
by actual function definitions, and the body of those functions
is defined by the new macro.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18851 57a11ea4-9604-0410-9ed3-97b8803252fd
Previous work setting Timespec values via gobject properties missed the case where the timespec loaded from the database was NULL.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18848 57a11ea4-9604-0410-9ed3-97b8803252fd
Also, the QSharedPointer cannot be used for bookkeeping of a C pointer
to any gnucash object because it refuses to work if it doesn't know the
actual struct definition, which in gnucash is always private. The
boost::shared_ptr would work without (by the custom deleter argument in the
constructor), but QSharedPointer doesn't (the custom deleter is accepted
only in addition to the known storage size, not alternatively), so it is
pointless here.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18847 57a11ea4-9604-0410-9ed3-97b8803252fd