Business Invoice Page
[Content Plugins]


Files

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

Data Structures

struct  GncPluginPageInvoice
struct  GncPluginPageInvoiceClass

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

00229 {
00230         static GType gnc_plugin_page_invoice_type = 0;
00231 
00232         if (gnc_plugin_page_invoice_type == 0) {
00233                 static const GTypeInfo our_info = {
00234                         sizeof (GncPluginPageInvoiceClass),
00235                         NULL,
00236                         NULL,
00237                         (GClassInitFunc) gnc_plugin_page_invoice_class_init,
00238                         NULL,
00239                         NULL,
00240                         sizeof (GncPluginPageInvoice),
00241                         0,
00242                         (GInstanceInitFunc) gnc_plugin_page_invoice_init
00243                 };
00244                 
00245                 gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
00246                                                                         "GncPluginPageInvoice",
00247                                                                         &our_info, 0);
00248         }
00249 
00250         return gnc_plugin_page_invoice_type;
00251 }

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

00255 {
00256         GncPluginPageInvoicePrivate *priv;
00257         GncPluginPageInvoice *invoice_page;
00258         GncPluginPage *plugin_page;
00259         const GList *item;
00260 
00261         /* Is there an existing page? */
00262         item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_INVOICE_NAME);
00263         for ( ; item; item = g_list_next(item)) {
00264           invoice_page = (GncPluginPageInvoice *)item->data;
00265           priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
00266           if (priv->iw == iw)
00267             return GNC_PLUGIN_PAGE(invoice_page);
00268         }
00269 
00270         invoice_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_INVOICE, (char *)NULL);
00271         priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
00272         priv->iw = iw;
00273 
00274         plugin_page = GNC_PLUGIN_PAGE(invoice_page);
00275         gnc_plugin_page_invoice_update_title(plugin_page);
00276         gnc_plugin_page_set_uri(plugin_page, "default:");
00277 
00278         priv->component_manager_id = 0;
00279         return plugin_page;
00280 }

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

00360 { 
00361   GtkActionGroup *action_group;
00362 
00363   g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
00364 
00365   action_group = gnc_plugin_page_get_action_group(page);
00366   gnc_plugin_update_actions (action_group, posted_actions,
00367                              "sensitive", is_posted);
00368   gnc_plugin_update_actions (action_group, unposted_actions,
00369                              "sensitive", !is_posted);
00370   gnc_plugin_update_actions (action_group, can_unpost_actions,
00371                              "sensitive", can_unpost);
00372 }

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

00837 {
00838   GncPluginPageInvoice *page;
00839   GncPluginPageInvoicePrivate *priv;
00840   gchar *title;
00841 
00842   g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
00843 
00844   page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
00845   priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
00846   title = gnc_invoice_get_title(priv->iw);
00847   gnc_plugin_page_set_page_name(plugin_page, title);
00848   g_free(title);
00849 }


Generated on Fri Jul 25 05:06:00 2008 for GnuCash by  doxygen 1.5.2