GnuCash  5.6-133-gc519490283+
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 448 of file gnc-plugin-page-owner-tree.cpp.

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

248 {
249  GncPluginPageOwnerTree *plugin_page;
251  const GList *item;
252 
253  g_return_val_if_fail( (owner_type != GNC_OWNER_UNDEFINED)
254  && (owner_type != GNC_OWNER_NONE), NULL);
255  ENTER(" ");
256 
257  /* Is there an existing page? */
258  item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_OWNER_TREE_NAME);
259  for ( ; item; item = g_list_next(item))
260  {
261  plugin_page = (GncPluginPageOwnerTree *)item->data;
262  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
263  if (priv->owner_type == owner_type)
264  {
265  LEAVE("existing %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
266  return GNC_PLUGIN_PAGE(plugin_page);
267  }
268  }
269 
270  plugin_page = GNC_PLUGIN_PAGE_OWNER_TREE(g_object_new(GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, nullptr));
271 
272  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
273  priv->owner_type = owner_type;
274 
275  LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
276  return GNC_PLUGIN_PAGE(plugin_page);
277 }
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