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

518 {
520  GncOwner *owner;
521 
522  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(page);
523  ENTER("page %p (tree view %p)", page, priv->tree_view);
524  owner = gnc_tree_view_owner_get_selected_owner (GNC_TREE_VIEW_OWNER(priv->tree_view));
525  if (owner == NULL)
526  {
527  LEAVE("no owner");
528  return NULL;
529  }
530 
531  LEAVE("owner %p", owner);
532  return owner;
533 }
#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 334 of file gnc-plugin-page-owner-tree.c.

335 {
336  GncPluginPageOwnerTree *plugin_page;
337 
339  const GList *item;
340 
341  GtkActionGroup *action_group;
342  GtkAction *action;
343  gint i;
344 
345  g_return_val_if_fail( (owner_type != GNC_OWNER_UNDEFINED)
346  && (owner_type != GNC_OWNER_NONE), NULL);
347  ENTER(" ");
348 
349  /* Is there an existing page? */
350  item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_OWNER_TREE_NAME);
351  for ( ; item; item = g_list_next(item))
352  {
353  plugin_page = (GncPluginPageOwnerTree *)item->data;
354  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
355  if (priv->owner_type == owner_type)
356  {
357  LEAVE("existing %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
358  return GNC_PLUGIN_PAGE(plugin_page);
359  }
360  }
361 
362  plugin_page = g_object_new(GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, NULL);
363 
364  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
365  priv->owner_type = owner_type;
366 
367  /* Hide menu and toolbar items that are not relevant for the active owner list */
368  action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(plugin_page));
369  for (i = 0; action_owners[i].action_name; i++)
370  {
371  action = gtk_action_group_get_action (action_group, action_owners[i].action_name);
372  g_object_set (G_OBJECT(action),
373  "visible", (priv->owner_type == action_owners[i].owner_type),
374  NULL);
375  }
376 
377  LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
378  return GNC_PLUGIN_PAGE(plugin_page);
379 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
GtkActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
Retrieve the GtkActionGroup object associated with this page.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
const char * action_name
The name of the action.
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