GnuCash  5.6-133-gc519490283+
Files | Data Structures | Macros | Enumerations | Functions
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)   ((GncPluginPageAccountTreePrivate*)gnc_plugin_page_account_tree_get_instance_private((GncPluginPageAccountTree*)o))
 
#define GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE   (gnc_plugin_page_account_tree_get_type ())
 
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, GncPluginPageAccountTree))
 
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, GncPluginPageAccountTreeClass))
 
#define GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE))
 
#define GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE))
 
#define GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, GncPluginPageAccountTreeClass))
 
#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)
 
GncPluginPagegnc_plugin_page_account_tree_new (void)
 Create a new "account tree" plugin page. More...
 
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). More...
 
Accountgnc_plugin_page_account_tree_get_current_account (GncPluginPageAccountTree *page)
 Given a pointer to an account tree plugin page, return the selected account (if any). More...
 
GType gnc_plugin_page_account_tree_get_type (void)
 Retrieve the type number for an "account tree" plugin page. More...
 

Detailed Description

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 516 of file gnc-plugin-page-account-tree.cpp.

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

◆ 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 300 of file gnc-plugin-page-account-tree.cpp.

301 {
302  ENTER(" ");
303  auto plugin_page = GNC_PLUGIN_PAGE_ACCOUNT_TREE
304  (g_object_new (GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE, nullptr));
305 
306  LEAVE("new account tree page %p", plugin_page);
307  return GNC_PLUGIN_PAGE (plugin_page);
308 }
#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_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 457 of file gnc-plugin-page-account-tree.cpp.

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