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" 45 static QofLogModule log_module = GNC_MOD_GUI;
48 static void gnc_tree_model_owner_finalize (GObject *
object);
49 static void gnc_tree_model_owner_dispose (GObject *
object);
52 static void gnc_tree_model_owner_tree_model_init (GtkTreeModelIface *iface);
53 static GtkTreeModelFlags gnc_tree_model_owner_get_flags (GtkTreeModel *tree_model);
54 static int gnc_tree_model_owner_get_n_columns (GtkTreeModel *tree_model);
55 static GType gnc_tree_model_owner_get_column_type (GtkTreeModel *tree_model,
57 static gboolean gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
60 static GtkTreePath *gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
62 static void gnc_tree_model_owner_get_value (GtkTreeModel *tree_model,
66 static gboolean gnc_tree_model_owner_iter_next (GtkTreeModel *tree_model,
68 static gboolean gnc_tree_model_owner_iter_children (GtkTreeModel *tree_model,
71 static gboolean gnc_tree_model_owner_iter_has_child (GtkTreeModel *tree_model,
73 static int gnc_tree_model_owner_iter_n_children (GtkTreeModel *tree_model,
75 static gboolean gnc_tree_model_owner_iter_nth_child (GtkTreeModel *tree_model,
79 static gboolean gnc_tree_model_owner_iter_parent (GtkTreeModel *tree_model,
84 static void gnc_tree_model_owner_event_handler (
QofInstance *entity,
86 GncTreeModelOwner *model,
97 GncOwnerType owner_type;
99 gint event_handler_id;
100 const gchar *negative_color;
105 G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
106 gnc_tree_model_owner_tree_model_init))
119 gnc_tree_model_owner_update_color (gpointer gsettings, gchar *key, gpointer user_data)
121 GncTreeModelOwner *model;
124 g_return_if_fail(GNC_IS_TREE_MODEL_OWNER(user_data));
127 model->negative_color = use_red ?
"red" : NULL;
134 gnc_tree_model_owner_class_init (GncTreeModelOwnerClass *klass)
136 GObjectClass *o_class;
138 o_class = G_OBJECT_CLASS (klass);
141 o_class->finalize = gnc_tree_model_owner_finalize;
142 o_class->dispose = gnc_tree_model_owner_dispose;
146 gnc_tree_model_owner_init (GncTreeModelOwner *model)
150 ENTER(
"model %p", model);
151 while (model->stamp == 0)
153 model->stamp = g_random_int ();
159 model->owner_list = NULL;
160 model->owner_type = GNC_OWNER_NONE;
161 model->negative_color = red ?
"red" : NULL;
164 gnc_tree_model_owner_update_color,
171 gnc_tree_model_owner_finalize (GObject *
object)
173 GncTreeModelOwner *model;
175 g_return_if_fail (
object != NULL);
176 g_return_if_fail (GNC_IS_TREE_MODEL_OWNER (
object));
178 ENTER(
"model %p",
object);
180 model = GNC_TREE_MODEL_OWNER (
object);
182 if (model->owner_list)
183 g_list_free_full (model->owner_list, (GDestroyNotify) gncOwnerFree);
186 model->owner_list = NULL;
188 G_OBJECT_CLASS(gnc_tree_model_owner_parent_class)->finalize (
object);
193 gnc_tree_model_owner_dispose (GObject *
object)
195 GncTreeModelOwner *model;
197 g_return_if_fail (
object != NULL);
198 g_return_if_fail (GNC_IS_TREE_MODEL_OWNER (
object));
200 ENTER(
"model %p",
object);
202 model = GNC_TREE_MODEL_OWNER (
object);
204 if (model->event_handler_id)
207 model->event_handler_id = 0;
211 gnc_tree_model_owner_update_color,
214 G_OBJECT_CLASS (gnc_tree_model_owner_parent_class)->dispose (
object);
226 GncTreeModelOwner *model;
229 ENTER(
"owner_type %d", owner_type);
231 for ( ; item; item = g_list_next(item))
233 model = (GncTreeModelOwner *)item->data;
234 if (model->owner_type == owner_type)
236 g_object_ref(G_OBJECT(model));
237 LEAVE(
"returning existing model %p", model);
238 return GTK_TREE_MODEL(model);
242 model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
245 model->book = gnc_get_current_book();
246 model->owner_type = owner_type;
252 LEAVE(
"model %p", model);
253 return GTK_TREE_MODEL (model);
261 #define ITER_STRING_LEN 128 264 iter_to_string (GtkTreeIter *iter)
266 #ifdef G_THREADS_ENABLED 267 static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free);
270 string = g_private_get (>mits_buffer_key);
273 string = g_malloc(ITER_STRING_LEN + 1);
274 g_private_set (>mits_buffer_key,
string);
277 static char string[ITER_STRING_LEN + 1];
281 snprintf(
string, ITER_STRING_LEN,
282 "[stamp:%x data:%p (%s), %p, %d]",
283 iter->stamp, iter->user_data,
284 gncOwnerGetName ((
GncOwner *) iter->user_data),
285 iter->user_data2, GPOINTER_TO_INT(iter->user_data3));
287 strcpy(
string,
"(null)");
297 gnc_tree_model_owner_tree_model_init (GtkTreeModelIface *iface)
299 iface->get_flags = gnc_tree_model_owner_get_flags;
300 iface->get_n_columns = gnc_tree_model_owner_get_n_columns;
301 iface->get_column_type = gnc_tree_model_owner_get_column_type;
302 iface->get_iter = gnc_tree_model_owner_get_iter;
303 iface->get_path = gnc_tree_model_owner_get_path;
304 iface->get_value = gnc_tree_model_owner_get_value;
305 iface->iter_next = gnc_tree_model_owner_iter_next;
306 iface->iter_children = gnc_tree_model_owner_iter_children;
307 iface->iter_has_child = gnc_tree_model_owner_iter_has_child;
308 iface->iter_n_children = gnc_tree_model_owner_iter_n_children;
309 iface->iter_nth_child = gnc_tree_model_owner_iter_nth_child;
310 iface->iter_parent = gnc_tree_model_owner_iter_parent;
313 static GtkTreeModelFlags
314 gnc_tree_model_owner_get_flags (GtkTreeModel *tree_model)
320 gnc_tree_model_owner_get_n_columns (GtkTreeModel *tree_model)
322 g_return_val_if_fail(GNC_IS_TREE_MODEL_OWNER(tree_model), -1);
324 return GNC_TREE_MODEL_OWNER_NUM_COLUMNS;
328 gnc_tree_model_owner_get_column_type (GtkTreeModel *tree_model,
331 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), G_TYPE_INVALID);
332 g_return_val_if_fail ((index < GNC_TREE_MODEL_OWNER_NUM_COLUMNS) && (index >= 0), G_TYPE_INVALID);
336 case GNC_TREE_MODEL_OWNER_COL_NAME:
337 case GNC_TREE_MODEL_OWNER_COL_TYPE:
338 case GNC_TREE_MODEL_OWNER_COL_CURRENCY:
339 case GNC_TREE_MODEL_OWNER_COL_ID:
340 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME:
341 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_1:
342 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_2:
343 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_3:
344 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_4:
345 case GNC_TREE_MODEL_OWNER_COL_PHONE:
346 case GNC_TREE_MODEL_OWNER_COL_FAX:
347 case GNC_TREE_MODEL_OWNER_COL_EMAIL:
348 case GNC_TREE_MODEL_OWNER_COL_BALANCE:
349 case GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT:
350 case GNC_TREE_MODEL_OWNER_COL_NOTES:
352 case GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE:
353 return G_TYPE_STRING;
355 case GNC_TREE_MODEL_OWNER_COL_ACTIVE:
356 return G_TYPE_BOOLEAN;
359 g_assert_not_reached ();
360 return G_TYPE_INVALID;
365 gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
369 GncTreeModelOwner *model;
373 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), FALSE);
376 gchar *path_string = gtk_tree_path_to_string(path);
377 ENTER(
"model %p, iter %p, path %s", tree_model, iter, path_string);
381 model = GNC_TREE_MODEL_OWNER (tree_model);
384 if (gtk_tree_path_get_depth (path) != 1)
390 indices = gtk_tree_path_get_indices (path);
392 owner = g_list_nth_data (model->owner_list, indices[0]);
400 iter->stamp = model->stamp;
401 iter->user_data = owner;
402 iter->user_data2 = GINT_TO_POINTER (indices[0]);
403 iter->user_data3 = NULL;
405 LEAVE(
"iter %s", iter_to_string (iter));
410 gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
413 GncTreeModelOwner *model = GNC_TREE_MODEL_OWNER (tree_model);
418 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
419 g_return_val_if_fail (iter != NULL, NULL);
420 g_return_val_if_fail (iter->user_data != NULL, NULL);
421 g_return_val_if_fail (iter->stamp == model->stamp, NULL);
423 ENTER(
"model %p, iter %s", model, iter_to_string(iter));
425 if (model->owner_list == NULL)
431 owner = (
GncOwner *) iter->user_data;
433 path = gtk_tree_path_new ();
434 i = g_list_index (model->owner_list, owner);
437 gtk_tree_path_free (path);
441 gtk_tree_path_prepend_index (path, i);
444 gchar *path_string = gtk_tree_path_to_string(path);
445 LEAVE(
"path (4) %s", path_string);
452 gnc_tree_model_owner_set_color(GncTreeModelOwner *model,
457 g_value_set_static_string (value, model->negative_color);
459 g_value_set_static_string (value, NULL);
463 gnc_tree_model_owner_get_value (GtkTreeModel *tree_model,
468 GncTreeModelOwner *model = GNC_TREE_MODEL_OWNER (tree_model);
471 gchar *
string = NULL;
473 g_return_if_fail (GNC_IS_TREE_MODEL_OWNER (model));
474 g_return_if_fail (iter != NULL);
475 g_return_if_fail (iter->user_data != NULL);
476 g_return_if_fail (iter->stamp == model->stamp);
478 ENTER(
"model %p, iter %s, col %d", tree_model,
479 iter_to_string(iter), column);
481 owner = (
GncOwner *) iter->user_data;
485 case GNC_TREE_MODEL_OWNER_COL_NAME:
486 g_value_init (value, G_TYPE_STRING);
487 g_value_set_string (value, gncOwnerGetName (owner));
489 case GNC_TREE_MODEL_OWNER_COL_TYPE:
490 g_value_init (value, G_TYPE_STRING);
491 g_value_set_string (value,
494 case GNC_TREE_MODEL_OWNER_COL_ID:
495 g_value_init (value, G_TYPE_STRING);
496 g_value_set_string (value, gncOwnerGetID (owner));
498 case GNC_TREE_MODEL_OWNER_COL_CURRENCY:
499 g_value_init (value, G_TYPE_STRING);
500 g_value_set_string (value,
503 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME:
504 g_value_init (value, G_TYPE_STRING);
505 string = g_strdup (gncAddressGetName (gncOwnerGetAddr (owner)));
507 g_value_take_string (value,
string);
509 g_value_set_static_string (value,
"");
511 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_1:
512 g_value_init (value, G_TYPE_STRING);
513 string = g_strdup (gncAddressGetAddr1 (gncOwnerGetAddr (owner)));
515 g_value_take_string (value,
string);
517 g_value_set_static_string (value,
"");
519 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_2:
520 g_value_init (value, G_TYPE_STRING);
521 string = g_strdup (gncAddressGetAddr2 (gncOwnerGetAddr (owner)));
523 g_value_take_string (value,
string);
525 g_value_set_static_string (value,
"");
527 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_3:
528 g_value_init (value, G_TYPE_STRING);
529 string = g_strdup (gncAddressGetAddr3 (gncOwnerGetAddr (owner)));
531 g_value_take_string (value,
string);
533 g_value_set_static_string (value,
"");
535 case GNC_TREE_MODEL_OWNER_COL_ADDRESS_4:
536 g_value_init (value, G_TYPE_STRING);
537 string = g_strdup (gncAddressGetAddr4 (gncOwnerGetAddr (owner)));
539 g_value_take_string (value,
string);
541 g_value_set_static_string (value,
"");
543 case GNC_TREE_MODEL_OWNER_COL_PHONE:
544 g_value_init (value, G_TYPE_STRING);
545 string = g_strdup (gncAddressGetPhone (gncOwnerGetAddr (owner)));
547 g_value_take_string (value,
string);
549 g_value_set_static_string (value,
"");
551 case GNC_TREE_MODEL_OWNER_COL_FAX:
552 g_value_init (value, G_TYPE_STRING);
553 string = g_strdup (gncAddressGetFax (gncOwnerGetAddr (owner)));
555 g_value_take_string (value,
string);
557 g_value_set_static_string (value,
"");
559 case GNC_TREE_MODEL_OWNER_COL_EMAIL:
560 g_value_init (value, G_TYPE_STRING);
561 string = g_strdup (gncAddressGetEmail (gncOwnerGetAddr (owner)));
563 g_value_take_string (value,
string);
565 g_value_set_static_string (value,
"");
568 case GNC_TREE_MODEL_OWNER_COL_BALANCE:
569 g_value_init (value, G_TYPE_STRING);
570 string = gnc_ui_owner_get_print_balance(owner, &negative);
571 g_value_take_string (value,
string);
574 case GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT:
575 g_value_init (value, G_TYPE_STRING);
576 string = gnc_ui_owner_get_print_report_balance(owner, &negative);
577 g_value_take_string (value,
string);
579 case GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE:
580 g_value_init (value, G_TYPE_STRING);
581 string = gnc_ui_owner_get_print_balance(owner, &negative);
582 gnc_tree_model_owner_set_color(model, negative, value);
586 case GNC_TREE_MODEL_OWNER_COL_NOTES:
587 g_value_init (value, G_TYPE_STRING);
591 case GNC_OWNER_UNDEFINED:
592 case GNC_OWNER_EMPLOYEE:
595 g_value_set_static_string (value,
"");
597 case GNC_OWNER_VENDOR:
600 case GNC_OWNER_CUSTOMER:
606 case GNC_TREE_MODEL_OWNER_COL_ACTIVE:
607 g_value_init (value, G_TYPE_BOOLEAN);
608 g_value_set_boolean (value, gncOwnerGetActive (owner));
612 g_assert_not_reached ();
618 gnc_tree_model_owner_iter_next (GtkTreeModel *tree_model,
621 GncTreeModelOwner *model = GNC_TREE_MODEL_OWNER (tree_model);
625 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
626 g_return_val_if_fail (iter != NULL, FALSE);
627 g_return_val_if_fail (iter->user_data != NULL, FALSE);
628 g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
630 ENTER(
"model %p, iter %s", tree_model, iter_to_string (iter));
633 i = GPOINTER_TO_INT (iter->user_data2);
634 owner = g_list_nth_data (model->owner_list, i + 1);
642 iter->user_data = owner;
643 iter->user_data2 = GINT_TO_POINTER (i + 1);
644 iter->user_data3 = NULL;
646 LEAVE(
"iter %s", iter_to_string(iter));
651 gnc_tree_model_owner_iter_children (GtkTreeModel *tree_model,
653 GtkTreeIter *parent_iter)
655 GncTreeModelOwner *model;
657 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), FALSE);
658 ENTER(
"model %p, iter %p (to be filed in), parent %s",
659 tree_model, iter, (parent_iter ? iter_to_string(parent_iter) :
"(null)"));
661 model = GNC_TREE_MODEL_OWNER (tree_model);
668 iter->user_data = g_list_nth_data (model->owner_list, 0);
669 iter->user_data2 = GINT_TO_POINTER (0);
670 iter->user_data3 = NULL;
671 iter->stamp = model->stamp;
672 LEAVE(
"iter (2) %s", iter_to_string(iter));
678 LEAVE(
"failed (owners don't have children)");
684 gnc_tree_model_owner_iter_has_child (GtkTreeModel *tree_model,
692 gnc_tree_model_owner_iter_n_children (GtkTreeModel *tree_model,
695 GncTreeModelOwner *model;
697 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), -1);
699 model = GNC_TREE_MODEL_OWNER (tree_model);
706 return (gint) g_list_length (model->owner_list);
708 g_return_val_if_fail (
709 GNC_TREE_MODEL_OWNER (tree_model)->stamp == iter->stamp, -1);
715 gnc_tree_model_owner_iter_nth_child (GtkTreeModel *tree_model,
717 GtkTreeIter *parent_iter,
720 GncTreeModelOwner *model;
724 gchar *parent_string;
725 parent_string = g_strdup(iter_to_string(parent_iter));
726 ENTER(
"model %p, iter %s, parent_iter %s, n %d",
727 tree_model, iter_to_string(iter),
729 g_free(parent_string);
733 ENTER(
"model %p, iter %s, parent_iter (null), n %d",
734 tree_model, iter_to_string(iter), n);
738 model = GNC_TREE_MODEL_OWNER (tree_model);
745 iter->user_data = g_list_nth_data (model->owner_list, n);
746 iter->user_data2 = GINT_TO_POINTER (n);
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_parent (GtkTreeModel *tree_model,
783 g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
784 g_return_val_if_fail (iter != NULL, NULL);
785 g_return_val_if_fail (iter->user_data != NULL, NULL);
786 g_return_val_if_fail (iter->stamp == model->stamp, NULL);
788 return (
GncOwner *) iter->user_data;
801 GList *owner_in_list;
803 ENTER(
"model %p, owner %p, iter %p", model, owner, iter);
808 owner_in_list = g_list_find_custom (model->owner_list, (gconstpointer)owner, (GCompareFunc)
gncOwnerGCompareFunc);
811 iter->stamp = model->stamp;
812 iter->user_data = owner_in_list->data;
813 iter->user_data2 = GINT_TO_POINTER (g_list_position (model->owner_list, owner_in_list));
814 iter->user_data3 = NULL;
815 LEAVE(
"iter %s", iter_to_string (iter));
821 iter->user_data = NULL;
822 LEAVE(
"Owner not found in list");
836 GtkTreeIter tree_iter;
837 GtkTreePath *tree_path;
839 ENTER(
"model %p, owner %p", model, owner);
850 tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
853 gchar *path_string = gtk_tree_path_to_string(tree_path);
854 LEAVE(
"path (2) %s", path_string);
869 increment_stamp(GncTreeModelOwner *model)
872 while (!model->stamp);
904 gnc_tree_model_owner_event_handler (
QofInstance *entity,
906 GncTreeModelOwner *model,
909 GtkTreePath *path = NULL;
913 g_return_if_fail(model);
918 ENTER(
"entity %p of type %d, model %p, event_data %p",
919 entity, event_type, model, ed);
924 LEAVE(
"model type and owner type differ");
930 LEAVE(
"not in this book");
939 DEBUG(
"add owner %p (%s)", &owner, gncOwnerGetName(&owner));
941 if (model->owner_list)
942 g_list_free_full (model->owner_list, (GDestroyNotify) gncOwnerFree);
946 increment_stamp(model);
949 LEAVE(
"can't generate iter");
952 path = gnc_tree_model_owner_get_path(GTK_TREE_MODEL(model), &iter);
955 DEBUG(
"can't generate path");
958 gtk_tree_model_row_inserted (GTK_TREE_MODEL(model), path, &iter);
961 case QOF_EVENT_REMOVE:
964 DEBUG(
"remove owner %d (%s) from owner_list %p", ed->idx,
965 gncOwnerGetName(&owner), model->owner_list);
966 path = gtk_tree_path_new();
969 DEBUG(
"can't generate path");
972 increment_stamp(model);
973 gtk_tree_path_append_index (path, ed->idx);
974 gtk_tree_model_row_deleted (GTK_TREE_MODEL(model), path);
977 case QOF_EVENT_MODIFY:
978 DEBUG(
"modify owner %p (%s)", &owner, gncOwnerGetName(&owner));
981 LEAVE(
"can't generate iter");
984 path = gnc_tree_model_owner_get_path(GTK_TREE_MODEL(model), &iter);
987 DEBUG(
"can't generate path");
990 gtk_tree_model_row_changed(GTK_TREE_MODEL(model), path, &iter);
994 LEAVE(
"unknown event type");
999 gtk_tree_path_free(path);
OwnerList * gncBusinessGetOwnerList(QofBook *book, QofIdTypeConst type_name, gboolean all_including_inactive)
Returns a GList of all objects of the given type_name in the given book, but each object is wrapped i...
Business Interface: Object OWNERs.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Register a callback that gets triggered when the given preference changes.
GncTreeModel gnc_tree_model
The parent object data.
GtkTreeModel implementation for gnucash owner tree.
QofBook * qof_instance_get_book(gconstpointer inst)
Return the book pointer.
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
utility functions for the GnuCash UI
#define DEBUG(format, args...)
Print a debugging message.
The instance data structure for an owner tree model.
#define ENTER(format, args...)
Print a function entry debugging message.
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
G_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_APPLICATION_WINDOW, G_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW, gnc_window_main_window_init)) static guint main_window_signals[LAST_SIGNAL]
A holding place for all the signals generated by the main window code.
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
int gncOwnerGCompareFunc(const GncOwner *a, const GncOwner *b)
Same as gncOwnerEqual, but returns 0 if equal to be used as a GList custom compare function...
GtkTreeModel * gnc_tree_model_owner_new(GncOwnerType owner_type)
Create a new GtkTreeModel for manipulating gnucash owners.
gint QofEventId
Define the type of events allowed.
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
void qofOwnerSetEntity(GncOwner *owner, QofInstance *ent)
set the owner from the entity.
const char * gnc_commodity_get_fullname(const gnc_commodity *cm)
Retrieve the full name for the specified commodity.
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Returns the QofIdType of the given GncOwnerType, or NULL if no suitable one exists.
GtkTreePath * gnc_tree_model_owner_get_path_from_owner(GncTreeModelOwner *model, GncOwner *owner)
Convert a model/owner pair into a gtk_tree_model_path.
GncOwner * gnc_tree_model_owner_get_owner(GncTreeModelOwner *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash owner.
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)
Check if entity is an owner kind.
GncOwnerType gncOwnerGetType(const GncOwner *owner)
Returns the GncOwnerType of this owner.
int stamp
The state of the model.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
gboolean gnc_tree_model_owner_get_iter_from_owner(GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter)
Convert a model/owner pair into a gtk_tree_model_iter.
#define LEAVE(format, args...)
Print a function exit debugging message.
GncVendor * gncOwnerGetVendor(const GncOwner *owner)
If the given owner is of type GNC_OWNER_VENDOR, returns the pointer to the vendor object...
GncCustomer * gncOwnerGetCustomer(const GncOwner *owner)
If the given owner is of type GNC_OWNER_CUSTOMER, returns the pointer to the customer object...
Commodity handling public routines.
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
Remove a function that was registered for a callback when the given preference changed.
GList OwnerList
For SWIG: A GList containing GncOwner.