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...
 
void gnc_tree_view_account_column_add_color (GncTreeViewAccount *view, GtkTreeViewColumn *col)
 Add the account color background data function to the GncTreeViewAccount column to show or not the column background in the account color.
 

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

1926 {
1927  AccountFilterDialog *fd = user_data;
1928  GNCAccountType acct_type;
1929  gnc_numeric total;
1930  gboolean result;
1931 
1932  ENTER("account %p:%s", account, xaccAccountGetName(account));
1933 
1934  if (g_hash_table_size (fd->filter_override) > 0)
1935  {
1936  Account *test_acc = NULL;
1937  test_acc = g_hash_table_lookup (fd->filter_override, account);
1938  if (test_acc != NULL)
1939  {
1940  LEAVE(" filter: override");
1941  return TRUE;
1942  }
1943  }
1944 
1945  if (!fd->show_hidden && xaccAccountIsHidden (account))
1946  {
1947  LEAVE(" hide: hidden");
1948  return FALSE;
1949  }
1950 
1951  if (!fd->show_zero_total)
1952  {
1953  total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
1954  if (gnc_numeric_zero_p(total))
1955  {
1956  LEAVE(" hide: zero balance");
1957  return FALSE;
1958  }
1959  }
1960 
1961  if (!fd->show_unused)
1962  {
1963  if (xaccAccountCountSplits(account, TRUE) == 0)
1964  {
1965  LEAVE(" hide: unused");
1966  return FALSE;
1967  }
1968  }
1969 
1970  acct_type = xaccAccountGetType(account);
1971  result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
1972  LEAVE(" %s", result ? "show" : "hide");
1973  return result;
1974 }
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account&#39;s account type.
Definition: Account.c:3009
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:3984
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:3731
#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:3031

◆ 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:2623
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:2683
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:2630
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:1863

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

1885 {
1886  GtkCellRenderer *renderer;
1887  GtkTreeViewColumn *column;
1888 
1889  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (account_view), NULL);
1890 
1891  renderer = gtk_cell_renderer_text_new ();
1892  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1893 
1894  column = gtk_tree_view_column_new_with_attributes (column_title,
1895  renderer, NULL);
1896  if (col_edited_cb)
1897  {
1898  gtva_setup_column_renderer_edited_cb(account_view, column,
1899  renderer, col_edited_cb);
1900  }
1901  gtk_tree_view_column_set_cell_data_func (column, renderer,
1902  col_source_helper,
1903  col_source_cb, NULL);
1904  gnc_tree_view_append_column (GNC_TREE_VIEW(account_view), column);
1905  return column;
1906 }
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 1780 of file gnc-tree-view-account.c.

1783 {
1784  GtkCellRenderer *renderer;
1785  GtkTreeViewColumn *column;
1786 
1787  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1788  g_return_val_if_fail (propname != NULL, NULL);
1789 
1790  column = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), column_title,
1791  propname, NULL, "Sample text",
1792  -1, -1, NULL);
1793 
1794  /* This new kvp column has only had one renderer added to it so
1795  * far. Find that renderer. */
1796  renderer = gnc_tree_view_column_get_renderer(column);
1797  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1798 
1799  // add a pointer to the view to make it easier to access in data_func
1800  g_object_set_data(G_OBJECT(column), "tree-view", (gpointer)view);
1801 
1802  gtk_tree_view_column_set_cell_data_func (column, renderer,
1803  account_cell_property_data_func,
1804  g_strdup(propname), g_free);
1805  return column;
1806 }
GtkCellRenderer * gnc_tree_view_column_get_renderer(GtkTreeViewColumn *column)
Return the "main" cell renderer from a GtkTreeViewColumn added to a GncTreeView my one of the conveni...
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.

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

1053 {
1054  GtkTreeModel *s_model;
1055  GtkTreeIter s_iter;
1056  gint num_children;
1057 
1058  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1059 
1060  if (account == NULL)
1061  {
1062  LEAVE("no account");
1063  return 0;
1064  }
1065 
1066  if (!gnc_tree_view_account_get_iter_from_account (view, account, &s_iter))
1067  {
1068  LEAVE("view_get_iter_from_account failed");
1069  return 0;
1070  }
1071 
1072  /* Any children? */
1073  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1074  num_children = gtk_tree_model_iter_n_children(s_model, &s_iter);
1075  LEAVE("%d children", num_children);
1076  return num_children;
1077 }
#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:3031

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

1643 {
1644  GtkTreePath *path;
1645 
1646  g_return_if_fail(view != NULL);
1647  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1648  ENTER("view %p, account %p", view, account);
1649 
1650  path = gnc_tree_view_account_get_path_from_account(view, account);
1651  if (path)
1652  {
1653  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
1654  gtk_tree_path_free(path);
1655  }
1656  LEAVE(" ");
1657 }
#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 1281 of file gnc-tree-view-account.c.

1283 {
1284  GtkTreeModel *model, *f_model;
1285  GtkTreeIter iter, f_iter;
1286  Account *account;
1287 
1288  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
1289  g_return_val_if_fail (s_iter != NULL, NULL);
1290 
1291  ENTER("model %p, iter %p", s_model, s_iter);
1292 
1293  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
1294  &f_iter,
1295  s_iter);
1296  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1297  gtk_tree_model_filter_convert_iter_to_child_iter (
1298  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
1299  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1301  GNC_TREE_MODEL_ACCOUNT(model), &iter);
1302  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1303  return account;
1304 }
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:3031

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

1237 {
1238  GtkTreeModel *model, *f_model, *s_model;
1239  GtkTreePath *path, *f_path;
1240  GtkTreeIter iter;
1241  Account *account;
1242 
1243  ENTER("view %p", view);
1244  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1245  g_return_val_if_fail (s_path != NULL, NULL);
1246 
1247  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1248  f_path = gtk_tree_model_sort_convert_path_to_child_path (
1249  GTK_TREE_MODEL_SORT (s_model), s_path);
1250  if (!f_path)
1251  {
1252  LEAVE("no filter path");
1253  return NULL;
1254  }
1255 
1256  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1257  path = gtk_tree_model_filter_convert_path_to_child_path (
1258  GTK_TREE_MODEL_FILTER (f_model), f_path);
1259  gtk_tree_path_free(f_path);
1260  if (!path)
1261  {
1262  LEAVE("no path");
1263  return NULL;
1264  }
1265 
1266  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1267  if (!gtk_tree_model_get_iter (model, &iter, path))
1268  {
1269  LEAVE("no iter");
1270  return NULL;
1271  }
1272 
1273  account = iter.user_data;
1274  gtk_tree_path_free(path);
1275  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1276  return account;
1277 }
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:3031

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

1665 {
1666  GtkTreePath *s_path;
1667  Account *account;
1668 
1669  ENTER("view %p", view);
1670  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1671 
1672  gtk_tree_view_get_cursor (GTK_TREE_VIEW(view), &s_path, NULL);
1673  if (!s_path)
1674  {
1675  LEAVE("no account");
1676  return NULL;
1677  }
1678 
1679  account = gnc_tree_view_account_get_account_from_path (view, s_path);
1680  gtk_tree_path_free(s_path);
1681  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1682  return account;
1683 }
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:3031

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

1313 {
1314  GtkTreeSelection *selection;
1315  GtkTreeModel *f_model, *s_model;
1316  GtkTreeIter iter, f_iter, s_iter;
1317  Account *account;
1318  GtkSelectionMode mode;
1319 
1320  ENTER("view %p", view);
1321  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1322 
1323  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1324  mode = gtk_tree_selection_get_mode(selection);
1325  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
1326  {
1327  return NULL;
1328  }
1329  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
1330  {
1331  LEAVE("no account, get_selected failed");
1332  return FALSE;
1333  }
1334 
1335  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
1336  &f_iter, &s_iter);
1337 
1338  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1339  gtk_tree_model_filter_convert_iter_to_child_iter (
1340  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
1341 
1342  account = iter.user_data;
1343  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1344  return account;
1345 }
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:3031

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

1471 {
1472  GtkTreeSelection *selection;
1474 
1475  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1476 
1477  info.return_list = NULL;
1478  info.priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1479  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1480  gtk_tree_selection_selected_foreach(selection, get_selected_accounts_helper, &info);
1481  return info.return_list;
1482 }

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

1091 {
1093 
1094  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1095  g_return_if_fail(avi != NULL);
1096 
1097  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1098 
1099  *avi = priv->avi;
1100 }

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

957 {
958  Account *root;
959 
960  root = gnc_book_get_root_account (gnc_get_current_book ());
961  return gnc_tree_view_account_new_with_root (root, show_root);
962 }
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 685 of file gnc-tree-view-account.c.

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

1202 {
1203  GtkTreeModel *f_model, *s_model;
1204 
1205  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1206 
1207  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1208  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1209  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
1210 }

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

1571 {
1572  GtkTreeModel *s_model;
1573  GtkTreeSelection *selection;
1574  GtkTreePath *sp_account, *sp_start, *sp_end;
1575  GtkTreeIter si_account, si_start, si_end;
1576  gboolean have_start, have_end;
1577  gint num_children;
1578 
1579  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1580 
1581  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1582 
1583  if (account == NULL)
1584  {
1585  LEAVE("no account");
1586  return;
1587  }
1588 
1589  if (!gnc_tree_view_account_get_iter_from_account (view, account, &si_account))
1590  {
1591  LEAVE("view_get_iter_from_account failed");
1592  return;
1593  }
1594 
1595  /* Any children? */
1596  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1597  num_children = gtk_tree_model_iter_n_children(s_model, &si_account);
1598  if (num_children == 0)
1599  {
1600  LEAVE("no children");
1601  return;
1602  }
1603 
1604  /* Expand the tree. Required for selection to work */
1605  sp_account = gtk_tree_model_get_path (s_model, &si_account);
1606  gtk_tree_view_expand_row (GTK_TREE_VIEW(view), sp_account, TRUE);
1607 
1608  /* compute start/end paths */
1609  have_start = gtk_tree_model_iter_nth_child(s_model, &si_start, &si_account, 0);
1610  si_end = si_account;
1611  while (num_children)
1612  {
1613  GtkTreeIter tmp_iter = si_end;
1614  have_end = gtk_tree_model_iter_nth_child(s_model, &si_end, &tmp_iter,
1615  num_children - 1);
1616  if (have_end)
1617  num_children = gtk_tree_model_iter_n_children(s_model, &si_end);
1618  else
1619  num_children = 0;
1620  }
1621 
1622  if (have_start && have_end)
1623  {
1624  sp_start = gtk_tree_model_get_path (s_model, &si_start);
1625  sp_end = gtk_tree_model_get_path (s_model, &si_end);
1626 
1627  /* select everything between */
1628  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1629  gtk_tree_selection_select_range (selection, sp_start, sp_end);
1630 
1631  /* clean up */
1632  gtk_tree_path_free(sp_start);
1633  gtk_tree_path_free(sp_end);
1634  }
1635  gtk_tree_path_free(sp_account);
1636  LEAVE(" ");
1637  return;
1638 }
#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:3031

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

1176 {
1178 
1179  ENTER("view %p, filter func %p, data %p, destroy %p",
1180  view, func, data, destroy);
1181 
1182  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1183 
1184  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1185  if (priv->filter_destroy)
1186  {
1187  priv->filter_destroy(priv->filter_data);
1188  }
1189  priv->filter_destroy = destroy;
1190  priv->filter_data = data;
1191  priv->filter_fn = func;
1192 
1194  LEAVE(" ");
1195 }
#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 1352 of file gnc-tree-view-account.c.

1354 {
1355  GtkTreeModel *model, *f_model, *s_model;
1356  GtkTreePath *path, *f_path, *s_path, *parent_path;
1357  GtkTreeSelection *selection;
1358 
1359  ENTER("view %p, account %p (%s)", view,
1360  account, xaccAccountGetName (account));
1361  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1362 
1363  /* Clear any existing selection. */
1364  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1365  gtk_tree_selection_unselect_all (selection);
1366 
1367  if (account == NULL)
1368  return;
1369 
1370  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1371  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1372  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1373 
1375  GNC_TREE_MODEL_ACCOUNT(model), account);
1376  if (path == NULL)
1377  {
1378  LEAVE("no path");
1379  return;
1380  }
1381  debug_path(DEBUG, path);
1382 
1383  f_path = gtk_tree_model_filter_convert_child_path_to_path (
1384  GTK_TREE_MODEL_FILTER (f_model), path);
1385  gtk_tree_path_free(path);
1386  if (f_path == NULL)
1387  {
1388  LEAVE("no filter path");
1389  return;
1390  }
1391  debug_path(DEBUG, f_path);
1392 
1393  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1394  f_path);
1395  gtk_tree_path_free(f_path);
1396  if (s_path == NULL)
1397  {
1398  LEAVE("no sort path");
1399  return;
1400  }
1401 
1402  /* gtk_tree_view requires that a row be visible before it can be selected */
1403  parent_path = gtk_tree_path_copy (s_path);
1404  if (gtk_tree_path_up (parent_path))
1405  {
1406  /* This function is misnamed. It expands the actual item
1407  * specified, not the path to the item specified. I.E. It expands
1408  * one level too many, thus the get of the parent. */
1409  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1410  }
1411  gtk_tree_path_free(parent_path);
1412 
1413  gtk_tree_selection_select_path (selection, s_path);
1414 
1415  /* give gtk+ a chance to resize the tree view first by handling pending
1416  * configure events */
1417  while (gtk_events_pending ())
1418  gtk_main_iteration ();
1419  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1420  debug_path(LEAVE, s_path);
1421  gtk_tree_path_free(s_path);
1422 }
#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:3031

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

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

1119 {
1121  gint i;
1122  guint sel_bits = 0;
1123 
1124  ENTER("%p", account_view);
1125  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1126  g_return_if_fail(avi != NULL);
1127 
1128  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1129  priv->avi = *avi;
1130 
1131  for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
1132  {
1133  sel_bits |= avi->include_type[i] ? (1 << i) : 0;
1134  }
1135 
1137  account_view, gnc_tree_view_account_filter_by_view_info,
1138  &priv->avi, NULL);
1139 
1140  LEAVE(" ");
1141 }
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.
#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.
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h: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_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:1075
#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
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h: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 }
#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:1075
void gnc_tree_view_configure_columns(GncTreeView *view)
Make all the correct columns visible, respecting their default visibility setting, their "always" visibility setting, and the last saved state if available.
const char * gnc_commodity_get_printname(const gnc_commodity *cm)
Retrieve the &#39;print&#39; name for the specified commodity.
GtkTreeModel * gnc_tree_model_price_new(QofBook *book, GNCPriceDB *price_db)
Create a new GtkTreeModel for manipulating gnucash commodity prices.
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h: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 2042 of file gnc-tree-view-account.c.

2044 {
2045  g_return_if_fail(GTK_IS_BUTTON(button));
2046 
2047  ENTER("button %p", button);
2048  fd->visible_types = 0;
2049  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2050  gnc_tree_view_account_refilter(fd->tree_view);
2051  LEAVE("types 0x%x", fd->visible_types);
2052 }
#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 2156 of file gnc-tree-view-account.c.

2159 {
2160  gpointer gptemp;
2161 
2162  g_return_if_fail(GTK_IS_DIALOG(dialog));
2163 
2164  ENTER("dialog %p, response %d", dialog, response);
2165 
2166  if (response != GTK_RESPONSE_OK)
2167  {
2168  fd->visible_types = fd->original_visible_types;
2169  fd->show_hidden = fd->original_show_hidden;
2170  fd->show_zero_total = fd->original_show_zero_total;
2171  fd->show_unused = fd->original_show_unused;
2172  gnc_tree_view_account_refilter(fd->tree_view);
2173  }
2174 
2175  /* Clean up and delete dialog */
2176  gptemp = (gpointer *)fd->dialog;
2177  g_atomic_pointer_compare_and_exchange(&gptemp,
2178  dialog, NULL);
2179  fd->dialog = gptemp;
2180  gtk_widget_destroy(dialog);
2181  LEAVE("types 0x%x", fd->visible_types);
2182 }
#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 2061 of file gnc-tree-view-account.c.

2063 {
2064  g_return_if_fail(GTK_IS_BUTTON(button));
2065 
2066  ENTER("button %p", button);
2067  fd->visible_types = -1;
2068  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2069  gnc_tree_view_account_refilter(fd->tree_view);
2070  LEAVE("types 0x%x", fd->visible_types);
2071 }
#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 2081 of file gnc-tree-view-account.c.

2083 {
2084  ENTER("button %p", button);
2085  gppat_filter_select_all_cb(button, fd);
2086  LEAVE(" ");
2087 }
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 1984 of file gnc-tree-view-account.c.

1986 {
1987  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1988 
1989  ENTER("button %p", button);
1990  fd->show_hidden = gtk_toggle_button_get_active(button);
1991  gnc_tree_view_account_refilter(fd->tree_view);
1992  LEAVE("show_hidden %d", fd->show_hidden);
1993 }
#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 2022 of file gnc-tree-view-account.c.

2024 {
2025  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2026 
2027  ENTER("button %p", button);
2028  fd->show_unused = gtk_toggle_button_get_active(button);
2029  gnc_tree_view_account_refilter(fd->tree_view);
2030  LEAVE("show_unused %d", fd->show_unused);
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_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 2003 of file gnc-tree-view-account.c.

2005 {
2006  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2007 
2008  ENTER("button %p", button);
2009  fd->show_zero_total = gtk_toggle_button_get_active(button);
2010  gnc_tree_view_account_refilter(fd->tree_view);
2011  LEAVE("show_zero %d", fd->show_zero_total);
2012 }
#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