GnuCash  5.6-150-g038405b370+
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 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 }
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 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 }
#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 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:2875
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...