mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Remove QofBook functions qof_book_get_slots & qof_book_kvp_changed
This commit is contained in:
parent
11aae5b2b9
commit
72c7f1d101
@ -244,20 +244,7 @@ qof_book_set_backend (QofBook *book, QofBackend *be)
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
void qof_book_kvp_changed (QofBook *book)
|
||||
{
|
||||
qof_book_begin_edit(book);
|
||||
qof_instance_set_dirty (QOF_INSTANCE (book));
|
||||
qof_book_commit_edit(book);
|
||||
}
|
||||
|
||||
/* ====================================================================== */
|
||||
|
||||
KvpFrame *qof_book_get_slots(const QofBook *book)
|
||||
{
|
||||
return qof_instance_get_slots(QOF_INSTANCE(book));
|
||||
}
|
||||
|
||||
/* Store arbitrary pointers in the QofBook for data storage extensibility */
|
||||
/* XXX if data is NULL, we should remove the key from the hash table!
|
||||
*/
|
||||
@ -379,7 +366,7 @@ qof_book_get_counter (QofBook *book, const char *counter_name)
|
||||
}
|
||||
|
||||
/* Use the KVP in the book */
|
||||
kvp = qof_book_get_slots (book);
|
||||
kvp = qof_instance_get_slots (QOF_INSTANCE (book));
|
||||
|
||||
if (!kvp)
|
||||
{
|
||||
@ -431,7 +418,7 @@ qof_book_increment_and_format_counter (QofBook *book, const char *counter_name)
|
||||
counter++;
|
||||
|
||||
/* Get the KVP from the current book */
|
||||
kvp = qof_book_get_slots (book);
|
||||
kvp = qof_instance_get_slots (QOF_INSTANCE (book));
|
||||
|
||||
if (!kvp)
|
||||
{
|
||||
@ -480,7 +467,7 @@ qof_book_get_counter_format(const QofBook *book, const char *counter_name)
|
||||
}
|
||||
|
||||
/* Get the KVP from the current book */
|
||||
kvp = qof_book_get_slots (book);
|
||||
kvp = qof_instance_get_slots (QOF_INSTANCE (book));
|
||||
|
||||
if (!kvp)
|
||||
{
|
||||
@ -633,8 +620,9 @@ qof_book_use_trading_accounts (const QofBook *book)
|
||||
{
|
||||
const char *opt;
|
||||
kvp_value *kvp_val;
|
||||
KvpFrame *frame = qof_instance_get_slots (QOF_INSTANCE (book));
|
||||
|
||||
kvp_val = kvp_frame_get_slot_path (qof_book_get_slots (book),
|
||||
kvp_val = kvp_frame_get_slot_path (frame,
|
||||
KVP_OPTION_PATH,
|
||||
OPTION_SECTION_ACCOUNTS,
|
||||
OPTION_NAME_TRADING_ACCOUNTS,
|
||||
@ -656,9 +644,10 @@ qof_book_use_split_action_for_num_field (const QofBook *book)
|
||||
{
|
||||
const char *opt;
|
||||
kvp_value *kvp_val;
|
||||
KvpFrame *frame = qof_instance_get_slots (QOF_INSTANCE (book));
|
||||
|
||||
g_assert(book);
|
||||
kvp_val = kvp_frame_get_slot_path (qof_book_get_slots (book),
|
||||
kvp_val = kvp_frame_get_slot_path (frame,
|
||||
KVP_OPTION_PATH,
|
||||
OPTION_SECTION_ACCOUNTS,
|
||||
OPTION_NAME_NUM_FIELD_SOURCE,
|
||||
@ -683,8 +672,10 @@ gint qof_book_get_num_days_autoreadonly (const QofBook *book)
|
||||
{
|
||||
kvp_value *kvp_val;
|
||||
double tmp;
|
||||
KvpFrame *frame = qof_instance_get_slots (QOF_INSTANCE (book));
|
||||
|
||||
g_assert(book);
|
||||
kvp_val = kvp_frame_get_slot_path (qof_book_get_slots (book),
|
||||
kvp_val = kvp_frame_get_slot_path (frame,
|
||||
KVP_OPTION_PATH,
|
||||
OPTION_SECTION_ACCOUNTS,
|
||||
OPTION_NAME_AUTO_READONLY_DAYS,
|
||||
@ -718,14 +709,16 @@ GDate* qof_book_get_autoreadonly_gdate (const QofBook *book)
|
||||
const char*
|
||||
qof_book_get_string_option(const QofBook* book, const char* opt_name)
|
||||
{
|
||||
return kvp_frame_get_string(qof_book_get_slots(book), opt_name);
|
||||
return kvp_frame_get_string(qof_instance_get_slots(QOF_INSTANCE (book)),
|
||||
opt_name);
|
||||
}
|
||||
|
||||
void
|
||||
qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_val)
|
||||
{
|
||||
qof_book_begin_edit(book);
|
||||
kvp_frame_set_string(qof_book_get_slots(book), opt_name, opt_val);
|
||||
kvp_frame_set_string(qof_instance_get_slots(QOF_INSTANCE (book)),
|
||||
opt_name, opt_val);
|
||||
qof_instance_set_dirty (QOF_INSTANCE (book));
|
||||
qof_book_commit_edit(book);
|
||||
}
|
||||
|
@ -206,24 +206,11 @@ QofCollection * qof_book_get_collection (const QofBook *, QofIdType);
|
||||
typedef void (*QofCollectionForeachCB) (QofCollection *, gpointer user_data);
|
||||
void qof_book_foreach_collection (const QofBook *, QofCollectionForeachCB, gpointer);
|
||||
|
||||
/** Return The kvp data for the book.
|
||||
* Note that the book KVP data is persistent, and is stored/retrieved
|
||||
* from the file/database. Thus, the book KVP is the correct place to
|
||||
* store data that needs to be persistent accross sessions (or shared
|
||||
* between multiple users). To store application runtime data, use
|
||||
* qof_book_set_data() instead.
|
||||
*/
|
||||
KvpFrame *qof_book_get_slots(const QofBook *book);
|
||||
|
||||
/** The qof_book_set_data() allows arbitrary pointers to structs
|
||||
* to be stored in QofBook. This is the "preferred" method for
|
||||
* extending QofBook to hold new data types. This is also
|
||||
* the ideal location to store other arbitrary runtime data
|
||||
* that the application may need.
|
||||
*
|
||||
* The book data differs from the book KVP in that the contents
|
||||
* of the book KVP are persistent (are saved and restored to file
|
||||
* or database), whereas the data pointers exist only at runtime.
|
||||
*/
|
||||
void qof_book_set_data (QofBook *book, const gchar *key, gpointer data);
|
||||
|
||||
@ -307,10 +294,6 @@ time64 qof_book_get_session_dirty_time(const QofBook *book);
|
||||
*/
|
||||
void qof_book_set_dirty_cb(QofBook *book, QofBookDirtyCB cb, gpointer user_data);
|
||||
|
||||
/** Call this function when you change the book kvp, to make sure the book
|
||||
* is marked 'dirty'. */
|
||||
void qof_book_kvp_changed (QofBook *book);
|
||||
|
||||
/** This will get the named counter for this book. The return value is
|
||||
* -1 on error or the current value of the counter.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user