Business Invoice Page
[Content Plugins]


Data Structures

struct  GncPluginPageInvoice
struct  GncPluginPageInvoiceClass

Files

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

Defines

#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)

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 264 of file gnc-plugin-page-invoice.c.

00265 {
00266     static GType gnc_plugin_page_invoice_type = 0;
00267 
00268     if (gnc_plugin_page_invoice_type == 0)
00269     {
00270         static const GTypeInfo our_info =
00271         {
00272             sizeof (GncPluginPageInvoiceClass),
00273             NULL,
00274             NULL,
00275             (GClassInitFunc) gnc_plugin_page_invoice_class_init,
00276             NULL,
00277             NULL,
00278             sizeof (GncPluginPageInvoice),
00279             0,
00280             (GInstanceInitFunc) gnc_plugin_page_invoice_init
00281         };
00282 
00283         gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
00284                                        "GncPluginPageInvoice",
00285                                        &our_info, 0);
00286     }
00287 
00288     return gnc_plugin_page_invoice_type;
00289 }

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:
iw A pointer to the invoice to be embedded into a main window.
Returns:
The newly created plugin page.

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

00293 {
00294     GncPluginPageInvoicePrivate *priv;
00295     GncPluginPageInvoice *invoice_page;
00296     GncPluginPage *plugin_page;
00297     const GList *item;
00298 
00299     /* Is there an existing page? */
00300     item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_INVOICE_NAME);
00301     for ( ; item; item = g_list_next(item))
00302     {
00303         invoice_page = (GncPluginPageInvoice *)item->data;
00304         priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
00305         if (priv->iw == iw)
00306             return GNC_PLUGIN_PAGE(invoice_page);
00307     }
00308 
00309     invoice_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_INVOICE, (char *)NULL);
00310     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
00311     priv->iw = iw;
00312 
00313     plugin_page = GNC_PLUGIN_PAGE(invoice_page);
00314     gnc_plugin_page_invoice_update_title(plugin_page);
00315     gnc_plugin_page_set_uri(plugin_page, "default:");
00316 
00317     priv->component_manager_id = 0;
00318     return plugin_page;
00319 }

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:
page A pointer invoice page.
is_posted Set this to TRUE if the invoice has been posted.
can_unpost Set this to TRUE if the invoice can be un-posted.

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

00399 {
00400     GtkActionGroup *action_group;
00401 
00402     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
00403 
00404     action_group = gnc_plugin_page_get_action_group(page);
00405     gnc_plugin_update_actions (action_group, posted_actions,
00406                                "sensitive", is_posted);
00407     gnc_plugin_update_actions (action_group, unposted_actions,
00408                                "sensitive", !is_posted);
00409     gnc_plugin_update_actions (action_group, can_unpost_actions,
00410                                "sensitive", can_unpost);
00411 }

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:
page A pointer invoice page.

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

00879 {
00880     GncPluginPageInvoice *page;
00881     GncPluginPageInvoicePrivate *priv;
00882     gchar *title;
00883 
00884     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
00885 
00886     page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
00887     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
00888     title = gnc_invoice_get_title(priv->iw);
00889     gnc_plugin_page_set_page_name(plugin_page, title);
00890     g_free(title);
00891 }


Generated on Thu Jul 29 04:36:20 2010 for GnuCash by  doxygen 1.5.7.1