GnuCash  4.901
Files | Data Structures | Macros | Enumerations | Functions
An Owner Tree Plugin

Files

file  gnc-plugin-page-owner-tree.c
 Functions providing a page which lists owners of one type.
 
file  gnc-plugin-page-owner-tree.h
 Functions providing a page which lists owners of one type.
 

Data Structures

struct  GncPluginPageOwnerTreePrivate
 
struct  action_owners_struct
 Map actions to owners. More...
 
struct  GncPluginPageOwnerTree
 
struct  GncPluginPageOwnerTreeClass
 

Macros

#define PLUGIN_PAGE_ACCT_TREE_CM_CLASS   "plugin-page-owner-tree"
 
#define DELETE_DIALOG_FILTER   "filter"
 
#define DELETE_DIALOG_OWNER   "owner"
 
#define GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(o)   ((GncPluginPageOwnerTreePrivate*)gnc_plugin_page_owner_tree_get_instance_private((GncPluginPageOwnerTree*)o))
 
#define OWNER_TYPE_LABEL   "OwnerType"
 
#define GNC_TYPE_PLUGIN_PAGE_OWNER_TREE   (gnc_plugin_page_owner_tree_get_type ())
 
#define GNC_PLUGIN_PAGE_OWNER_TREE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTree))
 
#define GNC_PLUGIN_PAGE_OWNER_TREE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTreeClass))
 
#define GNC_IS_PLUGIN_PAGE_OWNER_TREE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE))
 
#define GNC_IS_PLUGIN_PAGE_OWNER_TREE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE))
 
#define GNC_PLUGIN_PAGE_OWNER_TREE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTreeClass))
 
#define GNC_PLUGIN_PAGE_OWNER_TREE_NAME   "GncPluginPageOwnerTree"
 

Enumerations

enum  { OWNER_SELECTED, LAST_SIGNAL }
 

Functions

GncPluginPagegnc_plugin_page_owner_tree_new (GncOwnerType owner_type)
 Create a new "owner tree" plugin page. More...
 
GncOwnergnc_plugin_page_owner_tree_get_current_owner (GncPluginPageOwnerTree *page)
 Given a pointer to an owner tree plugin page, return the selected owner (if any). More...
 
GType gnc_plugin_page_owner_tree_get_type (void)
 Retrieve the type number for an "owner tree" plugin page. More...
 

Detailed Description

Function Documentation

◆ gnc_plugin_page_owner_tree_get_current_owner()

GncOwner * gnc_plugin_page_owner_tree_get_current_owner ( GncPluginPageOwnerTree page)

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

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

Definition at line 476 of file gnc-plugin-page-owner-tree.c.

477 {
479  GncOwner *owner;
480 
481  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(page);
482  ENTER("page %p (tree view %p)", page, priv->tree_view);
483  owner = gnc_tree_view_owner_get_selected_owner (GNC_TREE_VIEW_OWNER(priv->tree_view));
484  if (owner == NULL)
485  {
486  LEAVE("no owner");
487  return NULL;
488  }
489 
490  LEAVE("owner %p", owner);
491  return owner;
492 }
#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
GncOwner * gnc_tree_view_owner_get_selected_owner(GncTreeViewOwner *view)
This function returns the owner associated with the selected item in the owner tree view...

◆ gnc_plugin_page_owner_tree_get_type()

GType gnc_plugin_page_owner_tree_get_type ( void  )

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

Returns
The type number.

◆ gnc_plugin_page_owner_tree_new()

GncPluginPage * gnc_plugin_page_owner_tree_new ( GncOwnerType  owner_type)

Create a new "owner tree" plugin page.

Parameters
owner_typeThe owner type to create a page for. Can be any of the owner types defined in GnuCash, like vendor, customer,...
Returns
The newly created plugin page.

Definition at line 270 of file gnc-plugin-page-owner-tree.c.

271 {
272  GncPluginPageOwnerTree *plugin_page;
274  const GList *item;
275  GSimpleActionGroup *simple_action_group;
276  GAction *action;
277  gint i;
278 
279  g_return_val_if_fail( (owner_type != GNC_OWNER_UNDEFINED)
280  && (owner_type != GNC_OWNER_NONE), NULL);
281  ENTER(" ");
282 
283  /* Is there an existing page? */
284  item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_OWNER_TREE_NAME);
285  for ( ; item; item = g_list_next(item))
286  {
287  plugin_page = (GncPluginPageOwnerTree *)item->data;
288  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
289  if (priv->owner_type == owner_type)
290  {
291  LEAVE("existing %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
292  return GNC_PLUGIN_PAGE(plugin_page);
293  }
294  }
295 
296  plugin_page = g_object_new(GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, NULL);
297 
298  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
299  priv->owner_type = owner_type;
300 
301  LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
302  return GNC_PLUGIN_PAGE(plugin_page);
303 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Returns the QofIdType of the given GncOwnerType, or NULL if no suitable one exists.
Definition: gncOwner.c:236
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282