GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Functions
Business Invoice Page

Files

file  gnc-plugin-page-invoice.h
 utility functions for the GnuCash UI
 

Data Structures

struct  GncPluginPageInvoice
 
struct  GncPluginPageInvoiceClass
 

Macros

#define GNC_TYPE_PLUGIN_PAGE_INVOICE   (gnc_plugin_page_invoice_get_type ())
 
#define GNC_PLUGIN_PAGE_INVOICE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_INVOICE, GncPluginPageInvoice))
 
#define GNC_PLUGIN_PAGE_INVOICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_INVOICE, GncPluginPageInvoiceClass))
 
#define GNC_IS_PLUGIN_PAGE_INVOICE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_INVOICE))
 
#define GNC_IS_PLUGIN_PAGE_INVOICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_INVOICE))
 
#define GNC_PLUGIN_PAGE_INVOICE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_INVOICE, GncPluginPageInvoiceClass))
 
#define GNC_PLUGIN_PAGE_INVOICE_NAME   "GncPluginPageInvoice"
 

Functions

GType gnc_plugin_page_invoice_get_type (void)
 
GncPluginPagegnc_plugin_page_invoice_new (InvoiceWindow *iw)
 
void gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, gboolean can_unpost)
 
void gnc_plugin_page_invoice_update_title (GncPluginPage *page)
 

Detailed Description

Function Documentation

GType gnc_plugin_page_invoice_get_type ( void  )

Retrieve the type number for an "invoice" plugin page.

Returns
The type number.

Definition at line 294 of file gnc-plugin-page-invoice.c.

295 {
296  static GType gnc_plugin_page_invoice_type = 0;
297 
298  if (gnc_plugin_page_invoice_type == 0)
299  {
300  static const GTypeInfo our_info =
301  {
302  sizeof (GncPluginPageInvoiceClass),
303  NULL,
304  NULL,
305  (GClassInitFunc) gnc_plugin_page_invoice_class_init,
306  NULL,
307  NULL,
308  sizeof (GncPluginPageInvoice),
309  0,
310  (GInstanceInitFunc) gnc_plugin_page_invoice_init
311  };
312 
313  gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
314  "GncPluginPageInvoice",
315  &our_info, 0);
316  }
317 
318  return gnc_plugin_page_invoice_type;
319 }
GncPluginPage* gnc_plugin_page_invoice_new ( InvoiceWindow iw)

Create a new "invoice" plugin page, given a pointer to an InvoiceWindow data structure. This structure is used to describe both the "invoice entry" page in a window, and also to describe the New Invoice dialog.

Parameters
iwA pointer to the invoice to be embedded into a main window.
Returns
The newly created plugin page.

Definition at line 322 of file gnc-plugin-page-invoice.c.

323 {
325  GncPluginPageInvoice *invoice_page;
326  GncPluginPage *plugin_page;
327  const GList *item;
328 
329  /* Is there an existing page? */
330  item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_INVOICE_NAME);
331  for ( ; item; item = g_list_next(item))
332  {
333  invoice_page = (GncPluginPageInvoice *)item->data;
334  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
335  if (priv->iw == iw)
336  return GNC_PLUGIN_PAGE(invoice_page);
337  }
338 
339  invoice_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_INVOICE, (char *)NULL);
340  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
341  priv->iw = iw;
342 
343  plugin_page = GNC_PLUGIN_PAGE(invoice_page);
345  gnc_plugin_page_set_uri(plugin_page, "default:");
346 
347  priv->component_manager_id = 0;
348  return plugin_page;
349 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
void gnc_plugin_page_set_uri(GncPluginPage *page, const char *name)
void gnc_plugin_page_invoice_update_title(GncPluginPage *plugin_page)
void gnc_plugin_page_invoice_update_menus ( GncPluginPage page,
gboolean  is_posted,
gboolean  can_unpost 
)

Update the menu items associated with this invoice page. This function should be called whenever the posted state of an invoice is changed.

Parameters
pageA pointer invoice page.
is_postedSet this to TRUE if the invoice has been posted.
can_unpostSet this to TRUE if the invoice can be un-posted.

Definition at line 419 of file gnc-plugin-page-invoice.c.

420 {
421  GtkActionGroup *action_group;
422  gboolean is_readonly = qof_book_is_readonly(gnc_get_current_book());
423 
424  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
425 
426  if (is_readonly)
427  {
428  // Are we readonly? Then don't allow any actions.
429  is_posted = TRUE;
430  can_unpost = FALSE;
431  }
432 
433  action_group = gnc_plugin_page_get_action_group(page);
434  gnc_plugin_update_actions (action_group, posted_actions,
435  "sensitive", is_posted);
436  gnc_plugin_update_actions (action_group, unposted_actions,
437  "sensitive", !is_posted);
438  gnc_plugin_update_actions (action_group, can_unpost_actions,
439  "sensitive", can_unpost);
440  gnc_plugin_update_actions (action_group, invoice_book_readwrite_actions,
441  "sensitive", !is_readonly);
442 }
GtkActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
gboolean qof_book_is_readonly(const QofBook *book)
void gnc_plugin_update_actions(GtkActionGroup *action_group, const gchar **action_names, const gchar *property_name, gboolean value)
Definition: gnc-plugin.c:313
void gnc_plugin_page_invoice_update_title ( GncPluginPage page)

Update the title associated with this invoice page. This function should be called whenever the name on an invoice is changed.

Parameters
pageA pointer invoice page.

Definition at line 953 of file gnc-plugin-page-invoice.c.

954 {
955  GncPluginPageInvoice *page;
957  gchar *title;
958 
959  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
960 
961  page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
962  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
963  title = gnc_invoice_get_title(priv->iw);
964  main_window_update_page_name(plugin_page, title);
965  g_free(title);
966 }
void main_window_update_page_name(GncPluginPage *page, const gchar *name_in)