GnuCash  4.11-627-g58c1a51897
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 598 of file gnc-plugin-page-account-tree.c.

599 {
601  Account *account;
602 
603  priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
604  ENTER("page %p (tree view %p)", page, priv->tree_view);
605  account = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
606  if (account == NULL)
607  {
608  LEAVE("no account");
609  return NULL;
610  }
611 
612  LEAVE("account %p", account);
613  return account;
614 }
#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 377 of file gnc-plugin-page-account-tree.c.

378 {
379  GncPluginPageAccountTree *plugin_page;
380 
381  ENTER(" ");
382  plugin_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_ACCOUNT_TREE,
383  NULL);
384 
385  LEAVE("new account tree page %p", plugin_page);
386  return GNC_PLUGIN_PAGE (plugin_page);
387 }
#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 539 of file gnc-plugin-page-account-tree.c.

540 {
543  GncPluginPage *plugin_page = NULL;
544  const GList *page_list;
545  GtkWidget *window;
546 
547  /* Find Accounts page */
548  page_list = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME);
549 
550  // If we have a window, look for account page in that window
551  if (gnc_list_length_cmp (page_list, 0))
552  {
553  if (win != NULL)
554  {
555  for ( ; page_list; page_list = g_list_next(page_list))
556  {
557  plugin_page = GNC_PLUGIN_PAGE(page_list->data);
558  if (GTK_WINDOW(plugin_page->window) == win)
559  break;
560  }
561  }
562  else // if no window, open first account page in list
563  plugin_page = GNC_PLUGIN_PAGE(page_list->data);
564  }
565  else // we have no account pages, create one
566  plugin_page = gnc_plugin_page_account_tree_new ();
567 
568  g_return_if_fail(plugin_page);
569  window = plugin_page->window;
570 
571  gnc_main_window_open_page (GNC_MAIN_WINDOW(window), plugin_page);
572 
573  page = GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page);
574  priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
575 
576  if (account != NULL)
577  {
578  Account *root_account = gnc_get_current_root_account ();
579  Account *parent_account = NULL;
580  Account *temp_account = account;
581 
582  g_hash_table_insert (priv->fd.filter_override, account, account);
583 
584  // make sure we override all the parent accounts to root
585  while (parent_account != root_account)
586  {
587  parent_account = gnc_account_get_parent (temp_account);
588 
589  g_hash_table_insert (priv->fd.filter_override, parent_account, parent_account);
590  temp_account = parent_account;
591  }
592  gnc_tree_view_account_refilter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
593  gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT(priv->tree_view), account);
594  }
595 }
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...