GnuCash  5.6-133-gc519490283+
Files | Data Structures | Macros | Enumerations | Functions | Variables
GnuCash Tree Model

Files

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

Data Structures

struct  _GncTreeModelClass
 The class data structure for a generic tree model. More...
 
struct  AccountViewInfo
 
struct  AccountFilterDialog
 
struct  OwnerViewInfo
 
struct  OwnerFilterDialog
 

Macros

#define GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES   (gnc_tree_model_account_types_get_type ())
 
#define GNC_TYPE_TREE_MODEL_ACCOUNT   (gnc_tree_model_account_get_type ())
 
#define GNC_TREE_MODEL_ACCOUNT_NAME   "GncTreeModelAccount"
 
#define GNC_TYPE_TREE_MODEL_COMMODITY   (gnc_tree_model_commodity_get_type ())
 
#define GNC_TREE_MODEL_COMMODITY_NAME   "GncTreeModelCommodity"
 
#define GNC_TYPE_TREE_MODEL_OWNER   (gnc_tree_model_owner_get_type ())
 
#define GNC_TREE_MODEL_OWNER_NAME   "GncTreeModelOwner"
 
#define GNC_TYPE_TREE_MODEL_PRICE   (gnc_tree_model_price_get_type ())
 
#define GNC_TREE_MODEL_PRICE_NAME   "GncTreeModelPrice"
 
#define GNC_TYPE_TREE_MODEL   (gnc_tree_model_get_type ())
 
#define GNC_TREE_MODEL_NAME   "GncTreeModel"
 
#define GNC_TYPE_TREE_VIEW_ACCOUNT   (gnc_tree_view_account_get_type ())
 
#define GNC_TREE_VIEW_ACCOUNT_NAME   "GncTreeViewAccount"
 
#define GNC_TYPE_TREE_VIEW_COMMODITY   (gnc_tree_view_commodity_get_type ())
 
#define GNC_TYPE_TREE_VIEW_OWNER   (gnc_tree_view_owner_get_type ())
 
#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 ())
 

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_BALANCE_LIMIT,
  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_LIMIT_EXPLANATION, GNC_TREE_MODEL_ACCOUNT_COL_CLEARED, GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE, GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN, GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT,
  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL, GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD, GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
  GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO, GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT, GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN, GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
  GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE, GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_ACCOUNT,
  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL, GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD, GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS
}
 
enum  GncTreeModelCommodityColumn {
  GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE, GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC, GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL, GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
  GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME, GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME, GNC_TREE_MODEL_COMMODITY_COL_CUSIP, GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG, GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE, GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ, GNC_TREE_MODEL_COMMODITY_COL_LAST_VISIBLE = GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY, GNC_TREE_MODEL_COMMODITY_NUM_COLUMNS
}
 
enum  GncTreeModelOwnerColumn {
  GNC_TREE_MODEL_OWNER_COL_NAME, GNC_TREE_MODEL_OWNER_COL_TYPE, GNC_TREE_MODEL_OWNER_COL_ID, GNC_TREE_MODEL_OWNER_COL_CURRENCY,
  GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME, GNC_TREE_MODEL_OWNER_COL_ADDRESS_1, GNC_TREE_MODEL_OWNER_COL_ADDRESS_2, GNC_TREE_MODEL_OWNER_COL_ADDRESS_3,
  GNC_TREE_MODEL_OWNER_COL_ADDRESS_4, GNC_TREE_MODEL_OWNER_COL_PHONE, GNC_TREE_MODEL_OWNER_COL_FAX, GNC_TREE_MODEL_OWNER_COL_EMAIL,
  GNC_TREE_MODEL_OWNER_COL_BALANCE, GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT, GNC_TREE_MODEL_OWNER_COL_NOTES, GNC_TREE_MODEL_OWNER_COL_ACTIVE,
  GNC_TREE_MODEL_OWNER_COL_LAST_VISIBLE = GNC_TREE_MODEL_OWNER_COL_ACTIVE, GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE, GNC_TREE_MODEL_OWNER_NUM_COLUMNS
}
 
enum  GncTreeModelPriceColumn {
  GNC_TREE_MODEL_PRICE_COL_COMMODITY, GNC_TREE_MODEL_PRICE_COL_CURRENCY, GNC_TREE_MODEL_PRICE_COL_DATE, GNC_TREE_MODEL_PRICE_COL_SOURCE,
  GNC_TREE_MODEL_PRICE_COL_TYPE, GNC_TREE_MODEL_PRICE_COL_VALUE, GNC_TREE_MODEL_PRICE_COL_LAST_VISIBLE = GNC_TREE_MODEL_PRICE_COL_VALUE, GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
  GNC_TREE_MODEL_PRICE_NUM_COLUMNS
}
 

Functions

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)
 
GNCAccountType gnc_tree_model_account_types_get_active_combo (GtkComboBox *combo)
 
void gnc_tree_model_account_types_set_selection (GtkTreeSelection *sel, guint32 selected)
 
void gnc_tree_model_account_types_set_active_combo (GtkComboBox *combo, guint32 selected)
 
GtkTreeModel * gnc_tree_model_account_types_new (guint32 selected)
 
void gnc_tree_model_account_clear_cache (GncTreeModelAccount *model)
 Clear the tree model account cached values. More...
 
void account_filter_dialog_create (AccountFilterDialog *fd, GncPluginPage *page)
 
gboolean gnc_plugin_page_account_tree_filter_accounts (Account *account, gpointer user_data)
 This function tells the account tree view whether or not to filter out a particular account. More...
 
void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 The "show hidden" button in the Filter dialog changed state. More...
 
void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 The "show zero totals" button in the Filter dialog changed state. More...
 
void gppat_filter_show_unused_toggled_cb (GtkToggleButton *togglebutton, AccountFilterDialog *fd)
 The "show unused" button in the Filter dialog changed state. More...
 
void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd)
 The "clear all account types" button in the Filter dialog was clicked. More...
 
void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd)
 The "select all account types" button in the Filter dialog was clicked. More...
 
void gppat_filter_select_default_cb (GtkWidget *button, AccountFilterDialog *fd)
 The "select default account types" button in the Filter dialog was clicked. More...
 
void gppat_filter_response_cb (GtkWidget *dialog, gint response, AccountFilterDialog *fd)
 The Filter dialog was closed. More...
 
void gnc_tree_view_account_save (GncTreeViewAccount *tree_view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_account_restore (GncTreeViewAccount *view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_account_save_filter (GncTreeViewAccount *tree_view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_account_restore_filter (GncTreeViewAccount *view, AccountFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
GType gnc_tree_view_account_get_type (void)
 
void owner_filter_dialog_create (OwnerFilterDialog *fd, GncPluginPage *page)
 
gboolean gnc_plugin_page_owner_tree_filter_owners (GncOwner *owner, gpointer user_data)
 This function tells the owner tree view whether or not to filter out a particular owner. More...
 
void gppot_filter_show_inactive_toggled_cb (GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
 The "only show active" button in the Filter dialog changed state. More...
 
void gppot_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
 The "show zero totals" button in the Filter dialog changed state. More...
 
void gppot_filter_response_cb (GtkWidget *dialog, gint response, OwnerFilterDialog *fd)
 The Filter dialog was closed. More...
 
void gnc_tree_view_owner_save (GncTreeViewOwner *tree_view, OwnerFilterDialog *fd, GKeyFile *key_file, const gchar *group_name)
 
void gnc_tree_view_owner_restore (GncTreeViewOwner *view, OwnerFilterDialog *fd, GKeyFile *key_file, const gchar *group_name, GncOwnerType owner_type)
 

Variables

gboolean OwnerViewInfo::show_inactive
 
GtkWidget * OwnerFilterDialog::dialog
 
GncTreeViewOwner * OwnerFilterDialog::tree_view
 
gboolean OwnerFilterDialog::show_inactive
 
gboolean OwnerFilterDialog::original_show_inactive
 
gboolean OwnerFilterDialog::show_zero_total
 
gboolean OwnerFilterDialog::original_show_zero_total
 

Account Tree Model Constructors

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

Account Tree Model Get/Set Functions

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

Account Tree Model Constructors

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

Commodity Tree Model Filter Helper Functions

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

Commodity Tree Model Lookup Functions

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

Owner Tree Model Constructors

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

Owner Tree Model Get/Set Functions

GncOwnergnc_tree_model_owner_get_owner (GncTreeModelOwner *model, GtkTreeIter *iter)
 Convert a model/iter pair to a gnucash owner. More...
 
gboolean gnc_tree_model_owner_get_iter_from_owner (GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter)
 Convert a model/owner pair into a gtk_tree_model_iter. More...
 
GtkTreePath * gnc_tree_model_owner_get_path_from_owner (GncTreeModelOwner *model, GncOwner *owner)
 Convert a model/owner pair into a gtk_tree_model_path. More...
 

Account Tree Model Constructors

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

Price Tree Model Filter Helper Functions

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

Commodity Tree Model Lookup Functions

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

Account Tree View Constructors

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

Account Tree View Configuration

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

Account Tree View Filtering

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

Account Tree View Get/Set Functions

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

Commodity Tree View Constructors

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

Commodity Tree View Configuration

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

Commodity Tree View Filtering

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

Commodity Tree View Get/Set Functions

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

Owner Tree View Constructor

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

Owner Tree View Configuration

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

Owner Tree View Filtering

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

Owner Tree View Get/Set Functions

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

Price Tree View Constructors

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

Price Tree View Filtering

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

Price Tree View Get/Set Functions

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

Detailed Description

Typedef Documentation

◆ gnc_tree_view_account_filter_func

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

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

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

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

◆ gnc_tree_view_owner_filter_func

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

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

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

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

◆ gnc_tree_view_price_ns_filter_func

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

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

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

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

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

Function Documentation

◆ gnc_plugin_page_account_tree_filter_accounts()

gboolean gnc_plugin_page_account_tree_filter_accounts ( Account account,
gpointer  user_data 
)

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

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

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

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

2014 {
2015  AccountFilterDialog *fd = user_data;
2016  GNCAccountType acct_type;
2017  gnc_numeric total;
2018  gboolean result;
2019 
2020  ENTER("account %p:%s", account, xaccAccountGetName(account));
2021 
2022  if (g_hash_table_size (fd->filter_override) > 0)
2023  {
2024  Account *test_acc = NULL;
2025  test_acc = g_hash_table_lookup (fd->filter_override, account);
2026  if (test_acc != NULL)
2027  {
2028  LEAVE(" filter: override");
2029  return TRUE;
2030  }
2031  }
2032 
2033  if (!fd->show_hidden && xaccAccountIsHidden (account))
2034  {
2035  LEAVE(" hide: hidden");
2036  return FALSE;
2037  }
2038 
2039  if (!fd->show_zero_total)
2040  {
2041  total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
2042  if (gnc_numeric_zero_p(total))
2043  {
2044  LEAVE(" hide: zero balance");
2045  return FALSE;
2046  }
2047  }
2048 
2049  if (!fd->show_unused)
2050  {
2051  if (gnc_account_and_descendants_empty(account))
2052  {
2053  LEAVE(" hide: unused");
2054  return FALSE;
2055  }
2056  }
2057 
2058  acct_type = xaccAccountGetType(account);
2059  result = (fd->visible_types & (1 << acct_type)) ? TRUE : FALSE;
2060  LEAVE(" %s", result ? "show" : "hide");
2061  return result;
2062 }
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account&#39;s account type.
Definition: Account.cpp:3282
STRUCTS.
gboolean gnc_numeric_zero_p(gnc_numeric a)
Returns 1 if the given gnc_numeric is 0 (zero), else returns 0.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gboolean xaccAccountIsHidden(const Account *acc)
Should this account be "hidden".
Definition: Account.cpp:4349
GNCAccountType
The account types are used to determine how the transaction data in the account is displayed...
Definition: Account.h:101
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_plugin_page_owner_tree_filter_owners()

gboolean gnc_plugin_page_owner_tree_filter_owners ( GncOwner owner,
gpointer  user_data 
)

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

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

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

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

1027 {
1028  OwnerFilterDialog *fd = user_data;
1029  gnc_numeric total;
1030 
1031  ENTER("owner %p:%s", owner, gncOwnerGetName(owner));
1032 
1033  if (!fd->show_inactive && !gncOwnerGetActive (owner))
1034  {
1035  LEAVE(" hide: inactive");
1036  return FALSE;
1037  }
1038 
1039  if (!fd->show_zero_total)
1040  {
1041  total = gncOwnerGetBalanceInCurrency (owner, NULL);
1042  if (gnc_numeric_zero_p(total))
1043  {
1044  LEAVE(" hide: zero balance");
1045  return FALSE;
1046  }
1047  }
1048 
1049  return TRUE;
1050 }
gboolean gnc_numeric_zero_p(gnc_numeric a)
Returns 1 if the given gnc_numeric is 0 (zero), else returns 0.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gnc_numeric gncOwnerGetBalanceInCurrency(const GncOwner *owner, const gnc_commodity *report_currency)
Given an owner, extract the open balance from the owner and then convert it to the desired currency...
Definition: gncOwner.c:1478
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_account_clear_cache()

void gnc_tree_model_account_clear_cache ( GncTreeModelAccount *  model)

Clear the tree model account cached values.

Parameters
modelA pointer to the account tree model.

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

574 {
575  if (model)
576  {
577  // destroy the cached account values and recreate
578  g_hash_table_destroy (model->account_values_hash);
579  model->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
580  g_free, g_free);
581 
582  gtk_tree_model_foreach (GTK_TREE_MODEL(model), row_changed_foreach_func, NULL);
583  }
584 }

◆ gnc_tree_model_account_get_account()

Account* gnc_tree_model_account_get_account ( GncTreeModelAccount *  model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash account.

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

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

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

1243 {
1244  g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model), NULL);
1245  g_return_val_if_fail (iter != NULL, NULL);
1246  g_return_val_if_fail (iter->user_data != NULL, NULL);
1247  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
1248 
1249  return (Account *) iter->user_data;
1250 }
STRUCTS.

◆ gnc_tree_model_account_get_iter_from_account()

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

Convert a model/account pair into a gtk_tree_model_iter.

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

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

1261 {
1262  Account *parent;
1263  gint i;
1264 
1265  ENTER("model %p, account %p, iter %p", model, account, iter);
1266  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model), FALSE);
1267  gnc_leave_return_val_if_fail ((account != NULL), FALSE);
1268  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
1269 
1270  iter->user_data = account;
1271  iter->stamp = model->stamp;
1272 
1273  if (account == model->root)
1274  {
1275  iter->user_data2 = NULL;
1276  iter->user_data3 = GINT_TO_POINTER(0);
1277  LEAVE("Matched root");
1278  return TRUE;
1279  }
1280 
1281  if (model->root != gnc_account_get_root (account))
1282  {
1283  LEAVE("Root doesn't match");
1284  return FALSE;
1285  }
1286 
1287  parent = gnc_account_get_parent (account);
1288  i = gnc_account_child_index (parent, account);
1289  iter->user_data2 = parent;
1290  iter->user_data3 = GINT_TO_POINTER(i);
1291  LEAVE("iter %s", iter_to_string (iter));
1292  return (i != -1);
1293 }
Account * gnc_account_get_parent(const Account *acc)
This routine returns a pointer to the parent of the specified account.
Definition: Account.cpp:2902
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
gint gnc_account_child_index(const Account *parent, const Account *child)
Return the index of the specified child within the list of the parent&#39;s children. ...
Definition: Account.cpp:2962
Account * gnc_account_get_root(Account *acc)
This routine returns the root account of the account tree that the specified account belongs to...
Definition: Account.cpp:2909

◆ gnc_tree_model_account_get_path_from_account()

GtkTreePath* gnc_tree_model_account_get_path_from_account ( GncTreeModelAccount *  model,
Account account 
)

Convert a model/account pair into a gtk_tree_model_path.

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

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

1303 {
1304  GtkTreeIter tree_iter;
1305  GtkTreePath *tree_path;
1306 
1307  ENTER("model %p, account %p", model, account);
1308  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model), NULL);
1309  gnc_leave_return_val_if_fail (account != NULL, NULL);
1310 
1311  if (!gnc_tree_model_account_get_iter_from_account (model, account,
1312  &tree_iter))
1313  {
1314  LEAVE("no iter");
1315  return NULL;
1316  }
1317 
1318  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1319  if (tree_path)
1320  {
1321  gchar *path_string = gtk_tree_path_to_string (tree_path);
1322  LEAVE("path (2) %s", path_string);
1323  g_free (path_string);
1324  }
1325  else
1326  {
1327  LEAVE("no path");
1328  }
1329  return tree_path;
1330 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
gboolean gnc_tree_model_account_get_iter_from_account(GncTreeModelAccount *model, Account *account, GtkTreeIter *iter)
Convert a model/account pair into a gtk_tree_model_iter.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_account_new()

GtkTreeModel* gnc_tree_model_account_new ( Account root)

Create a new GtkTreeModel for manipulating gnucash accounts.

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

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

256 {
257  GncTreeModelAccount *model;
258  const GList *item;
259 
260  ENTER("root %p", root);
261  item = gnc_gobject_tracking_get_list (GNC_TREE_MODEL_ACCOUNT_NAME);
262  for ( ; item; item = g_list_next (item))
263  {
264  model = (GncTreeModelAccount *)item->data;
265  if (model->root == root)
266  {
267  g_object_ref (G_OBJECT(model));
268  LEAVE("returning existing model %p", model);
269  return GTK_TREE_MODEL(model);
270  }
271  }
272 
273  model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT, NULL);
274 
275  model->book = gnc_get_current_book();
276  model->root = root;
277 
278  model->event_handler_id = qof_event_register_handler
279  ((QofEventHandler)gnc_tree_model_account_event_handler, model);
280 
281  LEAVE("model %p", model);
282  return GTK_TREE_MODEL(model);
283 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:89
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_commodity_get_commodity()

gnc_commodity* gnc_tree_model_commodity_get_commodity ( GncTreeModelCommodity *  model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash commodity.

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

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

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

239 {
240  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
241  g_return_val_if_fail (iter != NULL, NULL);
242  g_return_val_if_fail (iter->user_data != NULL, NULL);
243  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
244 
245  if (iter->user_data != ITER_IS_COMMODITY)
246  return NULL;
247  return (gnc_commodity *)iter->user_data2;
248 }

◆ gnc_tree_model_commodity_get_iter_from_commodity()

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

Convert a commodity pointer into a GtkTreeIter.

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

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

896 {
897  gnc_commodity_namespace *name_space;
898  GList *list;
899  gint n;
900 
901  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
902  g_return_val_if_fail ((commodity != NULL), FALSE);
903  g_return_val_if_fail ((iter != NULL), FALSE);
904 
905  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
906 
907  name_space = gnc_commodity_get_namespace_ds(commodity);
908  if (name_space == NULL)
909  {
910  LEAVE("no namespace");
911  return FALSE;
912  }
913 
915  if (list == NULL)
916  {
917  LEAVE("empty list");
918  return FALSE;
919  }
920 
921  n = g_list_index(list, commodity);
922  if (n == -1)
923  {
924  LEAVE("not in list");
925  return FALSE;
926  }
927 
928  iter->stamp = model->stamp;
929  iter->user_data = ITER_IS_COMMODITY;
930  iter->user_data2 = commodity;
931  iter->user_data3 = GINT_TO_POINTER(n);
932  LEAVE("iter %s", iter_to_string(iter));
933  return TRUE;
934 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *name_space)
Return a list of all commodity data structures in the specified namespace.
gnc_commodity_namespace * gnc_commodity_get_namespace_ds(const gnc_commodity *cm)
Retrieve the namespace data structure for the specified commodity.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_commodity_get_iter_from_namespace()

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

Convert a commodity namespace pointer into a GtkTreeIter.

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

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

981 {
982  GList *list;
983  gint n;
984 
985  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
986  g_return_val_if_fail ((name_space != NULL), FALSE);
987  g_return_val_if_fail ((iter != NULL), FALSE);
988 
989  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
990 
991  list = gnc_commodity_table_get_namespaces_list(model->commodity_table);
992  if (list == NULL)
993  {
994  LEAVE("");
995  return FALSE;
996  }
997 
998  n = g_list_index(list, name_space);
999  if (n == -1)
1000  {
1001  LEAVE("");
1002  return FALSE;
1003  }
1004 
1005  iter->stamp = model->stamp;
1006  iter->user_data = ITER_IS_NAMESPACE;
1007  iter->user_data2 = name_space;
1008  iter->user_data3 = GINT_TO_POINTER(n);
1009  LEAVE("iter %s", iter_to_string(iter));
1010  return TRUE;
1011 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
GList * gnc_commodity_table_get_namespaces_list(const gnc_commodity_table *table)
Return a list of all namespace data structures in the commodity table.

◆ gnc_tree_model_commodity_get_namespace()

gnc_commodity_namespace* gnc_tree_model_commodity_get_namespace ( GncTreeModelCommodity *  model,
GtkTreeIter *  iter 
)

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

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

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

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

225 {
226  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
227  g_return_val_if_fail (iter != NULL, NULL);
228  g_return_val_if_fail (iter->user_data != NULL, NULL);
229  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
230 
231  if (iter->user_data != ITER_IS_NAMESPACE)
232  return NULL;
233  return (gnc_commodity_namespace *)iter->user_data2;
234 }

◆ gnc_tree_model_commodity_get_path_from_commodity()

GtkTreePath* gnc_tree_model_commodity_get_path_from_commodity ( GncTreeModelCommodity *  model,
gnc_commodity *  commodity 
)

Convert a commodity pointer into a GtkTreePath.

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

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

944 {
945  GtkTreeIter tree_iter;
946  GtkTreePath *tree_path;
947 
948  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), NULL);
949  g_return_val_if_fail (commodity != NULL, NULL);
950  ENTER("model %p, commodity %p", model, commodity);
951 
952  if (!gnc_tree_model_commodity_get_iter_from_commodity (model, commodity, &tree_iter))
953  {
954  LEAVE("no iter");
955  return NULL;
956  }
957 
958  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
959  if (tree_path)
960  {
961  gchar *path_string = gtk_tree_path_to_string(tree_path);
962  LEAVE("path (2) %s", path_string);
963  g_free(path_string);
964  }
965  else
966  {
967  LEAVE("no path");
968  }
969  return tree_path;
970 }
gboolean gnc_tree_model_commodity_get_iter_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity, GtkTreeIter *iter)
Convert a commodity pointer into a GtkTreeIter.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_commodity_iter_is_commodity()

gboolean gnc_tree_model_commodity_iter_is_commodity ( GncTreeModelCommodity *  model,
GtkTreeIter *  iter 
)

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

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

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

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

213 {
214  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
215  g_return_val_if_fail (iter != NULL, FALSE);
216  g_return_val_if_fail (iter->user_data != NULL, FALSE);
217  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
218 
219  return (iter->user_data == ITER_IS_COMMODITY);
220 }

◆ gnc_tree_model_commodity_iter_is_namespace()

gboolean gnc_tree_model_commodity_iter_is_namespace ( GncTreeModelCommodity *  model,
GtkTreeIter *  iter 
)

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

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

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

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

201 {
202  g_return_val_if_fail (GNC_IS_TREE_MODEL_COMMODITY (model), FALSE);
203  g_return_val_if_fail (iter != NULL, FALSE);
204  g_return_val_if_fail (iter->user_data != NULL, FALSE);
205  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
206 
207  return (iter->user_data == ITER_IS_NAMESPACE);
208 }

◆ gnc_tree_model_commodity_new()

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

Create a new GtkTreeModel for manipulating gnucash commodities.

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

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

169 {
170  GncTreeModelCommodity *model;
171  const GList *item;
172 
173  ENTER("");
174 
175  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_COMMODITY_NAME);
176  for ( ; item; item = g_list_next(item))
177  {
178  model = (GncTreeModelCommodity *)item->data;
179  if (model->commodity_table == ct)
180  {
181  g_object_ref(G_OBJECT(model));
182  LEAVE("returning existing model %p", model);
183  return GTK_TREE_MODEL(model);
184  }
185  }
186 
187  model = g_object_new (GNC_TYPE_TREE_MODEL_COMMODITY, NULL);
188  model->book = book;
189  model->commodity_table = ct;
190 
191  model->event_handler_id =
192  qof_event_register_handler (gnc_tree_model_commodity_event_handler, model);
193 
194  LEAVE("");
195  return GTK_TREE_MODEL (model);
196 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_owner_get_iter_from_owner()

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

Convert a model/owner pair into a gtk_tree_model_iter.

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

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

800 {
801  GList *owner_in_list;
802 
803  ENTER("model %p, owner %p, iter %p", model, owner, iter);
804  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
805  gnc_leave_return_val_if_fail ((owner != NULL), FALSE);
806  gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
807 
808  owner_in_list = g_list_find_custom (model->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
809  if (owner_in_list)
810  {
811  iter->stamp = model->stamp;
812  iter->user_data = owner_in_list->data;
813  iter->user_data2 = GINT_TO_POINTER (g_list_position (model->owner_list, owner_in_list));
814  iter->user_data3 = NULL;
815  LEAVE("iter %s", iter_to_string (iter));
816  return TRUE;
817  }
818  else
819  {
820  iter->stamp = 0;
821  iter->user_data = NULL;
822  LEAVE("Owner not found in list");
823  return FALSE;
824  }
825 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
int gncOwnerGCompareFunc(const GncOwner *a, const GncOwner *b)
Same as gncOwnerEqual, but returns 0 if equal to be used as a GList custom compare function...
Definition: gncOwner.c:411
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_owner_get_owner()

GncOwner* gnc_tree_model_owner_get_owner ( GncTreeModelOwner *  model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash owner.

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

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

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

782 {
783  g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
784  g_return_val_if_fail (iter != NULL, NULL);
785  g_return_val_if_fail (iter->user_data != NULL, NULL);
786  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
787 
788  return (GncOwner *) iter->user_data;
789 }

◆ gnc_tree_model_owner_get_path_from_owner()

GtkTreePath* gnc_tree_model_owner_get_path_from_owner ( GncTreeModelOwner *  model,
GncOwner owner 
)

Convert a model/owner pair into a gtk_tree_model_path.

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

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

835 {
836  GtkTreeIter tree_iter;
837  GtkTreePath *tree_path;
838 
839  ENTER("model %p, owner %p", model, owner);
840  gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), NULL);
841  gnc_leave_return_val_if_fail (owner != NULL, NULL);
842 
843  if (!gnc_tree_model_owner_get_iter_from_owner (model, owner,
844  &tree_iter))
845  {
846  LEAVE("no iter");
847  return NULL;
848  }
849 
850  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
851  if (tree_path)
852  {
853  gchar *path_string = gtk_tree_path_to_string(tree_path);
854  LEAVE("path (2) %s", path_string);
855  g_free(path_string);
856  }
857  else
858  {
859  LEAVE("no path");
860  }
861  return tree_path;
862 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define gnc_leave_return_val_if_fail(test, val)
Replacement for g_return_val_if_fail, but calls LEAVE if the test fails.
Definition: qoflog.h:294
gboolean gnc_tree_model_owner_get_iter_from_owner(GncTreeModelOwner *model, GncOwner *owner, GtkTreeIter *iter)
Convert a model/owner pair into a gtk_tree_model_iter.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_owner_new()

GtkTreeModel* gnc_tree_model_owner_new ( GncOwnerType  owner_type)

Create a new GtkTreeModel for manipulating gnucash owners.

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

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

225 {
226  GncTreeModelOwner *model;
227  const GList *item;
228 
229  ENTER("owner_type %d", owner_type);
230  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_OWNER_NAME);
231  for ( ; item; item = g_list_next(item))
232  {
233  model = (GncTreeModelOwner *)item->data;
234  if (model->owner_type == owner_type)
235  {
236  g_object_ref(G_OBJECT(model));
237  LEAVE("returning existing model %p", model);
238  return GTK_TREE_MODEL(model);
239  }
240  }
241 
242  model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
243  NULL);
244 
245  model->book = gnc_get_current_book();
246  model->owner_type = owner_type;
247  model->owner_list = gncBusinessGetOwnerList (model->book, gncOwnerTypeToQofIdType(owner_type), TRUE);
248 
249  model->event_handler_id = qof_event_register_handler
250  ((QofEventHandler)gnc_tree_model_owner_event_handler, model);
251 
252  LEAVE("model %p", model);
253  return GTK_TREE_MODEL (model);
254 }
OwnerList * gncBusinessGetOwnerList(QofBook *book, QofIdTypeConst type_name, gboolean all_including_inactive)
Returns a GList of all objects of the given type_name in the given book, but each object is wrapped i...
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:89
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Returns the QofIdType of the given GncOwnerType, or NULL if no suitable one exists.
Definition: gncOwner.c:235
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_price_get_commodity()

gnc_commodity* gnc_tree_model_price_get_commodity ( GncTreeModelPrice *  model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash commodity.

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

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

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

284 {
285  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
286  g_return_val_if_fail (iter != NULL, NULL);
287  g_return_val_if_fail (iter->user_data != NULL, NULL);
288  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
289 
290  if (iter->user_data != ITER_IS_COMMODITY)
291  return NULL;
292  return (gnc_commodity *)iter->user_data2;
293 }

◆ gnc_tree_model_price_get_iter_from_commodity()

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

Convert a commodity pointer into a GtkTreeIter.

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

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

1181 {
1182  gnc_commodity_namespace *name_space;
1183  GList *list;
1184  gint n;
1185 
1186  ENTER("model %p, commodity %p, iter %p", model, commodity, iter);
1187  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1188  g_return_val_if_fail ((commodity != NULL), FALSE);
1189  g_return_val_if_fail ((iter != NULL), FALSE);
1190 
1191  name_space = gnc_commodity_get_namespace_ds(commodity);
1192  if (name_space == NULL)
1193  {
1194  LEAVE("no namespace");
1195  return FALSE;
1196  }
1197 
1198  list = gnc_commodity_namespace_get_commodity_list(name_space);
1199  if (list == NULL)
1200  {
1201  LEAVE("empty list");
1202  return FALSE;
1203  }
1204 
1205  n = g_list_index(list, commodity);
1206  if (n == -1)
1207  {
1208  LEAVE("commodity not in list");
1209  return FALSE;
1210  }
1211 
1212  iter->stamp = model->stamp;
1213  iter->user_data = ITER_IS_COMMODITY;
1214  iter->user_data2 = commodity;
1215  iter->user_data3 = GINT_TO_POINTER(n);
1216  LEAVE("iter %s", iter_to_string(model, iter));
1217  return TRUE;
1218 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *name_space)
Return a list of all commodity data structures in the specified namespace.
gnc_commodity_namespace * gnc_commodity_get_namespace_ds(const gnc_commodity *cm)
Retrieve the namespace data structure for the specified commodity.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_price_get_iter_from_namespace()

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

Convert a commodity namespace pointer into a GtkTreeIter.

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

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

1229 {
1230  gnc_commodity_table *ct;
1231  GList *list;
1232  gint n;
1233 
1234  ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
1235  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1236  g_return_val_if_fail ((name_space != NULL), FALSE);
1237  g_return_val_if_fail ((iter != NULL), FALSE);
1238 
1239  ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
1241  if (list == NULL)
1242  {
1243  LEAVE("namespace list empty");
1244  return FALSE;
1245  }
1246 
1247  n = g_list_index(list, name_space);
1248  if (n == -1)
1249  {
1250  LEAVE("namespace not found");
1251  return FALSE;
1252  }
1253 
1254  iter->stamp = model->stamp;
1255  iter->user_data = ITER_IS_NAMESPACE;
1256  iter->user_data2 = name_space;
1257  iter->user_data3 = GINT_TO_POINTER(n);
1258  LEAVE("iter %s", iter_to_string(model, iter));
1259  return TRUE;
1260 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
gpointer qof_book_get_data(const QofBook *book, const gchar *key)
Retrieves arbitrary pointers to structs stored by qof_book_set_data.
GList * gnc_commodity_table_get_namespaces_list(const gnc_commodity_table *table)
Return a list of all namespace data structures in the commodity table.

◆ gnc_tree_model_price_get_iter_from_price()

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

Convert a price pointer into a GtkTreeIter.

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

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

1095 {
1096  gnc_commodity *commodity;
1097  GList *list;
1098  gint n;
1099 
1100  ENTER("model %p, price %p, iter %p", model, price, iter);
1101  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
1102  g_return_val_if_fail ((price != NULL), FALSE);
1103  g_return_val_if_fail ((iter != NULL), FALSE);
1104 
1105  commodity = gnc_price_get_commodity(price);
1106  if (commodity == NULL)
1107  {
1108  LEAVE("no commodity");
1109  return FALSE;
1110  }
1111 
1112  list = gnc_pricedb_get_prices(model->price_db, commodity, NULL);
1113  if (list == NULL)
1114  {
1115  LEAVE("empty list");
1116  return FALSE;
1117  }
1118 
1119  n = g_list_index(list, price);
1120  if (n == -1)
1121  {
1122  gnc_price_list_destroy(list);
1123  LEAVE("not in list");
1124  return FALSE;
1125  }
1126 
1127  iter->stamp = model->stamp;
1128  iter->user_data = ITER_IS_PRICE;
1129  iter->user_data2 = price;
1130  iter->user_data3 = GINT_TO_POINTER(n);
1131  gnc_price_list_destroy(list);
1132  LEAVE("iter %s", iter_to_string(model, iter));
1133  return TRUE;
1134 }
void gnc_price_list_destroy(PriceList *prices)
gnc_price_list_destroy - destroy the given price list, calling gnc_price_unref on all the prices incl...
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
PriceList * gnc_pricedb_get_prices(GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency)
Return all the prices for a given commodity in another.

◆ gnc_tree_model_price_get_namespace()

gnc_commodity_namespace* gnc_tree_model_price_get_namespace ( GncTreeModelPrice *  model,
GtkTreeIter *  iter 
)

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

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

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

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

270 {
271  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
272  g_return_val_if_fail (iter != NULL, NULL);
273  g_return_val_if_fail (iter->user_data != NULL, NULL);
274  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
275 
276  if (iter->user_data != ITER_IS_NAMESPACE)
277  return NULL;
278  return (gnc_commodity_namespace *)iter->user_data2;
279 }

◆ gnc_tree_model_price_get_path_from_price()

GtkTreePath* gnc_tree_model_price_get_path_from_price ( GncTreeModelPrice *  model,
GNCPrice *  price 
)

Convert a price pointer into a GtkTreePath.

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

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

1144 {
1145  GtkTreeIter tree_iter;
1146  GtkTreePath *tree_path;
1147 
1148  ENTER("model %p, price %p", model, price);
1149  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
1150  g_return_val_if_fail (price != NULL, NULL);
1151 
1152  if (!gnc_tree_model_price_get_iter_from_price (model, price, &tree_iter))
1153  {
1154  LEAVE("no iter");
1155  return NULL;
1156  }
1157 
1158  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &tree_iter);
1159  if (tree_path)
1160  {
1161  gchar *path_string = gtk_tree_path_to_string(tree_path);
1162  LEAVE("path (2) %s", path_string);
1163  g_free(path_string);
1164  }
1165  else
1166  {
1167  LEAVE("no path");
1168  }
1169  return tree_path;
1170 }
gboolean gnc_tree_model_price_get_iter_from_price(GncTreeModelPrice *model, GNCPrice *price, GtkTreeIter *iter)
Convert a price pointer into a GtkTreeIter.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_model_price_get_price()

GNCPrice* gnc_tree_model_price_get_price ( GncTreeModelPrice *  model,
GtkTreeIter *  iter 
)

Convert a model/iter pair to a gnucash price.

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

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

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

298 {
299  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), NULL);
300  g_return_val_if_fail (iter != NULL, NULL);
301  g_return_val_if_fail (iter->user_data != NULL, NULL);
302  g_return_val_if_fail (iter->stamp == model->stamp, NULL);
303 
304  if (iter->user_data != ITER_IS_PRICE)
305  return NULL;
306  return (GNCPrice *)iter->user_data2;
307 }

◆ gnc_tree_model_price_iter_is_commodity()

gboolean gnc_tree_model_price_iter_is_commodity ( GncTreeModelPrice *  model,
GtkTreeIter *  iter 
)

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

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

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

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

246 {
247  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
248  g_return_val_if_fail (iter != NULL, FALSE);
249  g_return_val_if_fail (iter->user_data != NULL, FALSE);
250  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
251 
252  return (iter->user_data == ITER_IS_COMMODITY);
253 }

◆ gnc_tree_model_price_iter_is_namespace()

gboolean gnc_tree_model_price_iter_is_namespace ( GncTreeModelPrice *  model,
GtkTreeIter *  iter 
)

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

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

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

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

234 {
235  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
236  g_return_val_if_fail (iter != NULL, FALSE);
237  g_return_val_if_fail (iter->user_data != NULL, FALSE);
238  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
239 
240  return (iter->user_data == ITER_IS_NAMESPACE);
241 }

◆ gnc_tree_model_price_iter_is_price()

gboolean gnc_tree_model_price_iter_is_price ( GncTreeModelPrice *  model,
GtkTreeIter *  iter 
)

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

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

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

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

258 {
259  g_return_val_if_fail (GNC_IS_TREE_MODEL_PRICE (model), FALSE);
260  g_return_val_if_fail (iter != NULL, FALSE);
261  g_return_val_if_fail (iter->user_data != NULL, FALSE);
262  g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
263 
264  return (iter->user_data == ITER_IS_PRICE);
265 }

◆ gnc_tree_model_price_new()

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

Create a new GtkTreeModel for manipulating gnucash commodity prices.

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

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

201 {
202  GncTreeModelPrice *model;
203  const GList *item;
204 
205  ENTER(" ");
206 
207  item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_PRICE_NAME);
208  for ( ; item; item = g_list_next(item))
209  {
210  model = (GncTreeModelPrice *)item->data;
211  if (model->price_db == price_db)
212  {
213  g_object_ref(G_OBJECT(model));
214  LEAVE("returning existing model %p", model);
215  return GTK_TREE_MODEL(model);
216  }
217  }
218 
219  model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE, NULL);
220 
221  model->book = book;
222  model->price_db = price_db;
223 
224  model->event_handler_id =
225  qof_event_register_handler (gnc_tree_model_price_event_handler, model);
226 
227  LEAVE("returning new model %p", model);
228  return GTK_TREE_MODEL (model);
229 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
Definition: qofevent.cpp:73
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_account_add_custom_column()

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

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

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

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

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

1956 {
1957  GtkCellRenderer *renderer;
1958 
1959  g_return_val_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view), NULL);
1960 
1961  renderer = gtk_cell_renderer_text_new();
1962 
1963  return gnc_tree_view_account_add_custom_column_renderer(
1964  account_view, column_title, col_source_cb, col_edited_cb, renderer);
1965 }

◆ gnc_tree_view_account_add_property_column()

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

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

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

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

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

1854 {
1855  GtkCellRenderer *renderer;
1856  GtkTreeViewColumn *column;
1857 
1858  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1859  g_return_val_if_fail (propname != NULL, NULL);
1860 
1861  column = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), column_title,
1862  propname, NULL, "Sample text",
1863  -1, -1, NULL);
1864 
1865  /* This new kvp column has only had one renderer added to it so
1866  * far. Find that renderer. */
1867  renderer = gnc_tree_view_column_get_renderer(column);
1868  g_object_set (G_OBJECT (renderer), "xalign", 1.0, NULL);
1869 
1870  // add a pointer to the view to make it easier to access in data_func
1871  g_object_set_data(G_OBJECT(column), "tree-view", (gpointer)view);
1872 
1873  gtk_tree_view_column_set_cell_data_func (column, renderer,
1874  account_cell_property_data_func,
1875  g_strdup(propname), g_free);
1876  return column;
1877 }
GtkCellRenderer * gnc_tree_view_column_get_renderer(GtkTreeViewColumn *column)
Return the "main" cell renderer from a GtkTreeViewColumn added to a GncTreeView my one of the conveni...
GtkTreeViewColumn * gnc_tree_view_add_text_column(GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
This function adds a new text column to a GncTreeView base view.

◆ gnc_tree_view_account_clear_model_cache()

void gnc_tree_view_account_clear_model_cache ( GncTreeViewAccount *  view)

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

Parameters
viewA pointer to an account tree view.

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

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

◆ gnc_tree_view_account_count_children()

gint gnc_tree_view_account_count_children ( GncTreeViewAccount *  view,
Account account 
)

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

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

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

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

◆ gnc_tree_view_account_expand_to_account()

void gnc_tree_view_account_expand_to_account ( GncTreeViewAccount *  view,
Account account 
)

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

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

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

1719 {
1720  GtkTreePath *path;
1721 
1722  g_return_if_fail(view != NULL);
1723  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1724  ENTER("view %p, account %p", view, account);
1725 
1726  path = gnc_tree_view_account_get_path_from_account(view, account);
1727  if (path)
1728  {
1729  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), path);
1730  gtk_tree_path_free(path);
1731  }
1732  LEAVE(" ");
1733 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_account_get_account_from_iter()

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

This function returns the account associated with the specified iter.

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

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

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

1358 {
1359  GtkTreeModel *model, *f_model;
1360  GtkTreeIter iter, f_iter;
1361  Account *account;
1362 
1363  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
1364  g_return_val_if_fail (s_iter != NULL, NULL);
1365 
1366  ENTER("model %p, iter %p", s_model, s_iter);
1367 
1368  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
1369  &f_iter,
1370  s_iter);
1371  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1372  gtk_tree_model_filter_convert_iter_to_child_iter (
1373  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
1374  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1376  GNC_TREE_MODEL_ACCOUNT(model), &iter);
1377  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1378  return account;
1379 }
STRUCTS.
Account * gnc_tree_model_account_get_account(GncTreeModelAccount *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash account.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_tree_view_account_get_account_from_path()

Account* gnc_tree_view_account_get_account_from_path ( GncTreeViewAccount *  view,
GtkTreePath *  path 
)

This function returns the account associated with the specified path.

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

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

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

1312 {
1313  GtkTreeModel *model, *f_model, *s_model;
1314  GtkTreePath *path, *f_path;
1315  GtkTreeIter iter;
1316  Account *account;
1317 
1318  ENTER("view %p", view);
1319  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1320  g_return_val_if_fail (s_path != NULL, NULL);
1321 
1322  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1323  f_path = gtk_tree_model_sort_convert_path_to_child_path (
1324  GTK_TREE_MODEL_SORT (s_model), s_path);
1325  if (!f_path)
1326  {
1327  LEAVE("no filter path");
1328  return NULL;
1329  }
1330 
1331  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1332  path = gtk_tree_model_filter_convert_path_to_child_path (
1333  GTK_TREE_MODEL_FILTER (f_model), f_path);
1334  gtk_tree_path_free(f_path);
1335  if (!path)
1336  {
1337  LEAVE("no path");
1338  return NULL;
1339  }
1340 
1341  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1342  if (!gtk_tree_model_get_iter (model, &iter, path))
1343  {
1344  LEAVE("no iter");
1345  return NULL;
1346  }
1347 
1348  account = iter.user_data;
1349  gtk_tree_path_free(path);
1350  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1351  return account;
1352 }
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_tree_view_account_get_cursor_account()

Account* gnc_tree_view_account_get_cursor_account ( GncTreeViewAccount *  view)

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

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

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

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

1741 {
1742  GtkTreePath *s_path;
1743  Account *account;
1744 
1745  ENTER("view %p", view);
1746  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1747 
1748  gtk_tree_view_get_cursor (GTK_TREE_VIEW(view), &s_path, NULL);
1749  if (!s_path)
1750  {
1751  LEAVE("no account");
1752  return NULL;
1753  }
1754 
1755  account = gnc_tree_view_account_get_account_from_path (view, s_path);
1756  gtk_tree_path_free(s_path);
1757  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1758  return account;
1759 }
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
Account * gnc_tree_view_account_get_account_from_path(GncTreeViewAccount *view, GtkTreePath *s_path)
This function returns the account associated with the specified path.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_tree_view_account_get_selected_account()

Account* gnc_tree_view_account_get_selected_account ( GncTreeViewAccount *  view)

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

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

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

1388 {
1389  GtkTreeSelection *selection;
1390  GtkTreeModel *f_model, *s_model;
1391  GtkTreeIter iter, f_iter, s_iter;
1392  Account *account;
1393  GtkSelectionMode mode;
1394 
1395  ENTER("view %p", view);
1396  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1397 
1398  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1399  mode = gtk_tree_selection_get_mode(selection);
1400  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
1401  {
1402  return NULL;
1403  }
1404  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
1405  {
1406  LEAVE("no account, get_selected failed");
1407  return FALSE;
1408  }
1409 
1410  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
1411  &f_iter, &s_iter);
1412 
1413  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1414  gtk_tree_model_filter_convert_iter_to_child_iter (
1415  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
1416 
1417  account = iter.user_data;
1418  LEAVE("account %p (%s)", account, xaccAccountGetName (account));
1419  return account;
1420 }
STRUCTS.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_tree_view_account_get_selected_accounts()

GList* gnc_tree_view_account_get_selected_accounts ( GncTreeViewAccount *  view)

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

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

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

1546 {
1547  GtkTreeSelection *selection;
1549 
1550  g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
1551 
1552  info.return_list = NULL;
1553  info.view = view;
1554  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
1555  gtk_tree_selection_selected_foreach(selection, get_selected_accounts_helper, &info);
1556  info.return_list = g_list_reverse (info.return_list);
1557  return info.return_list;
1558 }

◆ gnc_tree_view_account_get_view_info()

void gnc_tree_view_account_get_view_info ( GncTreeViewAccount *  account_view,
AccountViewInfo *  avi 
)

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

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

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

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

1195 {
1196  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1197  g_return_if_fail(avi != NULL);
1198 
1199  *avi = view->avi;
1200 }

◆ gnc_tree_view_account_new()

GtkTreeView* gnc_tree_view_account_new ( gboolean  show_root)

Create a new account tree view.

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

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

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

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

◆ gnc_tree_view_account_new_with_root()

GtkTreeView* gnc_tree_view_account_new_with_root ( Account root,
gboolean  show_root 
)

Create a new account tree view.

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

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

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

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

◆ gnc_tree_view_account_refilter()

void gnc_tree_view_account_refilter ( GncTreeViewAccount *  view)

This function forces the account tree filter to be evaluated.

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

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

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

1277 {
1278  GtkTreeModel *f_model, *s_model;
1279 
1280  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1281 
1282  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1283  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1284  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
1285 }

◆ gnc_tree_view_account_select_subaccounts()

void gnc_tree_view_account_select_subaccounts ( GncTreeViewAccount *  view,
Account account 
)

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

All other accounts will be unselected.

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

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

1647 {
1648  GtkTreeModel *s_model;
1649  GtkTreeSelection *selection;
1650  GtkTreePath *sp_account, *sp_start, *sp_end;
1651  GtkTreeIter si_account, si_start, si_end;
1652  gboolean have_start, have_end = FALSE;
1653  gint num_children;
1654 
1655  ENTER("view %p, account %p (%s)", view, account, xaccAccountGetName(account));
1656 
1657  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1658 
1659  if (account == NULL)
1660  {
1661  LEAVE("no account");
1662  return;
1663  }
1664 
1665  if (!gnc_tree_view_account_get_iter_from_account (view, account, &si_account))
1666  {
1667  LEAVE("view_get_iter_from_account failed");
1668  return;
1669  }
1670 
1671  /* Any children? */
1672  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1673  num_children = gtk_tree_model_iter_n_children(s_model, &si_account);
1674  if (num_children == 0)
1675  {
1676  LEAVE("no children");
1677  return;
1678  }
1679 
1680  /* Expand the tree. Required for selection to work */
1681  sp_account = gtk_tree_model_get_path (s_model, &si_account);
1682  gtk_tree_view_expand_row (GTK_TREE_VIEW(view), sp_account, TRUE);
1683 
1684  /* compute start/end paths */
1685  have_start = gtk_tree_model_iter_nth_child(s_model, &si_start, &si_account, 0);
1686  si_end = si_account;
1687  while (num_children)
1688  {
1689  GtkTreeIter tmp_iter = si_end;
1690  have_end = gtk_tree_model_iter_nth_child(s_model, &si_end, &tmp_iter,
1691  num_children - 1);
1692  if (have_end)
1693  num_children = gtk_tree_model_iter_n_children(s_model, &si_end);
1694  else
1695  num_children = 0;
1696  }
1697 
1698  if (have_start && have_end)
1699  {
1700  sp_start = gtk_tree_model_get_path (s_model, &si_start);
1701  sp_end = gtk_tree_model_get_path (s_model, &si_end);
1702 
1703  /* select everything between */
1704  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1705  gtk_tree_selection_select_range (selection, sp_start, sp_end);
1706 
1707  /* clean up */
1708  gtk_tree_path_free(sp_start);
1709  gtk_tree_path_free(sp_end);
1710  }
1711  gtk_tree_path_free(sp_account);
1712  LEAVE(" ");
1713  return;
1714 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_tree_view_account_set_filter()

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

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

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

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

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

1254 {
1255  ENTER("view %p, filter func %p, data %p, destroy %p",
1256  view, func, data, destroy);
1257 
1258  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1259 
1260  if (view->filter_destroy)
1261  {
1262  view->filter_destroy(view->filter_data);
1263  }
1264  view->filter_destroy = destroy;
1265  view->filter_data = data;
1266  view->filter_fn = func;
1267 
1269  LEAVE(" ");
1270 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_account_set_selected_account()

void gnc_tree_view_account_set_selected_account ( GncTreeViewAccount *  view,
Account account 
)

This function selects an account in the account tree view.

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

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

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

1429 {
1430  GtkTreeModel *model, *f_model, *s_model;
1431  GtkTreePath *path, *f_path, *s_path, *parent_path;
1432  GtkTreeSelection *selection;
1433 
1434  ENTER("view %p, account %p (%s)", view,
1435  account, xaccAccountGetName (account));
1436  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1437 
1438  /* Clear any existing selection. */
1439  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1440  gtk_tree_selection_unselect_all (selection);
1441 
1442  if (account == NULL)
1443  return;
1444 
1445  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1446  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1447  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1448 
1450  GNC_TREE_MODEL_ACCOUNT(model), account);
1451  if (path == NULL)
1452  {
1453  LEAVE("no path");
1454  return;
1455  }
1456  debug_path(DEBUG, path);
1457 
1458  f_path = gtk_tree_model_filter_convert_child_path_to_path (
1459  GTK_TREE_MODEL_FILTER (f_model), path);
1460  gtk_tree_path_free(path);
1461  if (f_path == NULL)
1462  {
1463  LEAVE("no filter path");
1464  return;
1465  }
1466  debug_path(DEBUG, f_path);
1467 
1468  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1469  f_path);
1470  gtk_tree_path_free(f_path);
1471  if (s_path == NULL)
1472  {
1473  LEAVE("no sort path");
1474  return;
1475  }
1476 
1477  /* gtk_tree_view requires that a row be visible before it can be selected */
1478  parent_path = gtk_tree_path_copy (s_path);
1479  if (gtk_tree_path_up (parent_path))
1480  {
1481  /* This function is misnamed. It expands the actual item
1482  * specified, not the path to the item specified. I.E. It expands
1483  * one level too many, thus the get of the parent. */
1484  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1485  }
1486  gtk_tree_path_free(parent_path);
1487 
1488  gtk_tree_selection_select_path (selection, s_path);
1489 
1490  /* give gtk+ a chance to resize the tree view first by handling pending
1491  * configure events */
1492  while (gtk_events_pending ())
1493  gtk_main_iteration ();
1494  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1495  debug_path(LEAVE, s_path);
1496  gtk_tree_path_free(s_path);
1497 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GtkTreePath * gnc_tree_model_account_get_path_from_account(GncTreeModelAccount *model, Account *account)
Convert a model/account pair into a gtk_tree_model_path.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
const char * xaccAccountGetName(const Account *acc)
Get the account&#39;s name.
Definition: Account.cpp:3304

◆ gnc_tree_view_account_set_selected_accounts()

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

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

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

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

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

1568 {
1569  GtkTreeModel *model, *f_model, *s_model;
1570  GtkTreePath *path, *f_path, *s_path, *parent_path;
1571  GtkTreeSelection *selection;
1572  GList *element;
1573  Account *account;
1574 
1575  g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view));
1576 
1577  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
1578  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
1579  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
1580 
1581  /* Clear any existing selection. */
1582  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1583  gtk_tree_selection_unselect_all (selection);
1584  gtk_tree_view_collapse_all (GTK_TREE_VIEW(view));
1585 
1586  /* Now go select what the user requested. */
1587  for (element = account_list; element; )
1588  {
1589  account = element->data;
1590  element = g_list_next(element);
1591 
1592  if (account == NULL)
1593  {
1594  /*
1595  * Oops. Someone must have deleted this account and not cleaned
1596  * up all references to it.
1597  */
1598  continue;
1599  }
1600 
1601  path = gnc_tree_model_account_get_path_from_account (GNC_TREE_MODEL_ACCOUNT(model), account);
1602  if (path == NULL)
1603  {
1604  /*
1605  * Oops. Someone must have deleted this account and not cleaned
1606  * up all references to it.
1607  */
1608  continue;
1609  }
1610 
1611  f_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (f_model),
1612  path);
1613  gtk_tree_path_free(path);
1614  if (f_path == NULL)
1615  continue;
1616 
1617  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
1618  f_path);
1619  gtk_tree_path_free(f_path);
1620  if (s_path == NULL)
1621  continue;
1622 
1623  /* gtk_tree_view requires that a row be visible before it can be selected */
1624  parent_path = gtk_tree_path_copy (s_path);
1625  if (gtk_tree_path_up (parent_path))
1626  {
1627  /* This function is misnamed. It expands the actual item
1628  * specified, not the path to the item specified. I.E. It
1629  * expands one level too many, thus the get of the parent. */
1630  gtk_tree_view_expand_to_path(GTK_TREE_VIEW(view), parent_path);
1631  }
1632  gtk_tree_path_free(parent_path);
1633 
1634  gtk_tree_selection_select_path (selection, s_path);
1635  if (show_last && (element == NULL))
1636  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
1637  gtk_tree_path_free(s_path);
1638  }
1639 }
STRUCTS.
GtkTreePath * gnc_tree_model_account_get_path_from_account(GncTreeModelAccount *model, Account *account)
Convert a model/account pair into a gtk_tree_model_path.

◆ gnc_tree_view_account_set_view_info()

void gnc_tree_view_account_set_view_info ( GncTreeViewAccount *  account_view,
AccountViewInfo *  avi 
)

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

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

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

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

1209 {
1210  ENTER("%p", view);
1211  g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
1212  g_return_if_fail(avi != NULL);
1213 
1214  view->avi = *avi;
1215 
1217  view, gnc_tree_view_account_filter_by_view_info,
1218  &view->avi, NULL);
1219 
1220  LEAVE(" ");
1221 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_set_filter(GncTreeViewAccount *view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
This function attaches a filter function to the given account tree.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_commodity_configure_columns()

void gnc_tree_view_commodity_configure_columns ( GncTreeViewCommodity *  view,
GSList *  column_names 
)

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

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

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

◆ gnc_tree_view_commodity_get_cursor_commodity()

gnc_commodity* gnc_tree_view_commodity_get_cursor_commodity ( GncTreeViewCommodity *  view)

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

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

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

◆ gnc_tree_view_commodity_get_selected_commodity()

gnc_commodity* gnc_tree_view_commodity_get_selected_commodity ( GncTreeViewCommodity *  view)

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

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

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

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

◆ gnc_tree_view_commodity_new()

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

Create a new commodity tree view.

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

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

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

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

◆ gnc_tree_view_commodity_refilter()

void gnc_tree_view_commodity_refilter ( GncTreeViewCommodity *  view)

This function forces the commodity tree filter to be evaluated.

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

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

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

592 {
593  GtkTreeModel *f_model, *s_model;
594 
595  g_return_if_fail(GNC_IS_TREE_VIEW_COMMODITY(view));
596 
597  ENTER("view %p", view);
598  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
599  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
600  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
601  LEAVE(" ");
602 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_commodity_select_commodity()

void gnc_tree_view_commodity_select_commodity ( GncTreeViewCommodity *  view,
gnc_commodity *  commodity 
)

Select the commodity in the associated commodity tree view.

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

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

652 {
653  GtkTreeSelection *selection;
654  GtkTreeModel *model, *f_model, *s_model;
655  GtkTreePath *tree_path;
656  GtkTreePath *f_tree_path;
657  GtkTreePath *s_tree_path;
658 
659  g_return_if_fail (GNC_IS_TREE_VIEW_COMMODITY(view));
660 
661  if (!commodity)
662  return;
663 
664  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
665 
666  s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
667  f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
668  model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));
669 
670  tree_path = gnc_tree_model_commodity_get_path_from_commodity (GNC_TREE_MODEL_COMMODITY(model), commodity);
671 
672  if (tree_path)
673  {
674  f_tree_path = gtk_tree_model_filter_convert_child_path_to_path
675  (GTK_TREE_MODEL_FILTER (f_model), tree_path);
676 
677  s_tree_path = gtk_tree_model_sort_convert_child_path_to_path
678  (GTK_TREE_MODEL_SORT (s_model), f_tree_path);
679 
680  gtk_tree_view_expand_to_path (GTK_TREE_VIEW(view), s_tree_path);
681  gtk_tree_selection_select_path (selection, s_tree_path);
682  gtk_tree_path_free (tree_path);
683  gtk_tree_path_free (f_tree_path);
684  gtk_tree_path_free (s_tree_path);
685  }
686 }
GtkTreePath * gnc_tree_model_commodity_get_path_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity)
Convert a commodity pointer into a GtkTreePath.

◆ gnc_tree_view_commodity_select_subcommodities()

void gnc_tree_view_commodity_select_subcommodities ( GncTreeViewCommodity *  view,
gnc_commodity *  commodity 
)

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

All other commodities will be unselected.

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

◆ gnc_tree_view_commodity_set_filter()

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

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

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

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

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

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

◆ gnc_tree_view_owner_get_owner_from_iter()

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

This function returns the owner associated with the specified iter.

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

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

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

701 {
702  GtkTreeModel *model, *f_model;
703  GtkTreeIter iter, f_iter;
704  GncOwner *owner;
705 
706  g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
707  g_return_val_if_fail (s_iter != NULL, NULL);
708 
709  ENTER("model %p, iter %p", s_model, s_iter);
710 
711  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
712  &f_iter,
713  s_iter);
714  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
715  gtk_tree_model_filter_convert_iter_to_child_iter (
716  GTK_TREE_MODEL_FILTER(f_model), &iter, &f_iter);
717  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
719  GNC_TREE_MODEL_OWNER(model), &iter);
720  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
721  return owner;
722 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GncOwner * gnc_tree_model_owner_get_owner(GncTreeModelOwner *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash owner.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_get_owner_from_path()

GncOwner* gnc_tree_view_owner_get_owner_from_path ( GncTreeViewOwner *  view,
GtkTreePath *  path 
)

This function returns the owner associated with the specified path.

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

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

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

655 {
656  GtkTreeModel *model, *f_model, *s_model;
657  GtkTreePath *path, *f_path;
658  GtkTreeIter iter;
659  GncOwner *owner;
660 
661  ENTER("view %p", view);
662  g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
663  g_return_val_if_fail (s_path != NULL, NULL);
664 
665  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
666  f_path = gtk_tree_model_sort_convert_path_to_child_path (
667  GTK_TREE_MODEL_SORT (s_model), s_path);
668  if (!f_path)
669  {
670  LEAVE("no filter path");
671  return NULL;
672  }
673 
674  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
675  path = gtk_tree_model_filter_convert_path_to_child_path (
676  GTK_TREE_MODEL_FILTER (f_model), f_path);
677  gtk_tree_path_free(f_path);
678  if (!path)
679  {
680  LEAVE("no path");
681  return NULL;
682  }
683 
684  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
685  if (!gtk_tree_model_get_iter (model, &iter, path))
686  {
687  LEAVE("no iter");
688  return NULL;
689  }
690 
691  owner = iter.user_data;
692  gtk_tree_path_free(path);
693  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
694  return owner;
695 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_get_selected_owner()

GncOwner* gnc_tree_view_owner_get_selected_owner ( GncTreeViewOwner *  view)

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

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

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

731 {
732  GtkTreeSelection *selection;
733  GtkTreeModel *f_model, *s_model;
734  GtkTreeIter iter, f_iter, s_iter;
735  GncOwner *owner;
736  GtkSelectionMode mode;
737 
738  ENTER("view %p", view);
739  g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
740 
741  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
742  mode = gtk_tree_selection_get_mode(selection);
743  if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
744  {
745  return NULL;
746  }
747  if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
748  {
749  LEAVE("no owner, get_selected failed");
750  return FALSE;
751  }
752 
753  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
754  &f_iter, &s_iter);
755 
756  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
757  gtk_tree_model_filter_convert_iter_to_child_iter (
758  GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
759 
760  owner = iter.user_data;
761  LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
762  return owner;
763 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_new()

GtkTreeView* gnc_tree_view_owner_new ( GncOwnerType  owner_type)

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

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

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

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

◆ gnc_tree_view_owner_refilter()

void gnc_tree_view_owner_refilter ( GncTreeViewOwner *  view)

This function forces the owner tree filter to be evaluated.

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

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

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

634 {
635  GtkTreeModel *f_model, *s_model;
636 
637  g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
638 
639  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
640  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
641  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
642 }

◆ gnc_tree_view_owner_set_filter()

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

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

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

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

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

611 {
612  ENTER("view %p, filter func %p, data %p, destroy %p",
613  view, func, data, destroy);
614 
615  g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
616 
617  if (view->filter_destroy)
618  {
619  view->filter_destroy(view->filter_data);
620  }
621  view->filter_destroy = destroy;
622  view->filter_data = data;
623  view->filter_fn = func;
624 
626  LEAVE(" ");
627 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_owner_set_selected_owner()

void gnc_tree_view_owner_set_selected_owner ( GncTreeViewOwner *  view,
GncOwner owner 
)

This function selects an owner in the owner tree view.

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

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

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

772 {
773  GtkTreeModel *model, *f_model, *s_model;
774  GtkTreePath *path, *f_path, *s_path;
775  GtkTreeSelection *selection;
776 
777  ENTER("view %p, owner %p (%s)", view,
778  owner, gncOwnerGetName (owner));
779  g_return_if_fail (GNC_IS_TREE_VIEW_OWNER (view));
780 
781  /* Clear any existing selection. */
782  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
783  gtk_tree_selection_unselect_all (selection);
784 
785  if (owner == NULL)
786  return;
787 
788  s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
789  f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
790  model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
791 
793  GNC_TREE_MODEL_OWNER(model), owner);
794  if (path == NULL)
795  {
796  LEAVE("no path");
797  return;
798  }
799  debug_path(DEBUG, path);
800 
801  f_path = gtk_tree_model_filter_convert_child_path_to_path (
802  GTK_TREE_MODEL_FILTER (f_model), path);
803  gtk_tree_path_free(path);
804  if (f_path == NULL)
805  {
806  LEAVE("no filter path");
807  return;
808  }
809  debug_path(DEBUG, f_path);
810 
811  s_path = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model),
812  f_path);
813  gtk_tree_path_free(f_path);
814  if (s_path == NULL)
815  {
816  LEAVE("no sort path");
817  return;
818  }
819 
820  gtk_tree_selection_select_path (selection, s_path);
821 
822  /* give gtk+ a chance to resize the tree view first by handling pending
823  * configure events */
824  while (gtk_events_pending ())
825  gtk_main_iteration ();
826  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), s_path, NULL, FALSE, 0.0, 0.0);
827  debug_path(LEAVE, s_path);
828  gtk_tree_path_free(s_path);
829 }
#define DEBUG(format, args...)
Print a debugging message.
Definition: qoflog.h:264
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GtkTreePath * gnc_tree_model_owner_get_path_from_owner(GncTreeModelOwner *model, GncOwner *owner)
Convert a model/owner pair into a gtk_tree_model_path.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_tree_view_price_get_cursor_price()

GNCPrice* gnc_tree_view_price_get_cursor_price ( GncTreeViewPrice *  view)

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

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

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

◆ gnc_tree_view_price_get_selected_commodities()

GList* gnc_tree_view_price_get_selected_commodities ( GncTreeViewPrice *  view)

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

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

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

811 {
812  GtkTreeSelection *selection;
813  GList *return_list = NULL;
814 
815  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
816  gtk_tree_selection_selected_foreach (selection, get_selected_commodity_helper, &return_list);
817  return g_list_reverse (return_list);
818 }

◆ gnc_tree_view_price_get_selected_price()

GNCPrice* gnc_tree_view_price_get_selected_price ( GncTreeViewPrice *  view)

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

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

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

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

◆ gnc_tree_view_price_get_selected_prices()

GList* gnc_tree_view_price_get_selected_prices ( GncTreeViewPrice *  view)

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

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

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

767 {
768  GtkTreeSelection *selection;
769  GList *return_list = NULL;
770 
771  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
772  gtk_tree_selection_selected_foreach(selection, get_selected_prices_helper, &return_list);
773  return g_list_reverse (return_list);
774 }

◆ gnc_tree_view_price_new()

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

Create a new price tree view.

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

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

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

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

◆ gnc_tree_view_price_set_selected_price()

void gnc_tree_view_price_set_selected_price ( GncTreeViewPrice *  view,
GNCPrice *  price 
)

This function selects an price in the price tree view.

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

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

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

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

◆ gppat_filter_clear_all_cb()

void gppat_filter_clear_all_cb ( GtkWidget *  button,
AccountFilterDialog fd 
)

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

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

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

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

2132 {
2133  g_return_if_fail(GTK_IS_BUTTON(button));
2134 
2135  ENTER("button %p", button);
2136  fd->visible_types = 0;
2137  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2138  gnc_tree_view_account_refilter(fd->tree_view);
2139  LEAVE("types 0x%x", fd->visible_types);
2140 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_response_cb()

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

The Filter dialog was closed.

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

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

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

2247 {
2248  gpointer gptemp;
2249 
2250  g_return_if_fail(GTK_IS_DIALOG(dialog));
2251 
2252  ENTER("dialog %p, response %d", dialog, response);
2253 
2254  if (response != GTK_RESPONSE_OK)
2255  {
2256  fd->visible_types = fd->original_visible_types;
2257  fd->show_hidden = fd->original_show_hidden;
2258  fd->show_zero_total = fd->original_show_zero_total;
2259  fd->show_unused = fd->original_show_unused;
2260  gnc_tree_view_account_refilter(fd->tree_view);
2261  }
2262 
2263  /* Clean up and delete dialog */
2264  gptemp = (gpointer)fd->dialog;
2265  g_atomic_pointer_compare_and_exchange(&gptemp,
2266  (gpointer)dialog, NULL);
2267  fd->dialog = gptemp;
2268  gtk_widget_destroy(dialog);
2269  LEAVE("types 0x%x", fd->visible_types);
2270 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_select_all_cb()

void gppat_filter_select_all_cb ( GtkWidget *  button,
AccountFilterDialog fd 
)

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

Make all account types visible, and update the page.

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

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

2151 {
2152  g_return_if_fail(GTK_IS_BUTTON(button));
2153 
2154  ENTER("button %p", button);
2155  fd->visible_types = -1;
2156  gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(fd->model));
2157  gnc_tree_view_account_refilter(fd->tree_view);
2158  LEAVE("types 0x%x", fd->visible_types);
2159 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_select_default_cb()

void gppat_filter_select_default_cb ( GtkWidget *  button,
AccountFilterDialog fd 
)

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

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

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

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

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

◆ gppat_filter_show_hidden_toggled_cb()

void gppat_filter_show_hidden_toggled_cb ( GtkToggleButton *  button,
AccountFilterDialog fd 
)

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

Update the page to reflect these changes.

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

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

2074 {
2075  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2076 
2077  ENTER("button %p", button);
2078  fd->show_hidden = gtk_toggle_button_get_active(button);
2079  gnc_tree_view_account_refilter(fd->tree_view);
2080  LEAVE("show_hidden %d", fd->show_hidden);
2081 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_show_unused_toggled_cb()

void gppat_filter_show_unused_toggled_cb ( GtkToggleButton *  button,
AccountFilterDialog fd 
)

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

Update the page to reflect these changes.

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

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

2112 {
2113  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2114 
2115  ENTER("button %p", button);
2116  fd->show_unused = gtk_toggle_button_get_active(button);
2117  gnc_tree_view_account_refilter(fd->tree_view);
2118  LEAVE("show_unused %d", fd->show_unused);
2119 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppat_filter_show_zero_toggled_cb()

void gppat_filter_show_zero_toggled_cb ( GtkToggleButton *  button,
AccountFilterDialog fd 
)

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

Update the page to reflect these changes.

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

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

2093 {
2094  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
2095 
2096  ENTER("button %p", button);
2097  fd->show_zero_total = gtk_toggle_button_get_active(button);
2098  gnc_tree_view_account_refilter(fd->tree_view);
2099  LEAVE("show_zero %d", fd->show_zero_total);
2100 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppot_filter_response_cb()

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

The Filter dialog was closed.

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

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

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

1101 {
1102  gpointer gptemp;
1103 
1104  g_return_if_fail(GTK_IS_DIALOG(dialog));
1105 
1106  ENTER("dialog %p, response %d", dialog, response);
1107 
1108  if (response != GTK_RESPONSE_OK)
1109  {
1110  fd->show_inactive = fd->original_show_inactive;
1111  fd->show_zero_total = fd->original_show_zero_total;
1112  gnc_tree_view_owner_refilter(fd->tree_view);
1113  }
1114 
1115  /* Clean up and delete dialog */
1116  gptemp = (gpointer)fd->dialog;
1117  g_atomic_pointer_compare_and_exchange(&gptemp,
1118  (gpointer)dialog, NULL);
1119  fd->dialog = gptemp;
1120  gtk_widget_destroy(dialog);
1121  LEAVE("");
1122 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppot_filter_show_inactive_toggled_cb()

void gppot_filter_show_inactive_toggled_cb ( GtkToggleButton *  button,
OwnerFilterDialog fd 
)

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

Update the page to reflect these changes.

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

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

1061 {
1062  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1063 
1064  ENTER("button %p", button);
1065  fd->show_inactive = !gtk_toggle_button_get_active(button);
1066  gnc_tree_view_owner_refilter(fd->tree_view);
1067  LEAVE("show_inactive %d", fd->show_inactive);
1068 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gppot_filter_show_zero_toggled_cb()

void gppot_filter_show_zero_toggled_cb ( GtkToggleButton *  button,
OwnerFilterDialog fd 
)

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

Update the page to reflect these changes.

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

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

1079 {
1080  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1081 
1082  ENTER("button %p", button);
1083  fd->show_zero_total = gtk_toggle_button_get_active(button);
1084  gnc_tree_view_owner_refilter(fd->tree_view);
1085  LEAVE("show_zero %d", fd->show_zero_total);
1086 }
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282