GnuCash 2.3.0
Data Structures | Files | Defines | Functions
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 296 of file gnc-plugin-page-invoice.c.

{
    static GType gnc_plugin_page_invoice_type = 0;

    if (gnc_plugin_page_invoice_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncPluginPageInvoiceClass),
            NULL,
            NULL,
            (GClassInitFunc) gnc_plugin_page_invoice_class_init,
            NULL,
            NULL,
            sizeof (GncPluginPageInvoice),
            0,
            (GInstanceInitFunc) gnc_plugin_page_invoice_init
        };

        gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
                                       "GncPluginPageInvoice",
                                       &our_info, 0);
    }

    return gnc_plugin_page_invoice_type;
}
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 324 of file gnc-plugin-page-invoice.c.

{
    GncPluginPageInvoicePrivate *priv;
    GncPluginPageInvoice *invoice_page;
    GncPluginPage *plugin_page;
    const GList *item;

    /* Is there an existing page? */
    item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_INVOICE_NAME);
    for ( ; item; item = g_list_next(item))
    {
        invoice_page = (GncPluginPageInvoice *)item->data;
        priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
        if (priv->iw == iw)
            return GNC_PLUGIN_PAGE(invoice_page);
    }

    invoice_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_INVOICE, (char *)NULL);
    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
    priv->iw = iw;

    plugin_page = GNC_PLUGIN_PAGE(invoice_page);
    gnc_plugin_page_invoice_update_title(plugin_page);
    gnc_plugin_page_set_uri(plugin_page, "default:");

    priv->component_manager_id = 0;
    return 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 430 of file gnc-plugin-page-invoice.c.

{
    GtkActionGroup *action_group;
    gboolean is_readonly = qof_book_is_readonly(gnc_get_current_book());

    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));

    if (is_readonly)
    {
        // Are we readonly? Then don't allow any actions.
        is_posted = TRUE;
        can_unpost = FALSE;
    }

    action_group = gnc_plugin_page_get_action_group(page);
    gnc_plugin_update_actions (action_group, posted_actions,
                               "sensitive", is_posted);
    gnc_plugin_update_actions (action_group, unposted_actions,
                               "sensitive", !is_posted);
    gnc_plugin_update_actions (action_group, can_unpost_actions,
                               "sensitive", can_unpost);
    gnc_plugin_update_actions (action_group, invoice_book_readwrite_actions,
                               "sensitive", !is_readonly);
}
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 960 of file gnc-plugin-page-invoice.c.

{
    GncPluginPageInvoice *page;
    GncPluginPageInvoicePrivate *priv;
    gchar *title;

    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));

    page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
    title = gnc_invoice_get_title(priv->iw);
    main_window_update_page_name(plugin_page, title);
    g_free(title);
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines