mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Allow Associations to be added to invoices
Use the existing associations functions to do the updating, opening and removing of the association for invoices and all objects that use the invoice interface. The actual association when present is added as a link button which is shown below the notes.
This commit is contained in:
parent
2f9be87549
commit
30f21763e8
@ -73,7 +73,10 @@
|
|||||||
#include "gnc-main-window.h"
|
#include "gnc-main-window.h"
|
||||||
#include "gnc-state.h"
|
#include "gnc-state.h"
|
||||||
|
|
||||||
|
#include "dialog-assoc.h"
|
||||||
|
#include "dialog-assoc-utils.h"
|
||||||
#include "dialog-transfer.h"
|
#include "dialog-transfer.h"
|
||||||
|
#include "gnc-uri-utils.h"
|
||||||
|
|
||||||
/* Disable -Waddress. GCC 4.2 warns (and fails to compile with -Werror) when
|
/* Disable -Waddress. GCC 4.2 warns (and fails to compile with -Werror) when
|
||||||
* passing the address of a guid on the stack to QOF_BOOK_LOOKUP_ENTITY via
|
* passing the address of a guid on the stack to QOF_BOOK_LOOKUP_ENTITY via
|
||||||
@ -166,6 +169,8 @@ struct _invoice_window
|
|||||||
GtkWidget * active_check;
|
GtkWidget * active_check;
|
||||||
GtkWidget * paid_label;
|
GtkWidget * paid_label;
|
||||||
|
|
||||||
|
GtkWidget * assoc_link_button;
|
||||||
|
|
||||||
GtkWidget * owner_box;
|
GtkWidget * owner_box;
|
||||||
GtkWidget * owner_label;
|
GtkWidget * owner_label;
|
||||||
GtkWidget * owner_choice;
|
GtkWidget * owner_choice;
|
||||||
@ -229,12 +234,12 @@ static GtkWidget *
|
|||||||
iw_get_window (InvoiceWindow *iw)
|
iw_get_window (InvoiceWindow *iw)
|
||||||
{
|
{
|
||||||
if (iw->page)
|
if (iw->page)
|
||||||
return gnc_plugin_page_get_window(iw->page);
|
return gnc_plugin_page_get_window (iw->page);
|
||||||
return iw->dialog;
|
return iw->dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gnc_invoice_get_register(InvoiceWindow *iw)
|
gnc_invoice_get_register (InvoiceWindow *iw)
|
||||||
{
|
{
|
||||||
if (iw)
|
if (iw)
|
||||||
return (GtkWidget *)iw->reg;
|
return (GtkWidget *)iw->reg;
|
||||||
@ -242,7 +247,7 @@ gnc_invoice_get_register(InvoiceWindow *iw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gnc_invoice_get_notes(InvoiceWindow *iw)
|
gnc_invoice_get_notes (InvoiceWindow *iw)
|
||||||
{
|
{
|
||||||
if (iw)
|
if (iw)
|
||||||
return (GtkWidget *)iw->notes_text;
|
return (GtkWidget *)iw->notes_text;
|
||||||
@ -313,6 +318,24 @@ iw_get_invoice (InvoiceWindow *iw)
|
|||||||
return gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
return gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GncInvoice *
|
||||||
|
gnc_invoice_window_get_invoice (InvoiceWindow *iw)
|
||||||
|
{
|
||||||
|
if (!iw)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return iw_get_invoice (iw);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gnc_invoice_window_get_assoc_link_button (InvoiceWindow *iw)
|
||||||
|
{
|
||||||
|
if (!iw)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return iw->assoc_link_button;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_gncEntry_switch_type (gpointer data, gpointer user_data)
|
set_gncEntry_switch_type (gpointer data, gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -2371,6 +2394,15 @@ gnc_invoice_save_page (InvoiceWindow *iw,
|
|||||||
gnc_table_save_state (table, group_name);
|
gnc_table_save_state (table, group_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
assoc_link_button_cb (GtkLinkButton *button, InvoiceWindow *iw)
|
||||||
|
{
|
||||||
|
GncInvoice *invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
||||||
|
gnc_assoc_open_uri (GTK_WINDOW(iw->dialog), gncInvoiceGetAssociation (invoice));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||||
{
|
{
|
||||||
@ -2383,6 +2415,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
|||||||
const gchar *prefs_group = NULL;
|
const gchar *prefs_group = NULL;
|
||||||
gboolean is_credit_note = FALSE;
|
gboolean is_credit_note = FALSE;
|
||||||
const gchar *style_label = NULL;
|
const gchar *style_label = NULL;
|
||||||
|
const gchar *assoc_uri;
|
||||||
|
|
||||||
invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
||||||
is_credit_note = gncInvoiceGetIsCreditNote (invoice);
|
is_credit_note = gncInvoiceGetIsCreditNote (invoice);
|
||||||
@ -2413,6 +2446,23 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
|||||||
iw->job_box = GTK_WIDGET (gtk_builder_get_object (builder, "page_job_hbox"));
|
iw->job_box = GTK_WIDGET (gtk_builder_get_object (builder, "page_job_hbox"));
|
||||||
iw->paid_label = GTK_WIDGET (gtk_builder_get_object (builder, "paid_label"));
|
iw->paid_label = GTK_WIDGET (gtk_builder_get_object (builder, "paid_label"));
|
||||||
|
|
||||||
|
iw->assoc_link_button = GTK_WIDGET(gtk_builder_get_object (builder, "assoc_link_button"));
|
||||||
|
g_signal_connect (G_OBJECT(iw->assoc_link_button), "activate-link",
|
||||||
|
G_CALLBACK(assoc_link_button_cb), iw);
|
||||||
|
|
||||||
|
/* invoice association */
|
||||||
|
assoc_uri = gncInvoiceGetAssociation (invoice);
|
||||||
|
if (assoc_uri)
|
||||||
|
{
|
||||||
|
gchar *display_uri = gnc_assoc_get_unescaped_just_uri (assoc_uri);
|
||||||
|
gtk_button_set_label (GTK_BUTTON(iw->assoc_link_button), _("Open Association:"));
|
||||||
|
gtk_link_button_set_uri (GTK_LINK_BUTTON(iw->assoc_link_button), display_uri);
|
||||||
|
gtk_widget_show (GTK_WIDGET (iw->assoc_link_button));
|
||||||
|
g_free (display_uri);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gtk_widget_hide (GTK_WIDGET (iw->assoc_link_button));
|
||||||
|
|
||||||
// Add a style context for this label so it can be easily manipulated with css
|
// Add a style context for this label so it can be easily manipulated with css
|
||||||
gnc_widget_style_context_add_class (GTK_WIDGET(iw->paid_label), "gnc-class-highlight");
|
gnc_widget_style_context_add_class (GTK_WIDGET(iw->paid_label), "gnc-class-highlight");
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@ gchar *gnc_invoice_get_help (InvoiceWindow *iw);
|
|||||||
|
|
||||||
gchar *gnc_invoice_get_title (InvoiceWindow *iw);
|
gchar *gnc_invoice_get_title (InvoiceWindow *iw);
|
||||||
|
|
||||||
|
GncInvoice * gnc_invoice_window_get_invoice (InvoiceWindow *iw);
|
||||||
|
|
||||||
|
GtkWidget * gnc_invoice_window_get_assoc_link_button (InvoiceWindow *iw);
|
||||||
|
|
||||||
GncInvoiceType gnc_invoice_get_type_from_window(InvoiceWindow *iw);
|
GncInvoiceType gnc_invoice_get_type_from_window(InvoiceWindow *iw);
|
||||||
|
|
||||||
#ifdef __GNC_PLUGIN_PAGE_H
|
#ifdef __GNC_PLUGIN_PAGE_H
|
||||||
|
@ -40,8 +40,11 @@
|
|||||||
#include "gnucash-register.h"
|
#include "gnucash-register.h"
|
||||||
#include "gnc-prefs.h"
|
#include "gnc-prefs.h"
|
||||||
#include "gnc-ui-util.h"
|
#include "gnc-ui-util.h"
|
||||||
|
#include "gnc-uri-utils.h"
|
||||||
#include "gnc-window.h"
|
#include "gnc-window.h"
|
||||||
#include "dialog-utils.h"
|
#include "dialog-utils.h"
|
||||||
|
#include "dialog-assoc.h"
|
||||||
|
#include "dialog-assoc-utils.h"
|
||||||
#include "gncInvoice.h"
|
#include "gncInvoice.h"
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
@ -85,6 +88,9 @@ static void gnc_plugin_page_invoice_cmd_duplicateEntry (GtkAction *action, GncPl
|
|||||||
static void gnc_plugin_page_invoice_cmd_pay_invoice (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
static void gnc_plugin_page_invoice_cmd_pay_invoice (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
static void gnc_plugin_page_invoice_cmd_save_layout (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
static void gnc_plugin_page_invoice_cmd_save_layout (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
static void gnc_plugin_page_invoice_cmd_reset_layout (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
static void gnc_plugin_page_invoice_cmd_reset_layout (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
|
static void gnc_plugin_page_invoice_cmd_associate (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
|
static void gnc_plugin_page_invoice_cmd_associate_remove (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
|
static void gnc_plugin_page_invoice_cmd_associate_open (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
static void gnc_plugin_page_invoice_cmd_company_report (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
static void gnc_plugin_page_invoice_cmd_company_report (GtkAction *action, GncPluginPageInvoice *plugin_page);
|
||||||
|
|
||||||
static void gnc_plugin_page_redraw_help_cb( GnucashRegister *gsr, GncPluginPageInvoice *invoice_page );
|
static void gnc_plugin_page_redraw_help_cb( GnucashRegister *gsr, GncPluginPageInvoice *invoice_page );
|
||||||
@ -201,6 +207,21 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] =
|
|||||||
"Create a new invoice for the same owner as the current one",
|
"Create a new invoice for the same owner as the current one",
|
||||||
G_CALLBACK (gnc_plugin_page_invoice_cmd_new_invoice)
|
G_CALLBACK (gnc_plugin_page_invoice_cmd_new_invoice)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"BusinessAssociationAction", NULL, "_Update Association for Invoice", NULL,
|
||||||
|
"Update Association for current Invoice",
|
||||||
|
G_CALLBACK (gnc_plugin_page_invoice_cmd_associate)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BusinessAssociationOpenAction", NULL, "_Open Association for Invoice", NULL,
|
||||||
|
"Open Association for current Invoice",
|
||||||
|
G_CALLBACK (gnc_plugin_page_invoice_cmd_associate_open)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"BusinessAssociationRemoveAction", NULL, "_Remove Association from Invoice", NULL,
|
||||||
|
"Remove Association from Invoice",
|
||||||
|
G_CALLBACK (gnc_plugin_page_invoice_cmd_associate_remove)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ToolsProcessPaymentAction", GNC_ICON_INVOICE_PAY, "_Pay Invoice", NULL,
|
"ToolsProcessPaymentAction", GNC_ICON_INVOICE_PAY, "_Pay Invoice", NULL,
|
||||||
"Enter a payment for the owner of this invoice",
|
"Enter a payment for the owner of this invoice",
|
||||||
@ -246,6 +267,8 @@ static const gchar *invoice_book_readwrite_actions[] =
|
|||||||
"EditDuplicateInvoiceAction",
|
"EditDuplicateInvoiceAction",
|
||||||
"BusinessNewInvoiceAction",
|
"BusinessNewInvoiceAction",
|
||||||
"ToolsProcessPaymentAction",
|
"ToolsProcessPaymentAction",
|
||||||
|
"BusinessAssociationAction",
|
||||||
|
"BusinessAssociationRemoveAction",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -285,6 +308,9 @@ static action_toolbar_labels invoice_action_labels[] =
|
|||||||
{"EditUnpostInvoiceAction", N_("_Unpost Invoice")},
|
{"EditUnpostInvoiceAction", N_("_Unpost Invoice")},
|
||||||
{"BusinessNewInvoiceAction", N_("New _Invoice")},
|
{"BusinessNewInvoiceAction", N_("New _Invoice")},
|
||||||
{"ToolsProcessPaymentAction", N_("_Pay Invoice")},
|
{"ToolsProcessPaymentAction", N_("_Pay Invoice")},
|
||||||
|
{"BusinessAssociationAction", N_("_Update Association for Invoice")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("_Open Association for Invoice")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("_Remove Association from Invoice")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -304,6 +330,9 @@ static action_toolbar_labels bill_action_labels[] =
|
|||||||
{"EditUnpostInvoiceAction", N_("_Unpost Bill")},
|
{"EditUnpostInvoiceAction", N_("_Unpost Bill")},
|
||||||
{"BusinessNewInvoiceAction", N_("New _Bill")},
|
{"BusinessNewInvoiceAction", N_("New _Bill")},
|
||||||
{"ToolsProcessPaymentAction", N_("_Pay Bill")},
|
{"ToolsProcessPaymentAction", N_("_Pay Bill")},
|
||||||
|
{"BusinessAssociationAction", N_("_Update Association for Bill")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("_Open Association for Bill")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("_Remove Association from Bill")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -323,6 +352,9 @@ static action_toolbar_labels voucher_action_labels[] =
|
|||||||
{"EditUnpostInvoiceAction", N_("_Unpost Voucher")},
|
{"EditUnpostInvoiceAction", N_("_Unpost Voucher")},
|
||||||
{"BusinessNewInvoiceAction", N_("New _Voucher")},
|
{"BusinessNewInvoiceAction", N_("New _Voucher")},
|
||||||
{"ToolsProcessPaymentAction", N_("_Pay Voucher")},
|
{"ToolsProcessPaymentAction", N_("_Pay Voucher")},
|
||||||
|
{"BusinessAssociationAction", N_("_Update Association for Voucher")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("_Open Association for Voucher")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("_Remove Association from Voucher")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -342,6 +374,9 @@ static action_toolbar_labels creditnote_action_labels[] =
|
|||||||
{"EditUnpostInvoiceAction", N_("_Unpost Credit Note")},
|
{"EditUnpostInvoiceAction", N_("_Unpost Credit Note")},
|
||||||
{"BusinessNewInvoiceAction", N_("New _Credit Note")},
|
{"BusinessNewInvoiceAction", N_("New _Credit Note")},
|
||||||
{"ToolsProcessPaymentAction", N_("_Pay Credit Note")},
|
{"ToolsProcessPaymentAction", N_("_Pay Credit Note")},
|
||||||
|
{"BusinessAssociationAction", N_("_Update Association for Credit Note")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("_Open Association for Credit Note")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("_Remove Association from Credit Note")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -356,6 +391,9 @@ static action_toolbar_labels invoice_action_tooltips[] = {
|
|||||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the invoice")},
|
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the invoice")},
|
||||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this invoice") },
|
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this invoice") },
|
||||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this invoice") },
|
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this invoice") },
|
||||||
|
{"BusinessAssociationAction", N_("Update Association for current invoice")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("Open Association for current invoice")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("Remove Association from invoice")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -375,6 +413,9 @@ static action_toolbar_labels bill_action_tooltips[] = {
|
|||||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the bill")},
|
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the bill")},
|
||||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this bill") },
|
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this bill") },
|
||||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this bill") },
|
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this bill") },
|
||||||
|
{"BusinessAssociationAction", N_("Update Association for current bill")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("Open Association for current bill")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("Remove Association from bill")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -394,6 +435,9 @@ static action_toolbar_labels voucher_action_tooltips[] = {
|
|||||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the voucher")},
|
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the voucher")},
|
||||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this voucher") },
|
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this voucher") },
|
||||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this voucher") },
|
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this voucher") },
|
||||||
|
{"BusinessAssociationAction", N_("Update Association for current voucher")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("Open Association for current voucher")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("Remove Association from voucher")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -413,6 +457,9 @@ static action_toolbar_labels creditnote_action_tooltips[] = {
|
|||||||
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the credit note")},
|
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the credit note")},
|
||||||
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this credit note") },
|
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this credit note") },
|
||||||
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this credit note") },
|
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this credit note") },
|
||||||
|
{"BusinessAssociationAction", N_("Update Association for credit note")},
|
||||||
|
{"BusinessAssociationOpenAction", N_("Open Association for credit note")},
|
||||||
|
{"BusinessAssociationRemoveAction", N_("Remove Association from credit note")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -550,6 +597,17 @@ gnc_plugin_page_invoice_finalize (GObject *object)
|
|||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_assoc_actions (GncPluginPage *plugin_page, gboolean has_uri)
|
||||||
|
{
|
||||||
|
GtkAction *uri_action;
|
||||||
|
|
||||||
|
uri_action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(plugin_page), "BusinessAssociationOpenAction");
|
||||||
|
gtk_action_set_sensitive (uri_action, has_uri);
|
||||||
|
uri_action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(plugin_page), "BusinessAssociationRemoveAction");
|
||||||
|
gtk_action_set_sensitive (uri_action, has_uri);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_invoice_action_update (GtkActionGroup *action_group,
|
gnc_plugin_page_invoice_action_update (GtkActionGroup *action_group,
|
||||||
action_toolbar_labels *action_list,
|
action_toolbar_labels *action_list,
|
||||||
@ -590,11 +648,13 @@ gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, g
|
|||||||
GtkActionGroup *action_group;
|
GtkActionGroup *action_group;
|
||||||
GncPluginPageInvoicePrivate *priv;
|
GncPluginPageInvoicePrivate *priv;
|
||||||
GncInvoiceType invoice_type;
|
GncInvoiceType invoice_type;
|
||||||
|
GncInvoice *invoice;
|
||||||
gint i, j;
|
gint i, j;
|
||||||
action_toolbar_labels *label_list;
|
action_toolbar_labels *label_list;
|
||||||
action_toolbar_labels *tooltip_list;
|
action_toolbar_labels *tooltip_list;
|
||||||
action_toolbar_labels *label_layout_list;
|
action_toolbar_labels *label_layout_list;
|
||||||
action_toolbar_labels *tooltip_layout_list;
|
action_toolbar_labels *tooltip_layout_list;
|
||||||
|
gboolean has_uri = FALSE;
|
||||||
|
|
||||||
gboolean is_readonly = qof_book_is_readonly(gnc_get_current_book());
|
gboolean is_readonly = qof_book_is_readonly(gnc_get_current_book());
|
||||||
|
|
||||||
@ -678,6 +738,13 @@ gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, g
|
|||||||
gnc_plugin_page_invoice_action_update (action_group, label_layout_list, (void*)gtk_action_set_label);
|
gnc_plugin_page_invoice_action_update (action_group, label_layout_list, (void*)gtk_action_set_label);
|
||||||
/* update the layout action tooltips */
|
/* update the layout action tooltips */
|
||||||
gnc_plugin_page_invoice_action_update (action_group, tooltip_layout_list, (void*)gtk_action_set_tooltip);
|
gnc_plugin_page_invoice_action_update (action_group, tooltip_layout_list, (void*)gtk_action_set_tooltip);
|
||||||
|
|
||||||
|
// update association buttons
|
||||||
|
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||||
|
if (gncInvoiceGetAssociation (invoice))
|
||||||
|
has_uri = TRUE;
|
||||||
|
|
||||||
|
update_assoc_actions (page, has_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1269,6 +1336,107 @@ gnc_plugin_page_invoice_cmd_reset_layout (GtkAction *action,
|
|||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_plugin_page_invoice_cmd_associate (GtkAction *action,
|
||||||
|
GncPluginPageInvoice *plugin_page)
|
||||||
|
{
|
||||||
|
GncPluginPageInvoicePrivate *priv;
|
||||||
|
GtkWindow *parent;
|
||||||
|
GtkAction *uri_action;
|
||||||
|
GncInvoice *invoice;
|
||||||
|
const gchar *uri;
|
||||||
|
gchar *ret_uri;
|
||||||
|
gboolean has_uri = FALSE;
|
||||||
|
|
||||||
|
g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
|
||||||
|
ENTER("(action %p, plugin_page %p)", action, plugin_page);
|
||||||
|
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
|
||||||
|
parent = GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||||
|
|
||||||
|
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||||
|
uri = gncInvoiceGetAssociation (invoice);
|
||||||
|
|
||||||
|
ret_uri = gnc_assoc_get_uri_dialog (parent, _("Change a Business Association"), uri);
|
||||||
|
|
||||||
|
if (ret_uri && g_strcmp0 (uri, ret_uri) != 0)
|
||||||
|
{
|
||||||
|
GtkWidget *assoc_link_button = gnc_invoice_window_get_assoc_link_button (priv->iw);
|
||||||
|
|
||||||
|
if (assoc_link_button)
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (ret_uri, "") == 0)
|
||||||
|
gtk_widget_hide (GTK_WIDGET(assoc_link_button));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gchar *display_uri = gnc_assoc_get_unescaped_just_uri (ret_uri);
|
||||||
|
gtk_link_button_set_uri (GTK_LINK_BUTTON(assoc_link_button), display_uri);
|
||||||
|
gtk_widget_show (GTK_WIDGET(assoc_link_button));
|
||||||
|
g_free (display_uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gncInvoiceSetAssociation (invoice, ret_uri);
|
||||||
|
has_uri = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the menu actions
|
||||||
|
update_assoc_actions (GNC_PLUGIN_PAGE(plugin_page), has_uri);
|
||||||
|
|
||||||
|
g_free (ret_uri);
|
||||||
|
LEAVE(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_plugin_page_invoice_cmd_associate_remove (GtkAction *action,
|
||||||
|
GncPluginPageInvoice *plugin_page)
|
||||||
|
{
|
||||||
|
GncPluginPageInvoicePrivate *priv;
|
||||||
|
GtkWindow *parent;
|
||||||
|
GtkAction *uri_action;
|
||||||
|
GncInvoice *invoice;
|
||||||
|
GtkWidget *assoc_link_button;
|
||||||
|
|
||||||
|
g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
|
||||||
|
ENTER("(action %p, plugin_page %p)", action, plugin_page);
|
||||||
|
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
|
||||||
|
parent = GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||||
|
|
||||||
|
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||||
|
gncInvoiceSetAssociation (invoice, "");
|
||||||
|
|
||||||
|
assoc_link_button = gnc_invoice_window_get_assoc_link_button (priv->iw);
|
||||||
|
|
||||||
|
if (assoc_link_button)
|
||||||
|
gtk_widget_hide (GTK_WIDGET(assoc_link_button));
|
||||||
|
|
||||||
|
// update the menu actions
|
||||||
|
update_assoc_actions (GNC_PLUGIN_PAGE(plugin_page), FALSE);
|
||||||
|
|
||||||
|
LEAVE(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_plugin_page_invoice_cmd_associate_open (GtkAction *action,
|
||||||
|
GncPluginPageInvoice *plugin_page)
|
||||||
|
{
|
||||||
|
GncPluginPageInvoicePrivate *priv;
|
||||||
|
GtkWindow *parent;
|
||||||
|
GncInvoice *invoice;
|
||||||
|
const gchar *uri = NULL;
|
||||||
|
|
||||||
|
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
|
||||||
|
ENTER("(action %p, plugin_page %p)", action, plugin_page);
|
||||||
|
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
|
||||||
|
parent = GTK_WINDOW(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page)));
|
||||||
|
|
||||||
|
invoice = gnc_invoice_window_get_invoice (priv->iw);
|
||||||
|
uri = gncInvoiceGetAssociation (invoice);
|
||||||
|
|
||||||
|
if (uri)
|
||||||
|
gnc_assoc_open_uri (parent, uri);
|
||||||
|
|
||||||
|
LEAVE(" ");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_invoice_cmd_company_report (GtkAction *action,
|
gnc_plugin_page_invoice_cmd_company_report (GtkAction *action,
|
||||||
GncPluginPageInvoice *plugin_page)
|
GncPluginPageInvoice *plugin_page)
|
||||||
|
@ -381,22 +381,61 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label_xalign">0</property>
|
<property name="label_xalign">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="border_width">3</property>
|
|
||||||
<property name="hscrollbar_policy">never</property>
|
|
||||||
<property name="shadow_type">in</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTextView" id="page_notes_text">
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="wrap_mode">word</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="accepts_tab">False</property>
|
<property name="vexpand">True</property>
|
||||||
<signal name="focus-out-event" handler="gnc_invoice_window_leave_notes_cb" swapped="no"/>
|
<property name="border_width">3</property>
|
||||||
|
<property name="hscrollbar_policy">never</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView" id="page_notes_text">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="wrap_mode">word</property>
|
||||||
|
<property name="accepts_tab">False</property>
|
||||||
|
<signal name="focus-out-event" handler="gnc_invoice_window_leave_notes_cb" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="assoc_hbox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLinkButton" id="assoc_link_button">
|
||||||
|
<property name="label" translatable="yes">Open Association</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="relief">none</property>
|
||||||
|
<property name="uri">http://www.gnucash.org</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
<placeholder name="AdditionalMenusPlaceholder">
|
<placeholder name="AdditionalMenusPlaceholder">
|
||||||
<menu name="Business" action="BusinessAction">
|
<menu name="Business" action="BusinessAction">
|
||||||
<placeholder name="BusinessPlaceholderMiddle">
|
<placeholder name="BusinessPlaceholderMiddle">
|
||||||
|
<separator name="BusinessSep1"/>
|
||||||
|
<menuitem name="BusinessAssociation" action="BusinessAssociationAction"/>
|
||||||
|
<menuitem name="BusinessAssociationOpen" action="BusinessAssociationOpenAction"/>
|
||||||
|
<menuitem name="BusinessAssociationRemove" action="BusinessAssociationRemoveAction"/>
|
||||||
|
<separator name="BusinessSep2"/>
|
||||||
<menuitem name="ToolsProcessPayment" action="ToolsProcessPaymentAction"/>
|
<menuitem name="ToolsProcessPayment" action="ToolsProcessPaymentAction"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
</menu>
|
</menu>
|
||||||
|
Loading…
Reference in New Issue
Block a user