GnuCash 7574033+
Loading...
Searching...
No Matches
An Account Tree Plugin

Files

Data Structures

struct  delete_helper_t
struct  GncPluginPageAccountTreePrivate
struct  Adopter
struct  Adopters
struct  GncPluginPageAccountTree
struct  GncPluginPageAccountTreeClass

Macros

#define PLUGIN_PAGE_ACCT_TREE_CM_CLASS   "plugin-page-acct-tree"
#define STATE_SECTION   "Account Hierarchy"
#define DELETE_DIALOG_FILTER   "filter"
#define DELETE_DIALOG_ACCOUNT   "account"
#define DELETE_DIALOG_TRANS_MAS   "trans_mas"
#define DELETE_DIALOG_SA_MAS   "sa_mas"
#define DELETE_DIALOG_SA_TRANS_MAS   "sa_trans_mas"
#define DELETE_DIALOG_SA_TRANS   "sa_trans"
#define DELETE_DIALOG_SA_SPLITS   "sa_has_split"
#define DELETE_DIALOG_OK_BUTTON   "deletebutton"
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(o)
#define GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE   (gnc_plugin_page_account_tree_get_type ())
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE(obj)
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_CLASS(klass)
#define GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(obj)
#define GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE_CLASS(klass)
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_CLASS(obj)
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME   "GncPluginPageAccountTree"

Enumerations

enum  { ACCOUNT_SELECTED , LAST_SIGNAL }

Functions

void gppat_populate_trans_mas_list (GtkToggleButton *sa_mrb, GtkWidget *dialog)
void gppat_set_insensitive_iff_rb_active (GtkWidget *widget, GtkToggleButton *b)
GncPluginPage * gnc_plugin_page_account_tree_new (void)
 Create a new "account tree" plugin page.
void gnc_plugin_page_account_tree_open (Account *account, GtkWindow *win)
 Given a pointer to an account, the account tree will open and the account will be selected (if any).
Account * gnc_plugin_page_account_tree_get_current_account (GncPluginPageAccountTree *page)
 Given a pointer to an account tree plugin page, return the selected account (if any).
GType gnc_plugin_page_account_tree_get_type (void)
 Retrieve the type number for an "account tree" plugin page.

Detailed Description

Macro Definition Documentation

◆ DELETE_DIALOG_ACCOUNT

#define DELETE_DIALOG_ACCOUNT   "account"

Definition at line 99 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_FILTER

#define DELETE_DIALOG_FILTER   "filter"

Definition at line 98 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_OK_BUTTON

#define DELETE_DIALOG_OK_BUTTON   "deletebutton"

Definition at line 105 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_SA_MAS

#define DELETE_DIALOG_SA_MAS   "sa_mas"

Definition at line 101 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_SA_SPLITS

#define DELETE_DIALOG_SA_SPLITS   "sa_has_split"

Definition at line 104 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_SA_TRANS

#define DELETE_DIALOG_SA_TRANS   "sa_trans"

Definition at line 103 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_SA_TRANS_MAS

#define DELETE_DIALOG_SA_TRANS_MAS   "sa_trans_mas"

Definition at line 102 of file gnc-plugin-page-account-tree.cpp.

◆ DELETE_DIALOG_TRANS_MAS

#define DELETE_DIALOG_TRANS_MAS   "trans_mas"

Definition at line 100 of file gnc-plugin-page-account-tree.cpp.

◆ GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE

#define GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE ( obj)
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE))

Definition at line 49 of file gnc-plugin-page-account-tree.h.

◆ GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE_CLASS

#define GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE_CLASS ( klass)
Value:
(G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE))

Definition at line 50 of file gnc-plugin-page-account-tree.h.

◆ GNC_PLUGIN_PAGE_ACCOUNT_TREE

#define GNC_PLUGIN_PAGE_ACCOUNT_TREE ( obj)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, GncPluginPageAccountTree))

Definition at line 47 of file gnc-plugin-page-account-tree.h.

◆ GNC_PLUGIN_PAGE_ACCOUNT_TREE_CLASS

#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_CLASS ( klass)
Value:
(G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, GncPluginPageAccountTreeClass))

Definition at line 48 of file gnc-plugin-page-account-tree.h.

◆ GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_CLASS

#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_CLASS ( obj)
Value:
(G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, GncPluginPageAccountTreeClass))

Definition at line 51 of file gnc-plugin-page-account-tree.h.

◆ GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE

#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE ( o)
Value:

Definition at line 121 of file gnc-plugin-page-account-tree.cpp.

121#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(o) \
122 ((GncPluginPageAccountTreePrivate*)gnc_plugin_page_account_tree_get_instance_private((GncPluginPageAccountTree*)o))

◆ GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME

#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME   "GncPluginPageAccountTree"

Definition at line 53 of file gnc-plugin-page-account-tree.h.

◆ GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE

#define GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE   (gnc_plugin_page_account_tree_get_type ())

Definition at line 46 of file gnc-plugin-page-account-tree.h.

◆ PLUGIN_PAGE_ACCT_TREE_CM_CLASS

#define PLUGIN_PAGE_ACCT_TREE_CM_CLASS   "plugin-page-acct-tree"

Definition at line 95 of file gnc-plugin-page-account-tree.cpp.

◆ STATE_SECTION

#define STATE_SECTION   "Account Hierarchy"

Definition at line 96 of file gnc-plugin-page-account-tree.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 107 of file gnc-plugin-page-account-tree.cpp.

108{
109 ACCOUNT_SELECTED,
110 LAST_SIGNAL
111};

Function Documentation

◆ gnc_plugin_page_account_tree_get_current_account()

Account * gnc_plugin_page_account_tree_get_current_account ( GncPluginPageAccountTree * page)

Given a pointer to an account tree plugin page, return the selected account (if any).

Parameters
pageThe "account tree" page.
Returns
The currently selected account. NULL if no account is selected.

Definition at line 518 of file gnc-plugin-page-account-tree.cpp.

519{
521 Account *account;
522
523 priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
524 ENTER("page %p (tree view %p)", page, priv->tree_view);
525 account = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
526 if (account == NULL)
527 {
528 LEAVE("no account");
529 return NULL;
530 }
531
532 LEAVE("account %p", account);
533 return account;
534}
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.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272
STRUCTS.

◆ gnc_plugin_page_account_tree_get_type()

GType gnc_plugin_page_account_tree_get_type ( void )

Retrieve the type number for an "account tree" plugin page.

Returns
The type number.

◆ gnc_plugin_page_account_tree_new()

GncPluginPage * gnc_plugin_page_account_tree_new ( void )

Create a new "account tree" plugin page.

Returns
The newly created plugin page.

Definition at line 302 of file gnc-plugin-page-account-tree.cpp.

303{
304 ENTER(" ");
305 auto plugin_page = GNC_PLUGIN_PAGE_ACCOUNT_TREE
306 (g_object_new (GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, nullptr));
307
308 LEAVE("new account tree page %p", plugin_page);
309 return GNC_PLUGIN_PAGE (plugin_page);
310}

◆ gnc_plugin_page_account_tree_open()

void gnc_plugin_page_account_tree_open ( Account * account,
GtkWindow * win )

Given a pointer to an account, the account tree will open and the account will be selected (if any).

Parameters
accountThe "account" to be selected.
winThe "window" where the account tree is to be selected.

Definition at line 459 of file gnc-plugin-page-account-tree.cpp.

460{
463 GncPluginPage *plugin_page = NULL;
464 const GList *page_list;
465 GtkWidget *window;
466
467 /* Find Accounts page */
468 page_list = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME);
469
470 // If we have a window, look for account page in that window
471 if (gnc_list_length_cmp (page_list, 0))
472 {
473 if (win != NULL)
474 {
475 for ( ; page_list; page_list = g_list_next(page_list))
476 {
477 plugin_page = GNC_PLUGIN_PAGE(page_list->data);
478 if (GTK_WINDOW(plugin_page->window) == win)
479 break;
480 }
481 }
482 else // if no window, open first account page in list
483 plugin_page = GNC_PLUGIN_PAGE(page_list->data);
484 }
485 else // we have no account pages, create one
486 plugin_page = gnc_plugin_page_account_tree_new ();
487
488 g_return_if_fail(plugin_page);
489 window = plugin_page->window;
490
491 gnc_main_window_open_page (GNC_MAIN_WINDOW(window), plugin_page);
492
493 page = GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page);
494 priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
495
496 if (account != NULL)
497 {
498 Account *root_account = gnc_get_current_root_account ();
499 Account *parent_account = NULL;
500 Account *temp_account = account;
501
502 g_hash_table_insert (priv->fd.filter_override, account, account);
503
504 // make sure we override all the parent accounts to root
505 while (parent_account != root_account)
506 {
507 parent_account = gnc_account_get_parent (temp_account);
508
509 g_hash_table_insert (priv->fd.filter_override, parent_account, parent_account);
510 temp_account = parent_account;
511 }
512 gnc_tree_view_account_refilter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
513 gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT(priv->tree_view), account);
514 }
515}
Account * gnc_account_get_parent(const Account *acc)
This routine returns a pointer to the parent of the specified account.
Definition Account.cpp:2916
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
GncPluginPage * gnc_plugin_page_account_tree_new(void)
Create a new "account tree" plugin page.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
This function forces the account tree filter to be evaluated.
void gnc_tree_view_account_set_selected_account(GncTreeViewAccount *view, Account *account)
This function selects an account in the account tree view.
gint gnc_list_length_cmp(const GList *list, size_t len)
Scans the GList elements the minimum number of iterations required to test it against a specified siz...
The instance data structure for a content plugin.
GtkWidget * window
The window that contains the display widget for this plugin.

◆ gppat_populate_trans_mas_list()

void gppat_populate_trans_mas_list ( GtkToggleButton * sa_mrb,
GtkWidget * dialog )

Definition at line 1243 of file gnc-plugin-page-account-tree.cpp.

1245{
1246 g_return_if_fail(GTK_IS_DIALOG(dialog));
1247
1248 /* Cannot move transactions to subaccounts if they are to be deleted. */
1249 auto trans_mas = GTK_WIDGET(g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_TRANS_MAS));
1250 gppat_populate_gas_list(dialog, GNC_ACCOUNT_SEL(trans_mas), !gtk_toggle_button_get_active(sa_mrb));
1251}

◆ gppat_set_insensitive_iff_rb_active()

void gppat_set_insensitive_iff_rb_active ( GtkWidget * widget,
GtkToggleButton * b )

Definition at line 1259 of file gnc-plugin-page-account-tree.cpp.

1260{
1261 GtkWidget *dialog = gtk_widget_get_toplevel(widget);
1262 auto subaccount_trans = GTK_WIDGET(g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_SA_TRANS));
1263 auto sa_mas = GTK_WIDGET(g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_SA_MAS));
1264 auto have_splits = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_SA_SPLITS) != nullptr;
1265
1266 gtk_widget_set_sensitive(widget, !gtk_toggle_button_get_active(b));
1267
1268 // If we have subaccount splits & delete subaccounts, enable subaccount_trans
1269 if ((have_splits) && !gtk_widget_is_sensitive(sa_mas))
1270 gtk_widget_set_sensitive(subaccount_trans, TRUE);
1271 else
1272 gtk_widget_set_sensitive(subaccount_trans, FALSE);
1273
1274 set_ok_sensitivity(dialog);
1275}