GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Typedefs | Enumerations | Functions
An Owner Tree Plugin

Files

file  gnc-plugin-page-owner-tree.c
 Functions providing a page which lists owners of one type. This type can be vendors, customers or employees.
 
file  gnc-plugin-page-owner-tree.h
 Functions providing a page which lists owners of one type. This type can be vendors, customers or employees.
 

Data Structures

struct  GncPluginPageOwnerTreePrivate
 
struct  action_owners_struct
 
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)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTreePrivate))
 
#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"
 

Typedefs

typedef struct
GncPluginPageOwnerTreePrivate 
GncPluginPageOwnerTreePrivate
 

Enumerations

enum  { OWNER_SELECTED, LAST_SIGNAL }
 

Functions

GType gnc_plugin_page_owner_tree_get_type (void)
 
GncPluginPagegnc_plugin_page_owner_tree_new (GncOwnerType owner_type)
 
GncOwnergnc_plugin_page_owner_tree_get_current_owner (GncPluginPageOwnerTree *page)
 

Detailed Description

Function Documentation

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

507 {
509  GncOwner *owner;
510 
511  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(page);
512  ENTER("page %p (tree view %p)", page, priv->tree_view);
513  owner = gnc_tree_view_owner_get_selected_owner (GNC_TREE_VIEW_OWNER(priv->tree_view));
514  if (owner == NULL)
515  {
516  LEAVE("no owner");
517  return NULL;
518  }
519 
520  LEAVE("owner %p", owner);
521  return owner;
522 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
GncOwner * gnc_tree_view_owner_get_selected_owner(GncTreeViewOwner *view)
GType gnc_plugin_page_owner_tree_get_type ( void  )

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

Returns
The type number.

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

315 {
316  static GType gnc_plugin_page_owner_tree_type = 0;
317 
318  if (gnc_plugin_page_owner_tree_type == 0)
319  {
320  static const GTypeInfo our_info =
321  {
323  NULL,
324  NULL,
325  (GClassInitFunc) gnc_plugin_page_owner_tree_class_init,
326  NULL,
327  NULL,
328  sizeof (GncPluginPageOwnerTree),
329  0,
330  (GInstanceInitFunc) gnc_plugin_page_owner_tree_init
331  };
332 
333  gnc_plugin_page_owner_tree_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
334  GNC_PLUGIN_PAGE_OWNER_TREE_NAME,
335  &our_info, 0);
336  }
337 
338  return gnc_plugin_page_owner_tree_type;
339 }
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 342 of file gnc-plugin-page-owner-tree.c.

343 {
344  GncPluginPageOwnerTree *plugin_page;
345 
347  const GList *item;
348 
349  GtkActionGroup *action_group;
350  GtkAction *action;
351  GValue gvalue = { 0 };
352  gint i;
353 
354  g_return_val_if_fail( (owner_type != GNC_OWNER_UNDEFINED)
355  && (owner_type != GNC_OWNER_NONE), NULL);
356  ENTER(" ");
357 
358  /* Is there an existing page? */
359  item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_OWNER_TREE_NAME);
360  for ( ; item; item = g_list_next(item))
361  {
362  plugin_page = (GncPluginPageOwnerTree *)item->data;
363  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
364  if (priv->owner_type == owner_type)
365  {
366  LEAVE("existing %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
367  return GNC_PLUGIN_PAGE(plugin_page);
368  }
369  }
370 
371  plugin_page = g_object_new(GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, NULL);
372 
373  priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
374  priv->owner_type = owner_type;
375 
376  /* Hide menu and toolbar items that are not relevant for the active owner list */
377  action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(plugin_page));
378  g_value_init (&gvalue, G_TYPE_BOOLEAN);
379  for (i = 0; action_owners[i].action_name; i++)
380  {
381  action = gtk_action_group_get_action (action_group, action_owners[i].action_name);
382  g_value_set_boolean (&gvalue, (priv->owner_type == action_owners[i].owner_type) );
383  g_object_set_property (G_OBJECT(action), "visible", &gvalue);
384  }
385 
386  LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
387  return GNC_PLUGIN_PAGE(plugin_page);
388 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
GtkActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
#define ENTER(format, args...)
Definition: qoflog.h:261
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Definition: gncOwner.c:213
#define LEAVE(format, args...)
Definition: qoflog.h:271