GnuCash  2.6.99
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_PLACEHOLDER, GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER, 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...
 
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)
 
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...
 
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...
 
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...
 

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_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...
 

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 267 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 wil 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 1903 of file gnc-tree-view-account.c.

1905 {
1906  AccountFilterDialog *fd = user_data;
1907  GNCAccountType acct_type;
1908  gnc_numeric total;
1909  gboolean result;
1910 
1911  ENTER("account %p:%s", account, xaccAccountGetName(account));
1912 
1913  if (g_hash_table_size (fd->filter_override) > 0)
1914  {
1915  Account *test_acc = NULL;
1916  test_acc = g_hash_table_lookup (fd->filter_override, account);
1917  if (test_acc != NULL)
1918  {
1919  LEAVE(" filter: override");
1920  return TRUE;
1921  }
1922  }
1923 
1924  if (!fd->show_hidden && xaccAccountIsHidden (account))
1925  {
1926  LEAVE(" hide: hidden");
1927  return FALSE;
1928  }
1929 
1930  if (!fd->show_zero_total)
1931  {
1932  total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
1933  if (gnc_numeric_zero_p(total))
1934  {
1935  LEAVE(" hide: zero balance");
1936  return FALSE;
1937  }
1938  }
1939 
1940  if (!fd->show_unused)
1941  {
1942  if (xaccAccountCountSplits(account, TRUE) == 0)
1943  {
1944  LEAVE(" hide: unused");
1945  return FALSE;
1946  }
1947  }
1948 
1949  acct_type = xaccAccountGetType(account);
1950  result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
1951  LEAVE(" %s", result ? "show" : "hide");
1952  return result;
1953 }
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account&#39;s account type.
Definition: Account.c:3010
STRUCTS.
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:261
gboolean xaccAccountIsHidden(const Account *acc)
Should this account be "hidden".
Definition: Account.c:3985
GNCAccountType
The account types are used to determine how the transaction data in the account is displayed...
Definition: Account.h:102
gint64 xaccAccountCountSplits(const Account *acc, gboolean include_children)
The xaccAccountCountSplits() routine returns the number of all the splits in the account.
Definition: Account.c:3732
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1082 of file gnc-tree-view-owner.c.

1084 {
1085  OwnerFilterDialog *fd = user_data;
1086  gnc_numeric total;
1087 
1088  ENTER("owner %p:%s", owner, gncOwnerGetName(owner));
1089 
1090  if (!fd->show_inactive && !gncOwnerGetActive (owner))
1091  {
1092  LEAVE(" hide: inactive");
1093  return FALSE;
1094  }
1095 
1096  if (!fd->show_zero_total)
1097  {
1098  total = gncOwnerGetBalanceInCurrency (owner, NULL);
1099  if (gnc_numeric_zero_p(total))
1100  {
1101  LEAVE(" hide: zero balance");
1102  return FALSE;
1103  }
1104  }
1105 
1106  return TRUE;
1107 }
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:261
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:1455
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1118 of file gnc-tree-model-account.c.

1120 {
1121  g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), NULL);
1122  g_return_val_if_fail (iter != NULL, NULL);
1123  g_return_val_if_fail (iter->user_data != NULL, NULL);
1124  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
1125 
1126  return (Account *) iter->user_data;
1127 }
STRUCTS.
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 1135 of file gnc-tree-model-account.c.

1138 {
1140  Account *parent;
1141  gint i;
1142 
1143  ENTER("model %p, account %p, iter %p", model, account, iter);
1144  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), FALSE);
1145  gnc_leave_return_val_if_fail ((account != NULL), FALSE);
1146  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
1147 
1148  iter->user_data = account;
1149  iter->stamp = model->stamp;
1150 
1151  priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
1152  if (account == priv->root)
1153  {
1154  iter->user_data2 = NULL;
1155  iter->user_data3 = GINT_TO_POINTER (0);
1156  LEAVE("Matched root");
1157  return TRUE;
1158  }
1159 
1160  if (priv->root != gnc_account_get_root (account))
1161  {
1162  LEAVE("Root doesn't match");
1163  return FALSE;
1164  }
1165 
1166  parent = gnc_account_get_parent(account);
1167  i = gnc_account_child_index(parent, account);
1168  iter->user_data2 = parent;
1169  iter->user_data3 = GINT_TO_POINTER (i);
1170  LEAVE("iter %s", iter_to_string(iter));
1171  return (i != -1);
1172 }
Account * gnc_account_get_parent(const Account *acc)
This routine returns a pointer to the parent of the specified account.
Definition: Account.c:2624
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#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:283
The instance private data for an account tree model.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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.c:2684
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.c:2631
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 1180 of file gnc-tree-model-account.c.

1182 {
1183  GtkTreeIter tree_iter;
1184  GtkTreePath *tree_path;
1185 
1186  ENTER("model %p, account %p", model, account);
1187  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), NULL);
1188  gnc_leave_return_val_if_fail (account != NULL, NULL);
1189 
1190  if (!gnc_tree_model_account_get_iter_from_account (model, account,
1191  &tree_iter))
1192  {
1193  LEAVE("no iter");
1194  return NULL;
1195  }
1196 
1197  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1198  if (tree_path)
1199  {
1200  gchar *path_string = gtk_tree_path_to_string(tree_path);
1201  LEAVE("path (2) %s", path_string);
1202  g_free(path_string);
1203  }
1204  else
1205  {
1206  LEAVE("no path");
1207  }
1208  return tree_path;
1209 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#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:283
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:271

◆ 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.

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

138 {
139  static GType gnc_tree_model_account_type = 0;
140 
141  if (gnc_tree_model_account_type == 0)
142  {
143  static const GTypeInfo our_info =
144  {
145  sizeof (GncTreeModelAccountClass), /* class_size */
146  NULL, /* base_init */
147  NULL, /* base_finalize */
148  (GClassInitFunc) gnc_tree_model_account_class_init,
149  NULL, /* class_finalize */
150  NULL, /* class_data */
151  sizeof (GncTreeModelAccount), /* */
152  0, /* n_preallocs */
153  (GInstanceInitFunc) gnc_tree_model_account_init
154  };
155 
156  static const GInterfaceInfo tree_model_info =
157  {
158  (GInterfaceInitFunc) gnc_tree_model_account_tree_model_init,
159  NULL,
160  NULL
161  };
162 
163  gnc_tree_model_account_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
164  GNC_TREE_MODEL_ACCOUNT_NAME,
165  &our_info, 0);
166 
167  g_type_add_interface_static (gnc_tree_model_account_type,
168  GTK_TYPE_TREE_MODEL,
169  &tree_model_info);
170  }
171 
172  return gnc_tree_model_account_type;
173 }
The class data structure for an account tree model.
The instance data structure for an account tree model.

◆ 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,
294  NULL);
295 
296  priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
297  priv->book = gnc_get_current_book();
298  priv->root = root;
299 
300  priv->event_handler_id = qof_event_register_handler
301  ((QofEventHandler)gnc_tree_model_account_event_handler, model);
302 
303  LEAVE("model %p", model);
304  return GTK_TREE_MODEL (model);
305 }
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:261
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:76
The instance private data for an account tree model.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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 287 of file gnc-tree-model-commodity.c.

289 {
290  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (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_COMMODITY)
296  return NULL;
297  return (gnc_commodity *)iter->user_data2;
298 }
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 957 of file gnc-tree-model-commodity.c.

960 {
961  gnc_commodity_namespace *name_space;
962  GList *list;
963  gint n;
964 
965  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
966  g_return_val_if_fail ((commodity != NULL), FALSE);
967  g_return_val_if_fail ((iter != NULL), FALSE);
968 
969  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
970 
971  name_space = gnc_commodity_get_namespace_ds(commodity);
972  if (name_space == NULL)
973  {
974  LEAVE("no namespace");
975  return FALSE;
976  }
977 
979  if (list == NULL)
980  {
981  LEAVE("empty list");
982  return FALSE;
983  }
984 
985  n = g_list_index(list, commodity);
986  if (n == -1)
987  {
988  LEAVE("not in list");
989  return FALSE;
990  }
991 
992  iter->stamp = model->stamp;
993  iter->user_data = ITER_IS_COMMODITY;
994  iter->user_data2 = commodity;
995  iter->user_data3 = GINT_TO_POINTER(n);
996  LEAVE("iter %s", iter_to_string(iter));
997  return TRUE;
998 }
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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 strucure for the specified commodity.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1042 of file gnc-tree-model-commodity.c.

1045 {
1047  GList *list;
1048  gint n;
1049 
1050  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
1051  g_return_val_if_fail ((name_space != NULL), FALSE);
1052  g_return_val_if_fail ((iter != NULL), FALSE);
1053 
1054  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1055 
1056  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
1057  list = gnc_commodity_table_get_namespaces_list(priv->commodity_table);
1058  if (list == NULL)
1059  {
1060  LEAVE("");
1061  return FALSE;
1062  }
1063 
1064  n = g_list_index(list, name_space);
1065  if (n == -1)
1066  {
1067  LEAVE("");
1068  return FALSE;
1069  }
1070 
1071  iter->stamp = model->stamp;
1072  iter->user_data = ITER_IS_NAMESPACE;
1073  iter->user_data2 = name_space;
1074  iter->user_data3 = GINT_TO_POINTER(n);
1075  LEAVE("iter %s", iter_to_string(iter));
1076  return TRUE;
1077 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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 273 of file gnc-tree-model-commodity.c.

275 {
276  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
277  g_return_val_if_fail (iter != NULL, NULL);
278  g_return_val_if_fail (iter->user_data != NULL, NULL);
279  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
280 
281  if (iter->user_data != ITER_IS_NAMESPACE)
282  return NULL;
283  return (gnc_commodity_namespace *)iter->user_data2;
284 }
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 1006 of file gnc-tree-model-commodity.c.

1008 {
1009  GtkTreeIter tree_iter;
1010  GtkTreePath *tree_path;
1011 
1012  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
1013  g_return_val_if_fail (commodity != NULL, NULL);
1014  ENTER("model %p, commodity %p", model, commodity);
1015 
1016  if (!gnc_tree_model_commodity_get_iter_from_commodity (model, commodity, &tree_iter))
1017  {
1018  LEAVE("no iter");
1019  return NULL;
1020  }
1021 
1022  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1023  if (tree_path)
1024  {
1025  gchar *path_string = gtk_tree_path_to_string(tree_path);
1026  LEAVE("path (2) %s", path_string);
1027  g_free(path_string);
1028  }
1029  else
1030  {
1031  LEAVE("no path");
1032  }
1033  return tree_path;
1034 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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.

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

111 {
112  static GType gnc_tree_model_commodity_type = 0;
113 
114  if (gnc_tree_model_commodity_type == 0)
115  {
116  static const GTypeInfo our_info =
117  {
119  NULL,
120  NULL,
121  (GClassInitFunc) gnc_tree_model_commodity_class_init,
122  NULL,
123  NULL,
124  sizeof (GncTreeModelCommodity),
125  0,
126  (GInstanceInitFunc) gnc_tree_model_commodity_init
127  };
128 
129  static const GInterfaceInfo tree_model_info =
130  {
131  (GInterfaceInitFunc) gnc_tree_model_commodity_tree_model_init,
132  NULL,
133  NULL
134  };
135 
136  gnc_tree_model_commodity_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
137  GNC_TREE_MODEL_COMMODITY_NAME,
138  &our_info, 0);
139 
140  g_type_add_interface_static (gnc_tree_model_commodity_type,
141  GTK_TYPE_TREE_MODEL,
142  &tree_model_info);
143  }
144 
145  return gnc_tree_model_commodity_type;
146 }
The class data structure for a commodity tree model.
The instance data structure for a commodity tree model.

◆ 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 261 of file gnc-tree-model-commodity.c.

263 {
264  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
265  g_return_val_if_fail (iter != NULL, FALSE);
266  g_return_val_if_fail (iter->user_data != NULL, FALSE);
267  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
268 
269  return (iter->user_data == ITER_IS_COMMODITY);
270 }
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 249 of file gnc-tree-model-commodity.c.

251 {
252  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
253  g_return_val_if_fail (iter != NULL, FALSE);
254  g_return_val_if_fail (iter->user_data != NULL, FALSE);
255  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
256 
257  return (iter->user_data == ITER_IS_NAMESPACE);
258 }
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 215 of file gnc-tree-model-commodity.c.

216 {
217  GncTreeModelCommodity *model;
219  const GList *item;
220 
221  ENTER("");
222 
223  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_COMMODITY_NAME);
224  for ( ; item; item = g_list_next(item))
225  {
226  model = (GncTreeModelCommodity *)item->data;
227  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
228  if (priv->commodity_table == ct)
229  {
230  g_object_ref(G_OBJECT(model));
231  LEAVE("returning existing model %p", model);
232  return GTK_TREE_MODEL(model);
233  }
234  }
235 
236  model = g_object_new (GNC_TYPE_TREE_MODEL_COMMODITY, NULL);
237  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
238  priv->book = book;
239  priv->commodity_table = ct;
240 
241  priv->event_handler_id =
242  qof_event_register_handler (gnc_tree_model_commodity_event_handler, model);
243 
244  LEAVE("");
245  return GTK_TREE_MODEL (model);
246 }
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:261
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:76
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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.

Definition at line 61 of file gnc-tree-model.c.

62 {
63  static GType gnc_tree_model_type = 0;
64 
65  if (gnc_tree_model_type == 0)
66  {
67  static const GTypeInfo our_info =
68  {
69  sizeof (GncTreeModelClass), /* class_size */
70  NULL, /* base_init */
71  NULL, /* base_finalize */
72  (GClassInitFunc) gnc_tree_model_class_init,
73  NULL, /* class_finalize */
74  NULL, /* class_data */
75  sizeof (GncTreeModel), /* */
76  0, /* n_preallocs */
77  (GInstanceInitFunc) gnc_tree_model_init
78  };
79 
80  //static const GInterfaceInfo tree_model_info = {
81  // (GInterfaceInitFunc) gnc_tree_model_tree_model_init,
82  // NULL,
83  // NULL
84  //};
85 
86  gnc_tree_model_type = g_type_register_static (G_TYPE_OBJECT,
87  GNC_TREE_MODEL_NAME,
88  &our_info, 0);
89 
90  //g_type_add_interface_static (gnc_tree_model_type,
91  // GTK_TYPE_TREE_MODEL,
92  // &tree_model_info);
93  }
94 
95  return gnc_tree_model_type;
96 }
The instance data structure for a generic tree model.
The class data structure for a generic tree model.

◆ 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 866 of file gnc-tree-model-owner.c.

869 {
871  GList *owner_in_list;
872 
873  ENTER("model %p, owner %p, iter %p", model, owner, iter);
874  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
875  gnc_leave_return_val_if_fail ((owner != NULL), FALSE);
876  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
877 
878 
879  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
880  owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
881  if (owner_in_list)
882  {
883  iter->stamp = model->stamp;
884  iter->user_data = owner_in_list->data;
885  iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list));
886  iter->user_data3 = NULL;
887  LEAVE("iter %s", iter_to_string (iter));
888  return TRUE;
889  }
890  else
891  {
892  iter->stamp = 0;
893  iter->user_data = NULL;
894  LEAVE("Owner not found in list");
895  return FALSE;
896  }
897 }
The instance private data for an owner tree model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#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:283
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:389
int stamp
The state of the model.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 849 of file gnc-tree-model-owner.c.

851 {
852  g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
853  g_return_val_if_fail (iter != NULL, NULL);
854  g_return_val_if_fail (iter->user_data != NULL, NULL);
855  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
856 
857  return (GncOwner *) iter->user_data;
858 }
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 905 of file gnc-tree-model-owner.c.

907 {
908  GtkTreeIter tree_iter;
909  GtkTreePath *tree_path;
910 
911  ENTER("model %p, owner %p", model, owner);
912  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
913  gnc_leave_return_val_if_fail (owner != NULL, NULL);
914 
915  if (!gnc_tree_model_owner_get_iter_from_owner (model, owner,
916  &tree_iter))
917  {
918  LEAVE("no iter");
919  return NULL;
920  }
921 
922  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
923  if (tree_path)
924  {
925  gchar *path_string = gtk_tree_path_to_string(tree_path);
926  LEAVE("path (2) %s", path_string);
927  g_free(path_string);
928  }
929  else
930  {
931  LEAVE("no path");
932  }
933  return tree_path;
934 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#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:283
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:271

◆ 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.

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

137 {
138  static GType gnc_tree_model_owner_type = 0;
139 
140  if (gnc_tree_model_owner_type == 0)
141  {
142  static const GTypeInfo our_info =
143  {
144  sizeof (GncTreeModelOwnerClass), /* class_size */
145  NULL, /* base_init */
146  NULL, /* base_finalize */
147  (GClassInitFunc) gnc_tree_model_owner_class_init,
148  NULL, /* class_finalize */
149  NULL, /* class_data */
150  sizeof (GncTreeModelOwner), /* */
151  0, /* n_preallocs */
152  (GInstanceInitFunc) gnc_tree_model_owner_init
153  };
154 
155  static const GInterfaceInfo tree_model_info =
156  {
157  (GInterfaceInitFunc) gnc_tree_model_owner_tree_model_init,
158  NULL,
159  NULL
160  };
161 
162  gnc_tree_model_owner_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
163  GNC_TREE_MODEL_OWNER_NAME,
164  &our_info, 0);
165 
166  g_type_add_interface_static (gnc_tree_model_owner_type,
167  GTK_TYPE_TREE_MODEL,
168  &tree_model_info);
169  }
170 
171  return gnc_tree_model_owner_type;
172 }
The instance data structure for an owner tree model.
The class data structure for an owner tree model.

◆ 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 274 of file gnc-tree-model-owner.c.

275 {
276  GncTreeModelOwner *model;
278  const GList *item;
279 
280  ENTER("owner_type %d", owner_type);
281  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_OWNER_NAME);
282  for ( ; item; item = g_list_next(item))
283  {
284  model = (GncTreeModelOwner *)item->data;
285  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
286  if (priv->owner_type == owner_type)
287  {
288  g_object_ref(G_OBJECT(model));
289  LEAVE("returning existing model %p", model);
290  return GTK_TREE_MODEL(model);
291  }
292  }
293 
294  model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
295  NULL);
296 
297  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
298  priv->book = gnc_get_current_book();
299  priv->owner_type = owner_type;
300  priv->owner_list = gncBusinessGetOwnerList (priv->book, gncOwnerTypeToQofIdType(owner_type), TRUE);
301 
302  priv->event_handler_id = qof_event_register_handler
303  ((QofEventHandler)gnc_tree_model_owner_event_handler, model);
304 
305  LEAVE("model %p", model);
306  return GTK_TREE_MODEL (model);
307 }
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:261
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:76
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Returns the QofIdType of the given GncOwnerType, or NULL if no suitable one exists.
Definition: gncOwner.c:213
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 335 of file gnc-tree-model-price.c.

337 {
338  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
339  g_return_val_if_fail (iter != NULL, NULL);
340  g_return_val_if_fail (iter->user_data != NULL, NULL);
341  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
342 
343  if (iter->user_data != ITER_IS_COMMODITY)
344  return NULL;
345  return (gnc_commodity *)iter->user_data2;
346 }
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 1249 of file gnc-tree-model-price.c.

1252 {
1253  gnc_commodity_namespace *name_space;
1254  GList *list;
1255  gint n;
1256 
1257  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
1258  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1259  g_return_val_if_fail ((commodity != NULL), FALSE);
1260  g_return_val_if_fail ((iter != NULL), FALSE);
1261 
1262  name_space = gnc_commodity_get_namespace_ds(commodity);
1263  if (name_space == NULL)
1264  {
1265  LEAVE("no namespace");
1266  return FALSE;
1267  }
1268 
1269  list = gnc_commodity_namespace_get_commodity_list(name_space);
1270  if (list == NULL)
1271  {
1272  LEAVE("empty list");
1273  return FALSE;
1274  }
1275 
1276  n = g_list_index(list, commodity);
1277  if (n == -1)
1278  {
1279  LEAVE("not in list");
1280  return FALSE;
1281  }
1282 
1283  iter->stamp = model->stamp;
1284  iter->user_data = ITER_IS_COMMODITY;
1285  iter->user_data2 = commodity;
1286  iter->user_data3 = GINT_TO_POINTER(n);
1287  LEAVE("iter %s", iter_to_string(model, iter));
1288  return TRUE;
1289 }
int stamp
The state of the model.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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 strucure for the specified commodity.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1297 of file gnc-tree-model-price.c.

1300 {
1302  gnc_commodity_table *ct;
1303  GList *list;
1304  gint n;
1305 
1306  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1307  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1308  g_return_val_if_fail ((name_space != NULL), FALSE);
1309  g_return_val_if_fail ((iter != NULL), FALSE);
1310 
1311  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
1312  ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
1314  if (list == NULL)
1315  return FALSE;
1316 
1317  n = g_list_index(list, name_space);
1318  if (n == -1)
1319  return FALSE;
1320 
1321  iter->stamp = model->stamp;
1322  iter->user_data = ITER_IS_NAMESPACE;
1323  iter->user_data2 = name_space;
1324  iter->user_data3 = GINT_TO_POINTER(n);
1325  LEAVE("iter %s", iter_to_string(model, iter));
1326  return TRUE;
1327 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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 1161 of file gnc-tree-model-price.c.

1164 {
1166  gnc_commodity *commodity;
1167  GList *list;
1168  gint n;
1169 
1170  ENTER("model %p, price %p, iter %p", model, price, iter);
1171  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1172  g_return_val_if_fail ((price != NULL), FALSE);
1173  g_return_val_if_fail ((iter != NULL), FALSE);
1174 
1175  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
1176  commodity = gnc_price_get_commodity(price);
1177  if (commodity == NULL)
1178  {
1179  LEAVE("no commodity");
1180  return FALSE;
1181  }
1182 
1183  list = gnc_pricedb_get_prices(priv->price_db, commodity, NULL);
1184  if (list == NULL)
1185  {
1186  LEAVE("empty list");
1187  return FALSE;
1188  }
1189 
1190  n = g_list_index(list, price);
1191  if (n == -1)
1192  {
1193  gnc_price_list_destroy(list);
1194  LEAVE("not in list");
1195  return FALSE;
1196  }
1197 
1198  iter->stamp = model->stamp;
1199  iter->user_data = ITER_IS_PRICE;
1200  iter->user_data2 = price;
1201  iter->user_data3 = GINT_TO_POINTER(n);
1202  gnc_price_list_destroy(list);
1203  LEAVE("iter %s", iter_to_string(model, iter));
1204  return TRUE;
1205 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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:1878

◆ 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 321 of file gnc-tree-model-price.c.

323 {
324  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
325  g_return_val_if_fail (iter != NULL, NULL);
326  g_return_val_if_fail (iter->user_data != NULL, NULL);
327  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
328 
329  if (iter->user_data != ITER_IS_NAMESPACE)
330  return NULL;
331  return (gnc_commodity_namespace *)iter->user_data2;
332 }
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 1213 of file gnc-tree-model-price.c.

1215 {
1216  GtkTreeIter tree_iter;
1217  GtkTreePath *tree_path;
1218 
1219  ENTER("model %p, price %p", model, price);
1220  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
1221  g_return_val_if_fail (price != NULL, NULL);
1222 
1223  if (!gnc_tree_model_price_get_iter_from_price (model, price, &tree_iter))
1224  {
1225  LEAVE("no iter");
1226  return NULL;
1227  }
1228 
1229  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1230  if (tree_path)
1231  {
1232  gchar *path_string = gtk_tree_path_to_string(tree_path);
1233  LEAVE("path (2) %s", path_string);
1234  g_free(path_string);
1235  }
1236  else
1237  {
1238  LEAVE("no path");
1239  }
1240  return tree_path;
1241 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 349 of file gnc-tree-model-price.c.

351 {
352  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
353  g_return_val_if_fail (iter != NULL, NULL);
354  g_return_val_if_fail (iter->user_data != NULL, NULL);
355  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
356 
357  if (iter->user_data != ITER_IS_PRICE)
358  return NULL;
359  return (GNCPrice *)iter->user_data2;
360 }
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.

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

142 {
143  static GType gnc_tree_model_price_type = 0;
144 
145  if (gnc_tree_model_price_type == 0)
146  {
147  static const GTypeInfo our_info =
148  {
149  sizeof (GncTreeModelPriceClass),
150  NULL,
151  NULL,
152  (GClassInitFunc) gnc_tree_model_price_class_init,
153  NULL,
154  NULL,
155  sizeof (GncTreeModelPrice),
156  0,
157  (GInstanceInitFunc) gnc_tree_model_price_init
158  };
159 
160  static const GInterfaceInfo tree_model_info =
161  {
162  (GInterfaceInitFunc) gnc_tree_model_price_tree_model_init,
163  NULL,
164  NULL
165  };
166 
167  gnc_tree_model_price_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
168  GNC_TREE_MODEL_PRICE_NAME,
169  &our_info, 0);
170 
171  g_type_add_interface_static (gnc_tree_model_price_type,
172  GTK_TYPE_TREE_MODEL,
173  &tree_model_info);
174  }
175 
176  return gnc_tree_model_price_type;
177 }
The class data structure for a price tree model.
The instance data structure for a price tree model.

◆ 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 297 of file gnc-tree-model-price.c.

299 {
300  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
301  g_return_val_if_fail (iter != NULL, FALSE);
302  g_return_val_if_fail (iter->user_data != NULL, FALSE);
303  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
304 
305  return (iter->user_data == ITER_IS_COMMODITY);
306 }
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 285 of file gnc-tree-model-price.c.

287 {
288  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
289  g_return_val_if_fail (iter != NULL, FALSE);
290  g_return_val_if_fail (iter->user_data != NULL, FALSE);
291  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
292 
293  return (iter->user_data == ITER_IS_NAMESPACE);
294 }
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 309 of file gnc-tree-model-price.c.

311 {
312  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
313  g_return_val_if_fail (iter != NULL, FALSE);
314  g_return_val_if_fail (iter->user_data != NULL, FALSE);
315  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
316 
317  return (iter->user_data == ITER_IS_PRICE);
318 }
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 252 of file gnc-tree-model-price.c.

253 {
254  GncTreeModelPrice *model;
256  const GList *item;
257 
258  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_PRICE_NAME);
259  for ( ; item; item = g_list_next(item))
260  {
261  model = (GncTreeModelPrice *)item->data;
262  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
263  if (priv->price_db == price_db)
264  {
265  g_object_ref(G_OBJECT(model));
266  LEAVE("returning existing model %p", model);
267  return GTK_TREE_MODEL(model);
268  }
269  }
270 
271  model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE,
272  NULL);
273 
274  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
275  priv->book = book;
276  priv->price_db = price_db;
277 
278  priv->event_handler_id =
279  qof_event_register_handler (gnc_tree_model_price_event_handler, model);
280 
281  return GTK_TREE_MODEL (model);
282 }
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.
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:76
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
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 1858 of file gnc-tree-view-account.c.

1864 {
1865  GtkCellRenderer *renderer;
1866  GtkTreeViewColumn *column;
1867 
1868  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (account_view), NULL);
1869 
1870  renderer = gtk_cell_renderer_text_new ();
1871  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1872 
1873  column = gtk_tree_view_column_new_with_attributes (column_title,
1874  renderer, NULL);
1875  if (col_edited_cb)
1876  {
1877  gtva_setup_column_renderer_edited_cb(account_view, column,
1878  renderer, col_edited_cb);
1879  }
1880  gtk_tree_view_column_set_cell_data_func (column, renderer,
1881  col_source_helper,
1882  col_source_cb, NULL);
1883  gnc_tree_view_append_column (GNC_TREE_VIEW(account_view), column);
1884  return column;
1885 }
gint gnc_tree_view_append_column(GncTreeView *view, GtkTreeViewColumn *column)
Add a column to a view based upon a GncTreeView.

◆ 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 1762 of file gnc-tree-view-account.c.

1765 {
1766  GtkCellRenderer *renderer;
1767  GtkTreeViewColumn *column;
1768 
1769  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1770  g_return_val_if_fail (propname != NULL, NULL);
1771 
1772  column = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), column_title,
1773  propname, NULL, "Sample text",
1774  -1, -1, NULL);
1775 
1776  /* This new kvp column has only had one renderer added to it so
1777  * far. Find that renderer. */
1778  renderer = gnc_tree_view_column_get_renderer(column);
1779  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1780 
1781  gtk_tree_view_column_set_cell_data_func (column, renderer,
1782  account_cell_property_data_func,
1783  g_strdup(propname), g_free);
1784  return column;
1785 }
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_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.
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...

◆ 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 1039 of file gnc-tree-view-account.c.

1041 {
1042  GtkTreeModel *s_model;
1043  GtkTreeIter s_iter;
1044  gint num_children;
1045 
1046  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1047 
1048  if (account == NULL)
1049  {
1050  LEAVE("no account");
1051  return 0;
1052  }
1053 
1054  if (!gnc_tree_view_account_get_iter_from_account (view, account, &s_iter))
1055  {
1056  LEAVE("view_get_iter_from_account failed");
1057  return 0;
1058  }
1059 
1060  /* Any children? */
1061  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1062  num_children = gtk_tree_model_iter_n_children(s_model, &s_iter);
1063  LEAVE("%d children", num_children);
1064  return num_children;
1065 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1629 of file gnc-tree-view-account.c.

1631 {
1632  GtkTreePath *path;
1633 
1634  g_return_if_fail(view != NULL);
1635  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1636  ENTER("view %p, account %p", view, account);
1637 
1638  path = gnc_tree_view_account_get_path_from_account(view, account);
1639  if (path)
1640  {
1641  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
1642  gtk_tree_path_free(path);
1643  }
1644  LEAVE(" ");
1645 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1269 of file gnc-tree-view-account.c.

1271 {
1272  GtkTreeModel *model, *f_model;
1273  GtkTreeIter iter, f_iter;
1274  Account *account;
1275 
1276  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
1277  g_return_val_if_fail (s_iter != NULL, NULL);
1278 
1279  ENTER("model %p, iter %p", s_model, s_iter);
1280 
1281  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
1282  &f_iter,
1283  s_iter);
1284  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1285  gtk_tree_model_filter_convert_iter_to_child_iter (
1286  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
1287  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1289  GNC_TREE_MODEL_ACCOUNT(model), &iter);
1290  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1291  return account;
1292 }
STRUCTS.
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1223 of file gnc-tree-view-account.c.

1225 {
1226  GtkTreeModel *model, *f_model, *s_model;
1227  GtkTreePath *path, *f_path;
1228  GtkTreeIter iter;
1229  Account *account;
1230 
1231  ENTER("view %p", view);
1232  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1233  g_return_val_if_fail (s_path != NULL, NULL);
1234 
1235  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1236  f_path = gtk_tree_model_sort_convert_path_to_child_path (
1237  GTK_TREE_MODEL_SORT (s_model), s_path);
1238  if (!f_path)
1239  {
1240  LEAVE("no filter path");
1241  return NULL;
1242  }
1243 
1244  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1245  path = gtk_tree_model_filter_convert_path_to_child_path (
1246  GTK_TREE_MODEL_FILTER (f_model), f_path);
1247  gtk_tree_path_free(f_path);
1248  if (!path)
1249  {
1250  LEAVE("no path");
1251  return NULL;
1252  }
1253 
1254  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1255  if (!gtk_tree_model_get_iter (model, &iter, path))
1256  {
1257  LEAVE("no iter");
1258  return NULL;
1259  }
1260 
1261  account = iter.user_data;
1262  gtk_tree_path_free(path);
1263  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1264  return account;
1265 }
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1652 of file gnc-tree-view-account.c.

1653 {
1654  GtkTreePath *s_path;
1655  Account *account;
1656 
1657  ENTER("view %p", view);
1658  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1659 
1660  gtk_tree_view_get_cursor (GTK_TREE_VIEW(view), &s_path, NULL);
1661  if (!s_path)
1662  {
1663  LEAVE("no account");
1664  return NULL;
1665  }
1666 
1667  account = gnc_tree_view_account_get_account_from_path (view, s_path);
1668  gtk_tree_path_free(s_path);
1669  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1670  return account;
1671 }
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1300 of file gnc-tree-view-account.c.

1301 {
1302  GtkTreeSelection *selection;
1303  GtkTreeModel *f_model, *s_model;
1304  GtkTreeIter iter, f_iter, s_iter;
1305  Account *account;
1306  GtkSelectionMode mode;
1307 
1308  ENTER("view %p", view);
1309  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1310 
1311  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1312  mode = gtk_tree_selection_get_mode(selection);
1313  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
1314  {
1315  return NULL;
1316  }
1317  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
1318  {
1319  LEAVE("no account, get_selected failed");
1320  return FALSE;
1321  }
1322 
1323  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
1324  &f_iter, &s_iter);
1325 
1326  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1327  gtk_tree_model_filter_convert_iter_to_child_iter (
1328  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
1329 
1330  account = iter.user_data;
1331  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1332  return account;
1333 }
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1458 of file gnc-tree-view-account.c.

1459 {
1460  GtkTreeSelection *selection;
1462 
1463  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1464 
1465  info.return_list = NULL;
1466  info.priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1467  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1468  gtk_tree_selection_selected_foreach(selection, get_selected_accounts_helper, &info);
1469  return info.return_list;
1470 }

◆ 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 1077 of file gnc-tree-view-account.c.

1079 {
1081 
1082  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1083  g_return_if_fail(avi != NULL);
1084 
1085  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1086 
1087  *avi = priv->avi;
1088 }

◆ 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 944 of file gnc-tree-view-account.c.

945 {
946  Account *root;
947 
948  root = gnc_book_get_root_account (gnc_get_current_book ());
949  return gnc_tree_view_account_new_with_root (root, show_root);
950 }
STRUCTS.
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 673 of file gnc-tree-view-account.c.

674 {
675  GncTreeView *view;
676  GtkTreeModel *model, *f_model, *s_model;
677  GtkTreePath *virtual_root_path = NULL;
678  const gchar *sample_type, *sample_commodity;
680  GtkTreeViewColumn *tax_info_column, *acc_color_column;
681  GtkCellRenderer *renderer;
682  GList *col_list = NULL, *node = NULL;
683 
684  ENTER(" ");
685  /* Create our view */
686  view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT,
687  "name", "account_tree", NULL);
688 
689  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(GNC_TREE_VIEW_ACCOUNT (view));
690 
691  /* Get the show_account_color value from gsettings */
692  priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_COLOR);
693 
694  /* Create/get a pointer to the existing model for this set of books. */
695  model = gnc_tree_model_account_new (root);
696 
697  /* Set up the view private filter layer on the common model. */
698  if (!show_root)
699  virtual_root_path = gtk_tree_path_new_first ();
700  f_model = gtk_tree_model_filter_new (model, virtual_root_path);
701  /* A GncTreeModelAccount is based on a GncTreeModel, which is a
702  * GObject that provides a GtkTreeModel interface. */
703  g_object_unref(G_OBJECT(model));
704  if (virtual_root_path)
705  gtk_tree_path_free(virtual_root_path);
706 
707  /* Set up the view private sort layer on the common model. */
708  s_model = gtk_tree_model_sort_new_with_model(f_model);
709  g_object_unref(G_OBJECT(f_model));
710  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
711  g_object_unref(G_OBJECT(s_model));
712 
713  /* Set default visibilities */
714  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
715 
717  sample_commodity = gnc_commodity_get_fullname(gnc_default_currency());
718 
719  priv->name_column
720  = gnc_tree_view_add_text_column(view, _("Account Name"), "name",
721  GNC_STOCK_ACCOUNT, "Expenses:Entertainment",
722  GNC_TREE_MODEL_ACCOUNT_COL_NAME,
723  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
724  sort_by_string);
725 
726  gnc_tree_view_add_text_column(view, _("Type"), "type", NULL, sample_type,
727  GNC_TREE_MODEL_ACCOUNT_COL_TYPE,
728  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
729  sort_by_string);
730 
731  gnc_tree_view_add_text_column(view, _("Commodity"), "commodity", NULL,
732  sample_commodity,
733  GNC_TREE_MODEL_ACCOUNT_COL_COMMODITY,
734  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
735  sort_by_string);
736  priv->code_column
737  = gnc_tree_view_add_text_column(view, _("Account Code"), "account-code", NULL,
738  "1-123-1234",
739  GNC_TREE_MODEL_ACCOUNT_COL_CODE,
740  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
741  sort_by_code);
742  priv->desc_column
743  = gnc_tree_view_add_text_column(view, _("Description"), "description", NULL,
744  "Sample account description.",
745  GNC_TREE_MODEL_ACCOUNT_COL_DESCRIPTION,
746  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
747  sort_by_string);
748 
749  gnc_tree_view_add_numeric_column(view, _("Last Num"), "lastnum", "12345",
750  GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM,
751  GNC_TREE_VIEW_COLUMN_COLOR_NONE,
752  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
753  sort_by_string);
754 
755  gnc_tree_view_add_numeric_column(view, _("Present"), "present",
756  SAMPLE_ACCOUNT_VALUE,
757  GNC_TREE_MODEL_ACCOUNT_COL_PRESENT,
758  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
759  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
760  sort_by_present_value);
761  priv->present_report_column
762  = gnc_tree_view_add_numeric_column(view, _("Present (Report)"), "present_report",
763  SAMPLE_ACCOUNT_VALUE,
764  GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT,
765  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
766  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
767  sort_by_present_value);
768 
769  gnc_tree_view_add_numeric_column(view, _("Balance"), "balance",
770  SAMPLE_ACCOUNT_VALUE,
771  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE,
772  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
773  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
774  sort_by_balance_value);
775  priv->balance_report_column
776  = gnc_tree_view_add_numeric_column(view, _("Balance (Report)"), "balance_report",
777  SAMPLE_ACCOUNT_VALUE,
778  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT,
779  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
780  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
781  sort_by_balance_value);
782 
783  gnc_tree_view_add_numeric_column(view, _("Balance (Period)"), "balance-period",
784  SAMPLE_ACCOUNT_VALUE,
785  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD,
786  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD,
787  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
788  sort_by_balance_period_value);
789 
790  gnc_tree_view_add_numeric_column(view, _("Cleared"), "cleared",
791  SAMPLE_ACCOUNT_VALUE,
792  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
793  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
794  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
795  sort_by_cleared_value);
796  priv->cleared_report_column
797  = gnc_tree_view_add_numeric_column(view, _("Cleared (Report)"), "cleared_report",
798  SAMPLE_ACCOUNT_VALUE,
799  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT,
800  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
801  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
802  sort_by_cleared_value);
803 
804  gnc_tree_view_add_numeric_column(view, _("Reconciled"), "reconciled",
805  SAMPLE_ACCOUNT_VALUE,
806  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
807  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
808  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
809  sort_by_reconciled_value);
810  priv->reconciled_report_column
811  = gnc_tree_view_add_numeric_column(view, _("Reconciled (Report)"), "reconciled_report",
812  SAMPLE_ACCOUNT_VALUE,
813  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT,
814  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
815  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
816  sort_by_reconciled_value);
817 
818  gnc_tree_view_add_text_column(view, _("Last Reconcile Date"), "last-recon-date", NULL,
819  "Last Reconcile Date",
820  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE,
821  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
822  sort_by_string);
823 
824  gnc_tree_view_add_numeric_column(view, _("Future Minimum"), "future_min",
825  SAMPLE_ACCOUNT_VALUE,
826  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN,
827  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
828  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
829  sort_by_future_min_value);
830  priv->future_min_report_column
831  = gnc_tree_view_add_numeric_column(view, _("Future Minimum (Report)"), "future_min_report",
832  SAMPLE_ACCOUNT_VALUE,
833  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT,
834  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
835  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
836  sort_by_future_min_value);
837 
838  gnc_tree_view_add_numeric_column(view, _("Total"), "total",
839  SAMPLE_ACCOUNT_VALUE,
840  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL,
841  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
842  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
843  sort_by_total_value);
844  priv->total_report_column
845  = gnc_tree_view_add_numeric_column(view, _("Total (Report)"), "total_report",
846  SAMPLE_ACCOUNT_VALUE,
847  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT,
848  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
849  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
850  sort_by_total_value);
851 
852  gnc_tree_view_add_numeric_column(view, _("Total (Period)"), "total-period",
853  SAMPLE_ACCOUNT_VALUE,
854  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD,
855  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD,
856  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
857  sort_by_total_period_value);
858 
859  /* Translators: The C is the column title and stands for Color, this should be one character */
860  acc_color_column
861  = gnc_tree_view_add_text_column(view, _("C"), "account-color", NULL,
862  "xx",
863  GNC_TREE_VIEW_COLUMN_DATA_NONE,
864  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
865  NULL);
866 
867  /* Add the full title to the object for menu creation */
868  g_object_set_data_full(G_OBJECT(acc_color_column), REAL_TITLE,
869  g_strdup(_("Account Color")), g_free);
870 
871  priv->notes_column
872  = gnc_tree_view_add_text_column(view, _("Notes"), "notes", NULL,
873  "Sample account notes.",
874  GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
875  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
876  sort_by_string);
877  tax_info_column
878  = gnc_tree_view_add_text_column(view, _("Tax Info"), "tax-info", NULL,
879  "Sample tax info.",
880  GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
881  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
882  sort_by_string);
883 
884  renderer = gnc_tree_view_column_get_renderer(tax_info_column);
885  gtk_tree_view_column_set_cell_data_func(tax_info_column,
886  renderer,
887  tax_info_data_func,
888  GTK_TREE_VIEW(view),
889  NULL);
890 
891  gnc_tree_view_add_toggle_column(view, _("Placeholder"),
892  /* Translators: This string has a context prefix; the translation
893  must only contain the part after the | character. */
894  Q_("Column letter for 'Placeholder'|P"),
895  "placeholder",
896  GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
897  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
898  sort_by_placeholder,
899  gnc_tree_view_account_placeholder_toggled);
900 
901  /* Add function to each column that optionally sets a background color for accounts */
902  col_list = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
903  for (node = col_list; node; node = node->next)
904  {
905  renderer = gnc_tree_view_column_get_renderer(node->data);
906  gtk_tree_view_column_set_cell_data_func(node->data,
907  renderer,
908  acc_color_data_func,
909  GTK_TREE_VIEW(view),
910  NULL);
911  }
912  g_list_free (col_list);
913 
914  /* Update column titles to use the currency name. */
915  gtva_update_column_names(view);
916 
917  /* By default only the first column is visible. */
919  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
920  gnc_tree_view_account_filter_helper,
921  view,
922  NULL);
923 
924  /* Default the sorting to account name */
925  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
926  GNC_TREE_MODEL_ACCOUNT_COL_NAME,
927  GTK_SORT_ASCENDING);
928 
929  /* Set account find-as-you-type search function */
930  gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(view), gnc_tree_view_search_compare, NULL, NULL);
931 
932  gtk_widget_show(GTK_WIDGET(view));
933  LEAVE("%p", view);
934  return GTK_TREE_VIEW(view);
935 }
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_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.
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:261
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
Definition: gnc-ui-util.c:1059
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...
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.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
Definition: gnc-prefs.c:196
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetTypeStr(GNCAccountType type)
The xaccAccountGetTypeStr() routine returns a string suitable for use in the GUI/Interface.
Definition: Account.c:4140
The Credit card account is used to denote credit (e.g.
Definition: Account.h:113

◆ 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 1189 of file gnc-tree-view-account.c.

1190 {
1191  GtkTreeModel *f_model, *s_model;
1192 
1193  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1194 
1195  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1196  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1197  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
1198 }

◆ 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 1557 of file gnc-tree-view-account.c.

1559 {
1560  GtkTreeModel *s_model;
1561  GtkTreeSelection *selection;
1562  GtkTreePath *sp_account, *sp_start, *sp_end;
1563  GtkTreeIter si_account, si_start, si_end;
1564  gboolean have_start, have_end;
1565  gint num_children;
1566 
1567  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1568 
1569  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1570 
1571  if (account == NULL)
1572  {
1573  LEAVE("no account");
1574  return;
1575  }
1576 
1577  if (!gnc_tree_view_account_get_iter_from_account (view, account, &si_account))
1578  {
1579  LEAVE("view_get_iter_from_account failed");
1580  return;
1581  }
1582 
1583  /* Any children? */
1584  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1585  num_children = gtk_tree_model_iter_n_children(s_model, &si_account);
1586  if (num_children == 0)
1587  {
1588  LEAVE("no children");
1589  return;
1590  }
1591 
1592  /* Expand the tree. Required for selection to work */
1593  sp_account = gtk_tree_model_get_path (s_model, &si_account);
1594  gtk_tree_view_expand_row (GTK_TREE_VIEW(view), sp_account, TRUE);
1595 
1596  /* compute start/end paths */
1597  have_start = gtk_tree_model_iter_nth_child(s_model, &si_start, &si_account, 0);
1598  si_end = si_account;
1599  while (num_children)
1600  {
1601  GtkTreeIter tmp_iter = si_end;
1602  have_end = gtk_tree_model_iter_nth_child(s_model, &si_end, &tmp_iter,
1603  num_children - 1);
1604  if (have_end)
1605  num_children = gtk_tree_model_iter_n_children(s_model, &si_end);
1606  else
1607  num_children = 0;
1608  }
1609 
1610  if (have_start && have_end)
1611  {
1612  sp_start = gtk_tree_model_get_path (s_model, &si_start);
1613  sp_end = gtk_tree_model_get_path (s_model, &si_end);
1614 
1615  /* select everything between */
1616  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1617  gtk_tree_selection_select_range (selection, sp_start, sp_end);
1618 
1619  /* clean up */
1620  gtk_tree_path_free(sp_start);
1621  gtk_tree_path_free(sp_end);
1622  }
1623  gtk_tree_path_free(sp_account);
1624  LEAVE(" ");
1625  return;
1626 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 1160 of file gnc-tree-view-account.c.

1164 {
1166 
1167  ENTER("view %p, filter func %p, data %p, destroy %p",
1168  view, func, data, destroy);
1169 
1170  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1171 
1172  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1173  if (priv->filter_destroy)
1174  {
1175  priv->filter_destroy(priv->filter_data);
1176  }
1177  priv->filter_destroy = destroy;
1178  priv->filter_data = data;
1179  priv->filter_fn = func;
1180 
1182  LEAVE(" ");
1183 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 entitre 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 1340 of file gnc-tree-view-account.c.

1342 {
1343  GtkTreeModel *model, *f_model, *s_model;
1344  GtkTreePath *path, *f_path, *s_path, *parent_path;
1345  GtkTreeSelection *selection;
1346 
1347  ENTER("view %p, account %p (%s)", view,
1348  account, xaccAccountGetName (account));
1349  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1350 
1351  /* Clear any existing selection. */
1352  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1353  gtk_tree_selection_unselect_all (selection);
1354 
1355  if (account == NULL)
1356  return;
1357 
1358  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1359  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1360  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1361 
1363  GNC_TREE_MODEL_ACCOUNT(model), account);
1364  if (path == NULL)
1365  {
1366  LEAVE("no path");
1367  return;
1368  }
1369  debug_path(DEBUG, path);
1370 
1371  f_path = gtk_tree_model_filter_convert_child_path_to_path (
1372  GTK_TREE_MODEL_FILTER (f_model), path);
1373  gtk_tree_path_free(path);
1374  if (f_path == NULL)
1375  {
1376  LEAVE("no filter path");
1377  return;
1378  }
1379  debug_path(DEBUG, f_path);
1380 
1381  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1382  f_path);
1383  gtk_tree_path_free(f_path);
1384  if (s_path == NULL)
1385  {
1386  LEAVE("no sort path");
1387  return;
1388  }
1389 
1390  /* gtk_tree_view requires that a row be visible before it can be selected */
1391  parent_path = gtk_tree_path_copy (s_path);
1392  if (gtk_tree_path_up (parent_path))
1393  {
1394  /* This function is misnamed. It expands the actual item
1395  * specified, not the path to the item specified. I.E. It expands
1396  * one level too many, thus the get of the parent. */
1397  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1398  }
1399  gtk_tree_path_free(parent_path);
1400 
1401  gtk_tree_selection_select_path (selection, s_path);
1402 
1403  /* give gtk+ a chance to resize the tree view first by handling pending
1404  * configure events */
1405  while (gtk_events_pending ())
1406  gtk_main_iteration ();
1407  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1408  debug_path(LEAVE, s_path);
1409  gtk_tree_path_free(s_path);
1410 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:255
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.c:3032

◆ 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 entitre 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 1477 of file gnc-tree-view-account.c.

1480 {
1481  GtkTreeModel *model, *f_model, *s_model;
1482  GtkTreePath *path, *f_path, *s_path, *parent_path;
1483  GtkTreeSelection *selection;
1484  GList *element;
1485  Account *account;
1486 
1487  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1488 
1489  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1490  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1491  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1492 
1493  /* Clear any existing selection. */
1494  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1495  gtk_tree_selection_unselect_all (selection);
1496  gtk_tree_view_collapse_all (GTK_TREE_VIEW(view));
1497 
1498  /* Now go select what the user requested. */
1499  for (element = account_list; element; )
1500  {
1501  account = element->data;
1502  element = g_list_next(element);
1503 
1504  if (account == NULL)
1505  {
1506  /*
1507  * Oops. Someone must have deleted this account and not cleaned
1508  * up all references to it.
1509  */
1510  continue;
1511  }
1512 
1513  path = gnc_tree_model_account_get_path_from_account (GNC_TREE_MODEL_ACCOUNT(model), account);
1514  if (path == NULL)
1515  {
1516  /*
1517  * Oops. Someone must have deleted this account and not cleaned
1518  * up all references to it.
1519  */
1520  continue;
1521  }
1522 
1523  f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
1524  path);
1525  gtk_tree_path_free(path);
1526  if (f_path == NULL)
1527  continue;
1528 
1529  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1530  f_path);
1531  gtk_tree_path_free(f_path);
1532  if (s_path == NULL)
1533  continue;
1534 
1535  /* gtk_tree_view requires that a row be visible before it can be selected */
1536  parent_path = gtk_tree_path_copy (s_path);
1537  if (gtk_tree_path_up (parent_path))
1538  {
1539  /* This function is misnamed. It expands the actual item
1540  * specified, not the path to the item specified. I.E. It
1541  * expands one level too many, thus the get of the parent. */
1542  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1543  }
1544  gtk_tree_path_free(parent_path);
1545 
1546  gtk_tree_selection_select_path (selection, s_path);
1547  if (show_last && (element == NULL))
1548  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1549  gtk_tree_path_free(s_path);
1550  }
1551 }
STRUCTS.
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 1105 of file gnc-tree-view-account.c.

1107 {
1109  gint i;
1110  guint sel_bits = 0;
1111 
1112  ENTER("%p", account_view);
1113  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1114  g_return_if_fail(avi != NULL);
1115 
1116  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1117  priv->avi = *avi;
1118 
1119  for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
1120  {
1121  sel_bits |= avi->include_type[i] ? (1 << i) : 0;
1122  }
1123 
1125  account_view, gnc_tree_view_account_filter_by_view_info,
1126  &priv->avi, NULL);
1127 
1128  LEAVE(" ");
1129 }
stop here; the following types just aren&#39;t ready for prime time
Definition: Account.h:161
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 avalible 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 645 of file gnc-tree-view-commodity.c.

646 {
647  GtkTreeSelection *selection;
648  GtkTreeModel *model, *f_model, *s_model;
649  GtkTreeIter iter, f_iter, s_iter;
650  gnc_commodity *commodity;
651 
652  g_return_val_if_fail (GNC_IS_TREE_VIEW_COMMODITY (view), NULL);
653 
654  ENTER("view %p", view);
655 
656  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
657  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
658  {
659  LEAVE("no commodity, get_selected failed");
660  return FALSE;
661  }
662 
663  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
664  &f_iter, &s_iter);
665 
666  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
667  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
668  &iter, &f_iter);
669 
670  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
671  commodity = gnc_tree_model_commodity_get_commodity (GNC_TREE_MODEL_COMMODITY(model),
672  &iter);
673  LEAVE("commodity %p (%s)", commodity,
674  commodity ? gnc_commodity_get_mnemonic(commodity) : "");
675  return commodity;
676 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 350 of file gnc-tree-view-commodity.c.

353 {
354  GncTreeView *view;
355  GtkTreeModel *model, *f_model, *s_model;
356  GtkTreeViewColumn *col;
357  gnc_commodity_table *ct;
358  va_list var_args;
359 
360  ENTER(" ");
361  /* Create/get a pointer to the existing model for this set of books. */
362  ct = gnc_commodity_table_get_table (book);
363  model = gnc_tree_model_commodity_new (book, ct);
364 
365  /* Set up the view private filter on the common model. */
366  f_model = gtk_tree_model_filter_new (model, NULL);
367  g_object_unref(G_OBJECT(model));
368  s_model = gtk_tree_model_sort_new_with_model (f_model);
369  g_object_unref(G_OBJECT(f_model));
370 
371  /* Create our view */
372  view = g_object_new (GNC_TYPE_TREE_VIEW_COMMODITY,
373  "name", "commodity_tree", NULL);
374  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
375  g_object_unref(G_OBJECT(s_model));
376 
377  DEBUG("model ref count is %d", G_OBJECT(model)->ref_count);
378  DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
379  DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);
380 
381  /* Set default visibilities */
382  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
383 
385  view, _("Namespace"), "namespace", NULL, "NASDAQ",
386  GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE,
387  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
388  sort_by_commodity_string);
390  view, _("Symbol"), "symbol", NULL, "ACMEACME",
391  GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC,
392  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
393  sort_by_commodity_string);
394  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
396  view, _("Name"), "name", NULL, "Acme Corporation, Inc.",
397  GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
398  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
399  sort_by_commodity_string);
400  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
402  view, _("Print Name"), "printname", NULL,
403  "ACMEACME (Acme Corporation, Inc.)",
404  GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
405  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
406  sort_by_commodity_string);
408  view, _("Display symbol"), "user_symbol", NULL, "ACME",
409  GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL,
410  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
411  sort_by_commodity_string);
412  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
414  view, _("Unique Name"), "uniquename", NULL,
415  "NASDAQ::ACMEACME", GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
416  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
417  sort_by_commodity_string);
419  /* Translators: Again replace CUSIP by the name of your
420  National Securities Identifying Number. */
421  view, _("ISIN/CUSIP"), "cusip_code", NULL, "QWERTYUIOP",
422  GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
423  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
424  sort_by_commodity_string);
425  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
427  view, _("Fraction"), "fraction", "10000",
428  GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
429  GNC_TREE_VIEW_COLUMN_COLOR_NONE,
430  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
431  sort_by_fraction);
432  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
434  view, _("Get Quotes"),
435  /* Translators: This string has a context prefix; the translation
436  must only contain the part after the | character. */
437  Q_("Column letter for 'Get Quotes'|Q"), "quote_flag",
438  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
439  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
440  sort_by_quote_flag,
441  NULL);
443  view, _("Source"), "quote_source", NULL, "yahoo",
444  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,
445  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
446  sort_by_commodity_string);
448  view, _("Timezone"), "quote_timezone", NULL, "America/New_York",
449  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
450  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
451  sort_by_commodity_string);
452  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
453 
455 
456  /* Set properties */
457  va_start (var_args, first_property_name);
458  g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
459  va_end (var_args);
460 
461  /* Sort on the name column by default. This allows for a consistent
462  * sort if commodities are briefly removed and re-added. */
463  if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
464  NULL, NULL))
465  {
466  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
467  GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
468  GTK_SORT_ASCENDING);
469  }
470 
471  gtk_widget_show(GTK_WIDGET(view));
472  LEAVE(" %p", view);
473  return GTK_TREE_VIEW(view);
474 }
gnc_commodity_table * gnc_commodity_table_get_table(QofBook *book)
Returns the commodity table associated with a book.
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_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 DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:255
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:261
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.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 622 of file gnc-tree-view-commodity.c.

623 {
624  GtkTreeModel *f_model, *s_model;
625 
626  g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));
627 
628  ENTER("view %p", view);
629  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
630  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
631  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
632  LEAVE(" ");
633 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 wil 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 584 of file gnc-tree-view-commodity.c.

589 {
590  GtkTreeModel *f_model, *s_model;
591  filter_user_data *fd = data;
592 
593  g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));
594  g_return_if_fail((ns_func != NULL) || (cm_func != NULL));
595 
596  ENTER("view %p, ns func %p, cm func %p, data %p, destroy %p",
597  view, ns_func, cm_func, data, destroy);
598 
599  fd = g_malloc(sizeof(filter_user_data));
600  fd->user_ns_fn = ns_func;
601  fd->user_cm_fn = cm_func;
602  fd->user_data = data;
603  fd->user_destroy = destroy;
604 
605  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
606  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
607  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
608  gnc_tree_view_commodity_filter_helper,
609  fd,
610  gnc_tree_view_commodity_filter_destroy);
611 
612  /* Whack any existing levels. The top two levels have been created
613  * before this routine can be called. */
614  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
615  LEAVE(" ");
616 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 752 of file gnc-tree-view-owner.c.

754 {
755  GtkTreeModel *model, *f_model;
756  GtkTreeIter iter, f_iter;
757  GncOwner *owner;
758 
759  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
760  g_return_val_if_fail (s_iter != NULL, NULL);
761 
762  ENTER("model %p, iter %p", s_model, s_iter);
763 
764  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
765  &f_iter,
766  s_iter);
767  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
768  gtk_tree_model_filter_convert_iter_to_child_iter (
769  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
770  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
772  GNC_TREE_MODEL_OWNER(model), &iter);
773  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
774  return owner;
775 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 706 of file gnc-tree-view-owner.c.

708 {
709  GtkTreeModel *model, *f_model, *s_model;
710  GtkTreePath *path, *f_path;
711  GtkTreeIter iter;
712  GncOwner *owner;
713 
714  ENTER("view %p", view);
715  g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
716  g_return_val_if_fail (s_path != NULL, NULL);
717 
718  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
719  f_path = gtk_tree_model_sort_convert_path_to_child_path (
720  GTK_TREE_MODEL_SORT (s_model), s_path);
721  if (!f_path)
722  {
723  LEAVE("no filter path");
724  return NULL;
725  }
726 
727  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
728  path = gtk_tree_model_filter_convert_path_to_child_path (
729  GTK_TREE_MODEL_FILTER (f_model), f_path);
730  gtk_tree_path_free(f_path);
731  if (!path)
732  {
733  LEAVE("no path");
734  return NULL;
735  }
736 
737  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
738  if (!gtk_tree_model_get_iter (model, &iter, path))
739  {
740  LEAVE("no iter");
741  return NULL;
742  }
743 
744  owner = iter.user_data;
745  gtk_tree_path_free(path);
746  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
747  return owner;
748 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 783 of file gnc-tree-view-owner.c.

784 {
785  GtkTreeSelection *selection;
786  GtkTreeModel *f_model, *s_model;
787  GtkTreeIter iter, f_iter, s_iter;
788  GncOwner *owner;
789  GtkSelectionMode mode;
790 
791  ENTER("view %p", view);
792  g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
793 
794  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
795  mode = gtk_tree_selection_get_mode(selection);
796  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
797  {
798  return NULL;
799  }
800  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
801  {
802  LEAVE("no owner, get_selected failed");
803  return FALSE;
804  }
805 
806  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
807  &f_iter, &s_iter);
808 
809  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
810  gtk_tree_model_filter_convert_iter_to_child_iter (
811  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
812 
813  owner = iter.user_data;
814  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
815  return owner;
816 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 361 of file gnc-tree-view-owner.c.

362 {
363  GncTreeView *view;
364  GtkTreeModel *model, *f_model, *s_model;
365  const gchar *sample_type, *sample_currency;
366  const gchar *owner_name = NULL, * owner_id = NULL;
368 
369  ENTER(" ");
370 
371  switch (owner_type)
372  {
373  case GNC_OWNER_NONE :
374  case GNC_OWNER_UNDEFINED :
375  PWARN("missing owner_type");
376  owner_name = _("Name");
377  owner_id = _("ID #");
378  break;
379  case GNC_OWNER_CUSTOMER :
380  owner_name = _("Company Name");
381  owner_id = _("Customer Number");
382  break;
383  case GNC_OWNER_JOB :
384  owner_name = _("Job Name");
385  owner_id = _("Job Number");
386  break;
387  case GNC_OWNER_VENDOR :
388  owner_name = _("Company Name");
389  owner_id = _("Vendor Number");
390  break;
391  case GNC_OWNER_EMPLOYEE :
392  owner_name = _("Employee Name");
393  owner_id = _("Employee Number");
394  break;
395  }
396  /* Create our view */
397  view = g_object_new (GNC_TYPE_TREE_VIEW_OWNER,
398  "name", "owner_tree", NULL);
399 
400  priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(GNC_TREE_VIEW_OWNER (view));
401 
402  /* Create/get a pointer to the existing model for this set of books. */
403  model = gnc_tree_model_owner_new (owner_type);
404 
405  /* Set up the view private filter layer on the common model. */
406  f_model = gtk_tree_model_filter_new (model, NULL);
407  /* A GncTreeModelOwner is based on a GncTreeModel, which is a
408  * GObject that provides a GtkTreeModel interface. */
409  g_object_unref(G_OBJECT(model));
410 
411  /* Set up the view private sort layer on the common model. */
412  s_model = gtk_tree_model_sort_new_with_model(f_model);
413  g_object_unref(G_OBJECT(f_model));
414  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
415  g_object_unref(G_OBJECT(s_model));
416 
417  /* Set default visibilities */
418  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
419 
420  sample_type = gncOwnerTypeToQofIdType (GNC_OWNER_CUSTOMER);
422 
423  priv->name_column
424  = gnc_tree_view_add_text_column(view, owner_name, GNC_OWNER_TREE_NAME_COL,
425  NULL, "GnuCash Inc.",
426  GNC_TREE_MODEL_OWNER_COL_NAME,
427  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
428  sort_by_string);
429  gnc_tree_view_add_text_column(view, _("Type"), GNC_OWNER_TREE_TYPE_COL,
430  NULL, sample_type,
431  GNC_TREE_MODEL_OWNER_COL_TYPE,
432  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
433  sort_by_string);
434  priv->id_column
435  = gnc_tree_view_add_text_column(view, owner_id, GNC_OWNER_TREE_ID_COL,
436  NULL, "1-123-1234",
437  GNC_TREE_MODEL_OWNER_COL_ID,
438  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
439  sort_by_string);
440  gnc_tree_view_add_text_column(view, _("Currency"), GNC_OWNER_TREE_CURRENCY_COL,
441  NULL, sample_currency,
442  GNC_TREE_MODEL_OWNER_COL_CURRENCY,
443  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
444  sort_by_string);
445  gnc_tree_view_add_text_column(view, _("Address Name"), GNC_OWNER_TREE_ADDRESS_NAME_COL,
446  NULL, "GnuCash Inc.",
447  GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME,
448  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
449  sort_by_string);
450  gnc_tree_view_add_text_column(view, _("Address 1"), GNC_OWNER_TREE_ADDRESS_1_COL,
451  NULL, "Free Software Foundation",
452  GNC_TREE_MODEL_OWNER_COL_ADDRESS_1,
453  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
454  sort_by_string);
455  gnc_tree_view_add_text_column(view, _("Address 2"), GNC_OWNER_TREE_ADDRESS_2_COL,
456  NULL, "51 Franklin Street, Fifth Floor",
457  GNC_TREE_MODEL_OWNER_COL_ADDRESS_2,
458  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
459  sort_by_string);
460  gnc_tree_view_add_text_column(view, _("Address 3"), GNC_OWNER_TREE_ADDRESS_3_COL,
461  NULL, "Boston, MA 02110-1301",
462  GNC_TREE_MODEL_OWNER_COL_ADDRESS_3,
463  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
464  sort_by_string);
465  gnc_tree_view_add_text_column(view, _("Address 4"), GNC_OWNER_TREE_ADDRESS_4_COL,
466  NULL, "USA",
467  GNC_TREE_MODEL_OWNER_COL_ADDRESS_4,
468  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
469  sort_by_string);
470  gnc_tree_view_add_text_column(view, _("Phone"), GNC_OWNER_TREE_PHONE_COL,
471  NULL, "+1-617-542-5942",
472  GNC_TREE_MODEL_OWNER_COL_PHONE,
473  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
474  sort_by_string);
475  gnc_tree_view_add_text_column(view, _("Fax"), GNC_OWNER_TREE_FAX_COL,
476  NULL, "+1-617-542-2652",
477  GNC_TREE_MODEL_OWNER_COL_FAX,
478  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
479  sort_by_string);
480  gnc_tree_view_add_text_column(view, _("E-mail"), GNC_OWNER_TREE_EMAIL_COL,
481  NULL, "gnu@gnu.org",
482  GNC_TREE_MODEL_OWNER_COL_EMAIL,
483  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
484  sort_by_string);
485  gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_COL,
486  SAMPLE_OWNER_VALUE,
487  GNC_TREE_MODEL_OWNER_COL_BALANCE,
488  GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
489  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
490  sort_by_balance_value);
491 
492  priv->balance_report_column
493  = gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_REPORT_COL,
494  SAMPLE_OWNER_VALUE,
495  GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT,
496  GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
497  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
498  sort_by_balance_value);
499 
500  priv->notes_column
501  = gnc_tree_view_add_text_column(view, _("Notes"), GNC_OWNER_TREE_NOTES_COL, NULL,
502  "Sample owner notes.",
503  GNC_TREE_MODEL_OWNER_COL_NOTES,
504  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
505  sort_by_string);
506  gnc_tree_view_add_toggle_column (view, _("Active"),
507  /* Translators: This string has a context prefix; the translation
508  must only contain the part after the | character. */
509  Q_("Column letter for 'Active'|A"),
510  GNC_OWNER_TREE_ACTIVE_COL,
511  GNC_TREE_MODEL_OWNER_COL_ACTIVE,
512  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
513  sort_by_boolean,
514  gnc_tree_view_owner_active_toggled);
515 
516  /* Update column titles to use the currency name. */
517  gtvo_update_column_names(view);
518 
519  /* By default only the first column is visible. */
521  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
522  gnc_tree_view_owner_filter_helper,
523  view,
524  NULL);
525 
526  /* Default the sorting to owner name */
527  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
528  GNC_TREE_MODEL_OWNER_COL_NAME,
529  GTK_SORT_ASCENDING);
530 
531  gtk_widget_show(GTK_WIDGET(view));
532  LEAVE("%p", view);
533  return GTK_TREE_VIEW(view);
534 }
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_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.
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:261
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
Definition: gnc-ui-util.c:1059
#define PWARN(format, args...)
Log a warning.
Definition: qoflog.h:243
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:213
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 686 of file gnc-tree-view-owner.c.

687 {
688  GtkTreeModel *f_model, *s_model;
689 
690  g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
691 
692  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
693  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
694  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
695 }

◆ 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 657 of file gnc-tree-view-owner.c.

661 {
663 
664  ENTER("view %p, filter func %p, data %p, destroy %p",
665  view, func, data, destroy);
666 
667  g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
668 
669  priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
670  if (priv->filter_destroy)
671  {
672  priv->filter_destroy(priv->filter_data);
673  }
674  priv->filter_destroy = destroy;
675  priv->filter_data = data;
676  priv->filter_fn = func;
677 
679  LEAVE(" ");
680 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 entitre 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 823 of file gnc-tree-view-owner.c.

825 {
826  GtkTreeModel *model, *f_model, *s_model;
827  GtkTreePath *path, *f_path, *s_path;
828  GtkTreeSelection *selection;
829 
830  ENTER("view %p, owner %p (%s)", view,
831  owner, gncOwnerGetName (owner));
832  g_return_if_fail (GNC_IS_TREE_VIEW_OWNER (view));
833 
834  /* Clear any existing selection. */
835  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
836  gtk_tree_selection_unselect_all (selection);
837 
838  if (owner == NULL)
839  return;
840 
841  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
842  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
843  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
844 
846  GNC_TREE_MODEL_OWNER(model), owner);
847  if (path == NULL)
848  {
849  LEAVE("no path");
850  return;
851  }
852  debug_path(DEBUG, path);
853 
854  f_path = gtk_tree_model_filter_convert_child_path_to_path (
855  GTK_TREE_MODEL_FILTER (f_model), path);
856  gtk_tree_path_free(path);
857  if (f_path == NULL)
858  {
859  LEAVE("no filter path");
860  return;
861  }
862  debug_path(DEBUG, f_path);
863 
864  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
865  f_path);
866  gtk_tree_path_free(f_path);
867  if (s_path == NULL)
868  {
869  LEAVE("no sort path");
870  return;
871  }
872 
873  gtk_tree_selection_select_path (selection, s_path);
874 
875  /* give gtk+ a chance to resize the tree view first by handling pending
876  * configure events */
877  while (gtk_events_pending ())
878  gtk_main_iteration ();
879  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
880  debug_path(LEAVE, s_path);
881  gtk_tree_path_free(s_path);
882 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:255
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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_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 656 of file gnc-tree-view-price.c.

657 {
658  GtkTreeSelection *selection;
659  GtkTreeModel *model, *f_model, *s_model;
660  GtkTreeIter iter, f_iter, s_iter;
661  GNCPrice *price;
662 
663  ENTER("view %p", view);
664  g_return_val_if_fail (GNC_IS_TREE_VIEW_PRICE (view), NULL);
665 
666  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
667  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
668  {
669  LEAVE("no price, get_selected failed");
670  return FALSE;
671  }
672 
673  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
674  &f_iter, &s_iter);
675 
676  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
677  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
678  &iter, &f_iter);
679 
680  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
681  price = gnc_tree_model_price_get_price (GNC_TREE_MODEL_PRICE(model),
682  &iter);
683  LEAVE("price %p", price);
684  return price;
685 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 794 of file gnc-tree-view-price.c.

795 {
796  GtkTreeSelection *selection;
797  GList *return_list = NULL;
798 
799  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
800  gtk_tree_selection_selected_foreach(selection, get_selected_prices_helper, &return_list);
801  return return_list;
802 }

◆ 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 388 of file gnc-tree-view-price.c.

391 {
392  GncTreeView *view;
393  GtkTreeModel *model, *f_model, *s_model;
394  GtkTreeViewColumn *col;
395  GNCPriceDB *price_db;
396  va_list var_args;
397  const gchar *sample_text;
398  gchar *sample_text2;
399 
400  ENTER(" ");
401  /* Create/get a pointer to the existing model for this set of books. */
402  price_db = gnc_pricedb_get_db(book);
403  model = gnc_tree_model_price_new (book, price_db);
404 
405  /* Set up the view private filter on the common model. */
406  f_model = gtk_tree_model_filter_new (model, NULL);
407  g_object_unref(G_OBJECT(model));
408  s_model = gtk_tree_model_sort_new_with_model (f_model);
409  g_object_unref(G_OBJECT(f_model));
410 
411  /* Create our view */
412  view = g_object_new (GNC_TYPE_TREE_VIEW_PRICE,
413  "name", "price_tree", NULL);
414  gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
415  g_object_unref(G_OBJECT(s_model));
416 
417  DEBUG("model ref count is %d", G_OBJECT(model)->ref_count);
418  DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
419  DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);
420 
422  sample_text2 = g_strdup_printf("%s%s", sample_text, sample_text);
424  view, _("Security"), "security", NULL, sample_text2,
425  GNC_TREE_MODEL_PRICE_COL_COMMODITY,
426  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
427  sort_by_name);
428  g_free(sample_text2);
430  view, _("Currency"), "currency", NULL, sample_text,
431  GNC_TREE_MODEL_PRICE_COL_CURRENCY,
432  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
433  sort_by_name);
434  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
436  view, _("Date"), "date", NULL, "2005-05-20",
437  GNC_TREE_MODEL_PRICE_COL_DATE,
438  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
439  sort_by_date);
440  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
442  view, _("Source"), "source", NULL, "Finance::Quote",
443  GNC_TREE_MODEL_PRICE_COL_SOURCE,
444  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
445  sort_by_source);
446  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
448  view, _("Type"), "type", NULL, "last",
449  GNC_TREE_MODEL_PRICE_COL_TYPE,
450  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
451  sort_by_type);
452  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
454  view, _("Price"), "price", "100.00000",
455  GNC_TREE_MODEL_PRICE_COL_VALUE,
456  GNC_TREE_VIEW_COLUMN_COLOR_NONE,
457  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
458  sort_by_value);
459  g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
460 
462 
463  /* Set properties */
464  va_start (var_args, first_property_name);
465  g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
466  va_end (var_args);
467 
468  /* Sort on the commodity column by default. This allows for a consistent
469  * sort if commodities are removed and re-added from the model. */
470  if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
471  NULL, NULL))
472  {
473  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
474  GNC_TREE_MODEL_PRICE_COL_COMMODITY,
475  GTK_SORT_ASCENDING);
476  }
477 
478  gtk_widget_show(GTK_WIDGET(view));
479  LEAVE(" %p", view);
480  return GTK_TREE_VIEW(view);
481 }
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_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 DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:255
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:261
GNCPriceDB * gnc_pricedb_get_db(QofBook *book)
Return the pricedb associated with the book.
Definition: gnc-pricedb.c:961
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
Definition: gnc-ui-util.c:1059
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.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 entitre 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 692 of file gnc-tree-view-price.c.

694 {
695  GtkTreeModel *model, *f_model, *s_model;
696  GtkTreePath *path, *f_path, *s_path, *parent_path;
697  GtkTreeSelection *selection;
698 
699  ENTER("view %p, price %p", view, price);
700 
701  /* Clear any existing selection. */
702  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
703  gtk_tree_selection_unselect_all (selection);
704 
705  if (price == NULL)
706  return;
707 
708  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
709  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
710  model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));
711 
712  path = gnc_tree_model_price_get_path_from_price (GNC_TREE_MODEL_PRICE(model), price);
713  if (path == NULL)
714  {
715  LEAVE("get_path_from_price failed");
716  return;
717  }
718  debug_path(DEBUG, path);
719 
720  f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
721  path);
722  gtk_tree_path_free(path);
723  if (f_path == NULL)
724  {
725  LEAVE("no filter path");
726  return;
727  }
728  debug_path(DEBUG, f_path);
729 
730  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
731  f_path);
732  gtk_tree_path_free(f_path);
733  if (s_path == NULL)
734  {
735  LEAVE("no sort path");
736  return;
737  }
738 
739  /* gtk_tree_view requires that a row be visible before it can be selected */
740  parent_path = gtk_tree_path_copy (s_path);
741  if (gtk_tree_path_up (parent_path))
742  {
743  /* This function is misnamed. It expands the actual item
744  * specified, not the path to the item specified. I.E. It expands
745  * one level too many, thus the get of the parent. */
746  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
747  }
748  gtk_tree_path_free(parent_path);
749 
750  gtk_tree_selection_select_path (selection, s_path);
751  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
752  debug_path(LEAVE, s_path);
753  gtk_tree_path_free(s_path);
754 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:255
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 2021 of file gnc-tree-view-account.c.

2023 {
2024  g_return_if_fail(GTK_IS_BUTTON(button));
2025 
2026  ENTER("button %p", button);
2027  fd->visible_types = 0;
2028  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2029  gnc_tree_view_account_refilter(fd->tree_view);
2030  LEAVE("types 0x%x", fd->visible_types);
2031 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 2135 of file gnc-tree-view-account.c.

2138 {
2139  gpointer gptemp;
2140 
2141  g_return_if_fail(GTK_IS_DIALOG(dialog));
2142 
2143  ENTER("dialog %p, response %d", dialog, response);
2144 
2145  if (response != GTK_RESPONSE_OK)
2146  {
2147  fd->visible_types = fd->original_visible_types;
2148  fd->show_hidden = fd->original_show_hidden;
2149  fd->show_zero_total = fd->original_show_zero_total;
2150  fd->show_unused = fd->original_show_unused;
2151  gnc_tree_view_account_refilter(fd->tree_view);
2152  }
2153 
2154  /* Clean up and delete dialog */
2155  gptemp = (gpointer *)fd->dialog;
2156  g_atomic_pointer_compare_and_exchange(&gptemp,
2157  dialog, NULL);
2158  fd->dialog = gptemp;
2159  gtk_widget_destroy(dialog);
2160  LEAVE("types 0x%x", fd->visible_types);
2161 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 2040 of file gnc-tree-view-account.c.

2042 {
2043  g_return_if_fail(GTK_IS_BUTTON(button));
2044 
2045  ENTER("button %p", button);
2046  fd->visible_types = -1;
2047  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2048  gnc_tree_view_account_refilter(fd->tree_view);
2049  LEAVE("types 0x%x", fd->visible_types);
2050 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 2060 of file gnc-tree-view-account.c.

2062 {
2063  ENTER("button %p", button);
2064  gppat_filter_select_all_cb(button, fd);
2065  LEAVE(" ");
2066 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1963 of file gnc-tree-view-account.c.

1965 {
1966  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1967 
1968  ENTER("button %p", button);
1969  fd->show_hidden = gtk_toggle_button_get_active(button);
1970  gnc_tree_view_account_refilter(fd->tree_view);
1971  LEAVE("show_hidden %d", fd->show_hidden);
1972 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 2001 of file gnc-tree-view-account.c.

2003 {
2004  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2005 
2006  ENTER("button %p", button);
2007  fd->show_unused = gtk_toggle_button_get_active(button);
2008  gnc_tree_view_account_refilter(fd->tree_view);
2009  LEAVE("show_unused %d", fd->show_unused);
2010 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 1982 of file gnc-tree-view-account.c.

1984 {
1985  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1986 
1987  ENTER("button %p", button);
1988  fd->show_zero_total = gtk_toggle_button_get_active(button);
1989  gnc_tree_view_account_refilter(fd->tree_view);
1990  LEAVE("show_zero %d", fd->show_zero_total);
1991 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:261
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:271

◆ 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 1155 of file gnc-tree-view-owner.c.

1158 {
1159  gpointer gptemp;
1160 
1161  g_return_if_fail(GTK_IS_DIALOG(dialog));
1162 
1163  ENTER("dialog %p, response %d", dialog, response);
1164 
1165  if (response != GTK_RESPONSE_OK)
1166  {
1167  fd->show_inactive = fd->original_show_inactive;
1168  fd->show_zero_total = fd->original_show_zero_total;
1169  gnc_tree_view_owner_refilter(fd->tree_view);
1170  }
1171 
1172  /* Clean up and delete dialog */
1173  gptemp = (gpointer *)fd->dialog;
1174  g_atomic_pointer_compare_and_exchange(&gptemp,
1175  dialog, NULL);
1176  fd->dialog = gptemp;
1177  gtk_widget_destroy(dialog);
1178  LEAVE("");
1179 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1116 of file gnc-tree-view-owner.c.

1118 {
1119  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1120 
1121  ENTER("button %p", button);
1122  fd->show_inactive = !gtk_toggle_button_get_active(button);
1123  gnc_tree_view_owner_refilter(fd->tree_view);
1124  LEAVE("show_inactive %d", fd->show_inactive);
1125 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271

◆ 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 1134 of file gnc-tree-view-owner.c.

1136 {
1137  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1138 
1139  ENTER("button %p", button);
1140  fd->show_zero_total = gtk_toggle_button_get_active(button);
1141  gnc_tree_view_owner_refilter(fd->tree_view);
1142  LEAVE("show_zero %d", fd->show_zero_total);
1143 }
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:261
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:271