mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
change event generation API to use entities instead of raw GUID's
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9580 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
6444e8169b
commit
c08077ce56
@ -41,14 +41,11 @@
|
||||
* event_type: the type of event -- this should be one of the
|
||||
* single-bit GNCEngineEventType values, not a combination.
|
||||
*/
|
||||
void gnc_engine_generate_event (const GUID *entity, QofIdType type,
|
||||
void gnc_engine_gen_event (QofEntity *entity,
|
||||
GNCEngineEventType event_type);
|
||||
|
||||
#define gnc_engine_gen_event(ent, ev) \
|
||||
gnc_engine_generate_event (&((ent)->guid), (ent)->e_type, ev);
|
||||
|
||||
/* generates an event even when events are suspended! */
|
||||
void gnc_engine_force_event (const GUID *entity, QofIdType type,
|
||||
void gnc_engine_force_event (QofEntity *entity,
|
||||
GNCEngineEventType event_type);
|
||||
|
||||
#endif
|
||||
|
@ -153,7 +153,7 @@ gnc_engine_resume_events (void)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_engine_generate_event_internal (const GUID *entity, QofIdType type,
|
||||
gnc_engine_generate_event_internal (QofEntity *entity,
|
||||
GNCEngineEventType event_type)
|
||||
{
|
||||
GList *node;
|
||||
@ -181,23 +181,22 @@ gnc_engine_generate_event_internal (const GUID *entity, QofIdType type,
|
||||
|
||||
PINFO ("id=%d hi=%p han=%p", hi->handler_id, hi, hi->handler);
|
||||
if (hi->handler)
|
||||
hi->handler ((GUID *)entity, type, event_type, hi->user_data);
|
||||
hi->handler ((GUID *)&entity->guid, entity->e_type, event_type, hi->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnc_engine_force_event (const GUID *entity, QofIdType type,
|
||||
gnc_engine_force_event (QofEntity *entity,
|
||||
GNCEngineEventType event_type)
|
||||
{
|
||||
if (!entity)
|
||||
return;
|
||||
|
||||
gnc_engine_generate_event_internal (entity, type, event_type);
|
||||
gnc_engine_generate_event_internal (entity, event_type);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_engine_generate_event (const GUID *entity, QofIdType type,
|
||||
GNCEngineEventType event_type)
|
||||
gnc_engine_gen_event (QofEntity *entity, GNCEngineEventType event_type)
|
||||
{
|
||||
if (!entity)
|
||||
return;
|
||||
@ -205,7 +204,7 @@ gnc_engine_generate_event (const GUID *entity, QofIdType type,
|
||||
if (suspend_counter)
|
||||
return;
|
||||
|
||||
gnc_engine_generate_event_internal (entity, type, event_type);
|
||||
gnc_engine_generate_event_internal (entity, event_type);
|
||||
}
|
||||
|
||||
/* =========================== END OF FILE ======================= */
|
||||
|
@ -122,58 +122,56 @@ const char * gnc_log_prettify (const char *name);
|
||||
*/
|
||||
|
||||
#define FATAL(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_FATAL)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
|
||||
"Fatal Error: %s: " format, FUNK, ## args); \
|
||||
} \
|
||||
"Fatal Error: %s(): " format, FUNK, ## args); \
|
||||
}
|
||||
|
||||
#define PERR(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_ERROR)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
|
||||
"Error: %s: " format, FUNK, ## args); \
|
||||
"Error: %s(): " format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define PWARN(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_WARNING)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
|
||||
"Warning: %s: " format, FUNK, ## args); \
|
||||
"Warning: %s(): " format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define PINFO(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_INFO)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
|
||||
"Info: %s: " format, FUNK, ## args); \
|
||||
"Info: %s(): " format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEBUG(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_DEBUG)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
|
||||
"Debug: %s: " format, FUNK, ## args); \
|
||||
"Debug: %s(): " format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ENTER(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_DEBUG)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
|
||||
"Enter: %s: " format, FUNK, ## args); \
|
||||
"Enter: %s" format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LEAVE(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_DEBUG)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
|
||||
"Leave: %s: " format, FUNK, ## args); \
|
||||
"Leave: %s" format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TRACE(format, args...) { \
|
||||
if (gnc_should_log (module, GNC_LOG_TRACE)) { \
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
|
||||
"Trace: %s: " format, FUNK, ## args); \
|
||||
"Trace: %s(): " format, FUNK, ## args); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ qof_book_destroy (QofBook *book)
|
||||
if (!book) return;
|
||||
|
||||
ENTER ("book=%p", book);
|
||||
gnc_engine_force_event (&book->entity.guid, QOF_ID_BOOK, GNC_EVENT_DESTROY);
|
||||
gnc_engine_force_event (&book->entity, GNC_EVENT_DESTROY);
|
||||
|
||||
qof_object_book_end (book);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user