mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Finish removing deprecated QOF functions.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13573 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
64ee595be2
commit
d331aa8f18
14
ChangeLog
14
ChangeLog
@ -1,5 +1,19 @@
|
||||
2006-03-09 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/gnc-tree-model-commodity.c:
|
||||
* src/gnome-utils/gnc-main-window.c:
|
||||
* src/gnome-utils/gnc-tree-model-price.c:
|
||||
* src/gnome-utils/gnc-plugin-page.[ch]:
|
||||
* src/gnome-utils/gnc-account-sel.c:
|
||||
* src/gnome-utils/account-quickfill.c:
|
||||
* src/engine/gnc-commodity.h:
|
||||
* src/engine/gnc-engine.h:
|
||||
* src/app-utils/gnc-component-manager.c:
|
||||
* lib/libqof/qof/deprecated.[ch]:
|
||||
* lib/libqof/qof/qofevent.c:
|
||||
* lib/libqof/qof/qofevent-p.h:
|
||||
* configure.in: Finish removing deprecated QOF functions.
|
||||
|
||||
* src/gnome/dialog-price-editor.c:
|
||||
* src/gnome/top-level.c:
|
||||
* src/gnc-ui.h: Restore clickable links for price quotes.
|
||||
|
@ -488,6 +488,8 @@ AC_SUBST(QOF_PREFIX)
|
||||
AC_SUBST(QOF_LIB_DIR)
|
||||
AC_SUBST(QOF_XML_DIR)
|
||||
|
||||
AC_DEFINE(QOF_DISABLE_DEPRECATED,1, [Don't use deprecated qof functions])
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
### Variables
|
||||
### Set up all the initial variable values...
|
||||
|
@ -22,6 +22,7 @@
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
#include "qof.h"
|
||||
|
||||
/* Don't be fooled: gnc_trace_num_spaces has external linkage and
|
||||
@ -102,5 +103,4 @@ qof_book_mergeRuleForeach(QofBookMergeData *mergeData,
|
||||
{
|
||||
qof_book_merge_rule_foreach(mergeData, cb, mergeResult);
|
||||
}
|
||||
|
||||
/* ==================================================================== */
|
||||
#endif /* QOF_DISABLE_DEPRECATED */
|
||||
|
@ -21,6 +21,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
|
||||
#ifndef _DEPRECATED_H
|
||||
#define _DEPRECATED_H
|
||||
#include "qof.h"
|
||||
@ -147,3 +149,4 @@ gint
|
||||
qof_book_mergeCommit(QofBookMergeData *mergeData );
|
||||
|
||||
#endif /* _DEPRECATED_H */
|
||||
#endif /* QOF_DISABLE_DEPRECATED */
|
||||
|
@ -30,7 +30,9 @@
|
||||
/* for backwards compatibility - to be moved back to qofevent.c in libqof2 */
|
||||
typedef struct
|
||||
{
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
GNCEngineEventHandler old_handler; /** \deprecated */
|
||||
#endif
|
||||
QofEventHandler handler;
|
||||
gpointer user_data;
|
||||
|
||||
|
@ -68,6 +68,7 @@ find_next_handler_id(void)
|
||||
}
|
||||
|
||||
/* support deprecated code with a private function*/
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
gint
|
||||
qof_event_register_old_handler (GNCEngineEventHandler handler, gpointer user_data)
|
||||
{
|
||||
@ -98,6 +99,7 @@ qof_event_register_old_handler (GNCEngineEventHandler handler, gpointer user_dat
|
||||
return handler_id;
|
||||
|
||||
}
|
||||
#endif /* QOF_DISABLE_DEPRECATED */
|
||||
|
||||
gint
|
||||
qof_event_register_handler (QofEventHandler handler, gpointer user_data)
|
||||
@ -150,13 +152,17 @@ qof_event_unregister_handler (gint handler_id)
|
||||
if(hi->handler)
|
||||
LEAVE ("(handler_id=%d) handler=%p data=%p", handler_id,
|
||||
hi->handler, hi->user_data);
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
if(hi->old_handler)
|
||||
LEAVE ("(handler_id=%d) handler=%p data=%p", handler_id,
|
||||
hi->old_handler, hi->user_data);
|
||||
#endif
|
||||
|
||||
/* safety -- clear the handler in case we're running events now */
|
||||
hi->handler = NULL;
|
||||
hi->old_handler = NULL;
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
hi->old_handler = NULL;
|
||||
#endif
|
||||
|
||||
if (handler_run_level == 0) {
|
||||
handlers = g_list_remove_link (handlers, node);
|
||||
@ -224,6 +230,7 @@ qof_event_generate_internal (QofEntity *entity, QofEventId event_id,
|
||||
HandlerInfo *hi = node->data;
|
||||
|
||||
next_node = node->next;
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
if ((hi->old_handler) && (use_old_handlers))
|
||||
{
|
||||
PINFO(" deprecated: id=%d hi=%p han=%p", hi->handler_id, hi,
|
||||
@ -231,6 +238,7 @@ qof_event_generate_internal (QofEntity *entity, QofEventId event_id,
|
||||
hi->old_handler ((GUID *)&entity->guid, entity->e_type,
|
||||
event_id, hi->user_data);
|
||||
}
|
||||
#endif
|
||||
if (hi->handler)
|
||||
{
|
||||
PINFO("id=%d hi=%p han=%p data=%p", hi->handler_id, hi,
|
||||
@ -249,7 +257,11 @@ qof_event_generate_internal (QofEntity *entity, QofEventId event_id,
|
||||
{
|
||||
HandlerInfo *hi = node->data;
|
||||
next_node = node->next;
|
||||
if ((hi->handler == NULL)&&(hi->old_handler == NULL))
|
||||
if ((hi->handler == NULL)
|
||||
#ifndef QOF_DISABLE_DEPRECATED
|
||||
&&(hi->old_handler == NULL)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* remove this node from the list, then free this node */
|
||||
handlers = g_list_remove_link (handlers, node);
|
||||
|
@ -257,19 +257,19 @@ add_event_type (ComponentEventInfo *cei, GNCIdTypeConst entity_type,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_cm_event_handler (GUID *entity, QofIdType type,
|
||||
gnc_cm_event_handler (QofEntity *entity,
|
||||
QofEventId event_type,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
gpointer event_data)
|
||||
{
|
||||
const GUID *guid = qof_entity_get_guid(entity);
|
||||
#if CM_DEBUG
|
||||
fprintf (stderr, "event_handler: event %d, type %s, guid %s\n", event_type,
|
||||
(type ? type : "(null)"), guid_to_string(entity));
|
||||
fprintf (stderr, "event_handler: event %d, entity %p, guid %s\n", event_type,
|
||||
entity, guid);
|
||||
#endif
|
||||
add_event (&changes, entity, event_type, TRUE);
|
||||
add_event (&changes, guid, event_type, TRUE);
|
||||
|
||||
g_return_if_fail (type);
|
||||
|
||||
if (safe_strcmp (type, GNC_ID_SPLIT) == 0)
|
||||
if (QOF_CHECK_TYPE(entity, GNC_ID_SPLIT))
|
||||
{
|
||||
/* split events are never generated by the engine, but might
|
||||
* be generated by a backend (viz. the postgres backend.)
|
||||
@ -277,7 +277,7 @@ gnc_cm_event_handler (GUID *entity, QofIdType type,
|
||||
add_event_type (&changes, GNC_ID_TRANS, QOF_EVENT_MODIFY, TRUE);
|
||||
}
|
||||
else
|
||||
add_event_type (&changes, type, event_type, TRUE);
|
||||
add_event_type (&changes, entity->e_type, event_type, TRUE);
|
||||
|
||||
got_events = TRUE;
|
||||
|
||||
@ -302,7 +302,7 @@ gnc_component_manager_init (void)
|
||||
changes_backup.event_masks = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
changes_backup.entity_events = guid_hash_table_new ();
|
||||
|
||||
handler_id = qof_event_register_old_handler (gnc_cm_event_handler, NULL);
|
||||
handler_id = qof_event_register_handler (gnc_cm_event_handler, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -49,6 +49,11 @@
|
||||
#include <glib.h>
|
||||
#include "gnc-engine.h"
|
||||
|
||||
#define GNC_IS_COMMODITY(obj) (QOF_CHECK_TYPE((obj), GNC_ID_COMMODITY))
|
||||
#define GNC_COMMODITY(obj) (QOF_CHECK_CAST((obj), GNC_ID_COMMODITY, gnc_commodity))
|
||||
#define GNC_IS_COMMODITY_NAMESPACE(obj) (QOF_CHECK_TYPE((obj), GNC_ID_COMMODITY_NAMESPACE))
|
||||
#define GNC_COMMODITY_NAMESPACE(obj) (QOF_CHECK_CAST((obj), GNC_ID_COMMODITY_NAMESPACE, gnc_commodity_namespace))
|
||||
|
||||
#define GNC_COMMODITY_TABLE "gnc_commodity_table"
|
||||
|
||||
/** The commodity namespace definitions are used to tag a commodity by
|
||||
|
@ -198,6 +198,8 @@ typedef struct gnc_lot_struct GNCLot;
|
||||
typedef struct gnc_price_s GNCPrice;
|
||||
typedef struct gnc_quote_source_s gnc_quote_source;
|
||||
|
||||
#define GNC_IS_PRICE(obj) (QOF_CHECK_TYPE((obj), GNC_ID_PRICE))
|
||||
#define GNC_PRICE(obj) (QOF_CHECK_CAST((obj), GNC_ID_PRICE, GNCPrice))
|
||||
|
||||
/** GList of Account */
|
||||
typedef GList AccountList;
|
||||
|
@ -70,24 +70,21 @@ shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
|
||||
* for account modification events, and add new accounts.
|
||||
*/
|
||||
static void
|
||||
listen_for_account_events (GUID *guid, QofIdType type,
|
||||
QofEventId event_type,
|
||||
gpointer user_data)
|
||||
listen_for_account_events (QofEntity *entity, QofEventId event_type,
|
||||
gpointer user_data, gpointer event_data)
|
||||
{
|
||||
QFB *qfb = user_data;
|
||||
QuickFill *qf = qfb->qf;
|
||||
QuickFill *match;
|
||||
char * name;
|
||||
const char *match_str;
|
||||
QofCollection *col;
|
||||
Account *account;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (! (event_type & QOF_EVENT_MODIFY)) return;
|
||||
if (QSTRCMP (type, GNC_ID_ACCOUNT)) return;
|
||||
if (!GNC_IS_ACCOUNT (entity)) return;
|
||||
|
||||
col = qof_book_get_collection (qfb->book, GNC_ID_ACCOUNT);
|
||||
account = GNC_ACCOUNT (qof_collection_lookup_entity (col, guid));
|
||||
account = GNC_ACCOUNT (entity);
|
||||
|
||||
/* Not every new account is eligable for the menu */
|
||||
if (qfb->dont_add_cb)
|
||||
@ -177,7 +174,7 @@ build_shared_quickfill (QofBook *book, AccountGroup *group, const char * key,
|
||||
xaccGroupForEachAccount (group, load_shared_qf_cb, qfb, TRUE);
|
||||
|
||||
qfb->listener =
|
||||
qof_event_register_old_handler (listen_for_account_events, qfb);
|
||||
qof_event_register_handler (listen_for_account_events, qfb);
|
||||
|
||||
qof_book_set_data_fin (book, key, qfb, shared_quickfill_destroy);
|
||||
|
||||
|
@ -54,9 +54,6 @@ static void gas_accounts_to_names (gpointer data, gpointer user_data);
|
||||
|
||||
static void gas_populate_list (GNCAccountSel *gas);
|
||||
static void gas_strcmp_adapter (gpointer a, gpointer b);
|
||||
static void gnc_account_sel_event_cb (GUID *entity, QofIdType id_type,
|
||||
QofEventId event_type,
|
||||
gpointer user_data);
|
||||
|
||||
static void gas_new_account_click (GtkButton *b, gpointer ud);
|
||||
|
||||
@ -97,14 +94,15 @@ gnc_account_sel_get_type (void)
|
||||
|
||||
static
|
||||
void
|
||||
gnc_account_sel_event_cb( GUID *entity, QofIdType type,
|
||||
gnc_account_sel_event_cb( QofEntity *entity,
|
||||
QofEventId event_type,
|
||||
gpointer user_data )
|
||||
gpointer user_data,
|
||||
gpointer event_data )
|
||||
{
|
||||
if ( ! ( event_type == QOF_EVENT_CREATE
|
||||
|| event_type == QOF_EVENT_MODIFY
|
||||
|| event_type == QOF_EVENT_DESTROY )
|
||||
|| strcmp( type, GNC_ID_ACCOUNT ) != 0 ) {
|
||||
|| !GNC_IS_ACCOUNT(entity) ) {
|
||||
return;
|
||||
}
|
||||
gas_populate_list( (GNCAccountSel*)user_data );
|
||||
@ -157,7 +155,7 @@ gnc_account_sel_init (GNCAccountSel *gas)
|
||||
gas_populate_list( gas );
|
||||
|
||||
gas->eventHandlerId =
|
||||
qof_event_register_old_handler( gnc_account_sel_event_cb, gas );
|
||||
qof_event_register_handler( gnc_account_sel_event_cb, gas );
|
||||
|
||||
gas->initDone = TRUE;
|
||||
}
|
||||
|
@ -996,9 +996,8 @@ gnc_main_window_delete_event (GtkWidget *window,
|
||||
* @param user_data A pointer to the window data structure.
|
||||
*/
|
||||
static void
|
||||
gnc_main_window_event_handler (GUID *entity, QofIdType type,
|
||||
QofEventId event_type,
|
||||
gpointer user_data)
|
||||
gnc_main_window_event_handler (QofEntity *entity, QofEventId event_type,
|
||||
gpointer user_data, gpointer event_data)
|
||||
{
|
||||
GncMainWindow *window;
|
||||
GncMainWindowPrivate *priv;
|
||||
@ -1009,13 +1008,13 @@ gnc_main_window_event_handler (GUID *entity, QofIdType type,
|
||||
g_return_if_fail(GNC_IS_MAIN_WINDOW(user_data));
|
||||
|
||||
/* soft failures */
|
||||
if (safe_strcmp(type, GNC_ID_BOOK) != 0)
|
||||
if (!QOF_CHECK_TYPE(entity, QOF_ID_BOOK))
|
||||
return;
|
||||
if (event_type != QOF_EVENT_DESTROY)
|
||||
return;
|
||||
|
||||
ENTER("entity %p of type %s, event %d, window %p",
|
||||
entity, type, event_type, user_data);
|
||||
ENTER("entity %p, event %d, window %p, event data %p",
|
||||
entity, event_type, user_data, event_data);
|
||||
window = GNC_MAIN_WINDOW(user_data);
|
||||
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||
|
||||
@ -1025,7 +1024,7 @@ gnc_main_window_event_handler (GUID *entity, QofIdType type,
|
||||
for (item = priv->installed_pages; item; item = next) {
|
||||
next = g_list_next(item);
|
||||
page = GNC_PLUGIN_PAGE(item->data);
|
||||
if (gnc_plugin_page_has_book (page, entity))
|
||||
if (gnc_plugin_page_has_book (page, (QofBook *)entity))
|
||||
gnc_main_window_close_page (page);
|
||||
}
|
||||
LEAVE(" ");
|
||||
@ -1622,8 +1621,7 @@ gnc_main_window_init (GncMainWindow *window,
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
priv->event_handler_id =
|
||||
qof_event_register_old_handler(gnc_main_window_event_handler,
|
||||
window);
|
||||
qof_event_register_handler(gnc_main_window_event_handler, window);
|
||||
|
||||
gnc_main_window_setup_window (window);
|
||||
gnc_gobject_tracking_remember(G_OBJECT(window),
|
||||
|
@ -533,7 +533,6 @@ gnc_plugin_page_finalize (GObject *object)
|
||||
{
|
||||
GncPluginPagePrivate *priv;
|
||||
GncPluginPage *page;
|
||||
GList *item;
|
||||
|
||||
page = GNC_PLUGIN_PAGE (object);
|
||||
|
||||
@ -546,9 +545,6 @@ gnc_plugin_page_finalize (GObject *object)
|
||||
g_free(priv->statusbar_text);
|
||||
|
||||
if (priv->books) {
|
||||
for (item = priv->books; item; item = g_list_next(item)) {
|
||||
guid_free (item->data);
|
||||
}
|
||||
g_list_free(priv->books);
|
||||
priv->books = NULL;
|
||||
}
|
||||
@ -700,17 +696,17 @@ gnc_plugin_page_add_book (GncPluginPage *page, QofBook *book)
|
||||
* function takes a guid instead of a QofBook because that's what the
|
||||
* engine event mechanism provides. */
|
||||
gboolean
|
||||
gnc_plugin_page_has_book (GncPluginPage *page, GUID *entity)
|
||||
gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book)
|
||||
{
|
||||
GncPluginPagePrivate *priv;
|
||||
GList *item;
|
||||
|
||||
g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE);
|
||||
g_return_val_if_fail (entity != NULL, FALSE);
|
||||
g_return_val_if_fail (book != NULL, FALSE);
|
||||
|
||||
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
|
||||
for (item = priv->books; item; item = g_list_next(item)) {
|
||||
if (guid_equal((GUID*)item->data, entity)) {
|
||||
if (item->data == book) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void gnc_plugin_page_add_book (GncPluginPage *page, QofBook *book);
|
||||
* @return TRUE if the page refers to the specified book. FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
gboolean gnc_plugin_page_has_book (GncPluginPage *page, GUID *book);
|
||||
gboolean gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book);
|
||||
|
||||
|
||||
/** Query a page to see if it has a reference to any book.
|
||||
|
@ -82,9 +82,10 @@ static gboolean gnc_tree_model_commodity_iter_nth_child (GtkTreeModel *tree_mode
|
||||
static gboolean gnc_tree_model_commodity_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
static void gnc_tree_model_commodity_event_handler (GUID *entity, QofIdType type,
|
||||
static void gnc_tree_model_commodity_event_handler (QofEntity *entity,
|
||||
QofEventId event_type,
|
||||
gpointer user_data);
|
||||
gpointer user_data,
|
||||
gpointer event_data);
|
||||
|
||||
/** The instance private data for a commodity database tree model. */
|
||||
typedef struct GncTreeModelCommodityPrivate
|
||||
@ -224,7 +225,7 @@ gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct)
|
||||
priv->commodity_table = ct;
|
||||
|
||||
priv->event_handler_id =
|
||||
qof_event_register_old_handler (gnc_tree_model_commodity_event_handler, model);
|
||||
qof_event_register_handler (gnc_tree_model_commodity_event_handler, model);
|
||||
|
||||
return GTK_TREE_MODEL (model);
|
||||
}
|
||||
@ -1021,7 +1022,6 @@ gnc_tree_model_commodity_get_path_from_namespace (GncTreeModelCommodity *model,
|
||||
/************************************************************/
|
||||
|
||||
typedef struct _remove_data {
|
||||
GUID guid;
|
||||
GncTreeModelCommodity *model;
|
||||
GtkTreePath *path;
|
||||
} remove_data;
|
||||
@ -1185,20 +1185,20 @@ gnc_tree_model_commodity_do_deletions (gpointer unused)
|
||||
* have this model mirror the engine's commodity table instead of
|
||||
* referencing it directly.
|
||||
*
|
||||
* @param entity The guid of the affected item.
|
||||
*
|
||||
* @param type The type of the affected item. This function only
|
||||
* cares about items of type "account" or "namespace".
|
||||
* @param entity The affected item.
|
||||
*
|
||||
* @param event type The type of the event. This function only cares
|
||||
* about items of type ADD, REMOVE, and DESTROY.
|
||||
*
|
||||
* @param user_data A pointer to the account tree model.
|
||||
*
|
||||
* @param event_data A pointer to additional data about this event.
|
||||
*/
|
||||
static void
|
||||
gnc_tree_model_commodity_event_handler (GUID *entity, QofIdType type,
|
||||
gnc_tree_model_commodity_event_handler (QofEntity *entity,
|
||||
QofEventId event_type,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
gpointer event_data)
|
||||
{
|
||||
GncTreeModelCommodity *model;
|
||||
GtkTreePath *path;
|
||||
@ -1206,18 +1206,18 @@ gnc_tree_model_commodity_event_handler (GUID *entity, QofIdType type,
|
||||
remove_data *data;
|
||||
const gchar *name;
|
||||
|
||||
ENTER("entity %p of type %s, event %d, model %p",
|
||||
entity, type, event_type, user_data);
|
||||
ENTER("entity %p, event %d, model %p, event data %p",
|
||||
entity, event_type, user_data, event_data);
|
||||
model = (GncTreeModelCommodity *)user_data;
|
||||
|
||||
/* hard failures */
|
||||
g_return_if_fail(GNC_IS_TREE_MODEL_COMMODITY(model));
|
||||
|
||||
/* get type specific data */
|
||||
if (safe_strcmp(type, GNC_ID_COMMODITY) == 0) {
|
||||
if (GNC_IS_COMMODITY(entity)) {
|
||||
gnc_commodity *commodity;
|
||||
|
||||
commodity = gnc_commodity_find_commodity_by_guid(entity, gnc_get_current_book ());
|
||||
commodity = GNC_COMMODITY(entity);
|
||||
name = gnc_commodity_get_mnemonic(commodity);
|
||||
if (event_type != QOF_EVENT_DESTROY) {
|
||||
if (!gnc_tree_model_commodity_get_iter_from_commodity (model, commodity, &iter)) {
|
||||
@ -1225,10 +1225,10 @@ gnc_tree_model_commodity_event_handler (GUID *entity, QofIdType type,
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (safe_strcmp(type, GNC_ID_COMMODITY_NAMESPACE) == 0) {
|
||||
} else if (GNC_IS_COMMODITY_NAMESPACE(entity)) {
|
||||
gnc_commodity_namespace *namespace;
|
||||
|
||||
namespace = gnc_commodity_find_namespace_by_guid(entity, gnc_get_current_book ());
|
||||
namespace = GNC_COMMODITY_NAMESPACE(entity);
|
||||
name = gnc_commodity_namespace_get_name(namespace);
|
||||
if (event_type != QOF_EVENT_DESTROY) {
|
||||
if (!gnc_tree_model_commodity_get_iter_from_namespace (model, namespace, &iter)) {
|
||||
@ -1257,7 +1257,6 @@ gnc_tree_model_commodity_event_handler (GUID *entity, QofIdType type,
|
||||
}
|
||||
|
||||
data = malloc(sizeof(*data));
|
||||
data->guid = *entity;
|
||||
data->model = model;
|
||||
data->path = path;
|
||||
pending_removals = g_slist_append (pending_removals, data);
|
||||
|
@ -101,9 +101,10 @@ static gboolean gnc_tree_model_price_iter_nth_child (GtkTreeModel *tree_model,
|
||||
static gboolean gnc_tree_model_price_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
static void gnc_tree_model_price_event_handler (GUID *entity, QofIdType type,
|
||||
static void gnc_tree_model_price_event_handler (QofEntity *entity,
|
||||
QofEventId event_type,
|
||||
gpointer user_data);
|
||||
gpointer user_data,
|
||||
gpointer event_data);
|
||||
|
||||
/** The instance private data for a price database tree model. */
|
||||
typedef struct GncTreeModelPricePrivate
|
||||
@ -252,7 +253,7 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
|
||||
priv->price_db = price_db;
|
||||
|
||||
priv->event_handler_id =
|
||||
qof_event_register_old_handler (gnc_tree_model_price_event_handler, model);
|
||||
qof_event_register_handler (gnc_tree_model_price_event_handler, model);
|
||||
|
||||
return GTK_TREE_MODEL (model);
|
||||
}
|
||||
@ -1299,7 +1300,6 @@ gnc_tree_model_price_get_path_from_namespace (GncTreeModelPrice *model,
|
||||
/************************************************************/
|
||||
|
||||
typedef struct _remove_data {
|
||||
GUID guid;
|
||||
GncTreeModelPrice *model;
|
||||
GtkTreePath *path;
|
||||
} remove_data;
|
||||
@ -1433,20 +1433,20 @@ gnc_tree_model_price_do_deletions (gpointer unused)
|
||||
* have this model mirror the engine's price table instead of
|
||||
* referencing it directly.
|
||||
*
|
||||
* @param entity The guid of the affected item.
|
||||
*
|
||||
* @param type The type of the affected item. This function only
|
||||
* cares about items of type "account" or "namespace".
|
||||
* @param entity The affected item.
|
||||
*
|
||||
* @param event type The type of the event. This function only cares
|
||||
* about items of type ADD, REMOVE, and DESTROY.
|
||||
*
|
||||
* @param user_data A pointer to the account tree model.
|
||||
*
|
||||
* @param event_data A pointer to additional data about this event.
|
||||
*/
|
||||
static void
|
||||
gnc_tree_model_price_event_handler (GUID *entity, QofIdType type,
|
||||
gnc_tree_model_price_event_handler (QofEntity *entity,
|
||||
QofEventId event_type,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
gpointer event_data)
|
||||
{
|
||||
GncTreeModelPrice *model;
|
||||
GtkTreePath *path;
|
||||
@ -1454,18 +1454,18 @@ gnc_tree_model_price_event_handler (GUID *entity, QofIdType type,
|
||||
remove_data *data;
|
||||
const gchar *name;
|
||||
|
||||
ENTER("entity %p of type %s, event %d, model %p",
|
||||
entity, type, event_type, user_data);
|
||||
ENTER("entity %p, event %d, model %p, event data %p",
|
||||
entity, event_type, user_data, event_data);
|
||||
model = (GncTreeModelPrice *)user_data;
|
||||
|
||||
/* hard failures */
|
||||
g_return_if_fail(GNC_IS_TREE_MODEL_PRICE(model));
|
||||
|
||||
/* get type specific data */
|
||||
if (safe_strcmp(type, GNC_ID_COMMODITY) == 0) {
|
||||
if (GNC_IS_COMMODITY(entity)) {
|
||||
gnc_commodity *commodity;
|
||||
|
||||
commodity = gnc_commodity_find_commodity_by_guid(entity, gnc_get_current_book ());
|
||||
commodity = GNC_COMMODITY(entity);
|
||||
name = gnc_commodity_get_mnemonic(commodity);
|
||||
if (event_type != QOF_EVENT_DESTROY) {
|
||||
if (!gnc_tree_model_price_get_iter_from_commodity (model, commodity, &iter)) {
|
||||
@ -1473,10 +1473,10 @@ gnc_tree_model_price_event_handler (GUID *entity, QofIdType type,
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (safe_strcmp(type, GNC_ID_COMMODITY_NAMESPACE) == 0) {
|
||||
} else if (GNC_IS_COMMODITY_NAMESPACE(entity)) {
|
||||
gnc_commodity_namespace *namespace;
|
||||
|
||||
namespace = gnc_commodity_find_namespace_by_guid(entity, gnc_get_current_book ());
|
||||
namespace = GNC_COMMODITY_NAMESPACE(entity);
|
||||
name = gnc_commodity_namespace_get_name(namespace);
|
||||
if (event_type != QOF_EVENT_DESTROY) {
|
||||
if (!gnc_tree_model_price_get_iter_from_namespace (model, namespace, &iter)) {
|
||||
@ -1484,10 +1484,10 @@ gnc_tree_model_price_event_handler (GUID *entity, QofIdType type,
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (safe_strcmp(type, GNC_ID_PRICE) == 0) {
|
||||
} else if (GNC_IS_PRICE(entity)) {
|
||||
GNCPrice *price;
|
||||
|
||||
price = gnc_price_lookup(entity, gnc_get_current_book ());
|
||||
price = GNC_PRICE(entity);
|
||||
name = "price";
|
||||
if (event_type != QOF_EVENT_DESTROY) {
|
||||
if (!gnc_tree_model_price_get_iter_from_price (model, price, &iter)) {
|
||||
@ -1516,7 +1516,6 @@ gnc_tree_model_price_event_handler (GUID *entity, QofIdType type,
|
||||
}
|
||||
|
||||
data = malloc(sizeof(*data));
|
||||
data->guid = *entity;
|
||||
data->model = model;
|
||||
data->path = path;
|
||||
pending_removals = g_slist_append (pending_removals, data);
|
||||
|
Loading…
Reference in New Issue
Block a user