GnuCash  5.6-150-g038405b370+
Files | Data Structures | Macros | Enumerations | Functions
An Owner Tree Plugin

Files

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

451 {
453  GncOwner *owner;
454 
455  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(page);
456  ENTER("page %p (tree view %p)", page, priv->tree_view);
457  owner = gnc_tree_view_owner_get_selected_owner (GNC_TREE_VIEW_OWNER(priv->tree_view));
458  if (owner == NULL)
459  {
460  LEAVE("no owner");
461  return NULL;
462  }
463 
464  LEAVE("owner %p", owner);
465  return owner;
466 }
#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 249 of file gnc-plugin-page-owner-tree.cpp.

250 {
251  GncPluginPageOwnerTree *plugin_page;
253  const GList *item;
254 
255  g_return_val_if_fail( (owner_type != GNC_OWNER_UNDEFINED)
256  && (owner_type != GNC_OWNER_NONE), NULL);
257  ENTER(" ");
258 
259  /* Is there an existing page? */
260  item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_OWNER_TREE_NAME);
261  for ( ; item; item = g_list_next(item))
262  {
263  plugin_page = (GncPluginPageOwnerTree *)item->data;
264  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
265  if (priv->owner_type == owner_type)
266  {
267  LEAVE("existing %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
268  return GNC_PLUGIN_PAGE(plugin_page);
269  }
270  }
271 
272  plugin_page = GNC_PLUGIN_PAGE_OWNER_TREE(g_object_new(GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, nullptr));
273 
274  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
275  priv->owner_type = owner_type;
276 
277  LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
278  return GNC_PLUGIN_PAGE(plugin_page);
279 }
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:235
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282