GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-tree-view-account.h
Go to the documentation of this file.
1/**********************************************************************\
2 * gnc-tree-view-account.h -- GtkTreeView implementation to display *
3 * accounts in a GtkTreeView. *
4 * Copyright (C) 2003,2005,2006 David Hampton <hampton@employees.org> *
5 * *
6 * This program is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU General Public License as *
8 * published by the Free Software Foundation; either version 2 of *
9 * the License, or (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, contact: *
18 * *
19 * Free Software Foundation Voice: +1-617-542-5942 *
20 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21 * Boston, MA 02110-1301, USA gnu@gnu.org *
22 * *
23\**********************************************************************/
24
34#ifndef __GNC_TREE_VIEW_ACCOUNT_H
35#define __GNC_TREE_VIEW_ACCOUNT_H
36
37#include <gtk/gtk.h>
38#include "gnc-tree-view.h"
39
40#include "gnc-ui-util.h"
41#include "gnc-plugin-page.h"
42
43G_BEGIN_DECLS
44
45/* type macros */
46#define GNC_TYPE_TREE_VIEW_ACCOUNT (gnc_tree_view_account_get_type ())
47G_DECLARE_FINAL_TYPE (GncTreeViewAccount, gnc_tree_view_account, GNC, TREE_VIEW_ACCOUNT, GncTreeView)
48
49#define GNC_TREE_VIEW_ACCOUNT_NAME "GncTreeViewAccount"
50
51/* typedefs & structures */
52typedef struct AccountViewInfo_s AccountViewInfo;
53
54
56{
57 gboolean include_type[NUM_ACCOUNT_TYPES];
58 gboolean show_hidden;
59};
60
61
62typedef struct
63{
64 GtkWidget *dialog;
65 GtkTreeModel *model;
66 GncTreeViewAccount *tree_view;
67 GHashTable *filter_override;
68 guint32 visible_types;
69 guint32 original_visible_types;
70 gboolean show_hidden;
71 gboolean original_show_hidden;
72 gboolean show_zero_total;
73 gboolean original_show_zero_total;
74 gboolean show_unused;
75 gboolean original_show_unused;
77
78void account_filter_dialog_create(AccountFilterDialog *fd,
79 GncPluginPage *page);
80
82 gpointer user_data);
83
84/* "Filter By" dialog callbacks */
85void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton,
87void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton,
89void gppat_filter_show_unused_toggled_cb (GtkToggleButton *togglebutton,
91void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd);
92void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd);
93void gppat_filter_select_default_cb (GtkWidget *button,
95void gppat_filter_response_cb (GtkWidget *dialog, gint response,
97
98/* Saving/Restoring */
99void gnc_tree_view_account_save(GncTreeViewAccount *tree_view,
101 GKeyFile *key_file, const gchar *group_name);
102void gnc_tree_view_account_restore(GncTreeViewAccount *view,
104 GKeyFile *key_file,
105 const gchar *group_name);
106
107void gnc_tree_view_account_save_filter (GncTreeViewAccount *tree_view,
109 GKeyFile *key_file,
110 const gchar *group_name);
111void gnc_tree_view_account_restore_filter (GncTreeViewAccount *view,
113 GKeyFile *key_file,
114 const gchar *group_name);
115
116
117/* Get the GType for an GncTreeViewAccount object. */
118GType gnc_tree_view_account_get_type (void);
119
120
137 gboolean show_root);
138
150GtkTreeView *gnc_tree_view_account_new (gboolean show_root);
151
158typedef gchar * (*GncTreeViewAccountColumnSource) (Account *account,
159 GtkTreeViewColumn *col,
160 GtkCellRenderer *cell);
161
162typedef void (*GncTreeViewAccountColumnTextEdited) (Account *account,
163 GtkTreeViewColumn *col,
164 const gchar *new_text);
165
166
184 GncTreeViewAccount *view, const gchar *column_title,
185 GncTreeViewAccountColumnSource source_cb,
186 GncTreeViewAccountColumnTextEdited edited_cb);
187GtkTreeViewColumn *gnc_tree_view_account_add_custom_column_renderer(
188 GncTreeViewAccount *account_view, const gchar *column_title,
189 GncTreeViewAccountColumnSource col_source_cb,
190 GncTreeViewAccountColumnTextEdited col_edited_cb,
191 GtkCellRenderer *renderer);
192void gnc_tree_view_account_set_name_edited(GncTreeViewAccount *view,
193 GncTreeViewAccountColumnTextEdited edited_cb);
194void gnc_tree_view_account_name_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_name);
195
196void gnc_tree_view_account_set_code_edited(GncTreeViewAccount *view,
197 GncTreeViewAccountColumnTextEdited edited_cb);
198void gnc_tree_view_account_code_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_code);
199
200void gnc_tree_view_account_set_description_edited(GncTreeViewAccount *view,
201 GncTreeViewAccountColumnTextEdited edited_cb);
202void gnc_tree_view_account_description_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_desc);
203
204void gnc_tree_view_account_set_notes_edited(GncTreeViewAccount *view,
205 GncTreeViewAccountColumnTextEdited edited_cb);
206void gnc_tree_view_account_notes_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_notes);
207
219GtkTreeViewColumn *
220gnc_tree_view_account_add_property_column (GncTreeViewAccount *view,
221 const gchar *column_title,
222 const gchar *propname);
223
240void gnc_tree_view_account_get_view_info (GncTreeViewAccount *account_view,
241 AccountViewInfo *avi);
242
254void gnc_tree_view_account_set_view_info (GncTreeViewAccount *account_view,
255 AccountViewInfo *avi);
256
257
266typedef gboolean (*gnc_tree_view_account_filter_func)(Account *account, gpointer data);
267
268
288void gnc_tree_view_account_set_filter (GncTreeViewAccount *account_view,
290 gpointer data,
291 GSourceFunc destroy);
292
293/* This is a convenient filter function for use with
294 * gnc_tree_view_account_set_filter() and the functions in
295 * gnc-tree-model-account-types.h. If you have some view that is
296 * backed by the "account types" tree model, you can get a guint32
297 * from that view's tree selection. Then, you can use that account
298 * type selection as a filter for the account tree view. This also
299 * can filter by whether an account is hidden or not.
300 */
301gboolean gnc_tree_view_account_filter_by_view_info(
302 Account* acct, gpointer data);
303
304
315void gnc_tree_view_account_refilter (GncTreeViewAccount *view);
332gint gnc_tree_view_account_count_children (GncTreeViewAccount *view,
333 Account *account);
334
341void gnc_tree_view_account_clear_model_cache (GncTreeViewAccount *view);
342
343
354Account * gnc_tree_view_account_get_account_from_path (GncTreeViewAccount *view,
355 GtkTreePath *path);
356
357
369 GtkTreeIter *iter);
370
371
380Account * gnc_tree_view_account_get_cursor_account (GncTreeViewAccount *view);
381
382
394Account * gnc_tree_view_account_get_selected_account (GncTreeViewAccount *view);
395
396
412void gnc_tree_view_account_set_selected_account (GncTreeViewAccount *view,
413 Account *account);
414
415
427GList * gnc_tree_view_account_get_selected_accounts (GncTreeViewAccount *view);
428
429
451void gnc_tree_view_account_set_selected_accounts (GncTreeViewAccount *view,
452 GList *account_list,
453 gboolean show_last);
454
455
468void gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view,
469 Account *account);
470
478void gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view, Account *account);
479
483void gnc_tree_view_account_column_add_color (GncTreeViewAccount *view, GtkTreeViewColumn *col);
484
489 (GncTreeViewAccount *view, GFunc editing_started_cb, gpointer editing_cb_data );
490
495 (GncTreeViewAccount *view, GFunc editing_finished_cb, gpointer editing_cb_data );
496
497
503G_END_DECLS
504
505#endif /* __GNC_TREE_VIEW_ACCOUNT_H */
Functions for adding plugins to a GnuCash window.
common utilities for manipulating a GtkTreeView within gnucash
utility functions for the GnuCash UI
@ NUM_ACCOUNT_TYPES
stop here; the following types just aren't ready for prime time
Definition Account.h:161
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 co...
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.
void gppat_filter_select_all_cb(GtkWidget *button, AccountFilterDialog *fd)
The "select all account types" button in the Filter dialog was clicked.
GtkTreeView * gnc_tree_view_account_new_with_root(Account *root, gboolean show_root)
Create a new account tree view.
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.
void gppat_filter_show_unused_toggled_cb(GtkToggleButton *togglebutton, AccountFilterDialog *fd)
The "show unused" button in the Filter dialog changed state.
void gppat_filter_clear_all_cb(GtkWidget *button, AccountFilterDialog *fd)
The "clear all account types" button in the Filter dialog was clicked.
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.
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 v...
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...
void gppat_filter_select_default_cb(GtkWidget *button, AccountFilterDialog *fd)
The "select default account types" button in the Filter dialog was clicked.
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
Account * gnc_tree_view_account_get_account_from_path(GncTreeViewAccount *view, GtkTreePath *path)
This function returns the account associated with the specified path.
gboolean(* gnc_tree_view_account_filter_func)(Account *account, gpointer data)
This is the description of a filter function used by the account tree.
void gppat_filter_show_hidden_toggled_cb(GtkToggleButton *togglebutton, AccountFilterDialog *fd)
The "show hidden" button in the Filter dialog changed state.
GtkTreeView * gnc_tree_view_account_new(gboolean show_root)
Create a new account tree view.
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.
void gppat_filter_show_zero_toggled_cb(GtkToggleButton *togglebutton, AccountFilterDialog *fd)
The "show zero totals" button in the Filter dialog changed state.
Account * gnc_tree_view_account_get_account_from_iter(GtkTreeModel *model, GtkTreeIter *iter)
This function returns the account associated with the specified iter.
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.
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 con...
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...
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.
void gppat_filter_response_cb(GtkWidget *dialog, gint response, AccountFilterDialog *fd)
The Filter dialog was closed.
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.
void gnc_tree_view_account_set_selected_account(GncTreeViewAccount *view, Account *account)
This function selects an account in the account tree view.
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 ...
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 acco...
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.
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.
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.
STRUCTS.
The instance data structure for a content plugin.