GnuCash  5.6-150-g038405b370+
gnc-tree-view-owner.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gnc-tree-view-owner.h -- GtkTreeView implementation to display *
3  * owners in a GtkTreeView. *
4  * Copyright (C) 2011 Geert Janssens <geert@kobaltwit.be> *
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_OWNER_H
35 #define __GNC_TREE_VIEW_OWNER_H
36 
37 #include <gtk/gtk.h>
38 #include "gncOwner.h"
39 #include "gnc-tree-view.h"
40 
41 #include "gnc-ui-util.h"
42 #include "gnc-plugin-page.h"
43 
44 G_BEGIN_DECLS
45 
46 /* type macros */
47 #define GNC_TYPE_TREE_VIEW_OWNER (gnc_tree_view_owner_get_type ())
48 G_DECLARE_FINAL_TYPE (GncTreeViewOwner, gnc_tree_view_owner, GNC, TREE_VIEW_OWNER, GncTreeView)
49 
50 #define GNC_TREE_VIEW_OWNER_NAME "GncTreeViewOwner"
51 
52 /* typedefs & structures */
53 typedef struct OwnerViewInfo_s OwnerViewInfo;
54 
55 
57 {
58  gboolean show_inactive;
59 };
60 
61 
62 typedef struct
63 {
64  GtkWidget *dialog;
65  GncTreeViewOwner *tree_view;
66  gboolean show_inactive;
67  gboolean original_show_inactive;
68  gboolean show_zero_total;
69  gboolean original_show_zero_total;
71 
72 #define GNC_OWNER_TREE_NAME_COL "name"
73 #define GNC_OWNER_TREE_TYPE_COL "type"
74 #define GNC_OWNER_TREE_ID_COL "owner-id"
75 #define GNC_OWNER_TREE_CURRENCY_COL "currency"
76 #define GNC_OWNER_TREE_ADDRESS_NAME_COL "address-name"
77 #define GNC_OWNER_TREE_ADDRESS_1_COL "address-1"
78 #define GNC_OWNER_TREE_ADDRESS_2_COL "address-2"
79 #define GNC_OWNER_TREE_ADDRESS_3_COL "address-3"
80 #define GNC_OWNER_TREE_ADDRESS_4_COL "address-4"
81 #define GNC_OWNER_TREE_PHONE_COL "phone"
82 #define GNC_OWNER_TREE_FAX_COL "fax"
83 #define GNC_OWNER_TREE_EMAIL_COL "email"
84 #define GNC_OWNER_TREE_BALANCE_COL "balance"
85 #define GNC_OWNER_TREE_BALANCE_REPORT_COL "balance-report"
86 #define GNC_OWNER_TREE_BALANCE_PERIOD_COL "balance-period"
87 #define GNC_OWNER_TREE_NOTES_COL "notes"
88 #define GNC_OWNER_TREE_ACTIVE_COL "active"
89 
90 
91 void owner_filter_dialog_create(OwnerFilterDialog *fd,
92  GncPluginPage *page);
93 
95  gpointer user_data);
96 
97 /* "Filter By" dialog callbacks */
98 void gppot_filter_show_inactive_toggled_cb (GtkToggleButton *togglebutton,
99  OwnerFilterDialog *fd);
100 void gppot_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton,
101  OwnerFilterDialog *fd);
102 void gppot_filter_response_cb (GtkWidget *dialog, gint response,
103  OwnerFilterDialog *fd);
104 
105 /* Saving/Restoring */
106 void gnc_tree_view_owner_save(GncTreeViewOwner *tree_view,
107  OwnerFilterDialog *fd,
108  GKeyFile *key_file, const gchar *group_name);
109 void gnc_tree_view_owner_restore(GncTreeViewOwner *view,
110  OwnerFilterDialog *fd,
111  GKeyFile *key_file,
112  const gchar *group_name,
113  GncOwnerType owner_type);
114 
115 
125 GtkTreeView *gnc_tree_view_owner_new (GncOwnerType owner_type);
126 
133 typedef gchar * (*GncTreeViewOwnerColumnSource) (GncOwner *owner,
134  GtkTreeViewColumn *col,
135  GtkCellRenderer *cell);
136 
137 typedef void (*GncTreeViewOwnerColumnTextEdited) (GncOwner *owner,
138  GtkTreeViewColumn *col,
139  const gchar *new_text);
140 
155 typedef gboolean (*gnc_tree_view_owner_filter_func)(GncOwner *owner, gpointer data);
156 
157 
177 void gnc_tree_view_owner_set_filter (GncTreeViewOwner *owner_view,
179  gpointer data,
180  GSourceFunc destroy);
181 
182 
193 void gnc_tree_view_owner_refilter (GncTreeViewOwner *view);
210 GncOwner * gnc_tree_view_owner_get_owner_from_path (GncTreeViewOwner *view,
211  GtkTreePath *path);
212 
213 
225  GtkTreeIter *iter);
226 
238 GncOwner * gnc_tree_view_owner_get_selected_owner (GncTreeViewOwner *view);
239 
240 
256 void gnc_tree_view_owner_set_selected_owner (GncTreeViewOwner *view,
257  GncOwner *owner);
258 
259 
260 G_END_DECLS
261 
262 #endif /* __GNC_TREE_VIEW_OWNER_H */
void gnc_tree_view_owner_set_selected_owner(GncTreeViewOwner *view, GncOwner *owner)
This function selects an owner in the owner tree view.
GtkTreeView * gnc_tree_view_owner_new(GncOwnerType owner_type)
Create a new owner tree view for one type of owners.
Business Interface: Object OWNERs.
The instance data structure for a content plugin.
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.
void gnc_tree_view_owner_refilter(GncTreeViewOwner *view)
This function forces the owner tree filter to be evaluated.
utility functions for the GnuCash UI
common utilities for manipulating a GtkTreeView within gnucash
GncOwner * gnc_tree_view_owner_get_owner_from_iter(GtkTreeModel *model, GtkTreeIter *iter)
This function returns the owner associated with the specified iter.
gboolean(* gnc_tree_view_owner_filter_func)(GncOwner *owner, gpointer data)
This is the description of a filter function used by the owner tree.
void gppot_filter_response_cb(GtkWidget *dialog, gint response, OwnerFilterDialog *fd)
The Filter dialog was closed.
Functions for adding plugins to a GnuCash window.
void gppot_filter_show_inactive_toggled_cb(GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
The "only show active" button in the Filter dialog changed state.
void gppot_filter_show_zero_toggled_cb(GtkToggleButton *togglebutton, OwnerFilterDialog *fd)
The "show zero totals" button in the Filter dialog changed state.
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...
GncOwner * gnc_tree_view_owner_get_owner_from_path(GncTreeViewOwner *view, GtkTreePath *path)
This function returns the owner associated with the specified path.
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...