GnuCash  4.11-243-g1cac132214+
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 652 of file gnc-plugin-page-account-tree.c.

653 {
655  Account *account;
656 
657  priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
658  ENTER("page %p (tree view %p)", page, priv->tree_view);
659  account = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
660  if (account == NULL)
661  {
662  LEAVE("no account");
663  return NULL;
664  }
665 
666  LEAVE("account %p", account);
667  return account;
668 }
#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 423 of file gnc-plugin-page-account-tree.c.

424 {
425  GncPluginPageAccountTree *plugin_page;
426 
427  ENTER(" ");
428  plugin_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE,
429  NULL);
430 
431  LEAVE("new account tree page %p", plugin_page);
432  return GNC_PLUGIN_PAGE (plugin_page);
433 }
#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 593 of file gnc-plugin-page-account-tree.c.

594 {
597  GncPluginPage *plugin_page = NULL;
598  const GList *page_list;
599  GtkWidget *window;
600 
601  /* Find Accounts page */
602  page_list = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME);
603 
604  // If we have a window, look for account page in that window
605  if (gnc_list_length_cmp (page_list, 0))
606  {
607  if (win != NULL)
608  {
609  for ( ; page_list; page_list = g_list_next(page_list))
610  {
611  plugin_page = GNC_PLUGIN_PAGE(page_list->data);
612  if (GTK_WINDOW(plugin_page->window) == win)
613  break;
614  }
615  }
616  else // if no window, open first account page in list
617  plugin_page = GNC_PLUGIN_PAGE(page_list->data);
618  }
619  else // we have no account pages, create one
620  plugin_page = gnc_plugin_page_account_tree_new ();
621 
622  g_return_if_fail(plugin_page);
623  window = plugin_page->window;
624 
625  gnc_main_window_open_page (GNC_MAIN_WINDOW(window), plugin_page);
626 
627  page = GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page);
628  priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
629 
630  if (account != NULL)
631  {
632  Account *root_account = gnc_get_current_root_account ();
633  Account *parent_account = NULL;
634  Account *temp_account = account;
635 
636  g_hash_table_insert (priv->fd.filter_override, account, account);
637 
638  // make sure we override all the parent accounts to root
639  while (parent_account != root_account)
640  {
641  parent_account = gnc_account_get_parent (temp_account);
642 
643  g_hash_table_insert (priv->fd.filter_override, parent_account, parent_account);
644  temp_account = parent_account;
645  }
646  gnc_tree_view_account_refilter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
647  gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT(priv->tree_view), account);
648  }
649 }
Account * gnc_account_get_parent(const Account *acc)
This routine returns a pointer to the parent of the specified account.
Definition: Account.cpp:2899
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.
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...