GnuCash 2.3.0
Data Structures | Files | Defines | Typedefs | Enumerations | Functions | Variables
GnuCash Tree Model
GUI

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_s
struct  GncTreeViewAccount
struct  GncTreeViewAccountClass
struct  AccountFilterDialog
struct  GncTreeViewCommodity
struct  GncTreeViewCommodityClass
struct  OwnerViewInfo_s
struct  GncTreeViewOwner
struct  GncTreeViewOwnerClass
struct  OwnerFilterDialog
struct  GncTreeViewPrice
struct  GncTreeViewPriceClass

Files

file  gnc-tree-model-account-types.h
 

GtkTreeModel implementation to display account types in a GtkTreeView.


file  gnc-tree-model-account.h
 

GtkTreeModel implementation for gnucash account tree.


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-account.h
 

GtkTreeView implementation for gnucash account 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.


Defines

#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))

Typedefs

typedef struct AccountViewInfo_s AccountViewInfo
typedef struct OwnerViewInfo_s OwnerViewInfo

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

int GncTreeViewOwner::stamp
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_namespacegnc_tree_model_commodity_get_namespace (GncTreeModelCommodity *model, GtkTreeIter *iter)
gnc_commoditygnc_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 *namespace, 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_namespacegnc_tree_model_price_get_namespace (GncTreeModelPrice *model, GtkTreeIter *iter)
gnc_commoditygnc_tree_model_price_get_commodity (GncTreeModelPrice *model, GtkTreeIter *iter)
GNCPricegnc_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 *namespace, 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, GtkFunction 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, GtkDestroyNotify destroy)
void gnc_tree_view_commodity_refilter (GncTreeViewCommodity *view)

Commodity Tree View Get/Set Functions

gnc_commoditygnc_tree_view_commodity_get_cursor_commodity (GncTreeViewCommodity *view)
gnc_commoditygnc_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, GtkFunction 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, GtkDestroyNotify destroy)

Price Tree View Get/Set Functions

GNCPricegnc_tree_view_price_get_cursor_price (GncTreeViewPrice *view)
GNCPricegnc_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)

Typedef Documentation

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.

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.

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

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

{
    AccountFilterDialog *fd = user_data;
    GNCAccountType acct_type;
    gnc_numeric total;
    gboolean result;

    ENTER("account %p:%s", account, xaccAccountGetName(account));

    if (!fd->show_hidden && xaccAccountIsHidden (account))
    {
        LEAVE(" hide: hidden");
        return FALSE;
    }

    if (!fd->show_zero_total)
    {
        total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
        if (gnc_numeric_zero_p(total))
        {
            LEAVE(" hide: zero balance");
            return FALSE;
        }
    }

    acct_type = xaccAccountGetType(account);
    result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
    LEAVE(" %s", result ? "show" : "hide");
    return result;
}
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 1049 of file gnc-tree-view-owner.c.

{
    OwnerFilterDialog *fd = user_data;
    gnc_numeric total;

    ENTER("owner %p:%s", owner, gncOwnerGetName(owner));

    if (!fd->show_inactive && !gncOwnerGetActive (owner))
    {
        LEAVE(" hide: inactive");
        return FALSE;
    }

    if (!fd->show_zero_total)
    {
        /* FIXME I'm not aware of any functions to get an owner's "balance" yet.
         *       This should be implemented before this function does anything useful.
         *       The code below is copied from the tree-view-account source to serve
         *       as an example.
        total = gncOwnerGetBalanceInCurrency (owner, NULL, TRUE);
        */
        total = gnc_numeric_zero();
        if (gnc_numeric_zero_p(total))
        {
            LEAVE(" hide: zero balance");
            return FALSE;
        }
    }

    return TRUE;
}
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 1126 of file gnc-tree-model-account.c.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    return (Account *) iter->user_data;
}
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 1143 of file gnc-tree-model-account.c.

{
    GncTreeModelAccountPrivate *priv;
    Account *parent;
    gint i;

    ENTER("model %p, account %p, iter %p", model, account, iter);
    gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), FALSE);
    gnc_leave_return_val_if_fail ((account != NULL), FALSE);
    gnc_leave_return_val_if_fail ((iter != NULL), FALSE);

    iter->user_data = account;
    iter->stamp = model->stamp;

    priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
    if (account == priv->root)
    {
        iter->user_data2 = NULL;
        iter->user_data3 = GINT_TO_POINTER (0);
        LEAVE("Matched root");
        return TRUE;
    }

    if (priv->root != gnc_account_get_root (account))
    {
        LEAVE("Root doesn't match");
        return FALSE;
    }

    parent = gnc_account_get_parent(account);
    i = gnc_account_child_index(parent, account);
    iter->user_data2 = parent;
    iter->user_data3 = GINT_TO_POINTER (i);
    LEAVE("iter %s", iter_to_string(iter));
    return (i != -1);
}
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 1188 of file gnc-tree-model-account.c.

{
    GtkTreeIter tree_iter;
    GtkTreePath *tree_path;

    ENTER("model %p, account %p", model, account);
    gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), NULL);
    gnc_leave_return_val_if_fail (account != NULL, NULL);

    if (!gnc_tree_model_account_get_iter_from_account (model, account,
            &tree_iter))
    {
        LEAVE("no iter");
        return NULL;
    }

    tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
    if (tree_path)
    {
        gchar *path_string = gtk_tree_path_to_string(tree_path);
        LEAVE("path (2) %s", path_string);
        g_free(path_string);
    }
    else
    {
        LEAVE("no path");
    }
    return tree_path;
}
GType gnc_tree_model_account_get_type ( void  )

Get the type of an account tree plugin.

Returns:
A GType.

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

{
    static GType gnc_tree_model_account_type = 0;

    if (gnc_tree_model_account_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncTreeModelAccountClass), /* class_size */
            NULL,                              /* base_init */
            NULL,                              /* base_finalize */
            (GClassInitFunc) gnc_tree_model_account_class_init,
            NULL,                              /* class_finalize */
            NULL,                              /* class_data */
            sizeof (GncTreeModelAccount),      /* */
            0,                                 /* n_preallocs */
            (GInstanceInitFunc) gnc_tree_model_account_init
        };

        static const GInterfaceInfo tree_model_info =
        {
            (GInterfaceInitFunc) gnc_tree_model_account_tree_model_init,
            NULL,
            NULL
        };

        gnc_tree_model_account_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
                                      GNC_TREE_MODEL_ACCOUNT_NAME,
                                      &our_info, 0);

        g_type_add_interface_static (gnc_tree_model_account_type,
                                     GTK_TYPE_TREE_MODEL,
                                     &tree_model_info);
    }

    return gnc_tree_model_account_type;
}
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 279 of file gnc-tree-model-account.c.

{
    GncTreeModelAccount *model;
    GncTreeModelAccountPrivate *priv;
    const GList *item;

    ENTER("root %p", root);
    item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_ACCOUNT_NAME);
    for ( ; item; item = g_list_next(item))
    {
        model = (GncTreeModelAccount *)item->data;
        priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
        if (priv->root == root)
        {
            g_object_ref(G_OBJECT(model));
            LEAVE("returning existing model %p", model);
            return GTK_TREE_MODEL(model);
        }
    }

    model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT,
                          NULL);

    priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
    priv->book = gnc_get_current_book();
    priv->root = root;

    priv->event_handler_id = qof_event_register_handler
                             ((QofEventHandler)gnc_tree_model_account_event_handler, model);

    LEAVE("model %p", model);
    return GTK_TREE_MODEL (model);
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    if (iter->user_data != ITER_IS_COMMODITY)
        return NULL;
    return (gnc_commodity *)iter->user_data2;
}
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 951 of file gnc-tree-model-commodity.c.

{
    gnc_commodity_namespace *namespace;
    GList *list;
    gint n;

    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
    g_return_val_if_fail ((commodity != NULL), FALSE);
    g_return_val_if_fail ((iter != NULL), FALSE);

    ENTER("model %p, commodity %p, iter %p", model, commodity, iter);

    namespace = gnc_commodity_get_namespace_ds(commodity);
    if (namespace == NULL)
    {
        LEAVE("no namespace");
        return FALSE;
    }

    list = gnc_commodity_namespace_get_commodity_list(namespace);
    if (list == NULL)
    {
        LEAVE("empty list");
        return FALSE;
    }

    n = g_list_index(list, commodity);
    if (n == -1)
    {
        LEAVE("not in list");
        return FALSE;
    }

    iter->stamp = model->stamp;
    iter->user_data  = ITER_IS_COMMODITY;
    iter->user_data2 = commodity;
    iter->user_data3 = GINT_TO_POINTER(n);
    LEAVE("iter %s", iter_to_string(iter));
    return TRUE;
}
gboolean gnc_tree_model_commodity_get_iter_from_namespace ( GncTreeModelCommodity model,
gnc_commodity_namespace namespace,
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 1036 of file gnc-tree-model-commodity.c.

{
    GncTreeModelCommodityPrivate *priv;
    GList *list;
    gint n;

    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
    g_return_val_if_fail ((namespace != NULL), FALSE);
    g_return_val_if_fail ((iter != NULL), FALSE);

    ENTER("model %p, namespace %p, iter %p", model, namespace, iter);

    priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
    list = gnc_commodity_table_get_namespaces_list(priv->commodity_table);
    if (list == NULL)
    {
        LEAVE("");
        return FALSE;
    }

    n = g_list_index(list, namespace);
    if (n == -1)
    {
        LEAVE("");
        return FALSE;
    }

    iter->stamp = model->stamp;
    iter->user_data  = ITER_IS_NAMESPACE;
    iter->user_data2 = namespace;
    iter->user_data3 = GINT_TO_POINTER(n);
    LEAVE("iter %s", iter_to_string(iter));
    return TRUE;
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    if (iter->user_data != ITER_IS_NAMESPACE)
        return NULL;
    return (gnc_commodity_namespace *)iter->user_data2;
}
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 1000 of file gnc-tree-model-commodity.c.

{
    GtkTreeIter tree_iter;
    GtkTreePath *tree_path;

    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
    g_return_val_if_fail (commodity != NULL, NULL);
    ENTER("model %p, commodity %p", model, commodity);

    if (!gnc_tree_model_commodity_get_iter_from_commodity (model, commodity, &tree_iter))
    {
        LEAVE("no iter");
        return NULL;
    }

    tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
    if (tree_path)
    {
        gchar *path_string = gtk_tree_path_to_string(tree_path);
        LEAVE("path (2) %s", path_string);
        g_free(path_string);
    }
    else
    {
        LEAVE("no path");
    }
    return tree_path;
}
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.

{
    static GType gnc_tree_model_commodity_type = 0;

    if (gnc_tree_model_commodity_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncTreeModelCommodityClass),
            NULL,
            NULL,
            (GClassInitFunc) gnc_tree_model_commodity_class_init,
            NULL,
            NULL,
            sizeof (GncTreeModelCommodity),
            0,
            (GInstanceInitFunc) gnc_tree_model_commodity_init
        };

        static const GInterfaceInfo tree_model_info =
        {
            (GInterfaceInitFunc) gnc_tree_model_commodity_tree_model_init,
            NULL,
            NULL
        };

        gnc_tree_model_commodity_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
                                        GNC_TREE_MODEL_COMMODITY_NAME,
                                        &our_info, 0);

        g_type_add_interface_static (gnc_tree_model_commodity_type,
                                     GTK_TYPE_TREE_MODEL,
                                     &tree_model_info);
    }

    return gnc_tree_model_commodity_type;
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
    g_return_val_if_fail (iter != NULL, FALSE);
    g_return_val_if_fail (iter->user_data != NULL, FALSE);
    g_return_val_if_fail (iter->stamp == model->stamp, FALSE);

    return (iter->user_data == ITER_IS_COMMODITY);
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
    g_return_val_if_fail (iter != NULL, FALSE);
    g_return_val_if_fail (iter->user_data != NULL, FALSE);
    g_return_val_if_fail (iter->stamp == model->stamp, FALSE);

    return (iter->user_data == ITER_IS_NAMESPACE);
}
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.

{
    GncTreeModelCommodity *model;
    GncTreeModelCommodityPrivate *priv;
    const GList *item;

    ENTER("");

    item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_COMMODITY_NAME);
    for ( ; item; item = g_list_next(item))
    {
        model = (GncTreeModelCommodity *)item->data;
        priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
        if (priv->commodity_table == ct)
        {
            g_object_ref(G_OBJECT(model));
            LEAVE("returning existing model %p", model);
            return GTK_TREE_MODEL(model);
        }
    }

    model = g_object_new (GNC_TYPE_TREE_MODEL_COMMODITY, NULL);
    priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
    priv->book = book;
    priv->commodity_table = ct;

    priv->event_handler_id =
        qof_event_register_handler (gnc_tree_model_commodity_event_handler, model);

    LEAVE("");
    return GTK_TREE_MODEL (model);
}
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.

{
    static GType gnc_tree_model_type = 0;

    if (gnc_tree_model_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncTreeModelClass),          /* class_size */
            NULL,                                  /* base_init */
            NULL,                                  /* base_finalize */
            (GClassInitFunc) gnc_tree_model_class_init,
            NULL,                                  /* class_finalize */
            NULL,                                  /* class_data */
            sizeof (GncTreeModel),                 /* */
            0,                             /* n_preallocs */
            (GInstanceInitFunc) gnc_tree_model_init
        };

        //static const GInterfaceInfo tree_model_info = {
        //  (GInterfaceInitFunc) gnc_tree_model_tree_model_init,
        //  NULL,
        //  NULL
        //};

        gnc_tree_model_type = g_type_register_static (G_TYPE_OBJECT,
                              GNC_TREE_MODEL_NAME,
                              &our_info, 0);

        //g_type_add_interface_static (gnc_tree_model_type,
        //                               GTK_TYPE_TREE_MODEL,
        //                               &tree_model_info);
    }

    return gnc_tree_model_type;
}
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 875 of file gnc-tree-model-owner.c.

{
    GncTreeModelOwnerPrivate *priv;
    GList *owner_in_list;

    ENTER("model %p, owner %p, iter %p", model, owner, iter);
    gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
    gnc_leave_return_val_if_fail ((owner != NULL), FALSE);
    gnc_leave_return_val_if_fail ((iter != NULL), FALSE);


    priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
    owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
    if (owner_in_list)
    {
        iter->stamp = model->stamp;
        iter->user_data = owner_in_list->data;
        iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list));
        iter->user_data3 = NULL;
        LEAVE("iter %s", iter_to_string (iter));
        return TRUE;
    }
    else
    {
        iter->stamp = 0;
        iter->user_data = NULL;
        LEAVE("Owner not found in list");
        return FALSE;
    }
}
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 858 of file gnc-tree-model-owner.c.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    return (GncOwner *) iter->user_data;
}
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 914 of file gnc-tree-model-owner.c.

{
    GtkTreeIter tree_iter;
    GtkTreePath *tree_path;

    ENTER("model %p, owner %p", model, owner);
    gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
    gnc_leave_return_val_if_fail (owner != NULL, NULL);

    if (!gnc_tree_model_owner_get_iter_from_owner (model, owner,
            &tree_iter))
    {
        LEAVE("no iter");
        return NULL;
    }

    tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
    if (tree_path)
    {
        gchar *path_string = gtk_tree_path_to_string(tree_path);
        LEAVE("path (2) %s", path_string);
        g_free(path_string);
    }
    else
    {
        LEAVE("no path");
    }
    return tree_path;
}
GType gnc_tree_model_owner_get_type ( void  )

Get the type of an owner tree plugin.

Returns:
A GType.

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

{
    static GType gnc_tree_model_owner_type = 0;

    if (gnc_tree_model_owner_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncTreeModelOwnerClass), /* class_size */
            NULL,                            /* base_init */
            NULL,                            /* base_finalize */
            (GClassInitFunc) gnc_tree_model_owner_class_init,
            NULL,                            /* class_finalize */
            NULL,                            /* class_data */
            sizeof (GncTreeModelOwner),      /* */
            0,                               /* n_preallocs */
            (GInstanceInitFunc) gnc_tree_model_owner_init
        };

        static const GInterfaceInfo tree_model_info =
        {
            (GInterfaceInitFunc) gnc_tree_model_owner_tree_model_init,
            NULL,
            NULL
        };

        gnc_tree_model_owner_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
                                    GNC_TREE_MODEL_OWNER_NAME,
                                    &our_info, 0);

        g_type_add_interface_static (gnc_tree_model_owner_type,
                                     GTK_TYPE_TREE_MODEL,
                                     &tree_model_info);
    }

    return gnc_tree_model_owner_type;
}
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 280 of file gnc-tree-model-owner.c.

{
    GncTreeModelOwner *model;
    GncTreeModelOwnerPrivate *priv;
    const GList *item;

    ENTER("owner_type %d", owner_type);
    item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_OWNER_NAME);
    for ( ; item; item = g_list_next(item))
    {
        model = (GncTreeModelOwner *)item->data;
        priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
        if (priv->owner_type == owner_type)
        {
            g_object_ref(G_OBJECT(model));
            LEAVE("returning existing model %p", model);
            return GTK_TREE_MODEL(model);
        }
    }

    model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
                          NULL);

    priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
    priv->book = gnc_get_current_book();
    priv->owner_type = owner_type;
    priv->owner_list = gncBusinessGetOwnerList (priv->book, gncOwnerTypeToQofIdType(owner_type), TRUE);

    priv->event_handler_id = qof_event_register_handler
                             ((QofEventHandler)gnc_tree_model_owner_event_handler, model);

    LEAVE("model %p", model);
    return GTK_TREE_MODEL (model);
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    if (iter->user_data != ITER_IS_COMMODITY)
        return NULL;
    return (gnc_commodity *)iter->user_data2;
}
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 1257 of file gnc-tree-model-price.c.

{
    gnc_commodity_namespace *namespace;
    GList *list;
    gint n;

    ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
    g_return_val_if_fail ((commodity != NULL), FALSE);
    g_return_val_if_fail ((iter != NULL), FALSE);

    namespace = gnc_commodity_get_namespace_ds(commodity);
    if (namespace == NULL)
    {
        LEAVE("no namespace");
        return FALSE;
    }

    list = gnc_commodity_namespace_get_commodity_list(namespace);
    if (list == NULL)
    {
        LEAVE("empty list");
        return FALSE;
    }

    n = g_list_index(list, commodity);
    if (n == -1)
    {
        LEAVE("not in list");
        return FALSE;
    }

    iter->stamp = model->stamp;
    iter->user_data  = ITER_IS_COMMODITY;
    iter->user_data2 = commodity;
    iter->user_data3 = GINT_TO_POINTER(n);
    LEAVE("iter %s", iter_to_string(model, iter));
    return TRUE;
}
gboolean gnc_tree_model_price_get_iter_from_namespace ( GncTreeModelPrice model,
gnc_commodity_namespace namespace,
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 1305 of file gnc-tree-model-price.c.

{
    GncTreeModelPricePrivate *priv;
    gnc_commodity_table *ct;
    GList *list;
    gint n;

    ENTER("model %p, namespace %p, iter %p", model, namespace, iter);
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
    g_return_val_if_fail ((namespace != NULL), FALSE);
    g_return_val_if_fail ((iter != NULL), FALSE);

    priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
    ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
    list = gnc_commodity_table_get_namespaces_list(ct);
    if (list == NULL)
        return FALSE;

    n = g_list_index(list, namespace);
    if (n == -1)
        return FALSE;

    iter->stamp = model->stamp;
    iter->user_data  = ITER_IS_NAMESPACE;
    iter->user_data2 = namespace;
    iter->user_data3 = GINT_TO_POINTER(n);
    LEAVE("iter %s", iter_to_string(model, iter));
    return TRUE;
}
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 1169 of file gnc-tree-model-price.c.

{
    GncTreeModelPricePrivate *priv;
    gnc_commodity *commodity;
    GList *list;
    gint n;

    ENTER("model %p, price %p, iter %p", model, price, iter);
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
    g_return_val_if_fail ((price != NULL), FALSE);
    g_return_val_if_fail ((iter != NULL), FALSE);

    priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
    commodity = gnc_price_get_commodity(price);
    if (commodity == NULL)
    {
        LEAVE("no commodity");
        return FALSE;
    }

    list = gnc_pricedb_get_prices(priv->price_db, commodity, NULL);
    if (list == NULL)
    {
        LEAVE("empty list");
        return FALSE;
    }

    n = g_list_index(list, price);
    if (n == -1)
    {
        gnc_price_list_destroy(list);
        LEAVE("not in list");
        return FALSE;
    }

    iter->stamp = model->stamp;
    iter->user_data  = ITER_IS_PRICE;
    iter->user_data2 = price;
    iter->user_data3 = GINT_TO_POINTER(n);
    gnc_price_list_destroy(list);
    LEAVE("iter %s", iter_to_string(model, iter));
    return TRUE;
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    if (iter->user_data != ITER_IS_NAMESPACE)
        return NULL;
    return (gnc_commodity_namespace *)iter->user_data2;
}
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 1221 of file gnc-tree-model-price.c.

{
    GtkTreeIter tree_iter;
    GtkTreePath *tree_path;

    ENTER("model %p, price %p", model, price);
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
    g_return_val_if_fail (price != NULL, NULL);

    if (!gnc_tree_model_price_get_iter_from_price (model, price, &tree_iter))
    {
        LEAVE("no iter");
        return NULL;
    }

    tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
    if (tree_path)
    {
        gchar *path_string = gtk_tree_path_to_string(tree_path);
        LEAVE("path (2) %s", path_string);
        g_free(path_string);
    }
    else
    {
        LEAVE("no path");
    }
    return tree_path;
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
    g_return_val_if_fail (iter != NULL, NULL);
    g_return_val_if_fail (iter->user_data != NULL, NULL);
    g_return_val_if_fail (iter->stamp == model->stamp, NULL);

    if (iter->user_data != ITER_IS_PRICE)
        return NULL;
    return (GNCPrice *)iter->user_data2;
}
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.

{
    static GType gnc_tree_model_price_type = 0;

    if (gnc_tree_model_price_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncTreeModelPriceClass),
            NULL,
            NULL,
            (GClassInitFunc) gnc_tree_model_price_class_init,
            NULL,
            NULL,
            sizeof (GncTreeModelPrice),
            0,
            (GInstanceInitFunc) gnc_tree_model_price_init
        };

        static const GInterfaceInfo tree_model_info =
        {
            (GInterfaceInitFunc) gnc_tree_model_price_tree_model_init,
            NULL,
            NULL
        };

        gnc_tree_model_price_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
                                    GNC_TREE_MODEL_PRICE_NAME,
                                    &our_info, 0);

        g_type_add_interface_static (gnc_tree_model_price_type,
                                     GTK_TYPE_TREE_MODEL,
                                     &tree_model_info);
    }

    return gnc_tree_model_price_type;
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
    g_return_val_if_fail (iter != NULL, FALSE);
    g_return_val_if_fail (iter->user_data != NULL, FALSE);
    g_return_val_if_fail (iter->stamp == model->stamp, FALSE);

    return (iter->user_data == ITER_IS_COMMODITY);
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
    g_return_val_if_fail (iter != NULL, FALSE);
    g_return_val_if_fail (iter->user_data != NULL, FALSE);
    g_return_val_if_fail (iter->stamp == model->stamp, FALSE);

    return (iter->user_data == ITER_IS_NAMESPACE);
}
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.

{
    g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
    g_return_val_if_fail (iter != NULL, FALSE);
    g_return_val_if_fail (iter->user_data != NULL, FALSE);
    g_return_val_if_fail (iter->stamp == model->stamp, FALSE);

    return (iter->user_data == ITER_IS_PRICE);
}
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.

{
    GncTreeModelPrice *model;
    GncTreeModelPricePrivate *priv;
    const GList *item;

    item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_PRICE_NAME);
    for ( ; item; item = g_list_next(item))
    {
        model = (GncTreeModelPrice *)item->data;
        priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
        if (priv->price_db == price_db)
        {
            g_object_ref(G_OBJECT(model));
            LEAVE("returning existing model %p", model);
            return GTK_TREE_MODEL(model);
        }
    }

    model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE,
                          NULL);

    priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
    priv->book = book;
    priv->price_db = price_db;

    priv->event_handler_id =
        qof_event_register_handler (gnc_tree_model_price_event_handler, model);

    return GTK_TREE_MODEL (model);
}
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 1679 of file gnc-tree-view-account.c.

{
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;

    g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (account_view), NULL);

    renderer = gtk_cell_renderer_text_new ();
    g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);

    column = gtk_tree_view_column_new_with_attributes (column_title,
             renderer, NULL);
    if (col_edited_cb)
    {
        gtva_setup_column_renderer_edited_cb(account_view, column,
                                             renderer, col_edited_cb);
    }
    gtk_tree_view_column_set_cell_data_func (column, renderer,
            col_source_helper,
            col_source_cb, NULL);
    gnc_tree_view_append_column (GNC_TREE_VIEW(account_view), column);
    return 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 1583 of file gnc-tree-view-account.c.

{
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;

    g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
    g_return_val_if_fail (kvp_key != NULL, NULL);

    column = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), column_title,
                                           kvp_key, NULL, "Sample text",
                                           -1, -1, NULL);

    /* This new kvp column has only had one renderer added to it so
     * far.  Find that renderer. */
    renderer = gnc_tree_view_column_get_renderer(column);
    g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);

    gtk_tree_view_column_set_cell_data_func (column, renderer,
            account_cell_kvp_data_func,
            g_strdup(kvp_key), g_free);
    return column;
}
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 868 of file gnc-tree-view-account.c.

{
    GtkTreeModel *s_model;
    GtkTreeIter s_iter;
    gint num_children;

    ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));

    if (account == NULL)
    {
        LEAVE("no account");
        return 0;
    }

    if (!gnc_tree_view_account_get_iter_from_account (view, account, &s_iter))
    {
        LEAVE("view_get_iter_from_account failed");
        return 0;
    }

    /* Any children? */
    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    num_children = gtk_tree_model_iter_n_children(s_model, &s_iter);
    LEAVE("%d children", num_children);
    return num_children;
}
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 1449 of file gnc-tree-view-account.c.

{
    GtkTreePath *path;

    g_return_if_fail(view != NULL);
    g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
    ENTER("view %p, account %p", view, account);

    path = gnc_tree_view_account_get_path_from_account(view, account);
    if (path)
    {
        gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
        gtk_tree_path_free(path);
    }
    LEAVE(" ");
}
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 1098 of file gnc-tree-view-account.c.

{
    GtkTreeModel *model, *f_model;
    GtkTreeIter iter, f_iter;
    Account *account;

    g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
    g_return_val_if_fail (s_iter != NULL, NULL);

    ENTER("model %p, iter %p", s_model, s_iter);

    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
            &f_iter,
            s_iter);
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_convert_iter_to_child_iter (
        GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
    account = gnc_tree_model_account_get_account (
                  GNC_TREE_MODEL_ACCOUNT(model), &iter);
    LEAVE("account %p (%s)", account, xaccAccountGetName (account));
    return account;
}
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 1052 of file gnc-tree-view-account.c.

{
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *path, *f_path;
    GtkTreeIter iter;
    Account *account;

    ENTER("view %p", view);
    g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
    g_return_val_if_fail (s_path != NULL, NULL);

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_path = gtk_tree_model_sort_convert_path_to_child_path (
                 GTK_TREE_MODEL_SORT (s_model), s_path);
    if (!f_path)
    {
        LEAVE("no filter path");
        return NULL;
    }

    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    path = gtk_tree_model_filter_convert_path_to_child_path (
               GTK_TREE_MODEL_FILTER (f_model), f_path);
    gtk_tree_path_free(f_path);
    if (!path)
    {
        LEAVE("no path");
        return NULL;
    }

    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
    if (!gtk_tree_model_get_iter (model, &iter, path))
    {
        LEAVE("no iter");
        return NULL;
    }

    account = iter.user_data;
    gtk_tree_path_free(path);
    LEAVE("account %p (%s)", account, xaccAccountGetName (account));
    return 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 1472 of file gnc-tree-view-account.c.

{
    GtkTreeModel *s_model;
    GtkTreePath *s_path;
    Account *account;

    ENTER("view %p", view);
    g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);

    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
    gtk_tree_view_get_cursor (GTK_TREE_VIEW(view), &s_path, NULL);
    if (!s_path)
    {
        LEAVE("no account");
        return NULL;
    }

    account = gnc_tree_view_account_get_account_from_path (view, s_path);
    gtk_tree_path_free(s_path);
    LEAVE("account %p (%s)", account, xaccAccountGetName (account));
    return 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 1129 of file gnc-tree-view-account.c.

{
    GtkTreeSelection *selection;
    GtkTreeModel *f_model, *s_model;
    GtkTreeIter iter, f_iter, s_iter;
    Account *account;
    GtkSelectionMode mode;

    ENTER("view %p", view);
    g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
    mode = gtk_tree_selection_get_mode(selection);
    if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
    {
        return NULL;
    }
    if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
    {
        LEAVE("no account, get_selected failed");
        return FALSE;
    }

    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
            &f_iter, &s_iter);

    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_convert_iter_to_child_iter (
        GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);

    account = iter.user_data;
    LEAVE("account %p (%s)", account, xaccAccountGetName (account));
    return account;
}
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 1287 of file gnc-tree-view-account.c.

{
    GtkTreeSelection *selection;
    GncTreeViewSelectionInfo info;

    g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);

    info.return_list = NULL;
    info.priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
    gtk_tree_selection_selected_foreach(selection, get_selected_accounts_helper, &info);
    return info.return_list;
}
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 906 of file gnc-tree-view-account.c.

{
    GncTreeViewAccountPrivate *priv;

    g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
    g_return_if_fail(avi != NULL);

    priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);

    *avi = priv->avi;
}
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 773 of file gnc-tree-view-account.c.

{
    Account *root;

    root = gnc_book_get_root_account (gnc_get_current_book ());
    return gnc_tree_view_account_new_with_root (root, show_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 548 of file gnc-tree-view-account.c.

{
    GncTreeView *view;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *virtual_root_path = NULL;
    const gchar *sample_type, *sample_commodity;
    GncTreeViewAccountPrivate *priv;
    GtkTreeViewColumn *tax_info_column;
    GtkCellRenderer *renderer;

    ENTER(" ");
    /* Create our view */
    view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT,
                         "name", "account_tree", NULL);

    priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(GNC_TREE_VIEW_ACCOUNT (view));

    /* Create/get a pointer to the existing model for this set of books. */
    model = gnc_tree_model_account_new (root);

    /* Set up the view private filter layer on the common model. */
    if (!show_root)
        virtual_root_path = gtk_tree_path_new_first ();
    f_model = gtk_tree_model_filter_new (model, virtual_root_path);
    /* A GncTreeModelAccount is based on a GncTreeModel, which is a
     * GObject that provides a GtkTreeModel interface. */
    g_object_unref(G_OBJECT(model));
    if (virtual_root_path)
        gtk_tree_path_free(virtual_root_path);

    /* Set up the view private sort layer on the common model. */
    s_model = gtk_tree_model_sort_new_with_model(f_model);
    g_object_unref(G_OBJECT(f_model));
    gnc_tree_view_set_model (view, s_model);
    g_object_unref(G_OBJECT(s_model));

    /* Set default visibilities */
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);

    sample_type = xaccAccountGetTypeStr(ACCT_TYPE_CREDIT);
    sample_commodity = gnc_commodity_get_fullname(gnc_default_currency());

    priv->name_column
    = gnc_tree_view_add_text_column(view, _("Account Name"), "name",
                                    GNC_STOCK_ACCOUNT, "Expenses:Entertainment",
                                    GNC_TREE_MODEL_ACCOUNT_COL_NAME,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    gnc_tree_view_add_text_column(view, _("Type"), "type", NULL, sample_type,
                                  GNC_TREE_MODEL_ACCOUNT_COL_TYPE,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Commodity"), "commodity", NULL,
                                  sample_commodity,
                                  GNC_TREE_MODEL_ACCOUNT_COL_COMMODITY,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    priv->code_column
    = gnc_tree_view_add_text_column(view, _("Account Code"), "account-code", NULL,
                                    "1-123-1234",
                                    GNC_TREE_MODEL_ACCOUNT_COL_CODE,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_code);
    priv->desc_column
    = gnc_tree_view_add_text_column(view, _("Description"), "description", NULL,
                                    "Sample account description.",
                                    GNC_TREE_MODEL_ACCOUNT_COL_DESCRIPTION,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    gnc_tree_view_add_numeric_column(view, _("Last Num"), "lastnum", "12345",
                                     GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM,
                                     GNC_TREE_VIEW_COLUMN_COLOR_NONE,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_string);
    gnc_tree_view_add_numeric_column(view, _("Present"), "present",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_PRESENT,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_present_value);
    priv->present_report_column
    = gnc_tree_view_add_numeric_column(view, _("Present (Report)"), "present_report",
                                       SAMPLE_ACCOUNT_VALUE,
                                       GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT,
                                       GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
                                       GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                       sort_by_present_value);
    gnc_tree_view_add_numeric_column(view, _("Balance"), "balance",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_BALANCE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_balance_value);
    priv->balance_report_column
    = gnc_tree_view_add_numeric_column(view, _("Balance (Report)"), "balance_report",
                                       SAMPLE_ACCOUNT_VALUE,
                                       GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT,
                                       GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
                                       GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                       sort_by_balance_value);

    gnc_tree_view_add_numeric_column(view, _("Balance (Period)"), "balance-period",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_balance_period_value);
    gnc_tree_view_add_numeric_column(view, _("Cleared"), "cleared",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_cleared_value);
    priv->cleared_report_column
    = gnc_tree_view_add_numeric_column(view, _("Cleared (Report)"), "cleared_report",
                                       SAMPLE_ACCOUNT_VALUE,
                                       GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT,
                                       GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
                                       GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                       sort_by_cleared_value);
    gnc_tree_view_add_numeric_column(view, _("Reconciled"), "reconciled",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_reconciled_value);
    priv->reconciled_report_column
    = gnc_tree_view_add_numeric_column(view, _("Reconciled (Report)"), "reconciled_report",
                                       SAMPLE_ACCOUNT_VALUE,
                                       GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT,
                                       GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
                                       GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                       sort_by_reconciled_value);
    gnc_tree_view_add_text_column(view, _("Last Reconcile Date"), "last-recon-date", NULL,
                                  "Last Reconcile Date",
                                  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_numeric_column(view, _("Future Minimum"), "future_min",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_future_min_value);
    priv->future_min_report_column
    =  gnc_tree_view_add_numeric_column(view, _("Future Minimum (Report)"), "future_min_report",
                                        SAMPLE_ACCOUNT_VALUE,
                                        GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT,
                                        GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
                                        GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                        sort_by_future_min_value);
    gnc_tree_view_add_numeric_column(view, _("Total"), "total",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_TOTAL,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_total_value);
    priv->total_report_column
    = gnc_tree_view_add_numeric_column(view, _("Total (Report)"), "total_report",
                                       SAMPLE_ACCOUNT_VALUE,
                                       GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT,
                                       GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
                                       GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                       sort_by_total_value);
    gnc_tree_view_add_numeric_column(view, _("Total (Period)"), "total-period",
                                     SAMPLE_ACCOUNT_VALUE,
                                     GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD,
                                     GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_total_period_value);
    priv->notes_column
    = gnc_tree_view_add_text_column(view, _("Notes"), "notes", NULL,
                                    "Sample account notes.",
                                    GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    tax_info_column
    = gnc_tree_view_add_text_column(view, _("Tax Info"), "tax-info", NULL,
                                    "Sample tax info.",
                                    GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    renderer = gnc_tree_view_column_get_renderer(tax_info_column);
    gtk_tree_view_column_set_cell_data_func(tax_info_column,
                                            renderer,
                                            tax_info_data_func,
                                            GTK_TREE_VIEW(view),
                                            NULL);
    gnc_tree_view_add_toggle_column(view, _("Placeholder"),
                                    /* Translators: This string has a context prefix; the translation
                                        must only contain the part after the | character. */
                                    Q_("Column letter for 'Placeholder'|P"),
                                    "placeholder",
                                    GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_placeholder,
                                    gnc_tree_view_account_placeholder_toggled);

    /* Update column titles to use the currency name. */
    gtva_update_column_names(view);

    /* By default only the first column is visible. */
    gnc_tree_view_configure_columns(view);
    gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
                                            gnc_tree_view_account_filter_helper,
                                            view,
                                            NULL);

    /* Default the sorting to account name */
    gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                         GNC_TREE_MODEL_ACCOUNT_COL_NAME,
                                         GTK_SORT_ASCENDING);

    gtk_widget_show(GTK_WIDGET(view));
    LEAVE("%p", view);
    return GTK_TREE_VIEW(view);
}
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 1018 of file gnc-tree-view-account.c.

{
    GtkTreeModel *f_model, *s_model;

    g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
}
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 1377 of file gnc-tree-view-account.c.

{
    GtkTreeModel *s_model;
    GtkTreeSelection *selection;
    GtkTreePath *sp_account, *sp_start, *sp_end;
    GtkTreeIter si_account, si_start, si_end;
    gboolean have_start, have_end;
    gint num_children;

    ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));

    g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));

    if (account == NULL)
    {
        LEAVE("no account");
        return;
    }

    if (!gnc_tree_view_account_get_iter_from_account (view, account, &si_account))
    {
        LEAVE("view_get_iter_from_account failed");
        return;
    }

    /* Any children? */
    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    num_children = gtk_tree_model_iter_n_children(s_model, &si_account);
    if (num_children == 0)
    {
        LEAVE("no children");
        return;
    }

    /* Expand the tree.  Required for selection to work */
    sp_account = gtk_tree_model_get_path (s_model, &si_account);
    gtk_tree_view_expand_row (GTK_TREE_VIEW(view), sp_account, TRUE);

    /* compute start/end paths */
    have_start = gtk_tree_model_iter_nth_child(s_model, &si_start, &si_account, 0);
    si_end = si_account;
    while (num_children)
    {
        GtkTreeIter tmp_iter = si_end;
        have_end = gtk_tree_model_iter_nth_child(s_model, &si_end, &tmp_iter,
                   num_children - 1);
        if (have_end)
            num_children = gtk_tree_model_iter_n_children(s_model, &si_end);
        else
            num_children = 0;
    }

    if (have_start && have_end)
    {
        sp_start = gtk_tree_model_get_path (s_model, &si_start);
        sp_end = gtk_tree_model_get_path (s_model, &si_end);

        /* select everything between */
        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
        gtk_tree_selection_select_range (selection, sp_start, sp_end);

        /* clean up */
        gtk_tree_path_free(sp_start);
        gtk_tree_path_free(sp_end);
    }
    gtk_tree_path_free(sp_account);
    LEAVE(" ");
    return;
}
void gnc_tree_view_account_set_filter ( GncTreeViewAccount account_view,
gnc_tree_view_account_filter_func  func,
gpointer  data,
GtkFunction  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 989 of file gnc-tree-view-account.c.

{
    GncTreeViewAccountPrivate *priv;

    ENTER("view %p, filter func %p, data %p, destroy %p",
          view, func, data, destroy);

    g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));

    priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
    if (priv->filter_destroy)
    {
        priv->filter_destroy(priv->filter_data);
    }
    priv->filter_destroy = destroy;
    priv->filter_data = data;
    priv->filter_fn = func;

    gnc_tree_view_account_refilter(view);
    LEAVE(" ");
}
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 1169 of file gnc-tree-view-account.c.

{
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *path, *f_path, *s_path, *parent_path;
    GtkTreeSelection *selection;

    ENTER("view %p, account %p (%s)", view,
          account, xaccAccountGetName (account));
    g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));

    /* Clear any existing selection. */
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
    gtk_tree_selection_unselect_all (selection);

    if (account == NULL)
        return;

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));

    path = gnc_tree_model_account_get_path_from_account (
               GNC_TREE_MODEL_ACCOUNT(model), account);
    if (path == NULL)
    {
        LEAVE("no path");
        return;
    }
    debug_path(DEBUG, path);

    f_path = gtk_tree_model_filter_convert_child_path_to_path (
                 GTK_TREE_MODEL_FILTER (f_model), path);
    gtk_tree_path_free(path);
    if (f_path == NULL)
    {
        LEAVE("no filter path");
        return;
    }
    debug_path(DEBUG, f_path);

    s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
             f_path);
    gtk_tree_path_free(f_path);
    if (s_path == NULL)
    {
        LEAVE("no sort path");
        return;
    }

    /* gtk_tree_view requires that a row be visible before it can be selected */
    parent_path = gtk_tree_path_copy (s_path);
    if (gtk_tree_path_up (parent_path))
    {
        /* This function is misnamed.  It expands the actual item
         * specified, not the path to the item specified. I.E. It expands
         * one level too many, thus the get of the parent. */
        gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
    }
    gtk_tree_path_free(parent_path);

    gtk_tree_selection_select_path (selection, s_path);

    /* give gtk+ a chance to resize the tree view first by handling pending
     * configure events */
    while (gtk_events_pending ())
        gtk_main_iteration ();
    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
    debug_path(LEAVE, s_path);
    gtk_tree_path_free(s_path);
}
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 1306 of file gnc-tree-view-account.c.

{
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *path, *f_path, *s_path, *parent_path;
    GtkTreeSelection *selection;
    GList *element;
    Account *account;

    g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));

    /* Clear any existing selection. */
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
    gtk_tree_selection_unselect_all (selection);
    gtk_tree_view_collapse_all (GTK_TREE_VIEW(view));

    /* Now go select what the user requested. */
    for (element = account_list; element; )
    {
        account = element->data;
        element = g_list_next(element);

        path = gnc_tree_model_account_get_path_from_account (GNC_TREE_MODEL_ACCOUNT(model), account);
        if (path == NULL)
        {
            /*
             * Oops.  Someone must have deleted this account and not cleaned
             * up all references to it.
             */
            continue;
        }

        f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
                 path);
        gtk_tree_path_free(path);
        if (f_path == NULL)
            continue;

        s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
                 f_path);
        gtk_tree_path_free(f_path);
        if (s_path == NULL)
            continue;

        /* gtk_tree_view requires that a row be visible before it can be selected */
        parent_path = gtk_tree_path_copy (s_path);
        if (gtk_tree_path_up (parent_path))
        {
            /* This function is misnamed.  It expands the actual item
             * specified, not the path to the item specified. I.E. It
             * expands one level too many, thus the get of the parent. */
            gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
        }
        gtk_tree_path_free(parent_path);

        gtk_tree_selection_select_path (selection, s_path);
        if (show_last && (element == NULL))
            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
        gtk_tree_path_free(s_path);
    }
}
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 934 of file gnc-tree-view-account.c.

{
    GncTreeViewAccountPrivate *priv;
    gint i;
    guint sel_bits = 0;

    ENTER("%p", account_view);
    g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
    g_return_if_fail(avi != NULL);

    priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
    priv->avi = *avi;

    for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
    {
        sel_bits |= avi->include_type[i] ? (1 << i) : 0;
    }

    gnc_tree_view_account_set_filter(
        account_view, gnc_tree_view_account_filter_by_view_info,
        &priv->avi, NULL);

    LEAVE(" ");
}
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_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_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 647 of file gnc-tree-view-commodity.c.

{
    GtkTreeSelection *selection;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreeIter iter, f_iter, s_iter;
    gnc_commodity *commodity;

    g_return_val_if_fail (GNC_IS_TREE_VIEW_COMMODITY (view), NULL);

    ENTER("view %p", view);

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
    if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
    {
        LEAVE("no commodity, get_selected failed");
        return FALSE;
    }

    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
            &f_iter, &s_iter);

    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
            &iter, &f_iter);

    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
    commodity = gnc_tree_model_commodity_get_commodity (GNC_TREE_MODEL_COMMODITY(model),
                &iter);
    LEAVE("commodity %p (%s)", commodity,
          commodity ? gnc_commodity_get_mnemonic(commodity) : "");
    return commodity;
}
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 360 of file gnc-tree-view-commodity.c.

{
    GncTreeView *view;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreeViewColumn *col;
    gnc_commodity_table *ct;
    va_list var_args;

    ENTER(" ");
    /* Create/get a pointer to the existing model for this set of books. */
    ct = gnc_commodity_table_get_table (book);
    model = gnc_tree_model_commodity_new (book, ct);

    /* Set up the view private filter on the common model. */
    f_model = gtk_tree_model_filter_new (model, NULL);
    g_object_unref(G_OBJECT(model));
    s_model = gtk_tree_model_sort_new_with_model (f_model);
    g_object_unref(G_OBJECT(f_model));

    /* Create our view */
    view = g_object_new (GNC_TYPE_TREE_VIEW_COMMODITY,
                         "name", "commodity_tree", NULL);
    gnc_tree_view_set_model (view, s_model);
    g_object_unref(G_OBJECT(s_model));

    DEBUG("model ref count is %d",   G_OBJECT(model)->ref_count);
    DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
    DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);

    /* Set default visibilities */
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);

    col = gnc_tree_view_add_text_column (
              view, _("Namespace"), "namespace", NULL, "NASDAQ",
              GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE,
              GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              view, _("Symbol"), "symbol", NULL, "ACMEACME",
              GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Name"), "name", NULL, "Acme Corporation, Inc.",
              GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Print Name"), "printname", NULL,
              "ACMEACME (Acme Corporation, Inc.)",
              GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              view, _("Unique Name"), "uniquename", NULL,
              "NASDAQ::ACMEACME", GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              /* Translators: Again replace CUSIP by the name of your
                 National Securities Identifying Number. */
              view, _("ISIN/CUSIP"), "cusip_code", NULL, "QWERTYUIOP",
              GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_numeric_column (
              view, _("Fraction"), "fraction", "10000",
              GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
              GNC_TREE_VIEW_COLUMN_COLOR_NONE,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_fraction);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_toggle_column(
              view, _("Get Quotes"),
              /* Translators: This string has a context prefix; the translation
                 must only contain the part after the | character. */
              Q_("Column letter for 'Get Quotes'|Q"), "quote_flag",
              GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_quote_flag,
              NULL);
    col = gnc_tree_view_add_text_column (
              view, _("Source"), "quote_source", NULL, "yahoo",
              GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    col = gnc_tree_view_add_text_column (
              view, _("Timezone"), "quote_timezone", NULL, "America/New_York",
              GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
              GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
              sort_by_commodity_string);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));

    gnc_tree_view_configure_columns(view);

    /* Set properties */
    va_start (var_args, first_property_name);
    g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
    va_end (var_args);

    /* Sort on the name column by default. This allows for a consistent
     * sort if commodities are briefly removed and re-added. */
    if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
            NULL, NULL))
    {
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                             GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
                                             GTK_SORT_ASCENDING);
    }

    gtk_widget_show(GTK_WIDGET(view));
    LEAVE(" %p", view);
    return GTK_TREE_VIEW(view);
}
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 624 of file gnc-tree-view-commodity.c.

{
    GtkTreeModel *f_model, *s_model;

    g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));

    ENTER("view %p", view);
    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
    LEAVE(" ");
}
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.
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,
GtkDestroyNotify  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 586 of file gnc-tree-view-commodity.c.

{
    GtkTreeModel *f_model, *s_model;
    filter_user_data *fd = data;

    g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));
    g_return_if_fail((ns_func != NULL) || (cm_func != NULL));

    ENTER("view %p, ns func %p, cm func %p, data %p, destroy %p",
          view, ns_func, cm_func, data, destroy);

    fd = g_malloc(sizeof(filter_user_data));
    fd->user_ns_fn   = ns_func;
    fd->user_cm_fn   = cm_func;
    fd->user_data    = data;
    fd->user_destroy = destroy;

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
                                            gnc_tree_view_commodity_filter_helper,
                                            fd,
                                            gnc_tree_view_commodity_filter_destroy);

    /* Whack any existing levels. The top two levels have been created
     * before this routine can be called. */
    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
    LEAVE(" ");
}
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 724 of file gnc-tree-view-owner.c.

{
    GtkTreeModel *model, *f_model;
    GtkTreeIter iter, f_iter;
    GncOwner *owner;

    g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
    g_return_val_if_fail (s_iter != NULL, NULL);

    ENTER("model %p, iter %p", s_model, s_iter);

    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
            &f_iter,
            s_iter);
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_convert_iter_to_child_iter (
        GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
    owner = gnc_tree_model_owner_get_owner (
                GNC_TREE_MODEL_OWNER(model), &iter);
    LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
    return owner;
}
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 678 of file gnc-tree-view-owner.c.

{
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *path, *f_path;
    GtkTreeIter iter;
    GncOwner *owner;

    ENTER("view %p", view);
    g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
    g_return_val_if_fail (s_path != NULL, NULL);

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_path = gtk_tree_model_sort_convert_path_to_child_path (
                 GTK_TREE_MODEL_SORT (s_model), s_path);
    if (!f_path)
    {
        LEAVE("no filter path");
        return NULL;
    }

    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    path = gtk_tree_model_filter_convert_path_to_child_path (
               GTK_TREE_MODEL_FILTER (f_model), f_path);
    gtk_tree_path_free(f_path);
    if (!path)
    {
        LEAVE("no path");
        return NULL;
    }

    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
    if (!gtk_tree_model_get_iter (model, &iter, path))
    {
        LEAVE("no iter");
        return NULL;
    }

    owner = iter.user_data;
    gtk_tree_path_free(path);
    LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
    return 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 755 of file gnc-tree-view-owner.c.

{
    GtkTreeSelection *selection;
    GtkTreeModel *f_model, *s_model;
    GtkTreeIter iter, f_iter, s_iter;
    GncOwner *owner;
    GtkSelectionMode mode;

    ENTER("view %p", view);
    g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
    mode = gtk_tree_selection_get_mode(selection);
    if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
    {
        return NULL;
    }
    if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
    {
        LEAVE("no owner, get_selected failed");
        return FALSE;
    }

    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
            &f_iter, &s_iter);

    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_convert_iter_to_child_iter (
        GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);

    owner = iter.user_data;
    LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
    return owner;
}
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 360 of file gnc-tree-view-owner.c.

{
    GncTreeView *view;
    GtkTreeModel *model, *f_model, *s_model;
    const gchar *sample_type, *sample_currency;
    GncTreeViewOwnerPrivate *priv;
    GtkTreeViewColumn *tax_info_column;
    GtkCellRenderer *renderer;

    ENTER(" ");
    /* Create our view */
    view = g_object_new (GNC_TYPE_TREE_VIEW_OWNER,
                         "name", "owner_tree", NULL);

    priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(GNC_TREE_VIEW_OWNER (view));

    /* Create/get a pointer to the existing model for this set of books. */
    model = gnc_tree_model_owner_new (owner_type);

    /* Set up the view private filter layer on the common model. */
    f_model = gtk_tree_model_filter_new (model, NULL);
    /* A GncTreeModelOwner is based on a GncTreeModel, which is a
     * GObject that provides a GtkTreeModel interface. */
    g_object_unref(G_OBJECT(model));

    /* Set up the view private sort layer on the common model. */
    s_model = gtk_tree_model_sort_new_with_model(f_model);
    g_object_unref(G_OBJECT(f_model));
    gnc_tree_view_set_model (view, s_model);
    g_object_unref(G_OBJECT(s_model));

    /* Set default visibilities */
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);

    sample_type = gncOwnerTypeToQofIdType (GNC_OWNER_CUSTOMER);
    sample_currency = gnc_commodity_get_fullname(gnc_default_currency());

    priv->name_column
    = gnc_tree_view_add_text_column(view, _("Owner Name"), GNC_OWNER_TREE_NAME_COL,
                                    NULL, "GnuCash Inc.",
                                    GNC_TREE_MODEL_OWNER_COL_NAME,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    gnc_tree_view_add_text_column(view, _("Type"), GNC_OWNER_TREE_TYPE_COL,
                                  NULL, sample_type,
                                  GNC_TREE_MODEL_OWNER_COL_TYPE,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    priv->id_column
    = gnc_tree_view_add_text_column(view, _("Owner ID"), GNC_OWNER_TREE_ID_COL,
                                    NULL, "1-123-1234",
                                    GNC_TREE_MODEL_OWNER_COL_ID,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    gnc_tree_view_add_text_column(view, _("Currency"), GNC_OWNER_TREE_CURRENCY_COL,
                                  NULL, sample_currency,
                                  GNC_TREE_MODEL_OWNER_COL_CURRENCY,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Address Name"), GNC_OWNER_TREE_ADDRESS_NAME_COL,
                                  NULL, "GnuCash Inc.",
                                  GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Address 1"), GNC_OWNER_TREE_ADDRESS_1_COL,
                                  NULL, "Free Software Foundation",
                                  GNC_TREE_MODEL_OWNER_COL_ADDRESS_1,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Address 2"), GNC_OWNER_TREE_ADDRESS_2_COL,
                                  NULL, "51 Franklin Street, Fifth Floor",
                                  GNC_TREE_MODEL_OWNER_COL_ADDRESS_2,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Address 3"), GNC_OWNER_TREE_ADDRESS_3_COL,
                                  NULL, "Boston, MA  02110-1301",
                                  GNC_TREE_MODEL_OWNER_COL_ADDRESS_3,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Address 4"), GNC_OWNER_TREE_ADDRESS_4_COL,
                                  NULL, "USA",
                                  GNC_TREE_MODEL_OWNER_COL_ADDRESS_4,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Phone"), GNC_OWNER_TREE_PHONE_COL,
                                  NULL, "+1-617-542-5942",
                                  GNC_TREE_MODEL_OWNER_COL_PHONE,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("Fax"), GNC_OWNER_TREE_FAX_COL,
                                  NULL, "+1-617-542-2652",
                                  GNC_TREE_MODEL_OWNER_COL_FAX,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_text_column(view, _("E-mail"), GNC_OWNER_TREE_EMAIL_COL,
                                  NULL, "gnu@gnu.org",
                                  GNC_TREE_MODEL_OWNER_COL_EMAIL,
                                  GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                  sort_by_string);
    gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_COL,
                                     SAMPLE_OWNER_VALUE,
                                     GNC_TREE_MODEL_OWNER_COL_BALANCE,
                                     GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_balance_value);

    priv->balance_report_column
    = gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_REPORT_COL,
                                       SAMPLE_OWNER_VALUE,
                                       GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT,
                                       GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
                                       GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                       sort_by_balance_value);

    priv->notes_column
    = gnc_tree_view_add_text_column(view, _("Notes"), GNC_OWNER_TREE_NOTES_COL, NULL,
                                    "Sample owner notes.",
                                    GNC_TREE_MODEL_OWNER_COL_NOTES,
                                    GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                    sort_by_string);
    gnc_tree_view_add_toggle_column (view, _("Active"),
                                     /* Translators: This string has a context prefix; the translation
                                        must only contain the part after the | character. */
                                     Q_("Column letter for 'Active'|A"),
                                     GNC_OWNER_TREE_ACTIVE_COL,
                                     GNC_TREE_MODEL_OWNER_COL_ACTIVE,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_boolean,
                                     gnc_tree_view_owner_active_toggled);

    /* Update column titles to use the currency name. */
    gtvo_update_column_names(view);

    /* By default only the first column is visible. */
    gnc_tree_view_configure_columns(view);
    gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
                                            gnc_tree_view_owner_filter_helper,
                                            view,
                                            NULL);

    /* Default the sorting to owner name */
    gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                         GNC_TREE_MODEL_OWNER_COL_NAME,
                                         GTK_SORT_ASCENDING);

    gtk_widget_show(GTK_WIDGET(view));
    LEAVE("%p", view);
    return GTK_TREE_VIEW(view);
}
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 658 of file gnc-tree-view-owner.c.

{
    GtkTreeModel *f_model, *s_model;

    g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
}
void gnc_tree_view_owner_set_filter ( GncTreeViewOwner owner_view,
gnc_tree_view_owner_filter_func  func,
gpointer  data,
GtkFunction  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 629 of file gnc-tree-view-owner.c.

{
    GncTreeViewOwnerPrivate *priv;

    ENTER("view %p, filter func %p, data %p, destroy %p",
          view, func, data, destroy);

    g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));

    priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
    if (priv->filter_destroy)
    {
        priv->filter_destroy(priv->filter_data);
    }
    priv->filter_destroy = destroy;
    priv->filter_data = data;
    priv->filter_fn = func;

    gnc_tree_view_owner_refilter(view);
    LEAVE(" ");
}
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 795 of file gnc-tree-view-owner.c.

{
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *path, *f_path, *s_path, *parent_path;
    GtkTreeSelection *selection;

    ENTER("view %p, owner %p (%s)", view,
          owner, gncOwnerGetName (owner));
    g_return_if_fail (GNC_IS_TREE_VIEW_OWNER (view));

    /* Clear any existing selection. */
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
    gtk_tree_selection_unselect_all (selection);

    if (owner == NULL)
        return;

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));

    path = gnc_tree_model_owner_get_path_from_owner (
               GNC_TREE_MODEL_OWNER(model), owner);
    if (path == NULL)
    {
        LEAVE("no path");
        return;
    }
    debug_path(DEBUG, path);

    f_path = gtk_tree_model_filter_convert_child_path_to_path (
                 GTK_TREE_MODEL_FILTER (f_model), path);
    gtk_tree_path_free(path);
    if (f_path == NULL)
    {
        LEAVE("no filter path");
        return;
    }
    debug_path(DEBUG, f_path);

    s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
             f_path);
    gtk_tree_path_free(f_path);
    if (s_path == NULL)
    {
        LEAVE("no sort path");
        return;
    }

    gtk_tree_selection_select_path (selection, s_path);

    /* give gtk+ a chance to resize the tree view first by handling pending
     * configure events */
    while (gtk_events_pending ())
        gtk_main_iteration ();
    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
    debug_path(LEAVE, s_path);
    gtk_tree_path_free(s_path);
}
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.
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 666 of file gnc-tree-view-price.c.

{
    GtkTreeSelection *selection;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreeIter iter, f_iter, s_iter;
    GNCPrice *price;

    ENTER("view %p", view);
    g_return_val_if_fail (GNC_IS_TREE_VIEW_PRICE (view), NULL);

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
    if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
    {
        LEAVE("no price, get_selected failed");
        return FALSE;
    }

    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
            &f_iter, &s_iter);

    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
            &iter, &f_iter);

    model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
    price = gnc_tree_model_price_get_price (GNC_TREE_MODEL_PRICE(model),
                                            &iter);
    LEAVE("price %p", price);
    return price;
}
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 804 of file gnc-tree-view-price.c.

{
    GtkTreeSelection *selection;
    GList *return_list = NULL;

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
    gtk_tree_selection_selected_foreach(selection, get_selected_prices_helper, &return_list);
    return return_list;
}
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 400 of file gnc-tree-view-price.c.

{
    GncTreeView *view;
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreeViewColumn *col;
    GNCPriceDB *price_db;
    va_list var_args;
    const gchar *sample_text;
    gchar *sample_text2;

    ENTER(" ");
    /* Create/get a pointer to the existing model for this set of books. */
    price_db = gnc_pricedb_get_db(book);
    model = gnc_tree_model_price_new (book, price_db);

    /* Set up the view private filter on the common model. */
    f_model = gtk_tree_model_filter_new (model, NULL);
    g_object_unref(G_OBJECT(model));
    s_model = gtk_tree_model_sort_new_with_model (f_model);
    g_object_unref(G_OBJECT(f_model));

    /* Create our view */
    view = g_object_new (GNC_TYPE_TREE_VIEW_PRICE,
                         "name", "price_tree", NULL);
    gnc_tree_view_set_model (view, s_model);
    g_object_unref(G_OBJECT(s_model));

    DEBUG("model ref count is %d",   G_OBJECT(model)->ref_count);
    DEBUG("f_model ref count is %d", G_OBJECT(f_model)->ref_count);
    DEBUG("s_model ref count is %d", G_OBJECT(s_model)->ref_count);

    sample_text = gnc_commodity_get_printname(gnc_default_currency());
    sample_text2 = g_strdup_printf("%s%s", sample_text, sample_text);
    col = gnc_tree_view_add_text_column (
              view, _("Security"), "security", NULL, sample_text2,
              GNC_TREE_MODEL_PRICE_COL_COMMODITY,
              GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
              sort_by_name);
    g_free(sample_text2);
    col = gnc_tree_view_add_text_column (
              view, _("Currency"), "currency", NULL, sample_text,
              GNC_TREE_MODEL_PRICE_COL_CURRENCY,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_name);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Date"), "date", NULL, "2005-05-20",
              GNC_TREE_MODEL_PRICE_COL_DATE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_date);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Source"), "source", NULL, "Finance::Quote",
              GNC_TREE_MODEL_PRICE_COL_SOURCE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_source);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_text_column (
              view, _("Type"), "type", NULL, "last",
              GNC_TREE_MODEL_PRICE_COL_TYPE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_type);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
    col = gnc_tree_view_add_numeric_column (
              view, _("Price"), "price", "100.00000",
              GNC_TREE_MODEL_PRICE_COL_VALUE,
              GNC_TREE_VIEW_COLUMN_COLOR_NONE,
              GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
              sort_by_value);
    g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));

    gnc_tree_view_configure_columns(view);

    /* Set properties */
    va_start (var_args, first_property_name);
    g_object_set_valist (G_OBJECT(view), first_property_name, var_args);
    va_end (var_args);

    /* Sort on the commodity column by default. This allows for a consistent
     * sort if commodities are removed and re-added from the model. */
    if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
            NULL, NULL))
    {
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                             GNC_TREE_MODEL_PRICE_COL_COMMODITY,
                                             GTK_SORT_ASCENDING);
    }

    gtk_widget_show(GTK_WIDGET(view));
    LEAVE(" %p", view);
    return GTK_TREE_VIEW(view);
}
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 702 of file gnc-tree-view-price.c.

{
    GtkTreeModel *model, *f_model, *s_model;
    GtkTreePath *path, *f_path, *s_path, *parent_path;
    GtkTreeSelection *selection;

    ENTER("view %p, price %p", view, price);

    /* Clear any existing selection. */
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
    gtk_tree_selection_unselect_all (selection);

    if (price == NULL)
        return;

    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
    model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));

    path = gnc_tree_model_price_get_path_from_price (GNC_TREE_MODEL_PRICE(model), price);
    if (path == NULL)
    {
        LEAVE("get_path_from_price failed");
        return;
    }
    debug_path(DEBUG, path);

    f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
             path);
    gtk_tree_path_free(path);
    if (f_path == NULL)
    {
        LEAVE("no filter path");
        return;
    }
    debug_path(DEBUG, f_path);

    s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
             f_path);
    gtk_tree_path_free(f_path);
    if (s_path == NULL)
    {
        LEAVE("no sort path");
        return;
    }

    /* gtk_tree_view requires that a row be visible before it can be selected */
    parent_path = gtk_tree_path_copy (s_path);
    if (gtk_tree_path_up (parent_path))
    {
        /* This function is misnamed.  It expands the actual item
         * specified, not the path to the item specified. I.E. It expands
         * one level too many, thus the get of the parent. */
        gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
    }
    gtk_tree_path_free(parent_path);

    gtk_tree_selection_select_path (selection, s_path);
    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
    debug_path(LEAVE, s_path);
    gtk_tree_path_free(s_path);
}
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 1803 of file gnc-tree-view-account.c.

{
    g_return_if_fail(GTK_IS_BUTTON(button));

    ENTER("button %p", button);
    fd->visible_types = 0;
    gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
    gnc_tree_view_account_refilter(fd->tree_view);
    LEAVE("types 0x%x", fd->visible_types);
}
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 1918 of file gnc-tree-view-account.c.

{
    gpointer gptemp;

    g_return_if_fail(GTK_IS_DIALOG(dialog));

    ENTER("dialog %p, response %d", dialog, response);

    if (response != GTK_RESPONSE_OK)
    {
        fd->visible_types = fd->original_visible_types;
        fd->show_hidden = fd->original_show_hidden;
        fd->show_zero_total = fd->original_show_zero_total;
        gnc_tree_view_account_refilter(fd->tree_view);
    }

    /* Clean up and delete dialog */
    gptemp = (gpointer *)fd->dialog;
    g_atomic_pointer_compare_and_exchange(&gptemp,
                                          dialog, NULL);
    fd->dialog = gptemp;
    gtk_widget_destroy(dialog);
    LEAVE("types 0x%x", fd->visible_types);
}
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 1822 of file gnc-tree-view-account.c.

{
    g_return_if_fail(GTK_IS_BUTTON(button));

    ENTER("button %p", button);
    fd->visible_types = -1;
    gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
    gnc_tree_view_account_refilter(fd->tree_view);
    LEAVE("types 0x%x", fd->visible_types);
}
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 1764 of file gnc-tree-view-account.c.

{
    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));

    ENTER("button %p", button);
    fd->show_hidden = gtk_toggle_button_get_active(button);
    gnc_tree_view_account_refilter(fd->tree_view);
    LEAVE("show_hidden %d", fd->show_hidden);
}
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 1783 of file gnc-tree-view-account.c.

{
    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));

    ENTER("button %p", button);
    fd->show_zero_total = gtk_toggle_button_get_active(button);
    gnc_tree_view_account_refilter(fd->tree_view);
    LEAVE("show_zero %d", fd->show_zero_total);
}
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 1128 of file gnc-tree-view-owner.c.

{
    gpointer gptemp;

    g_return_if_fail(GTK_IS_DIALOG(dialog));

    ENTER("dialog %p, response %d", dialog, response);

    if (response != GTK_RESPONSE_OK)
    {
        fd->show_inactive = fd->original_show_inactive;
        fd->show_zero_total = fd->original_show_zero_total;
        gnc_tree_view_owner_refilter(fd->tree_view);
    }

    /* Clean up and delete dialog */
    gptemp = (gpointer *)fd->dialog;
    g_atomic_pointer_compare_and_exchange(&gptemp,
                                          dialog, NULL);
    fd->dialog = gptemp;
    gtk_widget_destroy(dialog);
    LEAVE("");
}
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 1089 of file gnc-tree-view-owner.c.

{
    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));

    ENTER("button %p", button);
    fd->show_inactive = gtk_toggle_button_get_active(button);
    gnc_tree_view_owner_refilter(fd->tree_view);
    LEAVE("show_inactive %d", fd->show_inactive);
}
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 1107 of file gnc-tree-view-owner.c.

{
    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));

    ENTER("button %p", button);
    fd->show_zero_total = gtk_toggle_button_get_active(button);
    gnc_tree_view_owner_refilter(fd->tree_view);
    LEAVE("show_zero %d", fd->show_zero_total);
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines