GnuCash  2.6.16
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
 
struct  GncTreeModelAccountClass
 
struct  GncTreeModelCommodity
 
struct  GncTreeModelCommodityClass
 
struct  GncTreeModelOwner
 
struct  GncTreeModelOwnerClass
 
struct  GncTreeModelPrice
 
struct  GncTreeModelPriceClass
 
struct  GncTreeModel
 
struct  GncTreeModelClass
 
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)
 
GType gnc_tree_model_commodity_get_type (void)
 
GType gnc_tree_model_owner_get_type (void)
 
GType gnc_tree_model_price_get_type (void)
 
GType gnc_tree_model_get_type (void)
 
void account_filter_dialog_create (AccountFilterDialog *fd, GncPluginPage *page)
 
gboolean gnc_plugin_page_account_tree_filter_accounts (Account *account, gpointer user_data)
 
void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 
void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 
void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd)
 
void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd)
 
void gppat_filter_select_default_cb (GtkWidget *button, AccountFilterDialog *fd)
 
void gppat_filter_response_cb (GtkWidget *dialog, gint response, AccountFilterDialog *fd)
 
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)
 
void gppot_filter_show_inactive_toggled_cb (GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
 
void gppot_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
 
void gppot_filter_response_cb (GtkWidget *dialog, gint response, OwnerFilterDialog *fd)
 
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)
 

Account Tree Model Get/Set Functions

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

Account Tree Model Constructors

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

Commodity Tree Model Filter Helper Functions

gboolean gnc_tree_model_commodity_iter_is_namespace (GncTreeModelCommodity *model, GtkTreeIter *iter)
 
gboolean gnc_tree_model_commodity_iter_is_commodity (GncTreeModelCommodity *model, GtkTreeIter *iter)
 
gnc_commodity_namespace * gnc_tree_model_commodity_get_namespace (GncTreeModelCommodity *model, GtkTreeIter *iter)
 
gnc_commodity * gnc_tree_model_commodity_get_commodity (GncTreeModelCommodity *model, GtkTreeIter *iter)
 

Commodity Tree Model Lookup Functions

gboolean gnc_tree_model_commodity_get_iter_from_namespace (GncTreeModelCommodity *model, gnc_commodity_namespace *name_space, GtkTreeIter *iter)
 
gboolean gnc_tree_model_commodity_get_iter_from_commodity (GncTreeModelCommodity *model, gnc_commodity *commodity, GtkTreeIter *iter)
 
GtkTreePath * gnc_tree_model_commodity_get_path_from_commodity (GncTreeModelCommodity *model, gnc_commodity *commodity)
 

Owner Tree Model Constructors

GtkTreeModel * gnc_tree_model_owner_new (GncOwnerType owner_type)
 

Owner Tree Model Get/Set Functions

GncOwnergnc_tree_model_owner_get_owner (GncTreeModelOwner *model, GtkTreeIter *iter)
 
gboolean gnc_tree_model_owner_get_iter_from_owner (GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter)
 
GtkTreePath * gnc_tree_model_owner_get_path_from_owner (GncTreeModelOwner *model, GncOwner *owner)
 

Account Tree Model Constructors

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

Price Tree Model Filter Helper Functions

gboolean gnc_tree_model_price_iter_is_namespace (GncTreeModelPrice *model, GtkTreeIter *iter)
 
gboolean gnc_tree_model_price_iter_is_commodity (GncTreeModelPrice *model, GtkTreeIter *iter)
 
gboolean gnc_tree_model_price_iter_is_price (GncTreeModelPrice *model, GtkTreeIter *iter)
 
gnc_commodity_namespace * gnc_tree_model_price_get_namespace (GncTreeModelPrice *model, GtkTreeIter *iter)
 
gnc_commodity * gnc_tree_model_price_get_commodity (GncTreeModelPrice *model, GtkTreeIter *iter)
 
GNCPrice * gnc_tree_model_price_get_price (GncTreeModelPrice *model, GtkTreeIter *iter)
 

Commodity Tree Model Lookup Functions

gboolean gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model, gnc_commodity_namespace *name_space, GtkTreeIter *iter)
 
gboolean gnc_tree_model_price_get_iter_from_commodity (GncTreeModelPrice *model, gnc_commodity *commodity, GtkTreeIter *iter)
 
gboolean gnc_tree_model_price_get_iter_from_price (GncTreeModelPrice *model, GNCPrice *price, GtkTreeIter *iter)
 
GtkTreePath * gnc_tree_model_price_get_path_from_price (GncTreeModelPrice *model, GNCPrice *price)
 

Account Tree View Constructors

GtkTreeView * gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
 
GtkTreeView * gnc_tree_view_account_new (gboolean show_root)
 

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)
 
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_kvp_column (GncTreeViewAccount *view, const gchar *column_title, const gchar *kvp_key)
 

Account Tree View Filtering

typedef gboolean(* gnc_tree_view_account_filter_func) (Account *account, gpointer data)
 
void gnc_tree_view_account_get_view_info (GncTreeViewAccount *account_view, AccountViewInfo *avi)
 
void gnc_tree_view_account_set_view_info (GncTreeViewAccount *account_view, AccountViewInfo *avi)
 
void gnc_tree_view_account_set_filter (GncTreeViewAccount *account_view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
 
gboolean gnc_tree_view_account_filter_by_view_info (Account *acct, gpointer data)
 
void gnc_tree_view_account_refilter (GncTreeViewAccount *view)
 

Account Tree View Get/Set Functions

gint gnc_tree_view_account_count_children (GncTreeViewAccount *view, Account *account)
 
Accountgnc_tree_view_account_get_account_from_path (GncTreeViewAccount *view, GtkTreePath *path)
 
Accountgnc_tree_view_account_get_account_from_iter (GtkTreeModel *model, GtkTreeIter *iter)
 
Accountgnc_tree_view_account_get_cursor_account (GncTreeViewAccount *view)
 
Accountgnc_tree_view_account_get_selected_account (GncTreeViewAccount *view)
 
void gnc_tree_view_account_set_selected_account (GncTreeViewAccount *view, Account *account)
 
GList * gnc_tree_view_account_get_selected_accounts (GncTreeViewAccount *view)
 
void gnc_tree_view_account_set_selected_accounts (GncTreeViewAccount *view, GList *account_list, gboolean show_last)
 
void gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view, Account *account)
 
void gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view, Account *account)
 

Commodity Tree View Constructors

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

Commodity Tree View Configuration

void gnc_tree_view_commodity_configure_columns (GncTreeViewCommodity *view, GSList *column_names)
 

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)
 
void gnc_tree_view_commodity_refilter (GncTreeViewCommodity *view)
 

Commodity Tree View Get/Set Functions

gnc_commodity * gnc_tree_view_commodity_get_cursor_commodity (GncTreeViewCommodity *view)
 
gnc_commodity * gnc_tree_view_commodity_get_selected_commodity (GncTreeViewCommodity *view)
 
void gnc_tree_view_commodity_select_subcommodities (GncTreeViewCommodity *view, gnc_commodity *commodity)
 

Owner Tree View Constructor

GtkTreeView * gnc_tree_view_owner_new (GncOwnerType owner_type)
 

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)
 
void gnc_tree_view_owner_set_filter (GncTreeViewOwner *owner_view, gnc_tree_view_owner_filter_func func, gpointer data, GSourceFunc destroy)
 
void gnc_tree_view_owner_refilter (GncTreeViewOwner *view)
 

Owner Tree View Get/Set Functions

GncOwnergnc_tree_view_owner_get_owner_from_path (GncTreeViewOwner *view, GtkTreePath *path)
 
GncOwnergnc_tree_view_owner_get_owner_from_iter (GtkTreeModel *model, GtkTreeIter *iter)
 
GncOwnergnc_tree_view_owner_get_selected_owner (GncTreeViewOwner *view)
 
void gnc_tree_view_owner_set_selected_owner (GncTreeViewOwner *view, GncOwner *owner)
 

Price Tree View Constructors

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

Price Tree View Filtering

typedef gboolean(* gnc_tree_view_price_ns_filter_func) (gnc_commodity_namespace *, gpointer data)
 
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)
 
GNCPrice * gnc_tree_view_price_get_selected_price (GncTreeViewPrice *view)
 
void gnc_tree_view_price_set_selected_price (GncTreeViewPrice *view, GNCPrice *price)
 
GList * gnc_tree_view_price_get_selected_prices (GncTreeViewPrice *view)
 

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

1900 {
1901  AccountFilterDialog *fd = user_data;
1902  GNCAccountType acct_type;
1903  gnc_numeric total;
1904  gboolean result;
1905 
1906  ENTER("account %p:%s", account, xaccAccountGetName(account));
1907 
1908  if (!fd->show_hidden && xaccAccountIsHidden (account))
1909  {
1910  LEAVE(" hide: hidden");
1911  return FALSE;
1912  }
1913 
1914  if (!fd->show_zero_total)
1915  {
1916  total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
1917  if (gnc_numeric_zero_p(total))
1918  {
1919  LEAVE(" hide: zero balance");
1920  return FALSE;
1921  }
1922  }
1923 
1924  acct_type = xaccAccountGetType(account);
1925  result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
1926  LEAVE(" %s", result ? "show" : "hide");
1927  return result;
1928 }
GNCAccountType xaccAccountGetType(const Account *acc)
Definition: Account.c:2884
gboolean gnc_numeric_zero_p(gnc_numeric a)
Definition: gnc-numeric.c:173
#define ENTER(format, args...)
Definition: qoflog.h:256
gboolean xaccAccountIsHidden(const Account *acc)
Definition: Account.c:3868
GNCAccountType
Definition: Account.h:96
#define LEAVE(format, args...)
Definition: qoflog.h:266
const char * xaccAccountGetName(const Account *acc)
Definition: Account.c:2906

◆ 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)
Definition: gnc-numeric.c:173
#define ENTER(format, args...)
Definition: qoflog.h:256
gnc_numeric gncOwnerGetBalanceInCurrency(const GncOwner *owner, const gnc_commodity *report_currency)
Definition: gncOwner.c:1462
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1132 {
1133  g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), NULL);
1134  g_return_val_if_fail (iter != NULL, NULL);
1135  g_return_val_if_fail (iter->user_data != NULL, NULL);
1136  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
1137 
1138  return (Account *) iter->user_data;
1139 }

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

1150 {
1152  Account *parent;
1153  gint i;
1154 
1155  ENTER("model %p, account %p, iter %p", model, account, iter);
1156  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), FALSE);
1157  gnc_leave_return_val_if_fail ((account != NULL), FALSE);
1158  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
1159 
1160  iter->user_data = account;
1161  iter->stamp = model->stamp;
1162 
1163  priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
1164  if (account == priv->root)
1165  {
1166  iter->user_data2 = NULL;
1167  iter->user_data3 = GINT_TO_POINTER (0);
1168  LEAVE("Matched root");
1169  return TRUE;
1170  }
1171 
1172  if (priv->root != gnc_account_get_root (account))
1173  {
1174  LEAVE("Root doesn't match");
1175  return FALSE;
1176  }
1177 
1178  parent = gnc_account_get_parent(account);
1179  i = gnc_account_child_index(parent, account);
1180  iter->user_data2 = parent;
1181  iter->user_data3 = GINT_TO_POINTER (i);
1182  LEAVE("iter %s", iter_to_string(iter));
1183  return (i != -1);
1184 }
Account * gnc_account_get_parent(const Account *acc)
Definition: Account.c:2498
#define ENTER(format, args...)
Definition: qoflog.h:256
#define gnc_leave_return_val_if_fail(test, val)
Definition: qoflog.h:278
#define LEAVE(format, args...)
Definition: qoflog.h:266
gint gnc_account_child_index(const Account *parent, const Account *child)
Definition: Account.c:2558
Account * gnc_account_get_root(Account *acc)
Definition: Account.c:2505

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

1194 {
1195  GtkTreeIter tree_iter;
1196  GtkTreePath *tree_path;
1197 
1198  ENTER("model %p, account %p", model, account);
1199  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), NULL);
1200  gnc_leave_return_val_if_fail (account != NULL, NULL);
1201 
1202  if (!gnc_tree_model_account_get_iter_from_account (model, account,
1203  &tree_iter))
1204  {
1205  LEAVE("no iter");
1206  return NULL;
1207  }
1208 
1209  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1210  if (tree_path)
1211  {
1212  gchar *path_string = gtk_tree_path_to_string(tree_path);
1213  LEAVE("path (2) %s", path_string);
1214  g_free(path_string);
1215  }
1216  else
1217  {
1218  LEAVE("no path");
1219  }
1220  return tree_path;
1221 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define gnc_leave_return_val_if_fail(test, val)
Definition: qoflog.h:278
gboolean gnc_tree_model_account_get_iter_from_account(GncTreeModelAccount *model, Account *account, GtkTreeIter *iter)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

◆ 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)
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:84
#define ENTER(format, args...)
Definition: qoflog.h:256
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.c:72
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

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

972 {
973  gnc_commodity_namespace *name_space;
974  GList *list;
975  gint n;
976 
977  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
978  g_return_val_if_fail ((commodity != NULL), FALSE);
979  g_return_val_if_fail ((iter != NULL), FALSE);
980 
981  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
982 
983  name_space = gnc_commodity_get_namespace_ds(commodity);
984  if (name_space == NULL)
985  {
986  LEAVE("no namespace");
987  return FALSE;
988  }
989 
991  if (list == NULL)
992  {
993  LEAVE("empty list");
994  return FALSE;
995  }
996 
997  n = g_list_index(list, commodity);
998  if (n == -1)
999  {
1000  LEAVE("not in list");
1001  return FALSE;
1002  }
1003 
1004  iter->stamp = model->stamp;
1005  iter->user_data = ITER_IS_COMMODITY;
1006  iter->user_data2 = commodity;
1007  iter->user_data3 = GINT_TO_POINTER(n);
1008  LEAVE("iter %s", iter_to_string(iter));
1009  return TRUE;
1010 }
#define ENTER(format, args...)
Definition: qoflog.h:256
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *name_space)
gnc_commodity_namespace * gnc_commodity_get_namespace_ds(const gnc_commodity *cm)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1057 {
1059  GList *list;
1060  gint n;
1061 
1062  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
1063  g_return_val_if_fail ((name_space != NULL), FALSE);
1064  g_return_val_if_fail ((iter != NULL), FALSE);
1065 
1066  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1067 
1068  priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
1069  list = gnc_commodity_table_get_namespaces_list(priv->commodity_table);
1070  if (list == NULL)
1071  {
1072  LEAVE("");
1073  return FALSE;
1074  }
1075 
1076  n = g_list_index(list, name_space);
1077  if (n == -1)
1078  {
1079  LEAVE("");
1080  return FALSE;
1081  }
1082 
1083  iter->stamp = model->stamp;
1084  iter->user_data = ITER_IS_NAMESPACE;
1085  iter->user_data2 = name_space;
1086  iter->user_data3 = GINT_TO_POINTER(n);
1087  LEAVE("iter %s", iter_to_string(iter));
1088  return TRUE;
1089 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
GList * gnc_commodity_table_get_namespaces_list(const gnc_commodity_table *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 }

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

1020 {
1021  GtkTreeIter tree_iter;
1022  GtkTreePath *tree_path;
1023 
1024  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
1025  g_return_val_if_fail (commodity != NULL, NULL);
1026  ENTER("model %p, commodity %p", model, commodity);
1027 
1028  if (!gnc_tree_model_commodity_get_iter_from_commodity (model, commodity, &tree_iter))
1029  {
1030  LEAVE("no iter");
1031  return NULL;
1032  }
1033 
1034  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1035  if (tree_path)
1036  {
1037  gchar *path_string = gtk_tree_path_to_string(tree_path);
1038  LEAVE("path (2) %s", path_string);
1039  g_free(path_string);
1040  }
1041  else
1042  {
1043  LEAVE("no path");
1044  }
1045  return tree_path;
1046 }
gboolean gnc_tree_model_commodity_get_iter_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity, GtkTreeIter *iter)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

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

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

◆ 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)
#define ENTER(format, args...)
Definition: qoflog.h:256
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.c:72
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

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

881 {
883  GList *owner_in_list;
884 
885  ENTER("model %p, owner %p, iter %p", model, owner, iter);
886  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
887  gnc_leave_return_val_if_fail ((owner != NULL), FALSE);
888  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
889 
890 
891  priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
892  owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
893  if (owner_in_list)
894  {
895  iter->stamp = model->stamp;
896  iter->user_data = owner_in_list->data;
897  iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list));
898  iter->user_data3 = NULL;
899  LEAVE("iter %s", iter_to_string (iter));
900  return TRUE;
901  }
902  else
903  {
904  iter->stamp = 0;
905  iter->user_data = NULL;
906  LEAVE("Owner not found in list");
907  return FALSE;
908  }
909 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define gnc_leave_return_val_if_fail(test, val)
Definition: qoflog.h:278
int gncOwnerGCompareFunc(const GncOwner *a, const GncOwner *b)
Definition: gncOwner.c:360
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

863 {
864  g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
865  g_return_val_if_fail (iter != NULL, NULL);
866  g_return_val_if_fail (iter->user_data != NULL, NULL);
867  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
868 
869  return (GncOwner *) iter->user_data;
870 }

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

919 {
920  GtkTreeIter tree_iter;
921  GtkTreePath *tree_path;
922 
923  ENTER("model %p, owner %p", model, owner);
924  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
925  gnc_leave_return_val_if_fail (owner != NULL, NULL);
926 
927  if (!gnc_tree_model_owner_get_iter_from_owner (model, owner,
928  &tree_iter))
929  {
930  LEAVE("no iter");
931  return NULL;
932  }
933 
934  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
935  if (tree_path)
936  {
937  gchar *path_string = gtk_tree_path_to_string(tree_path);
938  LEAVE("path (2) %s", path_string);
939  g_free(path_string);
940  }
941  else
942  {
943  LEAVE("no path");
944  }
945  return tree_path;
946 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define gnc_leave_return_val_if_fail(test, val)
Definition: qoflog.h:278
gboolean gnc_tree_model_owner_get_iter_from_owner(GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

◆ 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)
const GList * gnc_gobject_tracking_get_list(const gchar *name)
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:84
#define ENTER(format, args...)
Definition: qoflog.h:256
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.c:72
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Definition: gncOwner.c:184
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

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

1272 {
1273  gnc_commodity_namespace *name_space;
1274  GList *list;
1275  gint n;
1276 
1277  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
1278  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1279  g_return_val_if_fail ((commodity != NULL), FALSE);
1280  g_return_val_if_fail ((iter != NULL), FALSE);
1281 
1282  name_space = gnc_commodity_get_namespace_ds(commodity);
1283  if (name_space == NULL)
1284  {
1285  LEAVE("no namespace");
1286  return FALSE;
1287  }
1288 
1289  list = gnc_commodity_namespace_get_commodity_list(name_space);
1290  if (list == NULL)
1291  {
1292  LEAVE("empty list");
1293  return FALSE;
1294  }
1295 
1296  n = g_list_index(list, commodity);
1297  if (n == -1)
1298  {
1299  LEAVE("not in list");
1300  return FALSE;
1301  }
1302 
1303  iter->stamp = model->stamp;
1304  iter->user_data = ITER_IS_COMMODITY;
1305  iter->user_data2 = commodity;
1306  iter->user_data3 = GINT_TO_POINTER(n);
1307  LEAVE("iter %s", iter_to_string(model, iter));
1308  return TRUE;
1309 }
#define ENTER(format, args...)
Definition: qoflog.h:256
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *name_space)
gnc_commodity_namespace * gnc_commodity_get_namespace_ds(const gnc_commodity *cm)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1320 {
1322  gnc_commodity_table *ct;
1323  GList *list;
1324  gint n;
1325 
1326  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1327  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1328  g_return_val_if_fail ((name_space != NULL), FALSE);
1329  g_return_val_if_fail ((iter != NULL), FALSE);
1330 
1331  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
1332  ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
1334  if (list == NULL)
1335  return FALSE;
1336 
1337  n = g_list_index(list, name_space);
1338  if (n == -1)
1339  return FALSE;
1340 
1341  iter->stamp = model->stamp;
1342  iter->user_data = ITER_IS_NAMESPACE;
1343  iter->user_data2 = name_space;
1344  iter->user_data3 = GINT_TO_POINTER(n);
1345  LEAVE("iter %s", iter_to_string(model, iter));
1346  return TRUE;
1347 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
gpointer qof_book_get_data(const QofBook *book, const gchar *key)
GList * gnc_commodity_table_get_namespaces_list(const gnc_commodity_table *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 1181 of file gnc-tree-model-price.c.

1184 {
1186  gnc_commodity *commodity;
1187  GList *list;
1188  gint n;
1189 
1190  ENTER("model %p, price %p, iter %p", model, price, iter);
1191  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1192  g_return_val_if_fail ((price != NULL), FALSE);
1193  g_return_val_if_fail ((iter != NULL), FALSE);
1194 
1195  priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
1196  commodity = gnc_price_get_commodity(price);
1197  if (commodity == NULL)
1198  {
1199  LEAVE("no commodity");
1200  return FALSE;
1201  }
1202 
1203  list = gnc_pricedb_get_prices(priv->price_db, commodity, NULL);
1204  if (list == NULL)
1205  {
1206  LEAVE("empty list");
1207  return FALSE;
1208  }
1209 
1210  n = g_list_index(list, price);
1211  if (n == -1)
1212  {
1213  gnc_price_list_destroy(list);
1214  LEAVE("not in list");
1215  return FALSE;
1216  }
1217 
1218  iter->stamp = model->stamp;
1219  iter->user_data = ITER_IS_PRICE;
1220  iter->user_data2 = price;
1221  iter->user_data3 = GINT_TO_POINTER(n);
1222  gnc_price_list_destroy(list);
1223  LEAVE("iter %s", iter_to_string(model, iter));
1224  return TRUE;
1225 }
void gnc_price_list_destroy(PriceList *prices)
Definition: gnc-pricedb.c:735
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
PriceList * gnc_pricedb_get_prices(GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency)
Definition: gnc-pricedb.c:1488

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

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

1235 {
1236  GtkTreeIter tree_iter;
1237  GtkTreePath *tree_path;
1238 
1239  ENTER("model %p, price %p", model, price);
1240  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
1241  g_return_val_if_fail (price != NULL, NULL);
1242 
1243  if (!gnc_tree_model_price_get_iter_from_price (model, price, &tree_iter))
1244  {
1245  LEAVE("no iter");
1246  return NULL;
1247  }
1248 
1249  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1250  if (tree_path)
1251  {
1252  gchar *path_string = gtk_tree_path_to_string(tree_path);
1253  LEAVE("path (2) %s", path_string);
1254  g_free(path_string);
1255  }
1256  else
1257  {
1258  LEAVE("no path");
1259  }
1260  return tree_path;
1261 }
gboolean gnc_tree_model_price_get_iter_from_price(GncTreeModelPrice *model, GNCPrice *price, GtkTreeIter *iter)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

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

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

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

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

◆ 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 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.c:72
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1859 {
1860  GtkCellRenderer *renderer;
1861  GtkTreeViewColumn *column;
1862 
1863  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (account_view), NULL);
1864 
1865  renderer = gtk_cell_renderer_text_new ();
1866  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1867 
1868  column = gtk_tree_view_column_new_with_attributes (column_title,
1869  renderer, NULL);
1870  if (col_edited_cb)
1871  {
1872  gtva_setup_column_renderer_edited_cb(account_view, column,
1873  renderer, col_edited_cb);
1874  }
1875  gtk_tree_view_column_set_cell_data_func (column, renderer,
1876  col_source_helper,
1877  col_source_cb, NULL);
1878  gnc_tree_view_append_column (GNC_TREE_VIEW(account_view), column);
1879  return column;
1880 }
gint gnc_tree_view_append_column(GncTreeView *view, GtkTreeViewColumn *column)

◆ gnc_tree_view_account_add_kvp_column()

GtkTreeViewColumn* gnc_tree_view_account_add_kvp_column ( GncTreeViewAccount view,
const gchar *  column_title,
const gchar *  kvp_key 
)

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 KVP slot.

Parameters
viewA pointer to an account tree view.
column_titleThe title for this new column.
kvp_keyThe lookup key to use for looking up data in the account KVP structures. The value associated with this key is what will be displayed in the column.

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

1760 {
1761  GtkCellRenderer *renderer;
1762  GtkTreeViewColumn *column;
1763 
1764  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1765  g_return_val_if_fail (kvp_key != NULL, NULL);
1766 
1767  column = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), column_title,
1768  kvp_key, NULL, "Sample text",
1769  -1, -1, NULL);
1770 
1771  /* This new kvp column has only had one renderer added to it so
1772  * far. Find that renderer. */
1773  renderer = gnc_tree_view_column_get_renderer(column);
1774  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1775 
1776  gtk_tree_view_column_set_cell_data_func (column, renderer,
1777  account_cell_kvp_data_func,
1778  g_strdup(kvp_key), g_free);
1779  return column;
1780 }
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
GtkCellRenderer * gnc_tree_view_column_get_renderer(GtkTreeViewColumn *column)

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

1037 {
1038  GtkTreeModel *s_model;
1039  GtkTreeIter s_iter;
1040  gint num_children;
1041 
1042  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1043 
1044  if (account == NULL)
1045  {
1046  LEAVE("no account");
1047  return 0;
1048  }
1049 
1050  if (!gnc_tree_view_account_get_iter_from_account (view, account, &s_iter))
1051  {
1052  LEAVE("view_get_iter_from_account failed");
1053  return 0;
1054  }
1055 
1056  /* Any children? */
1057  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1058  num_children = gtk_tree_model_iter_n_children(s_model, &s_iter);
1059  LEAVE("%d children", num_children);
1060  return num_children;
1061 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
const char * xaccAccountGetName(const Account *acc)
Definition: Account.c:2906

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

1627 {
1628  GtkTreePath *path;
1629 
1630  g_return_if_fail(view != NULL);
1631  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1632  ENTER("view %p, account %p", view, account);
1633 
1634  path = gnc_tree_view_account_get_path_from_account(view, account);
1635  if (path)
1636  {
1637  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
1638  gtk_tree_path_free(path);
1639  }
1640  LEAVE(" ");
1641 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1267 {
1268  GtkTreeModel *model, *f_model;
1269  GtkTreeIter iter, f_iter;
1270  Account *account;
1271 
1272  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
1273  g_return_val_if_fail (s_iter != NULL, NULL);
1274 
1275  ENTER("model %p, iter %p", s_model, s_iter);
1276 
1277  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
1278  &f_iter,
1279  s_iter);
1280  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1281  gtk_tree_model_filter_convert_iter_to_child_iter (
1282  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
1283  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1285  GNC_TREE_MODEL_ACCOUNT(model), &iter);
1286  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1287  return account;
1288 }
Account * gnc_tree_model_account_get_account(GncTreeModelAccount *model, GtkTreeIter *iter)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
const char * xaccAccountGetName(const Account *acc)
Definition: Account.c:2906

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

1221 {
1222  GtkTreeModel *model, *f_model, *s_model;
1223  GtkTreePath *path, *f_path;
1224  GtkTreeIter iter;
1225  Account *account;
1226 
1227  ENTER("view %p", view);
1228  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1229  g_return_val_if_fail (s_path != NULL, NULL);
1230 
1231  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1232  f_path = gtk_tree_model_sort_convert_path_to_child_path (
1233  GTK_TREE_MODEL_SORT (s_model), s_path);
1234  if (!f_path)
1235  {
1236  LEAVE("no filter path");
1237  return NULL;
1238  }
1239 
1240  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1241  path = gtk_tree_model_filter_convert_path_to_child_path (
1242  GTK_TREE_MODEL_FILTER (f_model), f_path);
1243  gtk_tree_path_free(f_path);
1244  if (!path)
1245  {
1246  LEAVE("no path");
1247  return NULL;
1248  }
1249 
1250  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1251  if (!gtk_tree_model_get_iter (model, &iter, path))
1252  {
1253  LEAVE("no iter");
1254  return NULL;
1255  }
1256 
1257  account = iter.user_data;
1258  gtk_tree_path_free(path);
1259  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1260  return account;
1261 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
const char * xaccAccountGetName(const Account *acc)
Definition: Account.c:2906

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

1649 {
1650  GtkTreePath *s_path;
1651  Account *account;
1652 
1653  ENTER("view %p", view);
1654  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1655 
1656  gtk_tree_view_get_cursor (GTK_TREE_VIEW(view), &s_path, NULL);
1657  if (!s_path)
1658  {
1659  LEAVE("no account");
1660  return NULL;
1661  }
1662 
1663  account = gnc_tree_view_account_get_account_from_path (view, s_path);
1664  gtk_tree_path_free(s_path);
1665  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1666  return account;
1667 }
#define ENTER(format, args...)
Definition: qoflog.h:256
Account * gnc_tree_view_account_get_account_from_path(GncTreeViewAccount *view, GtkTreePath *s_path)
#define LEAVE(format, args...)
Definition: qoflog.h:266
const char * xaccAccountGetName(const Account *acc)
Definition: Account.c:2906

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

1297 {
1298  GtkTreeSelection *selection;
1299  GtkTreeModel *f_model, *s_model;
1300  GtkTreeIter iter, f_iter, s_iter;
1301  Account *account;
1302  GtkSelectionMode mode;
1303 
1304  ENTER("view %p", view);
1305  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1306 
1307  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1308  mode = gtk_tree_selection_get_mode(selection);
1309  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
1310  {
1311  return NULL;
1312  }
1313  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
1314  {
1315  LEAVE("no account, get_selected failed");
1316  return FALSE;
1317  }
1318 
1319  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
1320  &f_iter, &s_iter);
1321 
1322  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1323  gtk_tree_model_filter_convert_iter_to_child_iter (
1324  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
1325 
1326  account = iter.user_data;
1327  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1328  return account;
1329 }
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266
const char * xaccAccountGetName(const Account *acc)
Definition: Account.c:2906

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

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

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

1075 {
1077 
1078  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1079  g_return_if_fail(avi != NULL);
1080 
1081  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1082 
1083  *avi = priv->avi;
1084 }

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

941 {
942  Account *root;
943 
944  root = gnc_book_get_root_account (gnc_get_current_book ());
945  return gnc_tree_view_account_new_with_root (root, show_root);
946 }
GtkTreeView * gnc_tree_view_account_new_with_root(Account *root, gboolean show_root)

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

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

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

1186 {
1187  GtkTreeModel *f_model, *s_model;
1188 
1189  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1190 
1191  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1192  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1193  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
1194 }

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

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

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

1160 {
1162 
1163  ENTER("view %p, filter func %p, data %p, destroy %p",
1164  view, func, data, destroy);
1165 
1166  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1167 
1168  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
1169  if (priv->filter_destroy)
1170  {
1171  priv->filter_destroy(priv->filter_data);
1172  }
1173  priv->filter_destroy = destroy;
1174  priv->filter_data = data;
1175  priv->filter_fn = func;
1176 
1178  LEAVE(" ");
1179 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

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

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

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

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

1103 {
1105  gint i;
1106  guint sel_bits = 0;
1107 
1108  ENTER("%p", account_view);
1109  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
1110  g_return_if_fail(avi != NULL);
1111 
1112  priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
1113  priv->avi = *avi;
1114 
1115  for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
1116  {
1117  sel_bits |= avi->include_type[i] ? (1 << i) : 0;
1118  }
1119 
1121  account_view, gnc_tree_view_account_filter_by_view_info,
1122  &priv->avi, NULL);
1123 
1124  LEAVE(" ");
1125 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_set_filter(GncTreeViewAccount *view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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)
const char * gnc_commodity_get_mnemonic(const gnc_commodity *cm)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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)
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
#define DEBUG(format, args...)
Definition: qoflog.h:250
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)
#define ENTER(format, args...)
Definition: qoflog.h:256
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)
void gnc_tree_view_configure_columns(GncTreeView *view)
GtkTreeModel * gnc_tree_model_commodity_new(QofBook *book, gnc_commodity_table *ct)
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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...)
Definition: qoflog.h:256
GncOwner * gnc_tree_model_owner_get_owner(GncTreeModelOwner *model, GtkTreeIter *iter)
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ gnc_tree_view_owner_new()

GtkTreeView* gnc_tree_view_owner_new ( GncOwnerType  owner_type)

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

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

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

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

◆ 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)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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...)
Definition: qoflog.h:250
#define ENTER(format, args...)
Definition: qoflog.h:256
GtkTreePath * gnc_tree_model_owner_get_path_from_owner(GncTreeModelOwner *model, GncOwner *owner)
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ gnc_tree_view_price_get_selected_prices()

GList* gnc_tree_view_price_get_selected_prices ( GncTreeViewPrice view)

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

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

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

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

◆ gnc_tree_view_price_new()

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

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

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

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

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

◆ 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...)
Definition: qoflog.h:250
#define ENTER(format, args...)
Definition: qoflog.h:256
GtkTreePath * gnc_tree_model_price_get_path_from_price(GncTreeModelPrice *model, GNCPrice *price)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1979 {
1980  g_return_if_fail(GTK_IS_BUTTON(button));
1981 
1982  ENTER("button %p", button);
1983  fd->visible_types = 0;
1984  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
1985  gnc_tree_view_account_refilter(fd->tree_view);
1986  LEAVE("types 0x%x", fd->visible_types);
1987 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

2094 {
2095  gpointer gptemp;
2096 
2097  g_return_if_fail(GTK_IS_DIALOG(dialog));
2098 
2099  ENTER("dialog %p, response %d", dialog, response);
2100 
2101  if (response != GTK_RESPONSE_OK)
2102  {
2103  fd->visible_types = fd->original_visible_types;
2104  fd->show_hidden = fd->original_show_hidden;
2105  fd->show_zero_total = fd->original_show_zero_total;
2106  gnc_tree_view_account_refilter(fd->tree_view);
2107  }
2108 
2109  /* Clean up and delete dialog */
2110  gptemp = (gpointer *)fd->dialog;
2111  g_atomic_pointer_compare_and_exchange(&gptemp,
2112  dialog, NULL);
2113  fd->dialog = gptemp;
2114  gtk_widget_destroy(dialog);
2115  LEAVE("types 0x%x", fd->visible_types);
2116 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1998 {
1999  g_return_if_fail(GTK_IS_BUTTON(button));
2000 
2001  ENTER("button %p", button);
2002  fd->visible_types = -1;
2003  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2004  gnc_tree_view_account_refilter(fd->tree_view);
2005  LEAVE("types 0x%x", fd->visible_types);
2006 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

2018 {
2019  ENTER("button %p", button);
2020  gppat_filter_select_all_cb(button, fd);
2021  LEAVE(" ");
2022 }
void gppat_filter_select_all_cb(GtkWidget *button, AccountFilterDialog *fd)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1940 {
1941  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1942 
1943  ENTER("button %p", button);
1944  fd->show_hidden = gtk_toggle_button_get_active(button);
1945  gnc_tree_view_account_refilter(fd->tree_view);
1946  LEAVE("show_hidden %d", fd->show_hidden);
1947 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Definition: qoflog.h:266

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

1959 {
1960  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1961 
1962  ENTER("button %p", button);
1963  fd->show_zero_total = gtk_toggle_button_get_active(button);
1964  gnc_tree_view_account_refilter(fd->tree_view);
1965  LEAVE("show_zero %d", fd->show_zero_total);
1966 }
#define ENTER(format, args...)
Definition: qoflog.h:256
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266

◆ 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)
#define ENTER(format, args...)
Definition: qoflog.h:256
#define LEAVE(format, args...)
Definition: qoflog.h:266