GnuCash  4.8a-134-g214de30c7+
Files | Data Structures | Macros | Enumerations | Functions | Variables
GnuCash Tree Model

Files

 
 
file  gnc-tree-model-commodity.h
 GtkTreeModel implementation for gnucash commodities.
 
file  gnc-tree-model-owner.h
 GtkTreeModel implementation for gnucash owner tree.
 
file  gnc-tree-model-price.h
 GtkTreeModel implementation for gnucash price database.
 
file  gnc-tree-model.h
 GtkTreeModel implementation for a generic gnucash tree.
 
 
file  gnc-tree-view-commodity.h
 GtkTreeView implementation for gnucash commodity tree.
 
file  gnc-tree-view-owner.h
 GtkTreeView implementation for gnucash owner tree.
 
file  gnc-tree-view-price.h
 GtkTreeView implementation for gnucash price tree.
 

Data Structures

struct  GncTreeModelAccountTypes
 
struct  GncTreeModelAccountTypesClass
 
struct  GncTreeModelAccount
 The instance data structure for an account tree model. More...
 
struct  GncTreeModelAccountClass
 The class data structure for an account tree model. More...
 
struct  GncTreeModelCommodity
 The instance data structure for a commodity tree model. More...
 
struct  GncTreeModelCommodityClass
 The class data structure for a commodity tree model. More...
 
struct  GncTreeModelOwner
 The instance data structure for an owner tree model. More...
 
struct  GncTreeModelOwnerClass
 The class data structure for an owner tree model. More...
 
struct  GncTreeModelPrice
 The instance data structure for a price tree model. More...
 
struct  GncTreeModelPriceClass
 The class data structure for a price tree model. More...
 
struct  GncTreeModel
 The instance data structure for a generic tree model. More...
 
struct  GncTreeModelClass
 The class data structure for a generic tree model. More...
 
struct  AccountViewInfo
 
struct  GncTreeViewAccount
 
struct  GncTreeViewAccountClass
 
struct  AccountFilterDialog
 
struct  GncTreeViewCommodity
 
struct  GncTreeViewCommodityClass
 
struct  OwnerViewInfo
 
struct  GncTreeViewOwner
 
struct  GncTreeViewOwnerClass
 
struct  OwnerFilterDialog
 
struct  GncTreeViewPrice
 
struct  GncTreeViewPriceClass
 

Macros

#define GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES   (gnc_tree_model_account_types_get_type ())
 
#define GNC_TREE_MODEL_ACCOUNT_TYPES(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, GncTreeModelAccountTypes))
 
#define GNC_TREE_MODEL_ACCOUNT_TYPES_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, GncTreeModelAccountTypesClass))
 
#define GNC_IS_TREE_MODEL_ACCOUNT_TYPES(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES))
 
#define GNC_IS_TREE_MODEL_ACCOUNT_TYPES_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES))
 
#define GNC_TREE_MODEL_ACCOUNT_TYPES_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, GncTreeModelAccountTypesClass))
 
#define GNC_TYPE_TREE_MODEL_ACCOUNT   (gnc_tree_model_account_get_type ())
 
#define GNC_TREE_MODEL_ACCOUNT(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_ACCOUNT, GncTreeModelAccount))
 
#define GNC_TREE_MODEL_ACCOUNT_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_ACCOUNT, GncTreeModelAccountClass))
 
#define GNC_IS_TREE_MODEL_ACCOUNT(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_ACCOUNT))
 
#define GNC_IS_TREE_MODEL_ACCOUNT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_ACCOUNT))
 
#define GNC_TREE_MODEL_ACCOUNT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_ACCOUNT, GncTreeModelAccountClass))
 
#define GNC_TREE_MODEL_ACCOUNT_NAME   "GncTreeModelAccount"
 
#define GNC_TYPE_TREE_MODEL_COMMODITY   (gnc_tree_model_commodity_get_type ())
 
#define GNC_TREE_MODEL_COMMODITY(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodity))
 
#define GNC_TREE_MODEL_COMMODITY_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodityClass))
 
#define GNC_IS_TREE_MODEL_COMMODITY(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_COMMODITY))
 
#define GNC_IS_TREE_MODEL_COMMODITY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_COMMODITY))
 
#define GNC_TREE_MODEL_COMMODITY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodityClass))
 
#define GNC_TREE_MODEL_COMMODITY_NAME   "GncTreeModelCommodity"
 
#define GNC_TYPE_TREE_MODEL_OWNER   (gnc_tree_model_owner_get_type ())
 
#define GNC_TREE_MODEL_OWNER(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwner))
 
#define GNC_TREE_MODEL_OWNER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwnerClass))
 
#define GNC_IS_TREE_MODEL_OWNER(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_OWNER))
 
#define GNC_IS_TREE_MODEL_OWNER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_OWNER))
 
#define GNC_TREE_MODEL_OWNER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwnerClass))
 
#define GNC_TREE_MODEL_OWNER_NAME   "GncTreeModelOwner"
 
#define GNC_TYPE_TREE_MODEL_PRICE   (gnc_tree_model_price_get_type ())
 
#define GNC_TREE_MODEL_PRICE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPrice))
 
#define GNC_TREE_MODEL_PRICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPriceClass))
 
#define GNC_IS_TREE_MODEL_PRICE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_PRICE))
 
#define GNC_IS_TREE_MODEL_PRICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_PRICE))
 
#define GNC_TREE_MODEL_PRICE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPriceClass))
 
#define GNC_TREE_MODEL_PRICE_NAME   "GncTreeModelPrice"
 
#define GNC_TYPE_TREE_MODEL   (gnc_tree_model_get_type ())
 
#define GNC_TREE_MODEL(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL, GncTreeModel))
 
#define GNC_TREE_MODEL_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL, GncTreeModelClass))
 
#define GNC_IS_TREE_MODEL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL))
 
#define GNC_IS_TREE_MODEL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL))
 
#define GNC_TREE_MODEL_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL, GncTreeModelClass))
 
#define GNC_TREE_MODEL_NAME   "GncTreeModel"
 
#define GNC_TYPE_TREE_VIEW_ACCOUNT   (gnc_tree_view_account_get_type ())
 
#define GNC_TREE_VIEW_ACCOUNT(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccount))
 
#define GNC_TREE_VIEW_ACCOUNT_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass))
 
#define GNC_IS_TREE_VIEW_ACCOUNT(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT))
 
#define GNC_IS_TREE_VIEW_ACCOUNT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT))
 
#define GNC_TREE_VIEW_ACCOUNT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass))
 
#define GNC_TREE_VIEW_ACCOUNT_NAME   "GncTreeViewAccount"
 
#define GNC_TYPE_TREE_VIEW_COMMODITY   (gnc_tree_view_commodity_get_type ())
 
#define GNC_TREE_VIEW_COMMODITY(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_COMMODITY, GncTreeViewCommodity))
 
#define GNC_TREE_VIEW_COMMODITY_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_COMMODITY, GncTreeViewCommodityClass))
 
#define GNC_IS_TREE_VIEW_COMMODITY(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_COMMODITY))
 
#define GNC_IS_TREE_VIEW_COMMODITY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_COMMODITY))
 
#define GNC_TREE_VIEW_COMMODITY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_COMMODITY, GncTreeViewCommodityClass))
 
#define GNC_TYPE_TREE_VIEW_OWNER   (gnc_tree_view_owner_get_type ())
 
#define GNC_TREE_VIEW_OWNER(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_OWNER, GncTreeViewOwner))
 
#define GNC_TREE_VIEW_OWNER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_OWNER, GncTreeViewOwnerClass))
 
#define GNC_IS_TREE_VIEW_OWNER(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_OWNER))
 
#define GNC_IS_TREE_VIEW_OWNER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_OWNER))
 
#define GNC_TREE_VIEW_OWNER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_OWNER, GncTreeViewOwnerClass))
 
#define GNC_TREE_VIEW_OWNER_NAME   "GncTreeViewOwner"
 
#define GNC_OWNER_TREE_NAME_COL   "name"
 
#define GNC_OWNER_TREE_TYPE_COL   "type"
 
#define GNC_OWNER_TREE_ID_COL   "owner-id"
 
#define GNC_OWNER_TREE_CURRENCY_COL   "currency"
 
#define GNC_OWNER_TREE_ADDRESS_NAME_COL   "address-name"
 
#define GNC_OWNER_TREE_ADDRESS_1_COL   "address-1"
 
#define GNC_OWNER_TREE_ADDRESS_2_COL   "address-2"
 
#define GNC_OWNER_TREE_ADDRESS_3_COL   "address-3"
 
#define GNC_OWNER_TREE_ADDRESS_4_COL   "address-4"
 
#define GNC_OWNER_TREE_PHONE_COL   "phone"
 
#define GNC_OWNER_TREE_FAX_COL   "fax"
 
#define GNC_OWNER_TREE_EMAIL_COL   "email"
 
#define GNC_OWNER_TREE_BALANCE_COL   "balance"
 
#define GNC_OWNER_TREE_BALANCE_REPORT_COL   "balance-report"
 
#define GNC_OWNER_TREE_BALANCE_PERIOD_COL   "balance-period"
 
#define GNC_OWNER_TREE_NOTES_COL   "notes"
 
#define GNC_OWNER_TREE_ACTIVE_COL   "active"
 
#define GNC_TYPE_TREE_VIEW_PRICE   (gnc_tree_view_price_get_type ())
 
#define GNC_TREE_VIEW_PRICE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_PRICE, GncTreeViewPrice))
 
#define GNC_TREE_VIEW_PRICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_PRICE, GncTreeViewPriceClass))
 
#define GNC_IS_TREE_VIEW_PRICE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_PRICE))
 
#define GNC_IS_TREE_VIEW_PRICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_PRICE))
 
#define GNC_TREE_VIEW_PRICE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_PRICE, GncTreeViewPriceClass))
 

Enumerations

enum  GncTreeModelAccountTypesColumn { GNC_TREE_MODEL_ACCOUNT_TYPES_COL_TYPE, GNC_TREE_MODEL_ACCOUNT_TYPES_COL_NAME, GNC_TREE_MODEL_ACCOUNT_TYPES_COL_SELECTED, GNC_TREE_MODEL_ACCOUNT_TYPES_NUM_COLUMNS }
 
enum  GncTreeModelAccountColumn {
  GNC_TREE_MODEL_ACCOUNT_COL_NAME, GNC_TREE_MODEL_ACCOUNT_COL_TYPE, GNC_TREE_MODEL_ACCOUNT_COL_COMMODITY, GNC_TREE_MODEL_ACCOUNT_COL_CODE,
  GNC_TREE_MODEL_ACCOUNT_COL_DESCRIPTION, GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM, GNC_TREE_MODEL_ACCOUNT_COL_PRESENT, GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT,
  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE, GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD, GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE,
  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN, GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_TOTAL, GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT,
  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD, GNC_TREE_MODEL_ACCOUNT_COL_NOTES, GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO, GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
  GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN, GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER, GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE, GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_ACCOUNT, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD,
  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD, GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS
}
 
enum  GncTreeModelCommodityColumn {
  GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE, GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC, GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL, GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
  GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME, GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME, GNC_TREE_MODEL_COMMODITY_COL_CUSIP, GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG, GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE, GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ, GNC_TREE_MODEL_COMMODITY_COL_LAST_VISIBLE = GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY, GNC_TREE_MODEL_COMMODITY_NUM_COLUMNS
}
 
enum  GncTreeModelOwnerColumn {
  GNC_TREE_MODEL_OWNER_COL_NAME, GNC_TREE_MODEL_OWNER_COL_TYPE, GNC_TREE_MODEL_OWNER_COL_ID, GNC_TREE_MODEL_OWNER_COL_CURRENCY,
  GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME, GNC_TREE_MODEL_OWNER_COL_ADDRESS_1, GNC_TREE_MODEL_OWNER_COL_ADDRESS_2, GNC_TREE_MODEL_OWNER_COL_ADDRESS_3,
  GNC_TREE_MODEL_OWNER_COL_ADDRESS_4, GNC_TREE_MODEL_OWNER_COL_PHONE, GNC_TREE_MODEL_OWNER_COL_FAX, GNC_TREE_MODEL_OWNER_COL_EMAIL,
  GNC_TREE_MODEL_OWNER_COL_BALANCE, GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT, GNC_TREE_MODEL_OWNER_COL_NOTES, GNC_TREE_MODEL_OWNER_COL_ACTIVE,
  GNC_TREE_MODEL_OWNER_COL_LAST_VISIBLE = GNC_TREE_MODEL_OWNER_COL_ACTIVE, GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE, GNC_TREE_MODEL_OWNER_NUM_COLUMNS
}
 
enum  GncTreeModelPriceColumn {
  GNC_TREE_MODEL_PRICE_COL_COMMODITY, GNC_TREE_MODEL_PRICE_COL_CURRENCY, GNC_TREE_MODEL_PRICE_COL_DATE, GNC_TREE_MODEL_PRICE_COL_SOURCE,
  GNC_TREE_MODEL_PRICE_COL_TYPE, GNC_TREE_MODEL_PRICE_COL_VALUE, GNC_TREE_MODEL_PRICE_COL_LAST_VISIBLE = GNC_TREE_MODEL_PRICE_COL_VALUE, GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
  GNC_TREE_MODEL_PRICE_NUM_COLUMNS
}
 

Functions

GType gnc_tree_model_account_types_get_type (void)
 
GtkTreeModel * gnc_tree_model_account_types_filter_using_mask (guint32 types)
 
void gnc_tree_model_account_types_set_mask (GtkTreeModel *f_model, guint32 types)
 
guint32 gnc_tree_model_account_types_get_mask (GtkTreeModel *f_model)
 
guint32 gnc_tree_model_account_types_get_selection (GtkTreeSelection *sel)
 
GNCAccountType gnc_tree_model_account_types_get_selection_single (GtkTreeSelection *sel)
 
void gnc_tree_model_account_types_set_selection (GtkTreeSelection *sel, guint32 selected)
 
GtkTreeModel * gnc_tree_model_account_types_new (guint32 selected)
 
GType gnc_tree_model_account_get_type (void)
 Get the type of an account tree plugin. More...
 
void gnc_tree_model_account_clear_cache (GncTreeModelAccount *model)
 Clear the tree model account cached values. More...
 
GType gnc_tree_model_commodity_get_type (void)
 Get the type of a commodity tree plugin. More...
 
GType gnc_tree_model_owner_get_type (void)
 Get the type of an owner tree plugin. More...
 
GType gnc_tree_model_price_get_type (void)
 Get the type of a price tree plugin. More...
 
GType gnc_tree_model_get_type (void)
 Get the type of a generic tree model plugin. More...
 
void account_filter_dialog_create (AccountFilterDialog *fd, GncPluginPage *page)
 
gboolean gnc_plugin_page_account_tree_filter_accounts (Account *account, gpointer user_data)
 This function tells the account tree view whether or not to filter out a particular account. More...
 
void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 The "show hidden" button in the Filter dialog changed state. More...
 
void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 The "show zero totals" button in the Filter dialog changed state. More...
 
void gppat_filter_show_unused_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 The "show unused" button in the Filter dialog changed state. More...
 
void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd)
 The "clear all account types" button in the Filter dialog was clicked. More...
 
void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd)
 The "select all account types" button in the Filter dialog was clicked. More...
 
void gppat_filter_select_default_cb (GtkWidget *button, AccountFilterDialog *fd)
 The "select default account types" button in the Filter dialog was clicked. More...
 
void gppat_filter_response_cb (GtkWidget *dialog, gint response, AccountFilterDialog *fd)
 The Filter dialog was closed. More...
 
void gnc_tree_view_account_save (GncTreeViewAccount *tree_view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_account_restore (GncTreeViewAccount *view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_account_save_filter (GncTreeViewAccount *tree_view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_account_restore_filter (GncTreeViewAccount *view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
GType gnc_tree_view_account_get_type (void)
 
GType gnc_tree_view_commodity_get_type (void)
 
void owner_filter_dialog_create (OwnerFilterDialog *fd, GncPluginPage *page)
 
gboolean gnc_plugin_page_owner_tree_filter_owners (GncOwner *owner, gpointer user_data)
 This function tells the owner tree view whether or not to filter out a particular owner. More...
 
void gppot_filter_show_inactive_toggled_cb (GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
 The "only show active" button in the Filter dialog changed state. More...
 
void gppot_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
 The "show zero totals" button in the Filter dialog changed state. More...
 
void gppot_filter_response_cb (GtkWidget *dialog, gint response, OwnerFilterDialog *fd)
 The Filter dialog was closed. More...
 
void gnc_tree_view_owner_save (GncTreeViewOwner *tree_view, OwnerFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_owner_restore (GncTreeViewOwner *view, OwnerFilterDialog *fd, GKeyFile *key_file, const gchar *group_name, GncOwnerType owner_type)
 
GType gnc_tree_view_owner_get_type (void)
 
GType gnc_tree_view_price_get_type (void)
 

Variables

gboolean OwnerViewInfo::show_inactive
 
GncTreeView GncTreeViewOwner::gnc_tree_view
 
int GncTreeViewOwner::stamp
 
GncTreeViewClass GncTreeViewOwnerClass::gnc_tree_view
 
GtkWidget * OwnerFilterDialog::dialog
 
GncTreeViewOwnerOwnerFilterDialog::tree_view
 
gboolean OwnerFilterDialog::show_inactive
 
gboolean OwnerFilterDialog::original_show_inactive
 
gboolean OwnerFilterDialog::show_zero_total
 
gboolean OwnerFilterDialog::original_show_zero_total
 

Account Tree Model Constructors

GtkTreeModel * gnc_tree_model_account_new (Account *root)
 Create a new GtkTreeModel for manipulating gnucash accounts. More...
 

Account Tree Model Get/Set Functions

Accountgnc_tree_model_account_get_account (GncTreeModelAccount *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash account. More...
 
gboolean gnc_tree_model_account_get_iter_from_account (GncTreeModelAccount *model, Account *account, GtkTreeIter *iter)
 Convert a model/account pair into a gtk_tree_model_iter. More...
 
GtkTreePath * gnc_tree_model_account_get_path_from_account (GncTreeModelAccount *model, Account *account)
 Convert a model/account pair into a gtk_tree_model_path. More...
 

Account Tree Model Constructors

GtkTreeModel * gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct)
 Create a new GtkTreeModel for manipulating gnucash commodities. More...
 

Commodity Tree Model Filter Helper Functions

gboolean gnc_tree_model_commodity_iter_is_namespace (GncTreeModelCommodity *model, GtkTreeIter *iter)
 Determine whether or not the specified GtkTreeIter points to a commodity namespace. More...
 
gboolean gnc_tree_model_commodity_iter_is_commodity (GncTreeModelCommodity *model, GtkTreeIter *iter)
 Determine whether or not the specified GtkTreeIter points to a commodity. More...
 
gnc_commodity_namespace * gnc_tree_model_commodity_get_namespace (GncTreeModelCommodity *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash commodity namespace. More...
 
gnc_commodity * gnc_tree_model_commodity_get_commodity (GncTreeModelCommodity *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash commodity. More...
 

Commodity Tree Model Lookup Functions

gboolean gnc_tree_model_commodity_get_iter_from_namespace (GncTreeModelCommodity *model, gnc_commodity_namespace *name_space, GtkTreeIter *iter)
 Convert a commodity namespace pointer into a GtkTreeIter. More...
 
gboolean gnc_tree_model_commodity_get_iter_from_commodity (GncTreeModelCommodity *model, gnc_commodity *commodity, GtkTreeIter *iter)
 Convert a commodity pointer into a GtkTreeIter. More...
 
GtkTreePath * gnc_tree_model_commodity_get_path_from_commodity (GncTreeModelCommodity *model, gnc_commodity *commodity)
 Convert a commodity pointer into a GtkTreePath. More...
 

Owner Tree Model Constructors

GtkTreeModel * gnc_tree_model_owner_new (GncOwnerType owner_type)
 Create a new GtkTreeModel for manipulating gnucash owners. More...
 

Owner Tree Model Get/Set Functions

GncOwnergnc_tree_model_owner_get_owner (GncTreeModelOwner *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash owner. More...
 
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. More...
 
GtkTreePath * gnc_tree_model_owner_get_path_from_owner (GncTreeModelOwner *model, GncOwner *owner)
 Convert a model/owner pair into a gtk_tree_model_path. More...
 

Account Tree Model Constructors

GtkTreeModel * gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
 Create a new GtkTreeModel for manipulating gnucash commodity prices. More...
 

Price Tree Model Filter Helper Functions

gboolean gnc_tree_model_price_iter_is_namespace (GncTreeModelPrice *model, GtkTreeIter *iter)
 Determine whether or not the specified GtkTreeIter points to a "commodity namespace". More...
 
gboolean gnc_tree_model_price_iter_is_commodity (GncTreeModelPrice *model, GtkTreeIter *iter)
 Determine whether or not the specified GtkTreeIter points to a commodity. More...
 
gboolean gnc_tree_model_price_iter_is_price (GncTreeModelPrice *model, GtkTreeIter *iter)
 Determine whether or not the specified GtkTreeIter points to a price. More...
 
gnc_commodity_namespace * gnc_tree_model_price_get_namespace (GncTreeModelPrice *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash commodity namespace. More...
 
gnc_commodity * gnc_tree_model_price_get_commodity (GncTreeModelPrice *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash commodity. More...
 
GNCPrice * gnc_tree_model_price_get_price (GncTreeModelPrice *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash price. More...
 

Commodity Tree Model Lookup Functions

gboolean gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model, gnc_commodity_namespace *name_space, GtkTreeIter *iter)
 Convert a commodity namespace pointer into a GtkTreeIter. More...
 
gboolean gnc_tree_model_price_get_iter_from_commodity (GncTreeModelPrice *model, gnc_commodity *commodity, GtkTreeIter *iter)
 Convert a commodity pointer into a GtkTreeIter. More...
 
gboolean gnc_tree_model_price_get_iter_from_price (GncTreeModelPrice *model, GNCPrice *price, GtkTreeIter *iter)
 Convert a price pointer into a GtkTreeIter. More...
 
GtkTreePath * gnc_tree_model_price_get_path_from_price (GncTreeModelPrice *model, GNCPrice *price)
 Convert a price pointer into a GtkTreePath. More...
 

Account Tree View Constructors

GtkTreeView * gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
 Create a new account tree view. More...
 
GtkTreeView * gnc_tree_view_account_new (gboolean show_root)
 Create a new account tree view. More...
 

Account Tree View Configuration

typedef gchar *(* GncTreeViewAccountColumnSource) (Account *account, GtkTreeViewColumn *col, GtkCellRenderer *cell)
 
typedef void(* GncTreeViewAccountColumnTextEdited) (Account *account, GtkTreeViewColumn *col, const gchar *new_text)
 
GtkTreeViewColumn * gnc_tree_view_account_add_custom_column (GncTreeViewAccount *view, const gchar *column_title, GncTreeViewAccountColumnSource source_cb, GncTreeViewAccountColumnTextEdited edited_cb)
 Add a new custom column to the set of columns in an account tree view. More...
 
GtkTreeViewColumn * gnc_tree_view_account_add_custom_column_renderer (GncTreeViewAccount *account_view, const gchar *column_title, GncTreeViewAccountColumnSource col_source_cb, GncTreeViewAccountColumnTextEdited col_edited_cb, GtkCellRenderer *renderer)
 
void gnc_tree_view_account_set_name_edited (GncTreeViewAccount *view, GncTreeViewAccountColumnTextEdited edited_cb)
 
void gnc_tree_view_account_name_edited_cb (Account *account, GtkTreeViewColumn *col, const gchar *new_name)
 
void gnc_tree_view_account_set_code_edited (GncTreeViewAccount *view, GncTreeViewAccountColumnTextEdited edited_cb)
 
void gnc_tree_view_account_code_edited_cb (Account *account, GtkTreeViewColumn *col, const gchar *new_code)
 
void gnc_tree_view_account_set_description_edited (GncTreeViewAccount *view, GncTreeViewAccountColumnTextEdited edited_cb)
 
void gnc_tree_view_account_description_edited_cb (Account *account, GtkTreeViewColumn *col, const gchar *new_desc)
 
void gnc_tree_view_account_set_notes_edited (GncTreeViewAccount *view, GncTreeViewAccountColumnTextEdited edited_cb)
 
void gnc_tree_view_account_notes_edited_cb (Account *account, GtkTreeViewColumn *col, const gchar *new_notes)
 
GtkTreeViewColumn * gnc_tree_view_account_add_property_column (GncTreeViewAccount *view, const gchar *column_title, const gchar *propname)
 Add a new column to the set of columns in an account tree view. More...
 

Account Tree View Filtering

typedef gboolean(* gnc_tree_view_account_filter_func) (Account *account, gpointer data)
 This is the description of a filter function used by the account tree. More...
 
void gnc_tree_view_account_get_view_info (GncTreeViewAccount *account_view, AccountViewInfo *avi)
 Given pointers to an account tree and old style filter block, this function will copy the current configuration of the account tree widget into the data block. More...
 
void gnc_tree_view_account_set_view_info (GncTreeViewAccount *account_view, AccountViewInfo *avi)
 Given pointers to an account tree and old style filter block, this function will applies the settings specified to the current configuration of the account tree widget. More...
 
void gnc_tree_view_account_set_filter (GncTreeViewAccount *account_view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
 This function attaches a filter function to the given account tree. More...
 
gboolean gnc_tree_view_account_filter_by_view_info (Account *acct, gpointer data)
 
void gnc_tree_view_account_refilter (GncTreeViewAccount *view)
 This function forces the account tree filter to be evaluated. More...
 

Account Tree View Get/Set Functions

gint gnc_tree_view_account_count_children (GncTreeViewAccount *view, Account *account)
 This function determines if an account in the account tree view has any visible children. More...
 
void gnc_tree_view_account_clear_model_cache (GncTreeViewAccount *view)
 This function clears the tree model account cache so the values will be updated/refreshed. More...
 
Accountgnc_tree_view_account_get_account_from_path (GncTreeViewAccount *view, GtkTreePath *path)
 This function returns the account associated with the specified path. More...
 
Accountgnc_tree_view_account_get_account_from_iter (GtkTreeModel *model, GtkTreeIter *iter)
 This function returns the account associated with the specified iter. More...
 
Accountgnc_tree_view_account_get_cursor_account (GncTreeViewAccount *view)
 This function returns the account in the account tree view at the current location of the cursor. More...
 
Accountgnc_tree_view_account_get_selected_account (GncTreeViewAccount *view)
 This function returns the account associated with the selected item in the account tree view. More...
 
void gnc_tree_view_account_set_selected_account (GncTreeViewAccount *view, Account *account)
 This function selects an account in the account tree view. More...
 
GList * gnc_tree_view_account_get_selected_accounts (GncTreeViewAccount *view)
 This function returns a list of the accounts associated with the selected items in the account tree view. More...
 
void gnc_tree_view_account_set_selected_accounts (GncTreeViewAccount *view, GList *account_list, gboolean show_last)
 This function selects a set of accounts in the account tree view. More...
 
void gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view, Account *account)
 This function selects all sub-accounts of an account in the account tree view. More...
 
void gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view, Account *account)
 This function forces the account tree expand whatever levels are necessary to make the specified account visible. More...
 
void gnc_tree_view_account_column_add_color (GncTreeViewAccount *view, GtkTreeViewColumn *col)
 Add the account color background data function to the GncTreeViewAccount column to show or not the column background in the account color.
 
void gnc_tree_view_account_set_editing_started_cb (GncTreeViewAccount *view, GFunc editing_started_cb, gpointer editing_cb_data)
 Setup the callback for when the user starts editing the account tree so actions can be disabled like the delete menu option as required.
 
void gnc_tree_view_account_set_editing_finished_cb (GncTreeViewAccount *view, GFunc editing_finished_cb, gpointer editing_cb_data)
 Setup the callback for when the user finishes editing the account tree so actions can be enabled like the delete menu option as required.
 

Commodity Tree View Constructors

GtkTreeView * gnc_tree_view_commodity_new (QofBook *book, const gchar *first_property_name,...)
 Create a new commodity tree view. More...
 

Commodity Tree View Configuration

void gnc_tree_view_commodity_configure_columns (GncTreeViewCommodity *view, GSList *column_names)
 Configure (by name) the set of visible columns in an commodity tree view. More...
 

Commodity Tree View Filtering

typedef gboolean(* gnc_tree_view_commodity_ns_filter_func) (gnc_commodity_namespace *, gpointer data)
 
typedef gboolean(* gnc_tree_view_commodity_cm_filter_func) (gnc_commodity *, gpointer data)
 
void gnc_tree_view_commodity_set_filter (GncTreeViewCommodity *view, gnc_tree_view_commodity_ns_filter_func ns_func, gnc_tree_view_commodity_cm_filter_func cm_func, gpointer data, GDestroyNotify destroy)
 This function attaches a filter function to the given commodity tree. More...
 
void gnc_tree_view_commodity_refilter (GncTreeViewCommodity *view)
 This function forces the commodity tree filter to be evaluated. More...
 

Commodity Tree View Get/Set Functions

gnc_commodity * gnc_tree_view_commodity_get_cursor_commodity (GncTreeViewCommodity *view)
 This function returns the commodity in the commodity tree view at the current location of the cursor. More...
 
gnc_commodity * gnc_tree_view_commodity_get_selected_commodity (GncTreeViewCommodity *view)
 This function returns the commodity associated with the selected item in the commodity tree view. More...
 
void gnc_tree_view_commodity_select_commodity (GncTreeViewCommodity *view, gnc_commodity *commodity)
 Select the commodity in the associated commodity tree view. More...
 
void gnc_tree_view_commodity_select_subcommodities (GncTreeViewCommodity *view, gnc_commodity *commodity)
 This function selects all sub-commodities of an commodity in the commodity tree view. More...
 

Owner Tree View Constructor

GtkTreeView * gnc_tree_view_owner_new (GncOwnerType owner_type)
 Create a new owner tree view for one type of owners. More...
 

Owner Tree View Configuration

typedef gchar *(* GncTreeViewOwnerColumnSource) (GncOwner *owner, GtkTreeViewColumn *col, GtkCellRenderer *cell)
 
typedef void(* GncTreeViewOwnerColumnTextEdited) (GncOwner *owner, GtkTreeViewColumn *col, const gchar *new_text)
 

Owner Tree View Filtering

typedef gboolean(* gnc_tree_view_owner_filter_func) (GncOwner *owner, gpointer data)
 This is the description of a filter function used by the owner tree. More...
 
void gnc_tree_view_owner_set_filter (GncTreeViewOwner *owner_view, gnc_tree_view_owner_filter_func func, gpointer data, GSourceFunc destroy)
 This function attaches a filter function to the given owner tree. More...
 
void gnc_tree_view_owner_refilter (GncTreeViewOwner *view)
 This function forces the owner tree filter to be evaluated. More...
 

Owner Tree View Get/Set Functions

GncOwnergnc_tree_view_owner_get_owner_from_path (GncTreeViewOwner *view, GtkTreePath *path)
 This function returns the owner associated with the specified path. More...
 
GncOwnergnc_tree_view_owner_get_owner_from_iter (GtkTreeModel *model, GtkTreeIter *iter)
 This function returns the owner associated with the specified iter. More...
 
GncOwnergnc_tree_view_owner_get_selected_owner (GncTreeViewOwner *view)
 This function returns the owner associated with the selected item in the owner tree view. More...
 
void gnc_tree_view_owner_set_selected_owner (GncTreeViewOwner *view, GncOwner *owner)
 This function selects an owner in the owner tree view. More...
 

Price Tree View Constructors

GtkTreeView * gnc_tree_view_price_new (QofBook *book, const gchar *first_property_name,...)
 Create a new price tree view. More...
 

Price Tree View Filtering

typedef gboolean(* gnc_tree_view_price_ns_filter_func) (gnc_commodity_namespace *, gpointer data)
 This function attaches a filter function to the given price tree. More...
 
typedef gboolean(* gnc_tree_view_price_cm_filter_func) (gnc_commodity *, gpointer data)
 
typedef gboolean(* gnc_tree_view_price_pc_filter_func) (GNCPrice *, gpointer data)
 
void gnc_tree_view_price_set_filter (GncTreeViewPrice *view, gnc_tree_view_price_ns_filter_func ns_func, gnc_tree_view_price_cm_filter_func cm_func, gnc_tree_view_price_pc_filter_func pc_func, gpointer data, GDestroyNotify destroy)
 

Price Tree View Get/Set Functions

GNCPrice * gnc_tree_view_price_get_cursor_price (GncTreeViewPrice *view)
 This function returns the price in the price tree view at the current location of the cursor. More...
 
GNCPrice * gnc_tree_view_price_get_selected_price (GncTreeViewPrice *view)
 This function returns the price associated with the selected item in the price tree view. More...
 
void gnc_tree_view_price_set_selected_price (GncTreeViewPrice *view, GNCPrice *price)
 This function selects an price in the price tree view. More...
 
GList * gnc_tree_view_price_get_selected_prices (GncTreeViewPrice *view)
 This function returns a list of the prices associated with the selected items in the price tree view. More...
 
GList * gnc_tree_view_price_get_selected_commodities (GncTreeViewPrice *view)
 This function returns a list of commodities associated with the selected rows that are not prices but are the parent rows for prices in the price tree view. More...
 

Detailed Description

Typedef Documentation

◆ gnc_tree_view_account_filter_func

typedef gboolean(* gnc_tree_view_account_filter_func) (Account *account, gpointer data)

This is the description of a filter function used by the account tree.

Parameters
accountThe account to be tested.
dataThe data provided when the filter function was added.
Returns
TRUE if the account should be displayed.

Definition at line 280 of file gnc-tree-view-account.h.

◆ gnc_tree_view_owner_filter_func

typedef gboolean(* gnc_tree_view_owner_filter_func) (GncOwner *owner, gpointer data)

This is the description of a filter function used by the owner tree.

Parameters
ownerThe owner to be tested.
dataThe data provided when the filter function was added.
Returns
TRUE if the owner should be displayed.

Definition at line 173 of file gnc-tree-view-owner.h.

◆ gnc_tree_view_price_ns_filter_func

typedef gboolean(* gnc_tree_view_price_ns_filter_func) (gnc_commodity_namespace *, gpointer data)

This function attaches a filter function to the given price tree.

This function will be called for each price that the view thinks should possibly show. The filter may perform any actions necessary on the price to decide whether it should be shown or not. (I.E. Check type, placeholder status, etc.) If the filter returns TRUE then the price will be displayed.

Parameters
price_viewA pointer to an price tree view.
funcA filtration function that is called on individual elements in the tree. If this function returns TRUE, the price will be displayed.
dataA data block passed into each instance of the function.
destroyA function to destroy the data block. This function will be called when the filter is destroyed. may be NULL.

Definition at line 138 of file gnc-tree-view-price.h.

Function Documentation

◆ gnc_plugin_page_account_tree_filter_accounts()

gboolean gnc_plugin_page_account_tree_filter_accounts ( Account account,
gpointer  user_data 
)

This function tells the account tree view whether or not to filter out a particular account.

Accounts may be filtered if the user has decided not to display that particular account type, or if the user has requested that accounts with a zero total not be shown.

Parameters
accountThe account that was toggled.
user_dataA pointer to the AccountFilterDialog struct.
Returns
TRUE if the account should be visible. FALSE if the account should be hidden.

Definition at line 2044 of file gnc-tree-view-account.c.

2046 {
2047  AccountFilterDialog *fd = user_data;
2048  GNCAccountType acct_type;
2049  gnc_numeric total;
2050  gboolean result;
2051 
2052  ENTER("account %p:%s", account, xaccAccountGetName(account));
2053 
2054  if (g_hash_table_size (fd->filter_override) > 0)
2055  {
2056  Account *test_acc = NULL;
2057  test_acc = g_hash_table_lookup (fd->filter_override, account);
2058  if (test_acc != NULL)
2059  {
2060  LEAVE(" filter: override");
2061  return TRUE;
2062  }
2063  }
2064 
2065  if (!fd->show_hidden && xaccAccountIsHidden (account))
2066  {
2067  LEAVE(" hide: hidden");
2068  return FALSE;
2069  }
2070 
2071  if (!fd->show_zero_total)
2072  {
2073  total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
2074  if (gnc_numeric_zero_p(total))
2075  {
2076  LEAVE(" hide: zero balance");
2077  return FALSE;
2078  }
2079  }
2080 
2081  if (!fd->show_unused)
2082  {
2083  if (gnc_account_and_descendants_empty(account))
2084  {
2085  LEAVE(" hide: unused");
2086  return FALSE;
2087  }
2088  }
2089 
2090  acct_type = xaccAccountGetType(account);
2091  result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
2092  LEAVE(" %s", result ? "show" : "hide");
2093  return result;
2094 }
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account&#39;s account type.
Definition: Account.cpp:3236
gboolean gnc_numeric_zero_p(gnc_numeric a)
Returns 1 if the given gnc_numeric is 0 (zero), else returns 0.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gboolean xaccAccountIsHidden(const Account *acc)
Should this account be "hidden".
Definition: Account.cpp:4309
GNCAccountType
The account types are used to determine how the transaction data in the account is displayed...
Definition: Account.h:105
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_plugin_page_owner_tree_filter_owners()

gboolean gnc_plugin_page_owner_tree_filter_owners ( GncOwner owner,
gpointer  user_data 
)

This function tells the owner tree view whether or not to filter out a particular owner.

Owners may be filtered if the user has decided not to display inactive owners, or if the user has requested that owners with a zero total not be shown.

Parameters
ownerThe owner that is being evaluated.
user_dataA pointer to the OwnerFilterDialog struct.
Returns
TRUE if the owner should be visible. FALSE if the owner should be hidden.

Definition at line 1052 of file gnc-tree-view-owner.c.

1054 {
1055  OwnerFilterDialog *fd = user_data;
1056  gnc_numeric total;
1057 
1058  ENTER("owner %p:%s", owner, gncOwnerGetName(owner));
1059 
1060  if (!fd->show_inactive && !gncOwnerGetActive (owner))
1061  {
1062  LEAVE(" hide: inactive");
1063  return FALSE;
1064  }
1065 
1066  if (!fd->show_zero_total)
1067  {
1068  total = gncOwnerGetBalanceInCurrency (owner, NULL);
1069  if (gnc_numeric_zero_p(total))
1070  {
1071  LEAVE(" hide: zero balance");
1072  return FALSE;
1073  }
1074  }
1075 
1076  return TRUE;
1077 }
gboolean gnc_numeric_zero_p(gnc_numeric a)
Returns 1 if the given gnc_numeric is 0 (zero), else returns 0.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gnc_numeric gncOwnerGetBalanceInCurrency(const GncOwner *owner, const gnc_commodity *report_currency)
Given an owner, extract the open balance from the owner and then convert it to the desired currency...
Definition: gncOwner.c:1479
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_account_clear_cache()

void gnc_tree_model_account_clear_cache ( GncTreeModelAccount model)

Clear the tree model account cached values.

Parameters
modelA pointer to the account tree model.

Definition at line 598 of file gnc-tree-model-account.c.

599 {
600  if (model)
601  {
602  GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
603 
604  // destroy the cached account values and recreate
605  g_hash_table_destroy (priv->account_values_hash);
606  priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
607  g_free, g_free);
608 
609  gtk_tree_model_foreach (GTK_TREE_MODEL(model), row_changed_foreach_func, NULL);
610  }
611 }
The instance private data for an account tree model.

◆ gnc_tree_model_account_get_account()

Account* gnc_tree_model_account_get_account ( GncTreeModelAccount model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash account.

This routine should only be called from an account tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the account tree model.
iterA gtk_tree_iter corresponding to a single account in the model.
Returns
A pointer to the corresponding account.

Definition at line 1266 of file gnc-tree-model-account.c.

1268 {
1269  g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model), NULL);
1270  g_return_val_if_fail (iter != NULL, NULL);
1271  g_return_val_if_fail (iter->user_data != NULL, NULL);
1272  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
1273 
1274  return (Account *) iter->user_data;
1275 }
int stamp
The state of the model.

◆ gnc_tree_model_account_get_iter_from_account()

gboolean gnc_tree_model_account_get_iter_from_account ( GncTreeModelAccount model,
Account account,
GtkTreeIter *  iter 
)

Convert a model/account pair into a gtk_tree_model_iter.

This routine should only be called from the file gnc-tree-view-account.c.

Definition at line 1283 of file gnc-tree-model-account.c.

1286 {
1288  Account *parent;
1289  gint i;
1290 
1291  ENTER("model %p, account %p, iter %p", model, account, iter);
1292  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model), FALSE);
1293  gnc_leave_return_val_if_fail ((account != NULL), FALSE);
1294  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
1295 
1296  iter->user_data = account;
1297  iter->stamp = model->stamp;
1298 
1299  priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
1300  if (account == priv->root)
1301  {
1302  iter->user_data2 = NULL;
1303  iter->user_data3 = GINT_TO_POINTER(0);
1304  LEAVE("Matched root");
1305  return TRUE;
1306  }
1307 
1308  if (priv->root != gnc_account_get_root (account))
1309  {
1310  LEAVE("Root doesn't match");
1311  return FALSE;
1312  }
1313 
1314  parent = gnc_account_get_parent (account);
1315  i = gnc_account_child_index (parent, account);
1316  iter->user_data2 = parent;
1317  iter->user_data3 = GINT_TO_POINTER(i);
1318  LEAVE("iter %s", iter_to_string (iter));
1319  return (i != -1);
1320 }
Account * gnc_account_get_parent(const Account *acc)
This routine returns a pointer to the parent of the specified account.
Definition: Account.cpp:2880
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
The instance private data for an account tree model.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
gint gnc_account_child_index(const Account *parent, const Account *child)
Return the index of the specified child within the list of the parent&#39;s children. ...
Definition: Account.cpp:2940
Account * gnc_account_get_root(Account *acc)
This routine returns the root account of the account tree that the specified account belongs to...
Definition: Account.cpp:2887
int stamp
The state of the model.

◆ gnc_tree_model_account_get_path_from_account()

GtkTreePath* gnc_tree_model_account_get_path_from_account ( GncTreeModelAccount model,
Account account 
)

Convert a model/account pair into a gtk_tree_model_path.

This routine should only be called from the file gnc-tree-view-account.c.

Definition at line 1328 of file gnc-tree-model-account.c.

1330 {
1331  GtkTreeIter tree_iter;
1332  GtkTreePath *tree_path;
1333 
1334  ENTER("model %p, account %p", model, account);
1335  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model), NULL);
1336  gnc_leave_return_val_if_fail (account != NULL, NULL);
1337 
1338  if (!gnc_tree_model_account_get_iter_from_account (model, account,
1339  &tree_iter))
1340  {
1341  LEAVE("no iter");
1342  return NULL;
1343  }
1344 
1345  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1346  if (tree_path)
1347  {
1348  gchar *path_string = gtk_tree_path_to_string (tree_path);
1349  LEAVE("path (2) %s", path_string);
1350  g_free (path_string);
1351  }
1352  else
1353  {
1354  LEAVE("no path");
1355  }
1356  return tree_path;
1357 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
gboolean gnc_tree_model_account_get_iter_from_account(GncTreeModelAccount *model, Account *account, GtkTreeIter *iter)
Convert a model/account pair into a gtk_tree_model_iter.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_account_get_type()

GType gnc_tree_model_account_get_type ( void  )

Get the type of an account tree plugin.

Returns
A GType.

◆ gnc_tree_model_account_new()

GtkTreeModel* gnc_tree_model_account_new ( Account root)

Create a new GtkTreeModel for manipulating gnucash accounts.

Parameters
rootThe account group to put at the top level of the tree hierarchy.

Definition at line 273 of file gnc-tree-model-account.c.

274 {
275  GncTreeModelAccount *model;
277  const GList *item;
278 
279  ENTER("root %p", root);
280  item = gnc_gobject_tracking_get_list (GNC_TREE_MODEL_ACCOUNT_NAME);
281  for ( ; item; item = g_list_next (item))
282  {
283  model = (GncTreeModelAccount *)item->data;
284  priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
285  if (priv->root == root)
286  {
287  g_object_ref (G_OBJECT(model));
288  LEAVE("returning existing model %p", model);
289  return GTK_TREE_MODEL(model);
290  }
291  }
292 
293  model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT, NULL);
294 
295  priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
296  priv->book = gnc_get_current_book();
297  priv->root = root;
298 
299  priv->event_handler_id = qof_event_register_handler
300  ((QofEventHandler)gnc_tree_model_account_event_handler, model);
301 
302  LEAVE("model %p", model);
303  return GTK_TREE_MODEL(model);
304 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:89
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
The instance private data for an account tree model.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
The instance data structure for an account tree model.

◆ gnc_tree_model_commodity_get_commodity()

gnc_commodity* gnc_tree_model_commodity_get_commodity ( GncTreeModelCommodity model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash commodity.

This routine should only be called from a commodity tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the commodity tree model.
iterA GtkTreeIter corresponding to a single commodity in the model.
Returns
A pointer to the corresponding commodity.

Definition at line 252 of file gnc-tree-model-commodity.c.

254 {
255  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
256  g_return_val_if_fail (iter != NULL, NULL);
257  g_return_val_if_fail (iter->user_data != NULL, NULL);
258  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
259 
260  if (iter->user_data != ITER_IS_COMMODITY)
261  return NULL;
262  return (gnc_commodity *)iter->user_data2;
263 }
int stamp
The state of the model.

◆ gnc_tree_model_commodity_get_iter_from_commodity()

gboolean gnc_tree_model_commodity_get_iter_from_commodity ( GncTreeModelCommodity model,
gnc_commodity *  commodity,
GtkTreeIter *  iter 
)

Convert a commodity pointer into a GtkTreeIter.

Parameters
modelA pointer to the commodity tree model.
commodityA pointer to the gnucash commodity.
iterA pointer to a GtkTreeIter. This iter will be filled in to point where the commodity appears in the commodity tree.
Returns
TRUE if the returned iter is valid, FALSE otherwise.

Definition at line 922 of file gnc-tree-model-commodity.c.

925 {
926  gnc_commodity_namespace *name_space;
927  GList *list;
928  gint n;
929 
930  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
931  g_return_val_if_fail ((commodity != NULL), FALSE);
932  g_return_val_if_fail ((iter != NULL), FALSE);
933 
934  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
935 
936  name_space = gnc_commodity_get_namespace_ds(commodity);
937  if (name_space == NULL)
938  {
939  LEAVE("no namespace");
940  return FALSE;
941  }
942 
944  if (list == NULL)
945  {
946  LEAVE("empty list");
947  return FALSE;
948  }
949 
950  n = g_list_index(list, commodity);
951  if (n == -1)
952  {
953  LEAVE("not in list");
954  return FALSE;
955  }
956 
957  iter->stamp = model->stamp;
958  iter->user_data = ITER_IS_COMMODITY;
959  iter->user_data2 = commodity;
960  iter->user_data3 = GINT_TO_POINTER(n);
961  LEAVE("iter %s", iter_to_string(iter));
962  return TRUE;
963 }
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *name_space)
Return a list of all commodity data structures in the specified namespace.
gnc_commodity_namespace * gnc_commodity_get_namespace_ds(const gnc_commodity *cm)
Retrieve the namespace data structure for the specified commodity.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_commodity_get_iter_from_namespace()

gboolean gnc_tree_model_commodity_get_iter_from_namespace ( GncTreeModelCommodity model,
gnc_commodity_namespace *  name_space,
GtkTreeIter *  iter 
)

Convert a commodity namespace pointer into a GtkTreeIter.

Parameters
modelA pointer to the commodity tree model.
namespaceA pointer to the gnucash commodity namespace.
iterA pointer to a GtkTreeIter. This iter will be filled in to point where the namespace appears in the commodity tree.
Returns
TRUE if the returned iter is valid, FALSE otherwise.

Definition at line 1007 of file gnc-tree-model-commodity.c.

1010 {
1012  GList *list;
1013  gint n;
1014 
1015  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
1016  g_return_val_if_fail ((name_space != NULL), FALSE);
1017  g_return_val_if_fail ((iter != NULL), FALSE);
1018 
1019  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1020 
1021  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
1022  list = gnc_commodity_table_get_namespaces_list(priv->commodity_table);
1023  if (list == NULL)
1024  {
1025  LEAVE("");
1026  return FALSE;
1027  }
1028 
1029  n = g_list_index(list, name_space);
1030  if (n == -1)
1031  {
1032  LEAVE("");
1033  return FALSE;
1034  }
1035 
1036  iter->stamp = model->stamp;
1037  iter->user_data = ITER_IS_NAMESPACE;
1038  iter->user_data2 = name_space;
1039  iter->user_data3 = GINT_TO_POINTER(n);
1040  LEAVE("iter %s", iter_to_string(iter));
1041  return TRUE;
1042 }
The instance private data for a commodity database tree model.
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
GList * gnc_commodity_table_get_namespaces_list(const gnc_commodity_table *table)
Return a list of all namespace data structures in the commodity table.

◆ gnc_tree_model_commodity_get_namespace()

gnc_commodity_namespace* gnc_tree_model_commodity_get_namespace ( GncTreeModelCommodity model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash commodity namespace.

This routine should only be called from a commodity tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the commodity tree model.
iterA GtkTreeIter corresponding to a single namespace in the model.
Returns
A pointer to the corresponding namespace.

Definition at line 238 of file gnc-tree-model-commodity.c.

240 {
241  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
242  g_return_val_if_fail (iter != NULL, NULL);
243  g_return_val_if_fail (iter->user_data != NULL, NULL);
244  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
245 
246  if (iter->user_data != ITER_IS_NAMESPACE)
247  return NULL;
248  return (gnc_commodity_namespace *)iter->user_data2;
249 }
int stamp
The state of the model.

◆ gnc_tree_model_commodity_get_path_from_commodity()

GtkTreePath* gnc_tree_model_commodity_get_path_from_commodity ( GncTreeModelCommodity model,
gnc_commodity *  commodity 
)

Convert a commodity pointer into a GtkTreePath.

Parameters
modelA pointer to the commodity tree model.
commodityA pointer to the gnucash commodity.
Returns
A pointer to a GtkTreePath describing the location of this commodity. This pointer must be freed by the caller when no longer needed. This routine will return NULL if the commodity does not exist in the tree.

Definition at line 971 of file gnc-tree-model-commodity.c.

973 {
974  GtkTreeIter tree_iter;
975  GtkTreePath *tree_path;
976 
977  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
978  g_return_val_if_fail (commodity != NULL, NULL);
979  ENTER("model %p, commodity %p", model, commodity);
980 
981  if (!gnc_tree_model_commodity_get_iter_from_commodity (model, commodity, &tree_iter))
982  {
983  LEAVE("no iter");
984  return NULL;
985  }
986 
987  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
988  if (tree_path)
989  {
990  gchar *path_string = gtk_tree_path_to_string(tree_path);
991  LEAVE("path (2) %s", path_string);
992  g_free(path_string);
993  }
994  else
995  {
996  LEAVE("no path");
997  }
998  return tree_path;
999 }
gboolean gnc_tree_model_commodity_get_iter_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity, GtkTreeIter *iter)
Convert a commodity pointer into a GtkTreeIter.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_commodity_get_type()

GType gnc_tree_model_commodity_get_type ( void  )

Get the type of a commodity tree plugin.

Returns
A GType.

◆ gnc_tree_model_commodity_iter_is_commodity()

gboolean gnc_tree_model_commodity_iter_is_commodity ( GncTreeModelCommodity model,
GtkTreeIter *  iter 
)

Determine whether or not the specified GtkTreeIter points to a commodity.

This routine should only be called from a commodity tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the commodity tree model.
iterA GtkTreeIter corresponding to a single item in the model.
Returns
TRUE if the iter points to a commodity, FALSE otherwise.

Definition at line 226 of file gnc-tree-model-commodity.c.

228 {
229  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
230  g_return_val_if_fail (iter != NULL, FALSE);
231  g_return_val_if_fail (iter->user_data != NULL, FALSE);
232  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
233 
234  return (iter->user_data == ITER_IS_COMMODITY);
235 }
int stamp
The state of the model.

◆ gnc_tree_model_commodity_iter_is_namespace()

gboolean gnc_tree_model_commodity_iter_is_namespace ( GncTreeModelCommodity model,
GtkTreeIter *  iter 
)

Determine whether or not the specified GtkTreeIter points to a commodity namespace.

This routine should only be called from a commodity tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the commodity tree model.
iterA GtkTreeIter corresponding to a single item in the model.
Returns
TRUE if the iter points to a commodity namespace, FALSE otherwise.

Definition at line 214 of file gnc-tree-model-commodity.c.

216 {
217  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
218  g_return_val_if_fail (iter != NULL, FALSE);
219  g_return_val_if_fail (iter->user_data != NULL, FALSE);
220  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
221 
222  return (iter->user_data == ITER_IS_NAMESPACE);
223 }
int stamp
The state of the model.

◆ gnc_tree_model_commodity_new()

GtkTreeModel* gnc_tree_model_commodity_new ( QofBook *  book,
gnc_commodity_table *  ct 
)

Create a new GtkTreeModel for manipulating gnucash commodities.

Parameters
bookThe book that holds these commodities.
ctA pointer to the commodity table to use for this tree. All namespaces and commodities in this tree will be included.

Definition at line 180 of file gnc-tree-model-commodity.c.

181 {
182  GncTreeModelCommodity *model;
184  const GList *item;
185 
186  ENTER("");
187 
188  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_COMMODITY_NAME);
189  for ( ; item; item = g_list_next(item))
190  {
191  model = (GncTreeModelCommodity *)item->data;
192  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
193  if (priv->commodity_table == ct)
194  {
195  g_object_ref(G_OBJECT(model));
196  LEAVE("returning existing model %p", model);
197  return GTK_TREE_MODEL(model);
198  }
199  }
200 
201  model = g_object_new (GNC_TYPE_TREE_MODEL_COMMODITY, NULL);
202  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
203  priv->book = book;
204  priv->commodity_table = ct;
205 
206  priv->event_handler_id =
207  qof_event_register_handler (gnc_tree_model_commodity_event_handler, model);
208 
209  LEAVE("");
210  return GTK_TREE_MODEL (model);
211 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
The instance private data for a commodity database tree model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
The instance data structure for a commodity tree model.

◆ gnc_tree_model_get_type()

GType gnc_tree_model_get_type ( void  )

Get the type of a generic tree model plugin.

Returns
A GType.

◆ gnc_tree_model_owner_get_iter_from_owner()

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.

This routine should only be called from the file gnc-tree-view-owner.c.

Definition at line 833 of file gnc-tree-model-owner.c.

836 {
838  GList *owner_in_list;
839 
840  ENTER("model %p, owner %p, iter %p", model, owner, iter);
841  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
842  gnc_leave_return_val_if_fail ((owner != NULL), FALSE);
843  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
844 
845 
846  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
847  owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
848  if (owner_in_list)
849  {
850  iter->stamp = model->stamp;
851  iter->user_data = owner_in_list->data;
852  iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list));
853  iter->user_data3 = NULL;
854  LEAVE("iter %s", iter_to_string (iter));
855  return TRUE;
856  }
857  else
858  {
859  iter->stamp = 0;
860  iter->user_data = NULL;
861  LEAVE("Owner not found in list");
862  return FALSE;
863  }
864 }
The instance private data for an owner tree model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
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...
Definition: gncOwner.c:412
int stamp
The state of the model.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_owner_get_owner()

GncOwner* gnc_tree_model_owner_get_owner ( GncTreeModelOwner model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash owner.

This routine should only be called from an owner tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the owner tree model.
iterA gtk_tree_iter corresponding to a single owner in the model.
Returns
A pointer to the corresponding owner.

Definition at line 816 of file gnc-tree-model-owner.c.

818 {
819  g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
820  g_return_val_if_fail (iter != NULL, NULL);
821  g_return_val_if_fail (iter->user_data != NULL, NULL);
822  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
823 
824  return (GncOwner *) iter->user_data;
825 }
int stamp
The state of the model.

◆ gnc_tree_model_owner_get_path_from_owner()

GtkTreePath* gnc_tree_model_owner_get_path_from_owner ( GncTreeModelOwner model,
GncOwner owner 
)

Convert a model/owner pair into a gtk_tree_model_path.

This routine should only be called from the file gnc-tree-view-owner.c.

Definition at line 872 of file gnc-tree-model-owner.c.

874 {
875  GtkTreeIter tree_iter;
876  GtkTreePath *tree_path;
877 
878  ENTER("model %p, owner %p", model, owner);
879  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
880  gnc_leave_return_val_if_fail (owner != NULL, NULL);
881 
882  if (!gnc_tree_model_owner_get_iter_from_owner (model, owner,
883  &tree_iter))
884  {
885  LEAVE("no iter");
886  return NULL;
887  }
888 
889  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
890  if (tree_path)
891  {
892  gchar *path_string = gtk_tree_path_to_string(tree_path);
893  LEAVE("path (2) %s", path_string);
894  g_free(path_string);
895  }
896  else
897  {
898  LEAVE("no path");
899  }
900  return tree_path;
901 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
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.
Definition: qoflog.h:282

◆ gnc_tree_model_owner_get_type()

GType gnc_tree_model_owner_get_type ( void  )

Get the type of an owner tree plugin.

Returns
A GType.

◆ gnc_tree_model_owner_new()

GtkTreeModel* gnc_tree_model_owner_new ( GncOwnerType  owner_type)

Create a new GtkTreeModel for manipulating gnucash owners.

Parameters
rootThe owner group to put at the top level of the tree hierarchy.

Definition at line 241 of file gnc-tree-model-owner.c.

242 {
243  GncTreeModelOwner *model;
245  const GList *item;
246 
247  ENTER("owner_type %d", owner_type);
248  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_OWNER_NAME);
249  for ( ; item; item = g_list_next(item))
250  {
251  model = (GncTreeModelOwner *)item->data;
252  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
253  if (priv->owner_type == owner_type)
254  {
255  g_object_ref(G_OBJECT(model));
256  LEAVE("returning existing model %p", model);
257  return GTK_TREE_MODEL(model);
258  }
259  }
260 
261  model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
262  NULL);
263 
264  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
265  priv->book = gnc_get_current_book();
266  priv->owner_type = owner_type;
267  priv->owner_list = gncBusinessGetOwnerList (priv->book, gncOwnerTypeToQofIdType(owner_type), TRUE);
268 
269  priv->event_handler_id = qof_event_register_handler
270  ((QofEventHandler)gnc_tree_model_owner_event_handler, model);
271 
272  LEAVE("model %p", model);
273  return GTK_TREE_MODEL (model);
274 }
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...
The instance data structure for an owner tree model.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:89
The instance private data for an owner tree model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Returns the QofIdType of the given GncOwnerType, or NULL if no suitable one exists.
Definition: gncOwner.c:236
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_price_get_commodity()

gnc_commodity* gnc_tree_model_price_get_commodity ( GncTreeModelPrice model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash commodity.

This routine should only be called from a commodity tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the commodity tree model.
iterA GtkTreeIter corresponding to a single commodity in the model.
Returns
A pointer to the corresponding commodity.

Definition at line 301 of file gnc-tree-model-price.c.

303 {
304  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
305  g_return_val_if_fail (iter != NULL, NULL);
306  g_return_val_if_fail (iter->user_data != NULL, NULL);
307  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
308 
309  if (iter->user_data != ITER_IS_COMMODITY)
310  return NULL;
311  return (gnc_commodity *)iter->user_data2;
312 }
int stamp
The state of the model.

◆ gnc_tree_model_price_get_iter_from_commodity()

gboolean gnc_tree_model_price_get_iter_from_commodity ( GncTreeModelPrice model,
gnc_commodity *  commodity,
GtkTreeIter *  iter 
)

Convert a commodity pointer into a GtkTreeIter.

Parameters
modelA pointer to the price tree model.
commodityA pointer to the gnucash commodity.
iterA pointer to a GtkTreeIter. This iter will be filled in to point where the commodity appears in the price tree.
Returns
TRUE if the returned iter is valid, FALSE otherwise.

Definition at line 1219 of file gnc-tree-model-price.c.

1222 {
1223  gnc_commodity_namespace *name_space;
1224  GList *list;
1225  gint n;
1226 
1227  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
1228  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1229  g_return_val_if_fail ((commodity != NULL), FALSE);
1230  g_return_val_if_fail ((iter != NULL), FALSE);
1231 
1232  name_space = gnc_commodity_get_namespace_ds(commodity);
1233  if (name_space == NULL)
1234  {
1235  LEAVE("no namespace");
1236  return FALSE;
1237  }
1238 
1239  list = gnc_commodity_namespace_get_commodity_list(name_space);
1240  if (list == NULL)
1241  {
1242  LEAVE("empty list");
1243  return FALSE;
1244  }
1245 
1246  n = g_list_index(list, commodity);
1247  if (n == -1)
1248  {
1249  LEAVE("commodity not in list");
1250  return FALSE;
1251  }
1252 
1253  iter->stamp = model->stamp;
1254  iter->user_data = ITER_IS_COMMODITY;
1255  iter->user_data2 = commodity;
1256  iter->user_data3 = GINT_TO_POINTER(n);
1257  LEAVE("iter %s", iter_to_string(model, iter));
1258  return TRUE;
1259 }
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *name_space)
Return a list of all commodity data structures in the specified namespace.
gnc_commodity_namespace * gnc_commodity_get_namespace_ds(const gnc_commodity *cm)
Retrieve the namespace data structure for the specified commodity.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_price_get_iter_from_namespace()

gboolean gnc_tree_model_price_get_iter_from_namespace ( GncTreeModelPrice model,
gnc_commodity_namespace *  name_space,
GtkTreeIter *  iter 
)

Convert a commodity namespace pointer into a GtkTreeIter.

Parameters
modelA pointer to the price tree model.
namespaceA pointer to the gnucash commodity namespace.
iterA pointer to a GtkTreeIter. This iter will be filled in to point where the namespace appears in the price tree.
Returns
TRUE if the returned iter is valid, FALSE otherwise.

Definition at line 1267 of file gnc-tree-model-price.c.

1270 {
1272  gnc_commodity_table *ct;
1273  GList *list;
1274  gint n;
1275 
1276  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1277  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1278  g_return_val_if_fail ((name_space != NULL), FALSE);
1279  g_return_val_if_fail ((iter != NULL), FALSE);
1280 
1281  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
1282  ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
1284  if (list == NULL)
1285  {
1286  LEAVE("namespace list empty");
1287  return FALSE;
1288  }
1289 
1290  n = g_list_index(list, name_space);
1291  if (n == -1)
1292  {
1293  LEAVE("namespace not found");
1294  return FALSE;
1295  }
1296 
1297  iter->stamp = model->stamp;
1298  iter->user_data = ITER_IS_NAMESPACE;
1299  iter->user_data2 = name_space;
1300  iter->user_data3 = GINT_TO_POINTER(n);
1301  LEAVE("iter %s", iter_to_string(model, iter));
1302  return TRUE;
1303 }
The instance private data for a price database tree model.
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
gpointer qof_book_get_data(const QofBook *book, const gchar *key)
Retrieves arbitrary pointers to structs stored by qof_book_set_data.
GList * gnc_commodity_table_get_namespaces_list(const gnc_commodity_table *table)
Return a list of all namespace data structures in the commodity table.

◆ gnc_tree_model_price_get_iter_from_price()

gboolean gnc_tree_model_price_get_iter_from_price ( GncTreeModelPrice model,
GNCPrice *  price,
GtkTreeIter *  iter 
)

Convert a price pointer into a GtkTreeIter.

Parameters
modelA pointer to the price tree model.
priceA pointer to the gnucash price.
iterA pointer to a GtkTreeIter. This iter will be filled in to point where the price appears in the price tree.
Returns
TRUE if the returned iter is valid, FALSE otherwise.

Definition at line 1131 of file gnc-tree-model-price.c.

1134 {
1136  gnc_commodity *commodity;
1137  GList *list;
1138  gint n;
1139 
1140  ENTER("model %p, price %p, iter %p", model, price, iter);
1141  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1142  g_return_val_if_fail ((price != NULL), FALSE);
1143  g_return_val_if_fail ((iter != NULL), FALSE);
1144 
1145  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
1146  commodity = gnc_price_get_commodity(price);
1147  if (commodity == NULL)
1148  {
1149  LEAVE("no commodity");
1150  return FALSE;
1151  }
1152 
1153  list = gnc_pricedb_get_prices(priv->price_db, commodity, NULL);
1154  if (list == NULL)
1155  {
1156  LEAVE("empty list");
1157  return FALSE;
1158  }
1159 
1160  n = g_list_index(list, price);
1161  if (n == -1)
1162  {
1163  gnc_price_list_destroy(list);
1164  LEAVE("not in list");
1165  return FALSE;
1166  }
1167 
1168  iter->stamp = model->stamp;
1169  iter->user_data = ITER_IS_PRICE;
1170  iter->user_data2 = price;
1171  iter->user_data3 = GINT_TO_POINTER(n);
1172  gnc_price_list_destroy(list);
1173  LEAVE("iter %s", iter_to_string(model, iter));
1174  return TRUE;
1175 }
void gnc_price_list_destroy(PriceList *prices)
gnc_price_list_destroy - destroy the given price list, calling gnc_price_unref on all the prices incl...
Definition: gnc-pricedb.c:790
The instance private data for a price database tree model.
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
PriceList * gnc_pricedb_get_prices(GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency)
Return all the prices for a given commodity in another.
Definition: gnc-pricedb.c:2108

◆ gnc_tree_model_price_get_namespace()

gnc_commodity_namespace* gnc_tree_model_price_get_namespace ( GncTreeModelPrice model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash commodity namespace.

This routine should only be called from a commodity tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the commodity tree model.
iterA GtkTreeIter corresponding to a single namespace in the model.
Returns
A pointer to the corresponding namespace.

Definition at line 287 of file gnc-tree-model-price.c.

289 {
290  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
291  g_return_val_if_fail (iter != NULL, NULL);
292  g_return_val_if_fail (iter->user_data != NULL, NULL);
293  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
294 
295  if (iter->user_data != ITER_IS_NAMESPACE)
296  return NULL;
297  return (gnc_commodity_namespace *)iter->user_data2;
298 }
int stamp
The state of the model.

◆ gnc_tree_model_price_get_path_from_price()

GtkTreePath* gnc_tree_model_price_get_path_from_price ( GncTreeModelPrice model,
GNCPrice *  price 
)

Convert a price pointer into a GtkTreePath.

Parameters
modelA pointer to the price tree model.
priceA pointer to the commodity price.
Returns
A pointer to a GtkTreePath describing the location of this price. This pointer must be freed by the caller when no longer needed. This routine will return NULL if the price does not exist in the tree.

Definition at line 1183 of file gnc-tree-model-price.c.

1185 {
1186  GtkTreeIter tree_iter;
1187  GtkTreePath *tree_path;
1188 
1189  ENTER("model %p, price %p", model, price);
1190  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
1191  g_return_val_if_fail (price != NULL, NULL);
1192 
1193  if (!gnc_tree_model_price_get_iter_from_price (model, price, &tree_iter))
1194  {
1195  LEAVE("no iter");
1196  return NULL;
1197  }
1198 
1199  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1200  if (tree_path)
1201  {
1202  gchar *path_string = gtk_tree_path_to_string(tree_path);
1203  LEAVE("path (2) %s", path_string);
1204  g_free(path_string);
1205  }
1206  else
1207  {
1208  LEAVE("no path");
1209  }
1210  return tree_path;
1211 }
gboolean gnc_tree_model_price_get_iter_from_price(GncTreeModelPrice *model, GNCPrice *price, GtkTreeIter *iter)
Convert a price pointer into a GtkTreeIter.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_price_get_price()

GNCPrice* gnc_tree_model_price_get_price ( GncTreeModelPrice model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash price.

This routine should only be called from a price tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the price tree model.
iterA GtkTreeIter corresponding to a single price in the model.
Returns
A pointer to the corresponding price.

Definition at line 315 of file gnc-tree-model-price.c.

317 {
318  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
319  g_return_val_if_fail (iter != NULL, NULL);
320  g_return_val_if_fail (iter->user_data != NULL, NULL);
321  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
322 
323  if (iter->user_data != ITER_IS_PRICE)
324  return NULL;
325  return (GNCPrice *)iter->user_data2;
326 }
int stamp
The state of the model.

◆ gnc_tree_model_price_get_type()

GType gnc_tree_model_price_get_type ( void  )

Get the type of a price tree plugin.

Returns
A GType.

◆ gnc_tree_model_price_iter_is_commodity()

gboolean gnc_tree_model_price_iter_is_commodity ( GncTreeModelPrice model,
GtkTreeIter *  iter 
)

Determine whether or not the specified GtkTreeIter points to a commodity.

This routine should only be called from a price tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the price tree model.
iterA GtkTreeIter corresponding to a single item in the model.
Returns
TRUE if the iter points to a commodity, FALSE otherwise.

Definition at line 263 of file gnc-tree-model-price.c.

265 {
266  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
267  g_return_val_if_fail (iter != NULL, FALSE);
268  g_return_val_if_fail (iter->user_data != NULL, FALSE);
269  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
270 
271  return (iter->user_data == ITER_IS_COMMODITY);
272 }
int stamp
The state of the model.

◆ gnc_tree_model_price_iter_is_namespace()

gboolean gnc_tree_model_price_iter_is_namespace ( GncTreeModelPrice model,
GtkTreeIter *  iter 
)

Determine whether or not the specified GtkTreeIter points to a "commodity namespace".

This routine should only be called from a price tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the price tree model.
iterA GtkTreeIter corresponding to a single item in the model.
Returns
TRUE if the iter points to a commodity namespace, FALSE otherwise.

Definition at line 251 of file gnc-tree-model-price.c.

253 {
254  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
255  g_return_val_if_fail (iter != NULL, FALSE);
256  g_return_val_if_fail (iter->user_data != NULL, FALSE);
257  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
258 
259  return (iter->user_data == ITER_IS_NAMESPACE);
260 }
int stamp
The state of the model.

◆ gnc_tree_model_price_iter_is_price()

gboolean gnc_tree_model_price_iter_is_price ( GncTreeModelPrice model,
GtkTreeIter *  iter 
)

Determine whether or not the specified GtkTreeIter points to a price.

This routine should only be called from a price tree view filter function. The model and iter values will be provided as part of the call to the filter.

Parameters
modelA pointer to the price tree model.
iterA GtkTreeIter corresponding to a single item in the model.
Returns
TRUE if the iter points to a price, FALSE otherwise.

Definition at line 275 of file gnc-tree-model-price.c.

277 {
278  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
279  g_return_val_if_fail (iter != NULL, FALSE);
280  g_return_val_if_fail (iter->user_data != NULL, FALSE);
281  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
282 
283  return (iter->user_data == ITER_IS_PRICE);
284 }
int stamp
The state of the model.

◆ gnc_tree_model_price_new()

GtkTreeModel* gnc_tree_model_price_new ( QofBook *  book,
GNCPriceDB *  price_db 
)

Create a new GtkTreeModel for manipulating gnucash commodity prices.

Parameters
bookThe book that holds these prices.
price_dbA pointer to the price database for this tree. All namespaces and commodities in the book, and all prices in this tree will be included.

Definition at line 216 of file gnc-tree-model-price.c.

217 {
218  GncTreeModelPrice *model;
220  const GList *item;
221 
222  ENTER(" ");
223 
224  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_PRICE_NAME);
225  for ( ; item; item = g_list_next(item))
226  {
227  model = (GncTreeModelPrice *)item->data;
228  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
229  if (priv->price_db == price_db)
230  {
231  g_object_ref(G_OBJECT(model));
232  LEAVE("returning existing model %p", model);
233  return GTK_TREE_MODEL(model);
234  }
235  }
236 
237  model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE, NULL);
238 
239  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
240  priv->book = book;
241  priv->price_db = price_db;
242 
243  priv->event_handler_id =
244  qof_event_register_handler (gnc_tree_model_price_event_handler, model);
245 
246  LEAVE("returning new model %p", model);
247  return GTK_TREE_MODEL (model);
248 }
The instance private data for a price database tree model.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
The instance data structure for a price tree model.

◆ gnc_tree_view_account_add_custom_column()

GtkTreeViewColumn* gnc_tree_view_account_add_custom_column ( GncTreeViewAccount view,
const gchar *  column_title,
GncTreeViewAccountColumnSource  source_cb,
GncTreeViewAccountColumnTextEdited  edited_cb 
)

Add a new custom column to the set of columns in an account tree view.

This column will be visible as soon as it is added and will query the provided functions to determine what data to display. The TreeView will own the resulting TreeViewColumn, but caller may set any additional properties they wish.

Parameters
viewA pointer to an account tree view.
column_titleThe title for this new column.
source_cbA callback function that is expected to provide the data to be displayed.
edited_cbA callback function that will be called if the user edits the displayed data.

Definition at line 1982 of file gnc-tree-view-account.c.

1988 {
1989  GtkCellRenderer *renderer;
1990 
1991  g_return_val_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view), NULL);
1992 
1993  renderer = gtk_cell_renderer_text_new();
1994 
1995  return gnc_tree_view_account_add_custom_column_renderer(
1996  account_view, column_title, col_source_cb, col_edited_cb, renderer);
1997 }

◆ gnc_tree_view_account_add_property_column()

GtkTreeViewColumn* gnc_tree_view_account_add_property_column ( GncTreeViewAccount view,
const gchar *  column_title,
const gchar *  propname 
)

Add a new column to the set of columns in an account tree view.

This column will be visible as soon as it is added and will display the contents of the specified account property

Parameters
viewA pointer to an account tree view.
column_titleThe title for this new column.
propnameThe g_object_property name of the desired value. This must be a string property.

Definition at line 1883 of file gnc-tree-view-account.c.

1886 {
1887  GtkCellRenderer *renderer;
1888  GtkTreeViewColumn *column;
1889 
1890  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1891  g_return_val_if_fail (propname != NULL, NULL);
1892 
1893  column = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), column_title,
1894  propname, NULL, "Sample text",
1895  -1, -1, NULL);
1896 
1897  /* This new kvp column has only had one renderer added to it so
1898  * far. Find that renderer. */
1899  renderer = gnc_tree_view_column_get_renderer(column);
1900  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1901 
1902  // add a pointer to the view to make it easier to access in data_func
1903  g_object_set_data(G_OBJECT(column), "tree-view", (gpointer)view);
1904 
1905  gtk_tree_view_column_set_cell_data_func (column, renderer,
1906  account_cell_property_data_func,
1907  g_strdup(propname), g_free);
1908  return column;
1909 }
GtkCellRenderer * gnc_tree_view_column_get_renderer(GtkTreeViewColumn *column)
Return the "main" cell renderer from a GtkTreeViewColumn added to a GncTreeView my one of the conveni...
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.

◆ gnc_tree_view_account_clear_model_cache()

void gnc_tree_view_account_clear_model_cache ( GncTreeViewAccount view)

This function clears the tree model account cache so the values will be updated/refreshed.

Parameters
viewA pointer to an account tree view.

Definition at line 1172 of file gnc-tree-view-account.c.

1173 {
1174  GtkTreeModel *model, *f_model, *s_model;
1175 
1176  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
1177  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT(s_model));
1178  model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(f_model));
1179 
1180  gnc_tree_model_account_clear_cache (GNC_TREE_MODEL_ACCOUNT(model));
1181 }
void gnc_tree_model_account_clear_cache(GncTreeModelAccount *model)
Clear the tree model account cached values.

◆ gnc_tree_view_account_count_children()

gint gnc_tree_view_account_count_children ( GncTreeViewAccount view,
Account account 
)

This function determines if an account in the account tree view has any visible children.

Parameters
viewA pointer to an account tree view.
accountA pointer to the account to check.
Returns
The number of children of the specified account. Returns 0 on error.

Definition at line 1143 of file gnc-tree-view-account.c.

1145 {
1146  GtkTreeModel *s_model;
1147  GtkTreeIter s_iter;
1148  gint num_children;
1149 
1150  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1151 
1152  if (account == NULL)
1153  {
1154  LEAVE("no account");
1155  return 0;
1156  }
1157 
1158  if (!gnc_tree_view_account_get_iter_from_account (view, account, &s_iter))
1159  {
1160  LEAVE("view_get_iter_from_account failed");
1161  return 0;
1162  }
1163 
1164  /* Any children? */
1165  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1166  num_children = gtk_tree_model_iter_n_children(s_model, &s_iter);
1167  LEAVE("%d children", num_children);
1168  return num_children;
1169 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_expand_to_account()

void gnc_tree_view_account_expand_to_account ( GncTreeViewAccount view,
Account account 
)

This function forces the account tree expand whatever levels are necessary to make the specified account visible.

Parameters
viewA pointer to an account tree view.
accountA pointer to the account to show.

Definition at line 1745 of file gnc-tree-view-account.c.

1747 {
1748  GtkTreePath *path;
1749 
1750  g_return_if_fail(view != NULL);
1751  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1752  ENTER("view %p, account %p", view, account);
1753 
1754  path = gnc_tree_view_account_get_path_from_account(view, account);
1755  if (path)
1756  {
1757  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
1758  gtk_tree_path_free(path);
1759  }
1760  LEAVE(" ");
1761 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_account_get_account_from_iter()

Account* gnc_tree_view_account_get_account_from_iter ( GtkTreeModel *  model,
GtkTreeIter *  iter 
)

This function returns the account associated with the specified iter.

This function is useful in selection callbacks on an account tree widget.

Parameters
modelThe model provided to the callback function.
iterThe iter provided to the callback function.
Returns
The account associated with this iter.

Definition at line 1384 of file gnc-tree-view-account.c.

1386 {
1387  GtkTreeModel *model, *f_model;
1388  GtkTreeIter iter, f_iter;
1389  Account *account;
1390 
1391  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
1392  g_return_val_if_fail (s_iter != NULL, NULL);
1393 
1394  ENTER("model %p, iter %p", s_model, s_iter);
1395 
1396  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
1397  &f_iter,
1398  s_iter);
1399  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1400  gtk_tree_model_filter_convert_iter_to_child_iter (
1401  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
1402  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1404  GNC_TREE_MODEL_ACCOUNT(model), &iter);
1405  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1406  return account;
1407 }
Account * gnc_tree_model_account_get_account(GncTreeModelAccount *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash account.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_get_account_from_path()

Account* gnc_tree_view_account_get_account_from_path ( GncTreeViewAccount view,
GtkTreePath *  path 
)

This function returns the account associated with the specified path.

This function is useful in selection callbacks on an account tree widget.

Parameters
viewA pointer to an account tree view.
pathA path specifying a node in the account tree.
Returns
The account associated with this path.

Definition at line 1338 of file gnc-tree-view-account.c.

1340 {
1341  GtkTreeModel *model, *f_model, *s_model;
1342  GtkTreePath *path, *f_path;
1343  GtkTreeIter iter;
1344  Account *account;
1345 
1346  ENTER("view %p", view);
1347  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1348  g_return_val_if_fail (s_path != NULL, NULL);
1349 
1350  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1351  f_path = gtk_tree_model_sort_convert_path_to_child_path (
1352  GTK_TREE_MODEL_SORT (s_model), s_path);
1353  if (!f_path)
1354  {
1355  LEAVE("no filter path");
1356  return NULL;
1357  }
1358 
1359  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1360  path = gtk_tree_model_filter_convert_path_to_child_path (
1361  GTK_TREE_MODEL_FILTER (f_model), f_path);
1362  gtk_tree_path_free(f_path);
1363  if (!path)
1364  {
1365  LEAVE("no path");
1366  return NULL;
1367  }
1368 
1369  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1370  if (!gtk_tree_model_get_iter (model, &iter, path))
1371  {
1372  LEAVE("no iter");
1373  return NULL;
1374  }
1375 
1376  account = iter.user_data;
1377  gtk_tree_path_free(path);
1378  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1379  return account;
1380 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_get_cursor_account()

Account* gnc_tree_view_account_get_cursor_account ( GncTreeViewAccount view)

This function returns the account in the account tree view at the current location of the cursor.

(The outline frame. Usually is selected and therefore filled in, but not always.)

Parameters
viewA pointer to an account tree view.
Returns
The account at the cursor.

Definition at line 1768 of file gnc-tree-view-account.c.

1769 {
1770  GtkTreePath *s_path;
1771  Account *account;
1772 
1773  ENTER("view %p", view);
1774  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1775 
1776  gtk_tree_view_get_cursor (GTK_TREE_VIEW(view), &s_path, NULL);
1777  if (!s_path)
1778  {
1779  LEAVE("no account");
1780  return NULL;
1781  }
1782 
1783  account = gnc_tree_view_account_get_account_from_path (view, s_path);
1784  gtk_tree_path_free(s_path);
1785  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1786  return account;
1787 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
Account * gnc_tree_view_account_get_account_from_path(GncTreeViewAccount *view, GtkTreePath *s_path)
This function returns the account associated with the specified path.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_get_selected_account()

Account* gnc_tree_view_account_get_selected_account ( GncTreeViewAccount view)

This function returns the account associated with the selected item in the account tree view.

Note
It only makes sense to call this function when the account tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an account tree view.
Returns
The selected account, or NULL if no account was selected.

Definition at line 1415 of file gnc-tree-view-account.c.

1416 {
1417  GtkTreeSelection *selection;
1418  GtkTreeModel *f_model, *s_model;
1419  GtkTreeIter iter, f_iter, s_iter;
1420  Account *account;
1421  GtkSelectionMode mode;
1422 
1423  ENTER("view %p", view);
1424  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1425 
1426  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1427  mode = gtk_tree_selection_get_mode(selection);
1428  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
1429  {
1430  return NULL;
1431  }
1432  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
1433  {
1434  LEAVE("no account, get_selected failed");
1435  return FALSE;
1436  }
1437 
1438  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
1439  &f_iter, &s_iter);
1440 
1441  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1442  gtk_tree_model_filter_convert_iter_to_child_iter (
1443  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
1444 
1445  account = iter.user_data;
1446  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1447  return account;
1448 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_get_selected_accounts()

GList* gnc_tree_view_account_get_selected_accounts ( GncTreeViewAccount view)

This function returns a list of the accounts associated with the selected items in the account tree view.

Note
It only makes sense to call this function when the account tree is set to select multiple items. There is a different function to use when the tree supports single selection.
Parameters
viewA pointer to an account tree view.
Returns
A list of accounts, or NULL if no account was selected.

Definition at line 1573 of file gnc-tree-view-account.c.

1574 {
1575  GtkTreeSelection *selection;
1577 
1578  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1579 
1580  info.return_list = NULL;
1581  info.priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1582  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1583  gtk_tree_selection_selected_foreach(selection, get_selected_accounts_helper, &info);
1584  info.return_list = g_list_reverse (info.return_list);
1585  return info.return_list;
1586 }

◆ gnc_tree_view_account_get_view_info()

void gnc_tree_view_account_get_view_info ( GncTreeViewAccount account_view,
AccountViewInfo *  avi 
)

Given pointers to an account tree and old style filter block, this function will copy the current configuration of the account tree widget into the data block.

This may be used in conjunction with the gnc_tree_view_account_set_view_info function to modify the filters on an existing account tree.

Parameters
account_viewA pointer to an account tree view.
aviA pointer to an old style filter block to fill in.

Definition at line 1192 of file gnc-tree-view-account.c.

1194 {
1196 
1197  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1198  g_return_if_fail(avi != NULL);
1199 
1200  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1201 
1202  *avi = priv->avi;
1203 }

◆ gnc_tree_view_account_new()

GtkTreeView* gnc_tree_view_account_new ( gboolean  show_root)

Create a new account tree view.

This view may or may not show a pseudo top-level account. The gnucash engine does not have a single top level account (it has a list of top level accounts), but this code provides one so that it can be used with all parts of the gnucash gui. The first level of accounts in the created tree will be the top level of accounts in the current book.

Parameters
show_rootShow the pseudo top-level account in this view.
Returns
A pointer to a new account tree view.

Definition at line 1048 of file gnc-tree-view-account.c.

1049 {
1050  Account *root;
1051 
1052  root = gnc_book_get_root_account (gnc_get_current_book ());
1053  return gnc_tree_view_account_new_with_root (root, show_root);
1054 }
GtkTreeView * gnc_tree_view_account_new_with_root(Account *root, gboolean show_root)
Create a new account tree view.

◆ gnc_tree_view_account_new_with_root()

GtkTreeView* gnc_tree_view_account_new_with_root ( Account root,
gboolean  show_root 
)

Create a new account tree view.

This view may or may not show a pseudo top-level account. The gnucash engine does not have a single top level account (it has a list of top level accounts), but this code provides one so that it can be used with all parts of the gnucash gui.

Parameters
rootThe account to use as the first level of the created tree.
show_rootShow the pseudo top-level account in this view.
Returns
A pointer to a new account tree view.

Definition at line 759 of file gnc-tree-view-account.c.

760 {
761  GncTreeView *view;
762  GtkTreeModel *model, *f_model, *s_model;
763  GtkTreePath *virtual_root_path = NULL;
764  const gchar *sample_type, *sample_commodity;
766  GtkTreeViewColumn *tax_info_column, *acc_color_column;
767  GtkCellRenderer *renderer;
768  GList *col_list = NULL, *node = NULL;
769 
770  ENTER(" ");
771  /* Create our view */
772  view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT,
773  "name", "gnc-id-account-tree", NULL);
774 
775  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(GNC_TREE_VIEW_ACCOUNT (view));
776 
777  /* Get the show_account_color value from gsettings */
778  priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_COLOR);
779 
780  /* Create/get a pointer to the existing model for this set of books. */
781  model = gnc_tree_model_account_new (root);
782 
783  /* Set up the view private filter layer on the common model. */
784  if (!show_root)
785  virtual_root_path = gtk_tree_path_new_first ();
786  f_model = gtk_tree_model_filter_new (model, virtual_root_path);
787  /* A GncTreeModelAccount is based on a GncTreeModel, which is a
788  * GObject that provides a GtkTreeModel interface. */
789  g_object_unref(G_OBJECT(model));
790  if (virtual_root_path)
791  gtk_tree_path_free(virtual_root_path);
792 
793  /* Set up the view private sort layer on the common model. */
794  s_model = gtk_tree_model_sort_new_with_model(f_model);
795  g_object_unref(G_OBJECT(f_model));
796  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
797  g_object_unref(G_OBJECT(s_model));
798 
799  /* Set default visibilities */
800  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
801 
803  sample_commodity = gnc_commodity_get_fullname(gnc_default_currency());
804 
805  priv->name_column
806  = gnc_tree_view_add_text_column(view, _("Account Name"), "name",
807  GNC_ICON_ACCOUNT, "Expenses:Entertainment",
808  GNC_TREE_MODEL_ACCOUNT_COL_NAME,
809  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
810  sort_by_string);
811 
812  gnc_tree_view_add_text_column(view, _("Type"), "type", NULL, sample_type,
813  GNC_TREE_MODEL_ACCOUNT_COL_TYPE,
814  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
815  sort_by_string);
816 
817  gnc_tree_view_add_text_column(view, _("Commodity"), "commodity", NULL,
818  sample_commodity,
819  GNC_TREE_MODEL_ACCOUNT_COL_COMMODITY,
820  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
821  sort_by_string);
822  priv->code_column
823  = gnc_tree_view_add_text_column(view, _("Account Code"), "account-code", NULL,
824  "1-123-1234",
825  GNC_TREE_MODEL_ACCOUNT_COL_CODE,
826  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
827  sort_by_code);
828  priv->desc_column
829  = gnc_tree_view_add_text_column(view, _("Description"), "description", NULL,
830  "Sample account description.",
831  GNC_TREE_MODEL_ACCOUNT_COL_DESCRIPTION,
832  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
833  sort_by_string);
834 
835  gnc_tree_view_add_numeric_column(view, _("Last Num"), "lastnum", "12345",
836  GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM,
837  GNC_TREE_VIEW_COLUMN_COLOR_NONE,
838  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
839  sort_by_string);
840 
841  gnc_tree_view_add_numeric_column(view, _("Present"), "present",
842  SAMPLE_ACCOUNT_VALUE,
843  GNC_TREE_MODEL_ACCOUNT_COL_PRESENT,
844  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
845  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
846  sort_by_present_value);
847  priv->present_report_column
848  = gnc_tree_view_add_numeric_column(view, _("Present (Report)"), "present_report",
849  SAMPLE_ACCOUNT_VALUE,
850  GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT,
851  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
852  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
853  sort_by_present_value);
854 
855  gnc_tree_view_add_numeric_column(view, _("Balance"), "balance",
856  SAMPLE_ACCOUNT_VALUE,
857  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE,
858  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
859  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
860  sort_by_balance_value);
861  priv->balance_report_column
862  = gnc_tree_view_add_numeric_column(view, _("Balance (Report)"), "balance_report",
863  SAMPLE_ACCOUNT_VALUE,
864  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT,
865  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
866  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
867  sort_by_balance_value);
868 
869  gnc_tree_view_add_numeric_column(view, _("Balance (Period)"), "balance-period",
870  SAMPLE_ACCOUNT_VALUE,
871  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD,
872  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD,
873  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
874  sort_by_balance_period_value);
875 
876  gnc_tree_view_add_numeric_column(view, _("Cleared"), "cleared",
877  SAMPLE_ACCOUNT_VALUE,
878  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
879  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
880  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
881  sort_by_cleared_value);
882  priv->cleared_report_column
883  = gnc_tree_view_add_numeric_column(view, _("Cleared (Report)"), "cleared_report",
884  SAMPLE_ACCOUNT_VALUE,
885  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT,
886  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
887  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
888  sort_by_cleared_value);
889 
890  gnc_tree_view_add_numeric_column(view, _("Reconciled"), "reconciled",
891  SAMPLE_ACCOUNT_VALUE,
892  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
893  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
894  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
895  sort_by_reconciled_value);
896  priv->reconciled_report_column
897  = gnc_tree_view_add_numeric_column(view, _("Reconciled (Report)"), "reconciled_report",
898  SAMPLE_ACCOUNT_VALUE,
899  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT,
900  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
901  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
902  sort_by_reconciled_value);
903 
904  gnc_tree_view_add_text_column(view, _("Last Reconcile Date"), "last-recon-date", NULL,
905  "Last Reconcile Date",
906  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE,
907  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
908  sort_by_last_reconcile_date);
909 
910  gnc_tree_view_add_numeric_column(view, _("Future Minimum"), "future_min",
911  SAMPLE_ACCOUNT_VALUE,
912  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN,
913  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
914  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
915  sort_by_future_min_value);
916  priv->future_min_report_column
917  = gnc_tree_view_add_numeric_column(view, _("Future Minimum (Report)"), "future_min_report",
918  SAMPLE_ACCOUNT_VALUE,
919  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT,
920  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
921  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
922  sort_by_future_min_value);
923 
924  gnc_tree_view_add_numeric_column(view, _("Total"), "total",
925  SAMPLE_ACCOUNT_VALUE,
926  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL,
927  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
928  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
929  sort_by_total_value);
930  priv->total_report_column
931  = gnc_tree_view_add_numeric_column(view, _("Total (Report)"), "total_report",
932  SAMPLE_ACCOUNT_VALUE,
933  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT,
934  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
935  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
936  sort_by_total_value);
937 
938  gnc_tree_view_add_numeric_column(view, _("Total (Period)"), "total-period",
939  SAMPLE_ACCOUNT_VALUE,
940  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD,
941  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD,
942  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
943  sort_by_total_period_value);
944 
945  /* Translators: The C is the column title and stands for Color, this should be one character */
946  acc_color_column
947  = gnc_tree_view_add_text_column(view, C_("Column header for 'Color'", "C"), "account-color", NULL,
948  "xx",
949  GNC_TREE_VIEW_COLUMN_DATA_NONE,
950  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
951  NULL);
952 
953  /* Add the full title to the object for menu creation */
954  g_object_set_data_full(G_OBJECT(acc_color_column), REAL_TITLE,
955  g_strdup(_("Account Color")), g_free);
956 
957  /* Also add the full title to the column header as a tooltip */
958  gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (acc_color_column), _("Account Color"));
959 
960  priv->notes_column
961  = gnc_tree_view_add_text_view_column(view, _("Notes"), "notes", NULL,
962  "Sample account notes.",
963  GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
964  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
965  sort_by_string);
966 
967  tax_info_column
968  = gnc_tree_view_add_text_column(view, _("Tax Info"), "tax-info", NULL,
969  "Sample tax info.",
970  GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
971  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
972  sort_by_string);
973 
974  renderer = gnc_tree_view_column_get_renderer(tax_info_column);
975  gtk_tree_view_column_set_cell_data_func(tax_info_column,
976  renderer,
977  tax_info_data_func,
978  GTK_TREE_VIEW(view),
979  NULL);
980 
981  gnc_tree_view_add_toggle_column (view, _("Hidden"),
982  C_("Column header for 'Hidden'", "H"),
983  "hidden",
984  GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN,
985  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
986  sort_by_hidden,
987  gnc_tree_view_account_hidden_toggled);
988 
989  gnc_tree_view_add_toggle_column(view, _("Placeholder"),
990  C_("Column header for 'Placeholder'", "P"),
991  "placeholder",
992  GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
993  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
994  sort_by_placeholder,
995  gnc_tree_view_account_placeholder_toggled);
996 
997  gnc_tree_view_add_toggle_column(view, _("Opening Balance"),
998  C_("Column header for 'Opening Balance'", "O"),
999  "opening-balance",
1000  GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
1001  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
1002  sort_by_opening_balance,
1003  NULL);
1004 
1005  /* Add function to each column that optionally sets a background color for accounts */
1006  col_list = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
1007  for (node = col_list; node; node = node->next)
1008  {
1009  renderer = gnc_tree_view_column_get_renderer(node->data);
1010  gtk_tree_view_column_set_cell_data_func(node->data,
1011  renderer,
1012  acc_color_data_func,
1013  GTK_TREE_VIEW(view),
1014  NULL);
1015  }
1016  g_list_free (col_list);
1017 
1018  /* Update column titles to use the currency name. */
1019  gtva_update_column_names(view);
1020 
1021  /* By default only the first column is visible. */
1023  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
1024  gnc_tree_view_account_filter_helper,
1025  view,
1026  NULL);
1027 
1028  /* Default the sorting to account name */
1029  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
1030  GNC_TREE_MODEL_ACCOUNT_COL_NAME,
1031  GTK_SORT_ASCENDING);
1032 
1033  /* Set account find-as-you-type search function */
1034  gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(view), gnc_tree_view_search_compare, NULL, NULL);
1035 
1036  gtk_widget_show(GTK_WIDGET(view));
1037  LEAVE("%p", view);
1038  return GTK_TREE_VIEW(view);
1039 }
GtkTreeViewColumn * gnc_tree_view_add_numeric_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *sizing_text, gint model_data_column, gint model_color_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new numeric column to a GncTreeView base view.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
Definition: gnc-ui-util.c:1194
GtkTreeViewColumn * gnc_tree_view_add_toggle_column(GncTreeView *view, const gchar *column_title, const gchar *column_short_title, const gchar *pref_name, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn, renderer_toggled toggle_edited_cb)
This function adds a new toggle column to a GncTreeView base view.
GtkCellRenderer * gnc_tree_view_column_get_renderer(GtkTreeViewColumn *column)
Return the "main" cell renderer from a GtkTreeViewColumn added to a GncTreeView my one of the conveni...
GtkTreeViewColumn * gnc_tree_view_add_text_view_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text view column to a GncTreeView base view.
GtkTreeModel * gnc_tree_model_account_new(Account *root)
Create a new GtkTreeModel for manipulating gnucash accounts.
void gnc_tree_view_configure_columns(GncTreeView *view)
Make all the correct columns visible, respecting their default visibility setting, their "always" visibility setting, and the last saved state if available.
const char * gnc_commodity_get_fullname(const gnc_commodity *cm)
Retrieve the full name for the specified commodity.
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetTypeStr(GNCAccountType type)
The xaccAccountGetTypeStr() routine returns a string suitable for use in the GUI/Interface.
Definition: Account.cpp:4464
The Credit card account is used to denote credit (e.g.
Definition: Account.h:116

◆ gnc_tree_view_account_refilter()

void gnc_tree_view_account_refilter ( GncTreeViewAccount view)

This function forces the account tree filter to be evaluated.

It may be necessary to call this function if the initial state of the view is incorrect. This appears to only be necessary if the filter affects one of the top level accounts in gnucash.

Note
This calls a function in gtk that is annotated in the sources as being slow. You have been warned.
Parameters
viewA pointer to an account tree view.

Definition at line 1304 of file gnc-tree-view-account.c.

1305 {
1306  GtkTreeModel *f_model, *s_model;
1307 
1308  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1309 
1310  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1311  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1312  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
1313 }

◆ gnc_tree_view_account_select_subaccounts()

void gnc_tree_view_account_select_subaccounts ( GncTreeViewAccount view,
Account account 
)

This function selects all sub-accounts of an account in the account tree view.

All other accounts will be unselected.

Note
It only makes sense to call this function when the account tree is set to select multiple items. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an account tree view.
accountA pointer to the account whose children should be selected.

Definition at line 1673 of file gnc-tree-view-account.c.

1675 {
1676  GtkTreeModel *s_model;
1677  GtkTreeSelection *selection;
1678  GtkTreePath *sp_account, *sp_start, *sp_end;
1679  GtkTreeIter si_account, si_start, si_end;
1680  gboolean have_start, have_end = FALSE;
1681  gint num_children;
1682 
1683  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1684 
1685  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1686 
1687  if (account == NULL)
1688  {
1689  LEAVE("no account");
1690  return;
1691  }
1692 
1693  if (!gnc_tree_view_account_get_iter_from_account (view, account, &si_account))
1694  {
1695  LEAVE("view_get_iter_from_account failed");
1696  return;
1697  }
1698 
1699  /* Any children? */
1700  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1701  num_children = gtk_tree_model_iter_n_children(s_model, &si_account);
1702  if (num_children == 0)
1703  {
1704  LEAVE("no children");
1705  return;
1706  }
1707 
1708  /* Expand the tree. Required for selection to work */
1709  sp_account = gtk_tree_model_get_path (s_model, &si_account);
1710  gtk_tree_view_expand_row (GTK_TREE_VIEW(view), sp_account, TRUE);
1711 
1712  /* compute start/end paths */
1713  have_start = gtk_tree_model_iter_nth_child(s_model, &si_start, &si_account, 0);
1714  si_end = si_account;
1715  while (num_children)
1716  {
1717  GtkTreeIter tmp_iter = si_end;
1718  have_end = gtk_tree_model_iter_nth_child(s_model, &si_end, &tmp_iter,
1719  num_children - 1);
1720  if (have_end)
1721  num_children = gtk_tree_model_iter_n_children(s_model, &si_end);
1722  else
1723  num_children = 0;
1724  }
1725 
1726  if (have_start && have_end)
1727  {
1728  sp_start = gtk_tree_model_get_path (s_model, &si_start);
1729  sp_end = gtk_tree_model_get_path (s_model, &si_end);
1730 
1731  /* select everything between */
1732  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1733  gtk_tree_selection_select_range (selection, sp_start, sp_end);
1734 
1735  /* clean up */
1736  gtk_tree_path_free(sp_start);
1737  gtk_tree_path_free(sp_end);
1738  }
1739  gtk_tree_path_free(sp_account);
1740  LEAVE(" ");
1741  return;
1742 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_set_filter()

void gnc_tree_view_account_set_filter ( GncTreeViewAccount account_view,
gnc_tree_view_account_filter_func  func,
gpointer  data,
GSourceFunc  destroy 
)

This function attaches a filter function to the given account tree.

This function will be called for each account that the view thinks should possibly show. The filter may perform any actions necessary on the account to decide whether it should be shown or not. (I.E. Check type, placeholder status, etc.) If the filter returns TRUE then the account will be displayed.

Parameters
account_viewA pointer to an account tree view.
funcA filtration function that is called on individual elements in the tree. If this function returns TRUE, the account will be displayed.
dataA data block passed into each instance of the function.
destroyA function to destroy the data block. This function will be called when the filter is destroyed. may be NULL.

Definition at line 1275 of file gnc-tree-view-account.c.

1279 {
1281 
1282  ENTER("view %p, filter func %p, data %p, destroy %p",
1283  view, func, data, destroy);
1284 
1285  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1286 
1287  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1288  if (priv->filter_destroy)
1289  {
1290  priv->filter_destroy(priv->filter_data);
1291  }
1292  priv->filter_destroy = destroy;
1293  priv->filter_data = data;
1294  priv->filter_fn = func;
1295 
1297  LEAVE(" ");
1298 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_account_set_selected_account()

void gnc_tree_view_account_set_selected_account ( GncTreeViewAccount view,
Account account 
)

This function selects an account in the account tree view.

All other accounts will be unselected. In addition, this function collapses the entire tree and then expands only the path to the selected account, making the item easy to find. In general, this routine only need be called when initially putting up a window containing an account tree view widget.

Note
It only makes sense to call this function when the account tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an account tree view.
accountA pointer to the account to select.

Definition at line 1455 of file gnc-tree-view-account.c.

1457 {
1458  GtkTreeModel *model, *f_model, *s_model;
1459  GtkTreePath *path, *f_path, *s_path, *parent_path;
1460  GtkTreeSelection *selection;
1461 
1462  ENTER("view %p, account %p (%s)", view,
1463  account, xaccAccountGetName (account));
1464  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1465 
1466  /* Clear any existing selection. */
1467  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1468  gtk_tree_selection_unselect_all (selection);
1469 
1470  if (account == NULL)
1471  return;
1472 
1473  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1474  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1475  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1476 
1478  GNC_TREE_MODEL_ACCOUNT(model), account);
1479  if (path == NULL)
1480  {
1481  LEAVE("no path");
1482  return;
1483  }
1484  debug_path(DEBUG, path);
1485 
1486  f_path = gtk_tree_model_filter_convert_child_path_to_path (
1487  GTK_TREE_MODEL_FILTER (f_model), path);
1488  gtk_tree_path_free(path);
1489  if (f_path == NULL)
1490  {
1491  LEAVE("no filter path");
1492  return;
1493  }
1494  debug_path(DEBUG, f_path);
1495 
1496  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1497  f_path);
1498  gtk_tree_path_free(f_path);
1499  if (s_path == NULL)
1500  {
1501  LEAVE("no sort path");
1502  return;
1503  }
1504 
1505  /* gtk_tree_view requires that a row be visible before it can be selected */
1506  parent_path = gtk_tree_path_copy (s_path);
1507  if (gtk_tree_path_up (parent_path))
1508  {
1509  /* This function is misnamed. It expands the actual item
1510  * specified, not the path to the item specified. I.E. It expands
1511  * one level too many, thus the get of the parent. */
1512  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1513  }
1514  gtk_tree_path_free(parent_path);
1515 
1516  gtk_tree_selection_select_path (selection, s_path);
1517 
1518  /* give gtk+ a chance to resize the tree view first by handling pending
1519  * configure events */
1520  while (gtk_events_pending ())
1521  gtk_main_iteration ();
1522  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1523  debug_path(LEAVE, s_path);
1524  gtk_tree_path_free(s_path);
1525 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GtkTreePath * gnc_tree_model_account_get_path_from_account(GncTreeModelAccount *model, Account *account)
Convert a model/account pair into a gtk_tree_model_path.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3258

◆ gnc_tree_view_account_set_selected_accounts()

void gnc_tree_view_account_set_selected_accounts ( GncTreeViewAccount view,
GList *  account_list,
gboolean  show_last 
)

This function selects a set of accounts in the account tree view.

All other accounts will be unselected. In addition, this function collapses the entire tree and then expands only the path to the selected accounts, making them easy to find. In general, this routine only need be called when initially putting up a window containing an account tree view widget.

Note
It only makes sense to call this function when the account tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
It is the responsibility of the caller to free the returned list.
Parameters
viewA pointer to an account tree view.
account_listA list of accounts to select.
show_lastForce the window to scroll to the last account selected.

Definition at line 1593 of file gnc-tree-view-account.c.

1596 {
1597  GtkTreeModel *model, *f_model, *s_model;
1598  GtkTreePath *path, *f_path, *s_path, *parent_path;
1599  GtkTreeSelection *selection;
1600  GList *element;
1601  Account *account;
1602 
1603  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1604 
1605  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1606  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1607  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1608 
1609  /* Clear any existing selection. */
1610  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1611  gtk_tree_selection_unselect_all (selection);
1612  gtk_tree_view_collapse_all (GTK_TREE_VIEW(view));
1613 
1614  /* Now go select what the user requested. */
1615  for (element = account_list; element; )
1616  {
1617  account = element->data;
1618  element = g_list_next(element);
1619 
1620  if (account == NULL)
1621  {
1622  /*
1623  * Oops. Someone must have deleted this account and not cleaned
1624  * up all references to it.
1625  */
1626  continue;
1627  }
1628 
1629  path = gnc_tree_model_account_get_path_from_account (GNC_TREE_MODEL_ACCOUNT(model), account);
1630  if (path == NULL)
1631  {
1632  /*
1633  * Oops. Someone must have deleted this account and not cleaned
1634  * up all references to it.
1635  */
1636  continue;
1637  }
1638 
1639  f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
1640  path);
1641  gtk_tree_path_free(path);
1642  if (f_path == NULL)
1643  continue;
1644 
1645  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1646  f_path);
1647  gtk_tree_path_free(f_path);
1648  if (s_path == NULL)
1649  continue;
1650 
1651  /* gtk_tree_view requires that a row be visible before it can be selected */
1652  parent_path = gtk_tree_path_copy (s_path);
1653  if (gtk_tree_path_up (parent_path))
1654  {
1655  /* This function is misnamed. It expands the actual item
1656  * specified, not the path to the item specified. I.E. It
1657  * expands one level too many, thus the get of the parent. */
1658  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1659  }
1660  gtk_tree_path_free(parent_path);
1661 
1662  gtk_tree_selection_select_path (selection, s_path);
1663  if (show_last && (element == NULL))
1664  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1665  gtk_tree_path_free(s_path);
1666  }
1667 }
GtkTreePath * gnc_tree_model_account_get_path_from_account(GncTreeModelAccount *model, Account *account)
Convert a model/account pair into a gtk_tree_model_path.

◆ gnc_tree_view_account_set_view_info()

void gnc_tree_view_account_set_view_info ( GncTreeViewAccount account_view,
AccountViewInfo *  avi 
)

Given pointers to an account tree and old style filter block, this function will applies the settings specified to the current configuration of the account tree widget.

This may be used in conjunction with the gnc_tree_view_account_get_view_info function to modify the filters on an existing account tree.

Parameters
account_viewA pointer to an account tree view.
aviA pointer to an old style filter block to apply to the view.

Definition at line 1220 of file gnc-tree-view-account.c.

1222 {
1224  gint i;
1225  guint sel_bits = 0;
1226 
1227  ENTER("%p", account_view);
1228  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1229  g_return_if_fail(avi != NULL);
1230 
1231  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1232  priv->avi = *avi;
1233 
1234  for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
1235  {
1236  sel_bits |= avi->include_type[i] ? (1 << i) : 0;
1237  }
1238 
1240  account_view, gnc_tree_view_account_filter_by_view_info,
1241  &priv->avi, NULL);
1242 
1243  LEAVE(" ");
1244 }
stop here; the following types just aren&#39;t ready for prime time
Definition: Account.h:164
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_set_filter(GncTreeViewAccount *view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
This function attaches a filter function to the given account tree.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_commodity_configure_columns()

void gnc_tree_view_commodity_configure_columns ( GncTreeViewCommodity view,
GSList *  column_names 
)

Configure (by name) the set of visible columns in an commodity tree view.

By default, only the commodity name column is show. The available list of columns can be found in the file gnc-tree-view-commodity.c

Parameters
viewA pointer to an commodity tree view.
column_namesA list of column names to make visible.

◆ gnc_tree_view_commodity_get_cursor_commodity()

gnc_commodity* gnc_tree_view_commodity_get_cursor_commodity ( GncTreeViewCommodity view)

This function returns the commodity in the commodity tree view at the current location of the cursor.

(The outline frame. Usually is selected and therefore filled in, but not always.)

Parameters
viewA pointer to an commodity tree view.
Returns
The commodity at the cursor.

◆ gnc_tree_view_commodity_get_selected_commodity()

gnc_commodity* gnc_tree_view_commodity_get_selected_commodity ( GncTreeViewCommodity view)

This function returns the commodity associated with the selected item in the commodity tree view.

Note
It only makes sense to call this function when the commodity tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an commodity tree view.
Returns
The selected commodity, or NULL if no commodity was selected.

Definition at line 625 of file gnc-tree-view-commodity.c.

626 {
627  GtkTreeSelection *selection;
628  GtkTreeModel *model, *f_model, *s_model;
629  GtkTreeIter iter, f_iter, s_iter;
630  gnc_commodity *commodity;
631 
632  g_return_val_if_fail (GNC_IS_TREE_VIEW_COMMODITY (view), NULL);
633 
634  ENTER("view %p", view);
635 
636  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
637  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
638  {
639  LEAVE("no commodity, get_selected failed");
640  return FALSE;
641  }
642 
643  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
644  &f_iter, &s_iter);
645 
646  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
647  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
648  &iter, &f_iter);
649 
650  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
651  commodity = gnc_tree_model_commodity_get_commodity (GNC_TREE_MODEL_COMMODITY(model),
652  &iter);
653  LEAVE("commodity %p (%s)", commodity,
654  commodity ? gnc_commodity_get_mnemonic(commodity) : "");
655  return commodity;
656 }
gnc_commodity * gnc_tree_model_commodity_get_commodity(GncTreeModelCommodity *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash commodity.
const char * gnc_commodity_get_mnemonic(const gnc_commodity *cm)
Retrieve the mnemonic for the specified commodity.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_commodity_new()

GtkTreeView* gnc_tree_view_commodity_new ( QofBook *  book,
const gchar *  first_property_name,
  ... 
)

Create a new commodity tree view.

This view may or may not show a pseudo top-level commodity. The gnucash engine does not have a single top level commodity (it has a list of top level commodities), but this code provides one so that it can be used with all parts of the gnucash gui.

Parameters
bookThe book containing the commodities to show.
first_property_namePairs of property name/value settings for the newly created object. Terminate the properties with a single NULL argument.
Returns
A pointer to a new commodity tree view.

Definition at line 322 of file gnc-tree-view-commodity.c.

325 {
326  GncTreeView *view;
327  GtkTreeModel *model, *f_model, *s_model;
328  GtkTreeViewColumn *col;
329  gnc_commodity_table *ct;
330  va_list var_args;
331 
332  ENTER(" ");
333  /* Create/get a pointer to the existing model for this set of books. */
334  ct = gnc_commodity_table_get_table (book);
335  model = gnc_tree_model_commodity_new (book, ct);
336 
337  /* Set up the view private filter on the common model. */
338  f_model = gtk_tree_model_filter_new (model, NULL);
339  g_object_unref(G_OBJECT(model));
340  s_model = gtk_tree_model_sort_new_with_model (f_model);
341  g_object_unref(G_OBJECT(f_model));
342 
343  /* Create our view */
344  view = g_object_new (GNC_TYPE_TREE_VIEW_COMMODITY,
345  "name", "gnc-id-commodity-tree", NULL);
346  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
347  g_object_unref(G_OBJECT(s_model));
348 
349  DEBUG("model ref count is %d", G_OBJECT(model)->ref_count);
350  DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
351  DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);
352 
353  /* Set default visibilities */
354  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
355 
357  view, _("Namespace"), "namespace", NULL, "NASDAQ",
358  GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE,
359  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
360  sort_by_commodity_string);
362  view, _("Symbol"), "symbol", NULL, "ACMEACME",
363  GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC,
364  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
365  sort_by_commodity_string);
366  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
368  view, _("Name"), "name", NULL, "Acme Corporation, Inc.",
369  GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
370  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
371  sort_by_commodity_string);
372  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
374  view, _("Print Name"), "printname", NULL,
375  "ACMEACME (Acme Corporation, Inc.)",
376  GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
377  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
378  sort_by_commodity_string);
380  view, _("Display symbol"), "user_symbol", NULL, "ACME",
381  GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL,
382  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
383  sort_by_commodity_string);
384  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
386  view, _("Unique Name"), "uniquename", NULL,
387  "NASDAQ::ACMEACME", GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
388  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
389  sort_by_commodity_string);
391  /* Translators: Again replace CUSIP by the name of your
392  National Securities Identifying Number. */
393  view, _("ISIN/CUSIP"), "cusip_code", NULL, "US1234567890",
394  GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
395  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
396  sort_by_commodity_string);
397  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
399  view, _("Fraction"), "fraction", "10000",
400  GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
401  GNC_TREE_VIEW_COLUMN_COLOR_NONE,
402  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
403  sort_by_fraction);
404  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
406  view, _("Get Quotes"),
407  C_("Column letter for 'Get Quotes'", "Q"), "quote_flag",
408  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
409  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
410  sort_by_quote_flag,
411  NULL);
413  view, _("Source"), "quote_source", NULL, "alphavantage",
414  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,
415  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
416  sort_by_commodity_string);
418  view, _("Timezone"), "quote_timezone", NULL, "America/New_York",
419  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
420  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
421  sort_by_commodity_string);
422  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
423 
425 
426  /* Set properties */
427  va_start (var_args, first_property_name);
428  g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
429  va_end (var_args);
430 
431  /* Sort on the name column by default. This allows for a consistent
432  * sort if commodities are briefly removed and re-added. */
433  if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
434  NULL, NULL))
435  {
436  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
437  GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
438  GTK_SORT_ASCENDING);
439  }
440 
441  gtk_widget_show(GTK_WIDGET(view));
442  LEAVE(" %p", view);
443  return GTK_TREE_VIEW(view);
444 }
gnc_commodity_table * gnc_commodity_table_get_table(QofBook *book)
Returns the commodity table associated with a book.
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
GtkTreeViewColumn * gnc_tree_view_add_numeric_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *sizing_text, gint model_data_column, gint model_color_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new numeric column to a GncTreeView base view.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GtkTreeViewColumn * gnc_tree_view_add_toggle_column(GncTreeView *view, const gchar *column_title, const gchar *column_short_title, const gchar *pref_name, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn, renderer_toggled toggle_edited_cb)
This function adds a new toggle column to a GncTreeView base view.
void gnc_tree_view_configure_columns(GncTreeView *view)
Make all the correct columns visible, respecting their default visibility setting, their "always" visibility setting, and the last saved state if available.
GtkTreeModel * gnc_tree_model_commodity_new(QofBook *book, gnc_commodity_table *ct)
Create a new GtkTreeModel for manipulating gnucash commodities.
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_commodity_refilter()

void gnc_tree_view_commodity_refilter ( GncTreeViewCommodity view)

This function forces the commodity tree filter to be evaluated.

It may be necessary to call this function if the initial state of the view is incorrect. This appears to only be necessary if the filter affects one of the top level commodities in gnucash.

Note
This calls a function in gtk that is annotated in the sources as being slow. You have been warned.
Parameters
viewA pointer to an commodity tree view.

Definition at line 602 of file gnc-tree-view-commodity.c.

603 {
604  GtkTreeModel *f_model, *s_model;
605 
606  g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));
607 
608  ENTER("view %p", view);
609  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
610  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
611  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
612  LEAVE(" ");
613 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_commodity_select_commodity()

void gnc_tree_view_commodity_select_commodity ( GncTreeViewCommodity view,
gnc_commodity *  commodity 
)

Select the commodity in the associated commodity tree view.

Parameters
viewA pointer to an commodity tree view.
Thecommodity to select.

Definition at line 662 of file gnc-tree-view-commodity.c.

663 {
664  GtkTreeSelection *selection;
665  GtkTreeModel *model, *f_model, *s_model;
666  GtkTreePath *tree_path;
667  GtkTreePath *f_tree_path;
668  GtkTreePath *s_tree_path;
669 
670  g_return_if_fail (GNC_IS_TREE_VIEW_COMMODITY(view));
671 
672  if (!commodity)
673  return;
674 
675  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
676 
677  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
678  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
679  model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));
680 
681  tree_path = gnc_tree_model_commodity_get_path_from_commodity (GNC_TREE_MODEL_COMMODITY(model), commodity);
682 
683  if (tree_path)
684  {
685  f_tree_path = gtk_tree_model_filter_convert_child_path_to_path
686  (GTK_TREE_MODEL_FILTER (f_model), tree_path);
687 
688  s_tree_path = gtk_tree_model_sort_convert_child_path_to_path
689  (GTK_TREE_MODEL_SORT (s_model), f_tree_path);
690 
691  gtk_tree_view_expand_to_path (GTK_TREE_VIEW(view), s_tree_path);
692  gtk_tree_selection_select_path (selection, s_tree_path);
693  gtk_tree_path_free (tree_path);
694  gtk_tree_path_free (f_tree_path);
695  gtk_tree_path_free (s_tree_path);
696  }
697 }
GtkTreePath * gnc_tree_model_commodity_get_path_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity)
Convert a commodity pointer into a GtkTreePath.

◆ gnc_tree_view_commodity_select_subcommodities()

void gnc_tree_view_commodity_select_subcommodities ( GncTreeViewCommodity view,
gnc_commodity *  commodity 
)

This function selects all sub-commodities of an commodity in the commodity tree view.

All other commodities will be unselected.

Note
It only makes sense to call this function when the commodity tree is set to select multiple items. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an commodity tree view.
commodityA pointer to the commodity whose children should be selected.

◆ gnc_tree_view_commodity_set_filter()

void gnc_tree_view_commodity_set_filter ( GncTreeViewCommodity view,
gnc_tree_view_commodity_ns_filter_func  ns_func,
gnc_tree_view_commodity_cm_filter_func  cm_func,
gpointer  data,
GDestroyNotify  destroy 
)

This function attaches a filter function to the given commodity tree.

This function will be called for each commodity that the view thinks should possibly show. The filter may perform any actions necessary on the commodity to decide whether it should be shown or not. (I.E. Check type, placeholder status, etc.) If the filter returns TRUE then the commodity will be displayed.

Parameters
viewA pointer to an commodity tree view.
ns_funcA filtration function that is called on individual tree elements that represent a namespace. If this function returns TRUE, the namespace (and commodities under it) will be displayed.
cm_funcA filtration function that is called on individual tree elements that represent a commodity. If this function returns TRUE, the commodity will be displayed.
dataA data block passed into each instance of the function.
destroyA function to destroy the data block. This function will be called when the filter is destroyed. may be NULL.

Definition at line 554 of file gnc-tree-view-commodity.c.

559 {
560  GtkTreeModel *f_model, *s_model;
561  filter_user_data *fd = data;
562 
563  g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));
564  g_return_if_fail((ns_func != NULL) || (cm_func != NULL));
565 
566  ENTER("view %p, ns func %p, cm func %p, data %p, destroy %p",
567  view, ns_func, cm_func, data, destroy);
568 
569  fd = g_malloc(sizeof(filter_user_data));
570  fd->user_ns_fn = ns_func;
571  fd->user_cm_fn = cm_func;
572  fd->user_data = data;
573  fd->user_destroy = destroy;
574 
575  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
576  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
577 
578  /* disconnect model from view */
579  g_object_ref (G_OBJECT(s_model));
580  gtk_tree_view_set_model (GTK_TREE_VIEW(view), NULL);
581 
582  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
583  gnc_tree_view_commodity_filter_helper,
584  fd,
585  gnc_tree_view_commodity_filter_destroy);
586 
587  /* Whack any existing levels. The top two levels have been created
588  * before this routine can be called. */
589  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
590 
591  /* connect model to view */
592  gtk_tree_view_set_model (GTK_TREE_VIEW(view), s_model);
593  g_object_unref (G_OBJECT(s_model));
594 
595  LEAVE(" ");
596 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_get_owner_from_iter()

GncOwner* gnc_tree_view_owner_get_owner_from_iter ( GtkTreeModel *  model,
GtkTreeIter *  iter 
)

This function returns the owner associated with the specified iter.

This function is useful in selection callbacks on an owner tree widget.

Parameters
modelThe model provided to the callback function.
iterThe iter provided to the callback function.
Returns
The owner associated with this iter.

Definition at line 722 of file gnc-tree-view-owner.c.

724 {
725  GtkTreeModel *model, *f_model;
726  GtkTreeIter iter, f_iter;
727  GncOwner *owner;
728 
729  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
730  g_return_val_if_fail (s_iter != NULL, NULL);
731 
732  ENTER("model %p, iter %p", s_model, s_iter);
733 
734  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
735  &f_iter,
736  s_iter);
737  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
738  gtk_tree_model_filter_convert_iter_to_child_iter (
739  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
740  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
742  GNC_TREE_MODEL_OWNER(model), &iter);
743  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
744  return owner;
745 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GncOwner * gnc_tree_model_owner_get_owner(GncTreeModelOwner *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash owner.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_get_owner_from_path()

GncOwner* gnc_tree_view_owner_get_owner_from_path ( GncTreeViewOwner view,
GtkTreePath *  path 
)

This function returns the owner associated with the specified path.

This function is useful in selection callbacks on an owner tree widget.

Parameters
viewA pointer to an owner tree view.
pathA path specifying a node in the owner tree.
Returns
The owner associated with this path.

Definition at line 676 of file gnc-tree-view-owner.c.

678 {
679  GtkTreeModel *model, *f_model, *s_model;
680  GtkTreePath *path, *f_path;
681  GtkTreeIter iter;
682  GncOwner *owner;
683 
684  ENTER("view %p", view);
685  g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
686  g_return_val_if_fail (s_path != NULL, NULL);
687 
688  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
689  f_path = gtk_tree_model_sort_convert_path_to_child_path (
690  GTK_TREE_MODEL_SORT (s_model), s_path);
691  if (!f_path)
692  {
693  LEAVE("no filter path");
694  return NULL;
695  }
696 
697  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
698  path = gtk_tree_model_filter_convert_path_to_child_path (
699  GTK_TREE_MODEL_FILTER (f_model), f_path);
700  gtk_tree_path_free(f_path);
701  if (!path)
702  {
703  LEAVE("no path");
704  return NULL;
705  }
706 
707  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
708  if (!gtk_tree_model_get_iter (model, &iter, path))
709  {
710  LEAVE("no iter");
711  return NULL;
712  }
713 
714  owner = iter.user_data;
715  gtk_tree_path_free(path);
716  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
717  return owner;
718 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_get_selected_owner()

GncOwner* gnc_tree_view_owner_get_selected_owner ( GncTreeViewOwner view)

This function returns the owner associated with the selected item in the owner tree view.

Note
It only makes sense to call this function when the owner tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an owner tree view.
Returns
The selected owner, or NULL if no owner was selected.

Definition at line 753 of file gnc-tree-view-owner.c.

754 {
755  GtkTreeSelection *selection;
756  GtkTreeModel *f_model, *s_model;
757  GtkTreeIter iter, f_iter, s_iter;
758  GncOwner *owner;
759  GtkSelectionMode mode;
760 
761  ENTER("view %p", view);
762  g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
763 
764  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
765  mode = gtk_tree_selection_get_mode(selection);
766  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
767  {
768  return NULL;
769  }
770  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
771  {
772  LEAVE("no owner, get_selected failed");
773  return FALSE;
774  }
775 
776  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
777  &f_iter, &s_iter);
778 
779  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
780  gtk_tree_model_filter_convert_iter_to_child_iter (
781  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
782 
783  owner = iter.user_data;
784  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
785  return owner;
786 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_new()

GtkTreeView* gnc_tree_view_owner_new ( GncOwnerType  owner_type)

Create a new owner tree view for one type of owners.

Parameters
owner_typeThe type of owners to use in the view.
Returns
A pointer to a new owner tree view.

Definition at line 333 of file gnc-tree-view-owner.c.

334 {
335  GncTreeView *view;
336  GtkTreeModel *model, *f_model, *s_model;
337  const gchar *sample_type, *sample_currency;
338  const gchar *owner_name = NULL, * owner_id = NULL;
340 
341  ENTER(" ");
342 
343  switch (owner_type)
344  {
345  case GNC_OWNER_NONE :
346  case GNC_OWNER_UNDEFINED :
347  PWARN("missing owner_type");
348  owner_name = _("Name");
349  owner_id = _("ID #");
350  break;
351  case GNC_OWNER_CUSTOMER :
352  owner_name = _("Company Name");
353  owner_id = _("Customer Number");
354  break;
355  case GNC_OWNER_JOB :
356  owner_name = _("Job Name");
357  owner_id = _("Job Number");
358  break;
359  case GNC_OWNER_VENDOR :
360  owner_name = _("Company Name");
361  owner_id = _("Vendor Number");
362  break;
363  case GNC_OWNER_EMPLOYEE :
364  owner_name = _("Employee Name");
365  owner_id = _("Employee Number");
366  break;
367  }
368  /* Create our view */
369  view = g_object_new (GNC_TYPE_TREE_VIEW_OWNER,
370  "name", "gnc-id-owner-tree", NULL);
371 
372  priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(GNC_TREE_VIEW_OWNER (view));
373 
374  /* Create/get a pointer to the existing model for this set of books. */
375  model = gnc_tree_model_owner_new (owner_type);
376 
377  /* Set up the view private filter layer on the common model. */
378  f_model = gtk_tree_model_filter_new (model, NULL);
379  /* A GncTreeModelOwner is based on a GncTreeModel, which is a
380  * GObject that provides a GtkTreeModel interface. */
381  g_object_unref(G_OBJECT(model));
382 
383  /* Set up the view private sort layer on the common model. */
384  s_model = gtk_tree_model_sort_new_with_model(f_model);
385  g_object_unref(G_OBJECT(f_model));
386  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
387  g_object_unref(G_OBJECT(s_model));
388 
389  /* Set default visibilities */
390  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
391 
392  sample_type = gncOwnerTypeToQofIdType (GNC_OWNER_CUSTOMER);
394 
395  priv->name_column
396  = gnc_tree_view_add_text_column(view, owner_name, GNC_OWNER_TREE_NAME_COL,
397  NULL, "GnuCash Inc.",
398  GNC_TREE_MODEL_OWNER_COL_NAME,
399  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
400  sort_by_string);
401  gnc_tree_view_add_text_column(view, _("Type"), GNC_OWNER_TREE_TYPE_COL,
402  NULL, sample_type,
403  GNC_TREE_MODEL_OWNER_COL_TYPE,
404  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
405  sort_by_string);
406  priv->id_column
407  = gnc_tree_view_add_text_column(view, owner_id, GNC_OWNER_TREE_ID_COL,
408  NULL, "1-123-1234",
409  GNC_TREE_MODEL_OWNER_COL_ID,
410  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
411  sort_by_string);
412  gnc_tree_view_add_text_column(view, _("Currency"), GNC_OWNER_TREE_CURRENCY_COL,
413  NULL, sample_currency,
414  GNC_TREE_MODEL_OWNER_COL_CURRENCY,
415  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
416  sort_by_string);
417  gnc_tree_view_add_text_column(view, _("Address Name"), GNC_OWNER_TREE_ADDRESS_NAME_COL,
418  NULL, "GnuCash Inc.",
419  GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME,
420  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
421  sort_by_string);
422  gnc_tree_view_add_text_column(view, _("Address 1"), GNC_OWNER_TREE_ADDRESS_1_COL,
423  NULL, "Free Software Foundation",
424  GNC_TREE_MODEL_OWNER_COL_ADDRESS_1,
425  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
426  sort_by_string);
427  gnc_tree_view_add_text_column(view, _("Address 2"), GNC_OWNER_TREE_ADDRESS_2_COL,
428  NULL, "51 Franklin Street, Fifth Floor",
429  GNC_TREE_MODEL_OWNER_COL_ADDRESS_2,
430  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
431  sort_by_string);
432  gnc_tree_view_add_text_column(view, _("Address 3"), GNC_OWNER_TREE_ADDRESS_3_COL,
433  NULL, "Boston, MA 02110-1301",
434  GNC_TREE_MODEL_OWNER_COL_ADDRESS_3,
435  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
436  sort_by_string);
437  gnc_tree_view_add_text_column(view, _("Address 4"), GNC_OWNER_TREE_ADDRESS_4_COL,
438  NULL, "USA",
439  GNC_TREE_MODEL_OWNER_COL_ADDRESS_4,
440  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
441  sort_by_string);
442  gnc_tree_view_add_text_column(view, _("Phone"), GNC_OWNER_TREE_PHONE_COL,
443  NULL, "+1-617-542-5942",
444  GNC_TREE_MODEL_OWNER_COL_PHONE,
445  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
446  sort_by_string);
447  gnc_tree_view_add_text_column(view, _("Fax"), GNC_OWNER_TREE_FAX_COL,
448  NULL, "+1-617-542-2652",
449  GNC_TREE_MODEL_OWNER_COL_FAX,
450  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
451  sort_by_string);
452  gnc_tree_view_add_text_column(view, _("E-mail"), GNC_OWNER_TREE_EMAIL_COL,
453  NULL, "gnu@gnu.org",
454  GNC_TREE_MODEL_OWNER_COL_EMAIL,
455  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
456  sort_by_string);
457  gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_COL,
458  SAMPLE_OWNER_VALUE,
459  GNC_TREE_MODEL_OWNER_COL_BALANCE,
460  GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
461  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
462  sort_by_balance_value);
463 
464  priv->balance_report_column
465  = gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_REPORT_COL,
466  SAMPLE_OWNER_VALUE,
467  GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT,
468  GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
469  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
470  sort_by_balance_value);
471 
472  priv->notes_column
473  = gnc_tree_view_add_text_column(view, _("Notes"), GNC_OWNER_TREE_NOTES_COL, NULL,
474  "Sample owner notes.",
475  GNC_TREE_MODEL_OWNER_COL_NOTES,
476  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
477  sort_by_string);
478  gnc_tree_view_add_toggle_column (view, _("Active"),
479  C_("Column letter for 'Active'", "A"),
480  GNC_OWNER_TREE_ACTIVE_COL,
481  GNC_TREE_MODEL_OWNER_COL_ACTIVE,
482  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
483  sort_by_boolean,
484  gnc_tree_view_owner_active_toggled);
485 
486  /* Update column titles to use the currency name. */
487  gtvo_update_column_names(view);
488 
489  /* By default only the first column is visible. */
491  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
492  gnc_tree_view_owner_filter_helper,
493  view,
494  NULL);
495 
496  /* Default the sorting to owner name */
497  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
498  GNC_TREE_MODEL_OWNER_COL_NAME,
499  GTK_SORT_ASCENDING);
500 
501  gtk_widget_show(GTK_WIDGET(view));
502  LEAVE("%p", view);
503  return GTK_TREE_VIEW(view);
504 }
GtkTreeViewColumn * gnc_tree_view_add_numeric_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *sizing_text, gint model_data_column, gint model_color_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new numeric column to a GncTreeView base view.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
Definition: gnc-ui-util.c:1194
#define PWARN(format, args...)
Log a warning.
Definition: qoflog.h:250
GtkTreeViewColumn * gnc_tree_view_add_toggle_column(GncTreeView *view, const gchar *column_title, const gchar *column_short_title, const gchar *pref_name, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn, renderer_toggled toggle_edited_cb)
This function adds a new toggle column to a GncTreeView base view.
GtkTreeModel * gnc_tree_model_owner_new(GncOwnerType owner_type)
Create a new GtkTreeModel for manipulating gnucash owners.
void gnc_tree_view_configure_columns(GncTreeView *view)
Make all the correct columns visible, respecting their default visibility setting, their "always" visibility setting, and the last saved state if available.
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.
Definition: gncOwner.c:236
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_refilter()

void gnc_tree_view_owner_refilter ( GncTreeViewOwner view)

This function forces the owner tree filter to be evaluated.

It may be necessary to call this function if the initial state of the view is incorrect. This appears to only be necessary if the filter affects one of the top level owners in gnucash.

Note
This calls a function in gtk that is annotated in the sources as being slow. You have been warned.
Parameters
viewA pointer to an owner tree view.

Definition at line 656 of file gnc-tree-view-owner.c.

657 {
658  GtkTreeModel *f_model, *s_model;
659 
660  g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
661 
662  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
663  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
664  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
665 }

◆ gnc_tree_view_owner_set_filter()

void gnc_tree_view_owner_set_filter ( GncTreeViewOwner owner_view,
gnc_tree_view_owner_filter_func  func,
gpointer  data,
GSourceFunc  destroy 
)

This function attaches a filter function to the given owner tree.

This function will be called for each owner that the view thinks should possibly show. The filter may perform any actions necessary on the owner to decide whether it should be shown or not. (I.E. Check type, placeholder status, etc.) If the filter returns TRUE then the owner will be displayed.

Parameters
owner_viewA pointer to an owner tree view.
funcA filtration function that is called on individual elements in the tree. If this function returns TRUE, the owner will be displayed.
dataA data block passed into each instance of the function.
destroyA function to destroy the data block. This function will be called when the filter is destroyed. may be NULL.

Definition at line 627 of file gnc-tree-view-owner.c.

631 {
633 
634  ENTER("view %p, filter func %p, data %p, destroy %p",
635  view, func, data, destroy);
636 
637  g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
638 
639  priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
640  if (priv->filter_destroy)
641  {
642  priv->filter_destroy(priv->filter_data);
643  }
644  priv->filter_destroy = destroy;
645  priv->filter_data = data;
646  priv->filter_fn = func;
647 
649  LEAVE(" ");
650 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_set_selected_owner()

void gnc_tree_view_owner_set_selected_owner ( GncTreeViewOwner view,
GncOwner owner 
)

This function selects an owner in the owner tree view.

All other owners will be unselected. In addition, this function collapses the entire tree and then expands only the path to the selected owner, making the item easy to find. In general, this routine only need be called when initially putting up a window containing an owner tree view widget.

Note
It only makes sense to call this function when the owner tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an owner tree view.
ownerA pointer to the owner to select.

Definition at line 793 of file gnc-tree-view-owner.c.

795 {
796  GtkTreeModel *model, *f_model, *s_model;
797  GtkTreePath *path, *f_path, *s_path;
798  GtkTreeSelection *selection;
799 
800  ENTER("view %p, owner %p (%s)", view,
801  owner, gncOwnerGetName (owner));
802  g_return_if_fail (GNC_IS_TREE_VIEW_OWNER (view));
803 
804  /* Clear any existing selection. */
805  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
806  gtk_tree_selection_unselect_all (selection);
807 
808  if (owner == NULL)
809  return;
810 
811  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
812  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
813  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
814 
816  GNC_TREE_MODEL_OWNER(model), owner);
817  if (path == NULL)
818  {
819  LEAVE("no path");
820  return;
821  }
822  debug_path(DEBUG, path);
823 
824  f_path = gtk_tree_model_filter_convert_child_path_to_path (
825  GTK_TREE_MODEL_FILTER (f_model), path);
826  gtk_tree_path_free(path);
827  if (f_path == NULL)
828  {
829  LEAVE("no filter path");
830  return;
831  }
832  debug_path(DEBUG, f_path);
833 
834  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
835  f_path);
836  gtk_tree_path_free(f_path);
837  if (s_path == NULL)
838  {
839  LEAVE("no sort path");
840  return;
841  }
842 
843  gtk_tree_selection_select_path (selection, s_path);
844 
845  /* give gtk+ a chance to resize the tree view first by handling pending
846  * configure events */
847  while (gtk_events_pending ())
848  gtk_main_iteration ();
849  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
850  debug_path(LEAVE, s_path);
851  gtk_tree_path_free(s_path);
852 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GtkTreePath * gnc_tree_model_owner_get_path_from_owner(GncTreeModelOwner *model, GncOwner *owner)
Convert a model/owner pair into a gtk_tree_model_path.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_price_get_cursor_price()

GNCPrice* gnc_tree_view_price_get_cursor_price ( GncTreeViewPrice view)

This function returns the price in the price tree view at the current location of the cursor.

(The outline frame. Usually is selected and therefore filled in, but not always.)

Parameters
viewA pointer to an price tree view.
Returns
The price at the cursor.

◆ gnc_tree_view_price_get_selected_commodities()

GList* gnc_tree_view_price_get_selected_commodities ( GncTreeViewPrice view)

This function returns a list of commodities associated with the selected rows that are not prices but are the parent rows for prices in the price tree view.

Note
It only makes sense to call this function when the price tree is set to select multiple items.
Parameters
viewA pointer to an price tree view.
Returns
A list of commodities, or NULL if no commodity was selected.

Definition at line 820 of file gnc-tree-view-price.c.

821 {
822  GtkTreeSelection *selection;
823  GList *return_list = NULL;
824 
825  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
826  gtk_tree_selection_selected_foreach (selection, get_selected_commodity_helper, &return_list);
827  return return_list;
828 }

◆ gnc_tree_view_price_get_selected_price()

GNCPrice* gnc_tree_view_price_get_selected_price ( GncTreeViewPrice view)

This function returns the price associated with the selected item in the price tree view.

Note
It only makes sense to call this function when the price tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an price tree view.
Returns
The selected price, or NULL if no price was selected.

Definition at line 638 of file gnc-tree-view-price.c.

639 {
640  GtkTreeSelection *selection;
641  GtkTreeModel *model, *f_model, *s_model;
642  GtkTreeIter iter, f_iter, s_iter;
643  GNCPrice *price;
644 
645  ENTER("view %p", view);
646  g_return_val_if_fail (GNC_IS_TREE_VIEW_PRICE (view), NULL);
647 
648  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
649  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
650  {
651  LEAVE("no price, get_selected failed");
652  return FALSE;
653  }
654 
655  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
656  &f_iter, &s_iter);
657 
658  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
659  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
660  &iter, &f_iter);
661 
662  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
663  price = gnc_tree_model_price_get_price (GNC_TREE_MODEL_PRICE(model),
664  &iter);
665  LEAVE("price %p", price);
666  return price;
667 }
GNCPrice * gnc_tree_model_price_get_price(GncTreeModelPrice *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash price.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_price_get_selected_prices()

GList* gnc_tree_view_price_get_selected_prices ( GncTreeViewPrice view)

This function returns a list of the prices associated with the selected items in the price tree view.

Note
It only makes sense to call this function when the price tree is set to select multiple items. There is a different function to use when the tree supports single selection.
Parameters
viewA pointer to an price tree view.
Returns
A list of prices, or NULL if no price was selected.

Definition at line 776 of file gnc-tree-view-price.c.

777 {
778  GtkTreeSelection *selection;
779  GList *return_list = NULL;
780 
781  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
782  gtk_tree_selection_selected_foreach(selection, get_selected_prices_helper, &return_list);
783  return return_list;
784 }

◆ gnc_tree_view_price_new()

GtkTreeView* gnc_tree_view_price_new ( QofBook *  book,
const gchar *  first_property_name,
  ... 
)

Create a new price tree view.

This view may or may not show a pseudo top-level price. The gnucash engine does not have a single top level price (it has a list of top level prices), but this code provides one so that it can be used with all parts of the gnucash gui.

Parameters
bookThe book containing the prices to show.
first_property_namePairs of property name/value settings for the newly created object. Terminate the properties with a single NULL argument.
Returns
A pointer to a new price tree view.

Definition at line 360 of file gnc-tree-view-price.c.

363 {
364  GncTreeView *view;
365  GtkTreeModel *model, *f_model, *s_model;
366  GtkTreeViewColumn *col;
367  GNCPriceDB *price_db;
368  va_list var_args;
369  const gchar *sample_text;
370  gchar *sample_text2;
371 
372  ENTER(" ");
373  /* Create/get a pointer to the existing model for this set of books. */
374  price_db = gnc_pricedb_get_db(book);
375  model = gnc_tree_model_price_new (book, price_db);
376 
377  /* Set up the view private filter on the common model. */
378  f_model = gtk_tree_model_filter_new (model, NULL);
379  g_object_unref(G_OBJECT(model));
380  s_model = gtk_tree_model_sort_new_with_model (f_model);
381  g_object_unref(G_OBJECT(f_model));
382 
383  /* Create our view */
384  view = g_object_new (GNC_TYPE_TREE_VIEW_PRICE,
385  "name", "gnc-id-price-tree", NULL);
386  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
387  g_object_unref(G_OBJECT(s_model));
388 
389  DEBUG("model ref count is %d", G_OBJECT(model)->ref_count);
390  DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
391  DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);
392 
394  sample_text2 = g_strdup_printf("%s%s", sample_text, sample_text);
396  view, _("Security"), "security", NULL, sample_text2,
397  GNC_TREE_MODEL_PRICE_COL_COMMODITY,
398  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
399  sort_by_name);
400  g_free(sample_text2);
402  view, _("Currency"), "currency", NULL, sample_text,
403  GNC_TREE_MODEL_PRICE_COL_CURRENCY,
404  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
405  sort_by_name);
406  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
408  view, _("Date"), "date", NULL, "2005-05-20",
409  GNC_TREE_MODEL_PRICE_COL_DATE,
410  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
411  sort_by_date);
412  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
414  view, _("Source"), "source", NULL, "Finance::Quote",
415  GNC_TREE_MODEL_PRICE_COL_SOURCE,
416  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
417  sort_by_source);
418  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
420  view, _("Type"), "type", NULL, "last",
421  GNC_TREE_MODEL_PRICE_COL_TYPE,
422  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
423  sort_by_type);
424  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
426  view, _("Price"), "price", "100.00000",
427  GNC_TREE_MODEL_PRICE_COL_VALUE,
428  GNC_TREE_VIEW_COLUMN_COLOR_NONE,
429  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
430  sort_by_value);
431  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
432 
434 
435  /* Set properties */
436  va_start (var_args, first_property_name);
437  g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
438  va_end (var_args);
439 
440  /* Sort on the commodity column by default. This allows for a consistent
441  * sort if commodities are removed and re-added from the model. */
442  if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
443  NULL, NULL))
444  {
445  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
446  GNC_TREE_MODEL_PRICE_COL_COMMODITY,
447  GTK_SORT_ASCENDING);
448  }
449 
450  gtk_widget_show(GTK_WIDGET(view));
451  LEAVE(" %p", view);
452  return GTK_TREE_VIEW(view);
453 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
GtkTreeViewColumn * gnc_tree_view_add_numeric_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *sizing_text, gint model_data_column, gint model_color_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new numeric column to a GncTreeView base view.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GNCPriceDB * gnc_pricedb_get_db(QofBook *book)
Return the pricedb associated with the book.
Definition: gnc-pricedb.c:966
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
Definition: gnc-ui-util.c:1194
void gnc_tree_view_configure_columns(GncTreeView *view)
Make all the correct columns visible, respecting their default visibility setting, their "always" visibility setting, and the last saved state if available.
const char * gnc_commodity_get_printname(const gnc_commodity *cm)
Retrieve the &#39;print&#39; name for the specified commodity.
GtkTreeModel * gnc_tree_model_price_new(QofBook *book, GNCPriceDB *price_db)
Create a new GtkTreeModel for manipulating gnucash commodity prices.
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_price_set_selected_price()

void gnc_tree_view_price_set_selected_price ( GncTreeViewPrice view,
GNCPrice *  price 
)

This function selects an price in the price tree view.

All other prices will be unselected. In addition, this function collapses the entire tree and then expands only the path to the selected price, making the item easy to find. In general, this routine only need be called when initially putting up a window containing an price tree view widget.

Note
It only makes sense to call this function when the price tree is set to select a single item. There is a different function to use when the tree supports multiple selections.
Parameters
viewA pointer to an price tree view.
priceA pointer to the price to select.

Definition at line 674 of file gnc-tree-view-price.c.

676 {
677  GtkTreeModel *model, *f_model, *s_model;
678  GtkTreePath *path, *f_path, *s_path, *parent_path;
679  GtkTreeSelection *selection;
680 
681  ENTER("view %p, price %p", view, price);
682 
683  /* Clear any existing selection. */
684  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
685  gtk_tree_selection_unselect_all (selection);
686 
687  if (price == NULL)
688  return;
689 
690  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
691  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
692  model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));
693 
694  path = gnc_tree_model_price_get_path_from_price (GNC_TREE_MODEL_PRICE(model), price);
695  if (path == NULL)
696  {
697  LEAVE("get_path_from_price failed");
698  return;
699  }
700  debug_path(DEBUG, path);
701 
702  f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
703  path);
704  gtk_tree_path_free(path);
705  if (f_path == NULL)
706  {
707  LEAVE("no filter path");
708  return;
709  }
710  debug_path(DEBUG, f_path);
711 
712  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
713  f_path);
714  gtk_tree_path_free(f_path);
715  if (s_path == NULL)
716  {
717  LEAVE("no sort path");
718  return;
719  }
720 
721  /* gtk_tree_view requires that a row be visible before it can be selected */
722  parent_path = gtk_tree_path_copy (s_path);
723  if (gtk_tree_path_up (parent_path))
724  {
725  /* This function is misnamed. It expands the actual item
726  * specified, not the path to the item specified. I.E. It expands
727  * one level too many, thus the get of the parent. */
728  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
729  }
730  gtk_tree_path_free(parent_path);
731 
732  gtk_tree_selection_select_path (selection, s_path);
733  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
734  debug_path(LEAVE, s_path);
735  gtk_tree_path_free(s_path);
736 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GtkTreePath * gnc_tree_model_price_get_path_from_price(GncTreeModelPrice *model, GNCPrice *price)
Convert a price pointer into a GtkTreePath.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_clear_all_cb()

void gppat_filter_clear_all_cb ( GtkWidget *  button,
AccountFilterDialog fd 
)

The "clear all account types" button in the Filter dialog was clicked.

Clear all account types shown, and update the visible page.

Parameters
buttonThe button that was clicked.
fdA pointer to the account filter dialog struct.

Definition at line 2162 of file gnc-tree-view-account.c.

2164 {
2165  g_return_if_fail(GTK_IS_BUTTON(button));
2166 
2167  ENTER("button %p", button);
2168  fd->visible_types = 0;
2169  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2170  gnc_tree_view_account_refilter(fd->tree_view);
2171  LEAVE("types 0x%x", fd->visible_types);
2172 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_response_cb()

void gppat_filter_response_cb ( GtkWidget *  dialog,
gint  response,
AccountFilterDialog fd 
)

The Filter dialog was closed.

Check to see if this was done via the OK button. If so, make the changes permanent. If not, revert any changes.

Parameters
dialogA pointer to the "Filter By" dialog.
responseThe response code from closing the dialog.
fdA pointer to the account filter dialog struct.

Definition at line 2276 of file gnc-tree-view-account.c.

2279 {
2280  gpointer gptemp;
2281 
2282  g_return_if_fail(GTK_IS_DIALOG(dialog));
2283 
2284  ENTER("dialog %p, response %d", dialog, response);
2285 
2286  if (response != GTK_RESPONSE_OK)
2287  {
2288  fd->visible_types = fd->original_visible_types;
2289  fd->show_hidden = fd->original_show_hidden;
2290  fd->show_zero_total = fd->original_show_zero_total;
2291  fd->show_unused = fd->original_show_unused;
2292  gnc_tree_view_account_refilter(fd->tree_view);
2293  }
2294 
2295  /* Clean up and delete dialog */
2296  gptemp = (gpointer)fd->dialog;
2297  g_atomic_pointer_compare_and_exchange(&gptemp,
2298  (gpointer)dialog, NULL);
2299  fd->dialog = gptemp;
2300  gtk_widget_destroy(dialog);
2301  LEAVE("types 0x%x", fd->visible_types);
2302 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_select_all_cb()

void gppat_filter_select_all_cb ( GtkWidget *  button,
AccountFilterDialog fd 
)

The "select all account types" button in the Filter dialog was clicked.

Make all account types visible, and update the page.

Parameters
buttonThe button that was clicked.
fdA pointer to the account filter dialog struct.

Definition at line 2181 of file gnc-tree-view-account.c.

2183 {
2184  g_return_if_fail(GTK_IS_BUTTON(button));
2185 
2186  ENTER("button %p", button);
2187  fd->visible_types = -1;
2188  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2189  gnc_tree_view_account_refilter(fd->tree_view);
2190  LEAVE("types 0x%x", fd->visible_types);
2191 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_select_default_cb()

void gppat_filter_select_default_cb ( GtkWidget *  button,
AccountFilterDialog fd 
)

The "select default account types" button in the Filter dialog was clicked.

Set all account types to their default visibility (which happens to be visible for all of them), and update the page.

Parameters
buttonThe button that was clicked.
fdA pointer to the account filter dialog struct.

Definition at line 2201 of file gnc-tree-view-account.c.

2203 {
2204  ENTER("button %p", button);
2205  gppat_filter_select_all_cb(button, fd);
2206  LEAVE(" ");
2207 }
void gppat_filter_select_all_cb(GtkWidget *button, AccountFilterDialog *fd)
The "select all account types" button in the Filter dialog was clicked.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_show_hidden_toggled_cb()

void gppat_filter_show_hidden_toggled_cb ( GtkToggleButton *  button,
AccountFilterDialog fd 
)

The "show hidden" button in the Filter dialog changed state.

Update the page to reflect these changes.

Parameters
buttonThe GtkCheckButton that was toggled.
fdA pointer to the account filter dialog struct.

Definition at line 2104 of file gnc-tree-view-account.c.

2106 {
2107  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2108 
2109  ENTER("button %p", button);
2110  fd->show_hidden = gtk_toggle_button_get_active(button);
2111  gnc_tree_view_account_refilter(fd->tree_view);
2112  LEAVE("show_hidden %d", fd->show_hidden);
2113 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_show_unused_toggled_cb()

void gppat_filter_show_unused_toggled_cb ( GtkToggleButton *  button,
AccountFilterDialog fd 
)

The "show unused" button in the Filter dialog changed state.

Update the page to reflect these changes.

Parameters
buttonThe GtkCheckButton that was toggled.
fdA pointer to the account filter dialog struct.

Definition at line 2142 of file gnc-tree-view-account.c.

2144 {
2145  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2146 
2147  ENTER("button %p", button);
2148  fd->show_unused = gtk_toggle_button_get_active(button);
2149  gnc_tree_view_account_refilter(fd->tree_view);
2150  LEAVE("show_unused %d", fd->show_unused);
2151 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_show_zero_toggled_cb()

void gppat_filter_show_zero_toggled_cb ( GtkToggleButton *  button,
AccountFilterDialog fd 
)

The "show zero totals" button in the Filter dialog changed state.

Update the page to reflect these changes.

Parameters
buttonThe GtkCheckButton that was toggled.
fdA pointer to the account filter dialog struct.

Definition at line 2123 of file gnc-tree-view-account.c.

2125 {
2126  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2127 
2128  ENTER("button %p", button);
2129  fd->show_zero_total = gtk_toggle_button_get_active(button);
2130  gnc_tree_view_account_refilter(fd->tree_view);
2131  LEAVE("show_zero %d", fd->show_zero_total);
2132 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppot_filter_response_cb()

void gppot_filter_response_cb ( GtkWidget *  dialog,
gint  response,
OwnerFilterDialog fd 
)

The Filter dialog was closed.

Check to see if this was done via the OK button. If so, make the changes permanent. If not, revert any changes.

Parameters
dialogA pointer to the "Filter By" dialog.
responseThe response code from closing the dialog.
fdA pointer to the owner filter dialog struct.

Definition at line 1125 of file gnc-tree-view-owner.c.

1128 {
1129  gpointer gptemp;
1130 
1131  g_return_if_fail(GTK_IS_DIALOG(dialog));
1132 
1133  ENTER("dialog %p, response %d", dialog, response);
1134 
1135  if (response != GTK_RESPONSE_OK)
1136  {
1137  fd->show_inactive = fd->original_show_inactive;
1138  fd->show_zero_total = fd->original_show_zero_total;
1139  gnc_tree_view_owner_refilter(fd->tree_view);
1140  }
1141 
1142  /* Clean up and delete dialog */
1143  gptemp = (gpointer)fd->dialog;
1144  g_atomic_pointer_compare_and_exchange(&gptemp,
1145  (gpointer)dialog, NULL);
1146  fd->dialog = gptemp;
1147  gtk_widget_destroy(dialog);
1148  LEAVE("");
1149 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppot_filter_show_inactive_toggled_cb()

void gppot_filter_show_inactive_toggled_cb ( GtkToggleButton *  button,
OwnerFilterDialog fd 
)

The "only show active" button in the Filter dialog changed state.

Update the page to reflect these changes.

Parameters
buttonThe GtkCheckButton that was toggled.
fdA pointer to the owner filter dialog struct.

Definition at line 1086 of file gnc-tree-view-owner.c.

1088 {
1089  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1090 
1091  ENTER("button %p", button);
1092  fd->show_inactive = !gtk_toggle_button_get_active(button);
1093  gnc_tree_view_owner_refilter(fd->tree_view);
1094  LEAVE("show_inactive %d", fd->show_inactive);
1095 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppot_filter_show_zero_toggled_cb()

void gppot_filter_show_zero_toggled_cb ( GtkToggleButton *  button,
OwnerFilterDialog fd 
)

The "show zero totals" button in the Filter dialog changed state.

Update the page to reflect these changes.

Parameters
buttonThe GtkCheckButton that was toggled.
fdA pointer to the owner filter dialog struct.

Definition at line 1104 of file gnc-tree-view-owner.c.

1106 {
1107  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1108 
1109  ENTER("button %p", button);
1110  fd->show_zero_total = gtk_toggle_button_get_active(button);
1111  gnc_tree_view_owner_refilter(fd->tree_view);
1112  LEAVE("show_zero %d", fd->show_zero_total);
1113 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282