28 #include <glib/gi18n.h>
32 #include "gnc-component-manager.h"
39 #include "gnc-ui-balances.h"
42 #define TREE_MODEL_OWNER_CM_CLASS "tree-model-owner"
50 static void gnc_tree_model_owner_finalize (GObject *
object);
51 static void gnc_tree_model_owner_dispose (GObject *
object);
54 static void gnc_tree_model_owner_tree_model_init (GtkTreeModelIface *iface);
55 static GtkTreeModelFlags gnc_tree_model_owner_get_flags (GtkTreeModel *tree_model);
56 static int gnc_tree_model_owner_get_n_columns (GtkTreeModel *tree_model);
57 static GType gnc_tree_model_owner_get_column_type (GtkTreeModel *tree_model,
59 static gboolean gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
62 static GtkTreePath *gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
64 static void gnc_tree_model_owner_get_value (GtkTreeModel *tree_model,
68 static gboolean gnc_tree_model_owner_iter_next (GtkTreeModel *tree_model,
70 static gboolean gnc_tree_model_owner_iter_children (GtkTreeModel *tree_model,
73 static gboolean gnc_tree_model_owner_iter_has_child (GtkTreeModel *tree_model,
75 static int gnc_tree_model_owner_iter_n_children (GtkTreeModel *tree_model,
77 static gboolean gnc_tree_model_owner_iter_nth_child (GtkTreeModel *tree_model,
81 static gboolean gnc_tree_model_owner_iter_parent (GtkTreeModel *tree_model,
86 static void gnc_tree_model_owner_event_handler (
QofInstance *entity,
95 GncOwnerType owner_type;
97 gint event_handler_id;
98 const gchar *negative_color;
101 #define GNC_TREE_MODEL_OWNER_GET_PRIVATE(o) \
102 (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwnerPrivate))
116 gnc_tree_model_owner_update_color (gpointer gsettings, gchar *key, gpointer user_data)
122 g_return_if_fail(GNC_IS_TREE_MODEL_OWNER(user_data));
124 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
126 priv->negative_color = use_red ?
"red" : NULL;
133 static GtkObjectClass *parent_class = NULL;
138 static GType gnc_tree_model_owner_type = 0;
140 if (gnc_tree_model_owner_type == 0)
142 static const GTypeInfo our_info =
147 (GClassInitFunc) gnc_tree_model_owner_class_init,
152 (GInstanceInitFunc) gnc_tree_model_owner_init
155 static const GInterfaceInfo tree_model_info =
157 (GInterfaceInitFunc) gnc_tree_model_owner_tree_model_init,
162 gnc_tree_model_owner_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
163 GNC_TREE_MODEL_OWNER_NAME,
166 g_type_add_interface_static (gnc_tree_model_owner_type,
171 return gnc_tree_model_owner_type;
177 GObjectClass *o_class;
179 parent_class = g_type_class_peek_parent (klass);
181 o_class = G_OBJECT_CLASS (klass);
184 o_class->finalize = gnc_tree_model_owner_finalize;
185 o_class->dispose = gnc_tree_model_owner_dispose;
196 ENTER(
"model %p", model);
197 while (model->
stamp == 0)
199 model->
stamp = g_random_int ();
204 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
206 priv->owner_list = NULL;
207 priv->owner_type = GNC_OWNER_NONE;
208 priv->negative_color = red ?
"red" : NULL;
211 gnc_tree_model_owner_update_color,
218 gnc_tree_model_owner_finalize (GObject *
object)
223 g_return_if_fail (
object != NULL);
224 g_return_if_fail (GNC_IS_TREE_MODEL_OWNER (
object));
226 ENTER(
"model %p",
object);
228 model = GNC_TREE_MODEL_OWNER (
object);
229 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
232 priv->owner_list = NULL;
234 if (G_OBJECT_CLASS (parent_class)->finalize)
235 G_OBJECT_CLASS(parent_class)->finalize (
object);
240 gnc_tree_model_owner_dispose (GObject *
object)
245 g_return_if_fail (
object != NULL);
246 g_return_if_fail (GNC_IS_TREE_MODEL_OWNER (
object));
248 ENTER(
"model %p",
object);
250 model = GNC_TREE_MODEL_OWNER (
object);
251 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
253 if (priv->event_handler_id)
256 priv->event_handler_id = 0;
260 gnc_tree_model_owner_update_color,
263 if (G_OBJECT_CLASS (parent_class)->dispose)
264 G_OBJECT_CLASS (parent_class)->dispose (
object);
280 ENTER(
"owner_type %d", owner_type);
282 for ( ; item; item = g_list_next(item))
285 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
286 if (priv->owner_type == owner_type)
288 g_object_ref(G_OBJECT(model));
289 LEAVE(
"returning existing model %p", model);
290 return GTK_TREE_MODEL(model);
294 model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
297 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
298 priv->book = gnc_get_current_book();
299 priv->owner_type = owner_type;
305 LEAVE(
"model %p", model);
306 return GTK_TREE_MODEL (model);
314 #define ITER_STRING_LEN 128
317 iter_to_string (GtkTreeIter *iter)
319 #ifdef G_THREADS_ENABLED
320 #ifndef HAVE_GLIB_2_32
321 static GStaticPrivate gtmits_buffer_key = G_STATIC_PRIVATE_INIT;
324 string = g_static_private_get (>mits_buffer_key);
327 string = g_malloc(ITER_STRING_LEN + 1);
328 g_static_private_set (>mits_buffer_key,
string, g_free);
331 static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free);
334 string = g_private_get (>mits_buffer_key);
337 string = g_malloc(ITER_STRING_LEN + 1);
338 g_private_set (>mits_buffer_key,
string);
342 static char string[ITER_STRING_LEN + 1];
346 snprintf(
string, ITER_STRING_LEN,
347 "[stamp:%x data:%p (%s), %p, %d]",
348 iter->stamp, iter->user_data,
349 gncOwnerGetName ((
GncOwner *) iter->user_data),
350 iter->user_data2, GPOINTER_TO_INT(iter->user_data3));
352 strcpy(
string,
"(null)");
362 gnc_tree_model_owner_tree_model_init (GtkTreeModelIface *iface)
364 iface->get_flags = gnc_tree_model_owner_get_flags;
365 iface->get_n_columns = gnc_tree_model_owner_get_n_columns;
366 iface->get_column_type = gnc_tree_model_owner_get_column_type;
367 iface->get_iter = gnc_tree_model_owner_get_iter;
368 iface->get_path = gnc_tree_model_owner_get_path;
369 iface->get_value = gnc_tree_model_owner_get_value;
370 iface->iter_next = gnc_tree_model_owner_iter_next;
371 iface->iter_children = gnc_tree_model_owner_iter_children;
372 iface->iter_has_child = gnc_tree_model_owner_iter_has_child;
373 iface->iter_n_children = gnc_tree_model_owner_iter_n_children;
374 iface->iter_nth_child = gnc_tree_model_owner_iter_nth_child;
375 iface->iter_parent = gnc_tree_model_owner_iter_parent;
378 static GtkTreeModelFlags
379 gnc_tree_model_owner_get_flags (GtkTreeModel *tree_model)
385 gnc_tree_model_owner_get_n_columns (GtkTreeModel *tree_model)
387 g_return_val_if_fail(GNC_IS_TREE_MODEL_OWNER(tree_model), -1);
389 return GNC_TREE_MODEL_OWNER_NUM_COLUMNS;
393 gnc_tree_model_owner_get_column_type (GtkTreeModel *tree_model,
396 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), G_TYPE_INVALID);
397 g_return_val_if_fail ((index < GNC_TREE_MODEL_OWNER_NUM_COLUMNS) && (index >= 0), G_TYPE_INVALID);
401 case GNC_TREE_MODEL_OWNER_COL_NAME:
402 case GNC_TREE_MODEL_OWNER_COL_TYPE:
403 case GNC_TREE_MODEL_OWNER_COL_CURRENCY:
404 case GNC_TREE_MODEL_OWNER_COL_ID:
405 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME:
406 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_1:
407 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_2:
408 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_3:
409 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_4:
410 case GNC_TREE_MODEL_OWNER_COL_PHONE:
411 case GNC_TREE_MODEL_OWNER_COL_FAX:
412 case GNC_TREE_MODEL_OWNER_COL_EMAIL:
413 case GNC_TREE_MODEL_OWNER_COL_BALANCE:
414 case GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT:
415 case GNC_TREE_MODEL_OWNER_COL_NOTES:
417 case GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE:
418 return G_TYPE_STRING;
420 case GNC_TREE_MODEL_OWNER_COL_ACTIVE:
421 return G_TYPE_BOOLEAN;
424 g_assert_not_reached ();
425 return G_TYPE_INVALID;
430 gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
439 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), FALSE);
442 gchar *path_string = gtk_tree_path_to_string(path);
443 ENTER(
"model %p, iter %p, path %s", tree_model, iter, path_string);
447 model = GNC_TREE_MODEL_OWNER (tree_model);
448 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
451 if (gtk_tree_path_get_depth (path) != 1)
457 indices = gtk_tree_path_get_indices (path);
459 owner = g_list_nth_data (priv->owner_list, indices[0]);
467 iter->stamp = model->
stamp;
468 iter->user_data = owner;
469 iter->user_data2 = GINT_TO_POINTER (indices[0]);
470 iter->user_data3 = NULL;
472 LEAVE(
"iter %s", iter_to_string (iter));
477 gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
486 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
487 g_return_val_if_fail (iter != NULL, NULL);
488 g_return_val_if_fail (iter->user_data != NULL, NULL);
489 g_return_val_if_fail (iter->stamp == model->
stamp, NULL);
491 ENTER(
"model %p, iter %s", model, iter_to_string(iter));
493 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
494 if (priv->owner_list == NULL)
500 owner = (
GncOwner *) iter->user_data;
502 path = gtk_tree_path_new ();
503 i = g_list_index (priv->owner_list, owner);
506 gtk_tree_path_free (path);
510 gtk_tree_path_prepend_index (path, i);
513 gchar *path_string = gtk_tree_path_to_string(path);
514 LEAVE(
"path (4) %s", path_string);
527 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
529 g_value_set_static_string (value, priv->negative_color);
531 g_value_set_static_string (value, NULL);
535 gnc_tree_model_owner_get_value (GtkTreeModel *tree_model,
543 gchar *
string = NULL;
545 g_return_if_fail (GNC_IS_TREE_MODEL_OWNER (model));
546 g_return_if_fail (iter != NULL);
547 g_return_if_fail (iter->user_data != NULL);
548 g_return_if_fail (iter->stamp == model->
stamp);
550 ENTER(
"model %p, iter %s, col %d", tree_model,
551 iter_to_string(iter), column);
553 owner = (
GncOwner *) iter->user_data;
557 case GNC_TREE_MODEL_OWNER_COL_NAME:
558 g_value_init (value, G_TYPE_STRING);
559 g_value_set_string (value, gncOwnerGetName (owner));
561 case GNC_TREE_MODEL_OWNER_COL_TYPE:
562 g_value_init (value, G_TYPE_STRING);
563 g_value_set_string (value,
566 case GNC_TREE_MODEL_OWNER_COL_ID:
567 g_value_init (value, G_TYPE_STRING);
568 g_value_set_string (value, gncOwnerGetID (owner));
570 case GNC_TREE_MODEL_OWNER_COL_CURRENCY:
571 g_value_init (value, G_TYPE_STRING);
572 g_value_set_string (value,
575 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME:
576 g_value_init (value, G_TYPE_STRING);
577 string = g_strdup (gncAddressGetName (gncOwnerGetAddr (owner)));
579 g_value_take_string (value,
string);
581 g_value_set_static_string (value,
"");
583 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_1:
584 g_value_init (value, G_TYPE_STRING);
585 string = g_strdup (gncAddressGetAddr1 (gncOwnerGetAddr (owner)));
587 g_value_take_string (value,
string);
589 g_value_set_static_string (value,
"");
591 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_2:
592 g_value_init (value, G_TYPE_STRING);
593 string = g_strdup (gncAddressGetAddr2 (gncOwnerGetAddr (owner)));
595 g_value_take_string (value,
string);
597 g_value_set_static_string (value,
"");
599 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_3:
600 g_value_init (value, G_TYPE_STRING);
601 string = g_strdup (gncAddressGetAddr3 (gncOwnerGetAddr (owner)));
603 g_value_take_string (value,
string);
605 g_value_set_static_string (value,
"");
607 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_4:
608 g_value_init (value, G_TYPE_STRING);
609 string = g_strdup (gncAddressGetAddr4 (gncOwnerGetAddr (owner)));
611 g_value_take_string (value,
string);
613 g_value_set_static_string (value,
"");
615 case GNC_TREE_MODEL_OWNER_COL_PHONE:
616 g_value_init (value, G_TYPE_STRING);
617 string = g_strdup (gncAddressGetPhone (gncOwnerGetAddr (owner)));
619 g_value_take_string (value,
string);
621 g_value_set_static_string (value,
"");
623 case GNC_TREE_MODEL_OWNER_COL_FAX:
624 g_value_init (value, G_TYPE_STRING);
625 string = g_strdup (gncAddressGetFax (gncOwnerGetAddr (owner)));
627 g_value_take_string (value,
string);
629 g_value_set_static_string (value,
"");
631 case GNC_TREE_MODEL_OWNER_COL_EMAIL:
632 g_value_init (value, G_TYPE_STRING);
633 string = g_strdup (gncAddressGetEmail (gncOwnerGetAddr (owner)));
635 g_value_take_string (value,
string);
637 g_value_set_static_string (value,
"");
640 case GNC_TREE_MODEL_OWNER_COL_BALANCE:
641 g_value_init (value, G_TYPE_STRING);
642 string = gnc_ui_owner_get_print_balance(owner, &negative);
643 g_value_take_string (value,
string);
646 case GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT:
647 g_value_init (value, G_TYPE_STRING);
648 string = gnc_ui_owner_get_print_report_balance(owner, &negative);
649 g_value_take_string (value,
string);
651 case GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE:
652 g_value_init (value, G_TYPE_STRING);
653 string = gnc_ui_owner_get_print_balance(owner, &negative);
654 gnc_tree_model_owner_set_color(model, negative, value);
658 case GNC_TREE_MODEL_OWNER_COL_NOTES:
659 g_value_init (value, G_TYPE_STRING);
663 case GNC_OWNER_UNDEFINED:
664 case GNC_OWNER_EMPLOYEE:
667 g_value_set_static_string (value,
"");
669 case GNC_OWNER_VENDOR:
672 case GNC_OWNER_CUSTOMER:
678 case GNC_TREE_MODEL_OWNER_COL_ACTIVE:
679 g_value_init (value, G_TYPE_BOOLEAN);
680 g_value_set_boolean (value, gncOwnerGetActive (owner));
684 g_assert_not_reached ();
690 gnc_tree_model_owner_iter_next (GtkTreeModel *tree_model,
698 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
699 g_return_val_if_fail (iter != NULL, FALSE);
700 g_return_val_if_fail (iter->user_data != NULL, FALSE);
701 g_return_val_if_fail (iter->stamp == model->
stamp, FALSE);
703 ENTER(
"model %p, iter %s", tree_model, iter_to_string (iter));
705 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
708 i = GPOINTER_TO_INT (iter->user_data2);
709 owner = g_list_nth_data (priv->owner_list, i + 1);
717 iter->user_data = owner;
718 iter->user_data2 = GINT_TO_POINTER (i + 1);
719 iter->user_data3 = NULL;
721 LEAVE(
"iter %s", iter_to_string(iter));
726 gnc_tree_model_owner_iter_children (GtkTreeModel *tree_model,
728 GtkTreeIter *parent_iter)
733 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), FALSE);
734 ENTER(
"model %p, iter %p (to be filed in), parent %s",
735 tree_model, iter, (parent_iter ? iter_to_string(parent_iter) :
"(null)"));
737 model = GNC_TREE_MODEL_OWNER (tree_model);
738 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
745 iter->user_data = g_list_nth_data (priv->owner_list, 0);
746 iter->user_data2 = GINT_TO_POINTER (0);
747 iter->user_data3 = NULL;
748 iter->stamp = model->
stamp;
749 LEAVE(
"iter (2) %s", iter_to_string(iter));
755 LEAVE(
"failed (owners don't have children)");
761 gnc_tree_model_owner_iter_has_child (GtkTreeModel *tree_model,
769 gnc_tree_model_owner_iter_n_children (GtkTreeModel *tree_model,
775 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), -1);
777 model = GNC_TREE_MODEL_OWNER (tree_model);
778 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE (model);
785 return (gint) g_list_length (priv->owner_list);
787 g_return_val_if_fail (
788 GNC_TREE_MODEL_OWNER (tree_model)->stamp == iter->stamp, -1);
794 gnc_tree_model_owner_iter_nth_child (GtkTreeModel *tree_model,
796 GtkTreeIter *parent_iter,
804 gchar *parent_string;
805 parent_string = g_strdup(iter_to_string(parent_iter));
806 ENTER(
"model %p, iter %s, parent_iter %s, n %d",
807 tree_model, iter_to_string(iter),
809 g_free(parent_string);
813 ENTER(
"model %p, iter %s, parent_iter (null), n %d",
814 tree_model, iter_to_string(iter), n);
818 model = GNC_TREE_MODEL_OWNER (tree_model);
819 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
826 iter->user_data = g_list_nth_data (priv->owner_list, n);
827 iter->user_data2 = GINT_TO_POINTER (n);
828 iter->user_data3 = NULL;
829 iter->stamp = model->
stamp;
830 LEAVE(
"iter (2) %s", iter_to_string(iter));
836 LEAVE(
"failed (owners don't have children)");
842 gnc_tree_model_owner_iter_parent (GtkTreeModel *tree_model,
864 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
865 g_return_val_if_fail (iter != NULL, NULL);
866 g_return_val_if_fail (iter->user_data != NULL, NULL);
867 g_return_val_if_fail (iter->stamp == model->
stamp, NULL);
869 return (
GncOwner *) iter->user_data;
883 GList *owner_in_list;
885 ENTER(
"model %p, owner %p, iter %p", model, owner, iter);
891 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
892 owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)
gncOwnerGCompareFunc);
895 iter->stamp = model->
stamp;
896 iter->user_data = owner_in_list->data;
897 iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list));
898 iter->user_data3 = NULL;
899 LEAVE(
"iter %s", iter_to_string (iter));
905 iter->user_data = NULL;
906 LEAVE(
"Owner not found in list");
920 GtkTreeIter tree_iter;
921 GtkTreePath *tree_path;
923 ENTER(
"model %p, owner %p", model, owner);
934 tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
937 gchar *path_string = gtk_tree_path_to_string(tree_path);
938 LEAVE(
"path (2) %s", path_string);
956 while (!model->
stamp);
988 gnc_tree_model_owner_event_handler (
QofInstance *entity,
994 GtkTreePath *path = NULL;
998 g_return_if_fail(model);
1003 ENTER(
"entity %p of type %d, model %p, event_data %p",
1004 entity, event_type, model, ed);
1005 priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
1010 LEAVE(
"model type and owner type differ");
1016 LEAVE(
"not in this book");
1025 DEBUG(
"add owner %p (%s)", &owner, gncOwnerGetName(&owner));
1029 increment_stamp(model);
1032 LEAVE(
"can't generate iter");
1035 path = gnc_tree_model_owner_get_path(GTK_TREE_MODEL(model), &iter);
1038 DEBUG(
"can't generate path");
1041 gtk_tree_model_row_inserted (GTK_TREE_MODEL(model), path, &iter);
1044 case QOF_EVENT_REMOVE:
1047 DEBUG(
"remove owner %d (%s) from owner_list %p", ed->idx,
1048 gncOwnerGetName(&owner), priv->owner_list);
1049 path = gtk_tree_path_new();
1052 DEBUG(
"can't generate path");
1055 increment_stamp(model);
1056 gtk_tree_path_append_index (path, ed->idx);
1057 gtk_tree_model_row_deleted (GTK_TREE_MODEL(model), path);
1060 case QOF_EVENT_MODIFY:
1061 DEBUG(
"modify owner %p (%s)", &owner, gncOwnerGetName(&owner));
1064 LEAVE(
"can't generate iter");
1067 path = gnc_tree_model_owner_get_path(GTK_TREE_MODEL(model), &iter);
1070 DEBUG(
"can't generate path");
1073 gtk_tree_model_row_changed(GTK_TREE_MODEL(model), path, &iter);
1077 LEAVE(
"unknown event type");
1082 gtk_tree_path_free(path);
OwnerList * gncBusinessGetOwnerList(QofBook *book, QofIdTypeConst type_name, gboolean all_including_inactive)
Business Interface: Object OWNERs.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
GtkTreeModel implementation for gnucash owner tree.
QofBook * qof_instance_get_book(gconstpointer)
utility functions for the GnuCash UI
#define DEBUG(format, args...)
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
#define ENTER(format, args...)
#define gnc_leave_return_val_if_fail(test, val)
gint qof_event_register_handler(QofEventHandler handler, gpointer handler_data)
Register a handler for events.
int gncOwnerGCompareFunc(const GncOwner *a, const GncOwner *b)
GType gnc_tree_model_owner_get_type(void)
GtkTreeModel * gnc_tree_model_owner_new(GncOwnerType owner_type)
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
void qofOwnerSetEntity(GncOwner *owner, QofInstance *ent)
const char * gnc_commodity_get_fullname(const gnc_commodity *cm)
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
GtkTreePath * gnc_tree_model_owner_get_path_from_owner(GncTreeModelOwner *model, GncOwner *owner)
GncOwner * gnc_tree_model_owner_get_owner(GncTreeModelOwner *model, GtkTreeIter *iter)
Additional event handling code.
All type declarations for the whole Gnucash engine.
Generic api to store and retrieve preferences.
gboolean GNC_IS_OWNER(QofInstance *ent)
GncOwnerType gncOwnerGetType(const GncOwner *owner)
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
gboolean gnc_tree_model_owner_get_iter_from_owner(GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter)
#define LEAVE(format, args...)
GncVendor * gncOwnerGetVendor(const GncOwner *owner)
GncCustomer * gncOwnerGetCustomer(const GncOwner *owner)
Commodity handling public routines.
const gchar * QofLogModule
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)