mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Move some report g-wrapping to report-gnome module.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6272 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
91d891a7f1
commit
960c44f6e5
@ -89,7 +89,7 @@
|
||||
'<gw:void>
|
||||
"gnc_ui_hierarchy_druid"
|
||||
'()
|
||||
"Open the hiearchy druid for importing an account hierarchy.")
|
||||
"Open the hierarchy druid for importing an account hierarchy.")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
@ -147,30 +147,6 @@
|
||||
'()
|
||||
"Destroy the UI.")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-window
|
||||
'<gw:void>
|
||||
"reportWindow"
|
||||
'((<gw:int> report-id))
|
||||
"Show report window")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-window-reload
|
||||
'<gw:void>
|
||||
"gnc_report_window_reload"
|
||||
'((<gnc:report-window*> wind))
|
||||
"Force reload of a report window")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-window-add-edited-report
|
||||
'<gw:void>
|
||||
"gnc_report_window_add_edited_report"
|
||||
'((<gnc:report-window*> wind) (<gw:scm> report))
|
||||
"Add a report to the list of reports with open editors")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-raise-editor
|
||||
@ -178,7 +154,7 @@
|
||||
"gnc_report_raise_editor"
|
||||
'((<gw:scm> report))
|
||||
"Raise the report's editor window")
|
||||
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:main-window-open-report
|
||||
@ -187,14 +163,6 @@
|
||||
'((<gw:int> report-id) (<gw:bool> top-level))
|
||||
"Show report window")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:print-report
|
||||
'<gw:void>
|
||||
"gnc_print_report"
|
||||
'((<gw:int> report-id))
|
||||
"Print a report with dialog support")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:style-sheet-dialog-open
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "window-help.h"
|
||||
#include "window-reconcile.h"
|
||||
#include "window-register.h"
|
||||
#include "window-report.h"
|
||||
#include "top-level.h"
|
||||
|
||||
|
||||
@ -1002,8 +1003,6 @@ gnc_register_create_summary_bar (RegWindow *regData)
|
||||
{
|
||||
gboolean has_shares;
|
||||
GtkWidget *summarybar;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
regData->cleared_label = NULL;
|
||||
regData->balance_label = NULL;
|
||||
@ -1967,7 +1966,6 @@ gnc_reg_get_name (RegWindow *regData, gboolean for_window)
|
||||
static void
|
||||
gnc_reg_set_window_name (RegWindow *regData)
|
||||
{
|
||||
SplitRegister *reg;
|
||||
gchar *windowname;
|
||||
|
||||
if (regData == NULL)
|
||||
@ -3223,17 +3221,16 @@ closeCB (GtkWidget *widget, gpointer data)
|
||||
gnc_ledger_display_close (regData->ledger);
|
||||
}
|
||||
|
||||
static void
|
||||
report_helper (RegWindow *regData, SCM func, Query *query)
|
||||
static int
|
||||
report_helper (RegWindow *regData, gboolean invoice, Query *query)
|
||||
{
|
||||
SplitRegister *reg = gnc_ledger_display_get_split_register (regData->ledger);
|
||||
char *str;
|
||||
SCM qtype;
|
||||
SCM args;
|
||||
SCM func;
|
||||
SCM arg;
|
||||
|
||||
g_return_if_fail (gh_procedure_p (func));
|
||||
|
||||
args = SCM_EOL;
|
||||
|
||||
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
|
||||
@ -3256,20 +3253,28 @@ report_helper (RegWindow *regData, SCM func, Query *query)
|
||||
args = gh_cons (arg, args);
|
||||
|
||||
qtype = gh_eval_str("<gnc:Query*>");
|
||||
g_return_if_fail (qtype != SCM_UNDEFINED);
|
||||
g_return_val_if_fail (qtype != SCM_UNDEFINED, -1);
|
||||
|
||||
if (!query)
|
||||
{
|
||||
query = gnc_ledger_display_get_query (regData->ledger);
|
||||
g_return_if_fail (query != NULL);
|
||||
g_return_val_if_fail (query != NULL, -1);
|
||||
}
|
||||
|
||||
arg = gw_wcp_assimilate_ptr (query, qtype);
|
||||
args = gh_cons (arg, args);
|
||||
if (arg == SCM_UNDEFINED)
|
||||
return;
|
||||
g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
|
||||
|
||||
gh_apply (func, args);
|
||||
arg = gh_bool2scm (invoice);
|
||||
args = gh_cons (arg, args);
|
||||
|
||||
func = gh_eval_str ("gnc:register-report-create");
|
||||
g_return_val_if_fail (gh_procedure_p (func), -1);
|
||||
|
||||
arg = gh_apply (func, args);
|
||||
g_return_val_if_fail (gh_exact_p (arg), -1);
|
||||
|
||||
return gh_scm2int (arg);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@ -3283,12 +3288,11 @@ static void
|
||||
reportCB (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
SCM func;
|
||||
int id;
|
||||
|
||||
func = gh_eval_str ("gnc:show-register-report");
|
||||
g_return_if_fail (gh_procedure_p (func));
|
||||
|
||||
report_helper (regData, func, NULL);
|
||||
id = report_helper (regData, FALSE, NULL);
|
||||
if (id >= 0)
|
||||
reportWindow (id);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@ -3302,12 +3306,11 @@ static void
|
||||
invoiceCB (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
SCM func;
|
||||
int id;
|
||||
|
||||
func = gh_eval_str ("gnc:show-invoice-report");
|
||||
g_return_if_fail (gh_procedure_p (func));
|
||||
|
||||
report_helper (regData, func, NULL);
|
||||
id = report_helper (regData, TRUE, NULL);
|
||||
if (id >= 0)
|
||||
reportWindow (id);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@ -3324,7 +3327,7 @@ invoiceTransCB (GtkWidget *widget, gpointer data)
|
||||
SplitRegister *reg;
|
||||
Split *split;
|
||||
Query *query;
|
||||
SCM func;
|
||||
int id;
|
||||
|
||||
reg = gnc_ledger_display_get_split_register (regData->ledger);
|
||||
|
||||
@ -3332,9 +3335,6 @@ invoiceTransCB (GtkWidget *widget, gpointer data)
|
||||
if (!split)
|
||||
return;
|
||||
|
||||
func = gh_eval_str ("gnc:show-invoice-report");
|
||||
g_return_if_fail (gh_procedure_p (func));
|
||||
|
||||
query = xaccMallocQuery ();
|
||||
|
||||
xaccQuerySetGroup (query, gnc_get_current_group ());
|
||||
@ -3342,7 +3342,9 @@ invoiceTransCB (GtkWidget *widget, gpointer data)
|
||||
xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split),
|
||||
GNC_ID_SPLIT, QUERY_AND);
|
||||
|
||||
report_helper (regData, func, query);
|
||||
id = report_helper (regData, TRUE, query);
|
||||
if (id >= 0)
|
||||
reportWindow (id);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@ -3356,12 +3358,11 @@ static void
|
||||
printReportCB (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
SCM func;
|
||||
int id;
|
||||
|
||||
func = gh_eval_str ("gnc:print-register-report");
|
||||
g_return_if_fail (gh_procedure_p (func));
|
||||
|
||||
report_helper (regData, func, NULL);
|
||||
id = report_helper (regData, FALSE, NULL);
|
||||
if (id >= 0)
|
||||
gnc_print_report (id);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
|
@ -51,4 +51,36 @@
|
||||
'<gnc:report-window*>
|
||||
"gnc_report_window*" "const gnc_report_window*")))
|
||||
#t)
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-window
|
||||
'<gw:void>
|
||||
"reportWindow"
|
||||
'((<gw:int> report-id))
|
||||
"Show report window")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-window-reload
|
||||
'<gw:void>
|
||||
"gnc_report_window_reload"
|
||||
'((<gnc:report-window*> wind))
|
||||
"Force reload of a report window")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:report-window-add-edited-report
|
||||
'<gw:void>
|
||||
"gnc_report_window_add_edited_report"
|
||||
'((<gnc:report-window*> wind) (<gw:scm> report))
|
||||
"Add a report to the list of reports with open editors")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:print-report
|
||||
'<gw:void>
|
||||
"gnc_print_report"
|
||||
'((<gw:int> report-id))
|
||||
"Print a report with dialog support")
|
||||
)
|
||||
|
@ -613,8 +613,8 @@
|
||||
'renderer reg-renderer
|
||||
'in-menu? #f)
|
||||
|
||||
(define (gnc:apply-register-report func invoice? query journal? double?
|
||||
title debit-string credit-string)
|
||||
(define (gnc:register-report-create-internal invoice? query journal? double?
|
||||
title debit-string credit-string)
|
||||
(let* ((options (gnc:make-report-options "Register"))
|
||||
(invoice-op (gnc:lookup-option options "Invoice" "Make an invoice"))
|
||||
(query-op (gnc:lookup-option options "__reg" "query"))
|
||||
@ -637,6 +637,6 @@
|
||||
(gnc:option-set-value title-op title)
|
||||
(gnc:option-set-value debit-op debit-string)
|
||||
(gnc:option-set-value credit-op credit-string)
|
||||
(func (gnc:make-report "Register" options))))
|
||||
(gnc:make-report "Register" options)))
|
||||
|
||||
(export gnc:apply-register-report)
|
||||
(export gnc:register-report-create-internal)
|
||||
|
@ -6,9 +6,8 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-module (gnucash report standard-reports))
|
||||
(export gnc:show-register-report)
|
||||
(export gnc:print-register-report)
|
||||
(export gnc:show-invoice-report)
|
||||
|
||||
(export gnc:register-report-create)
|
||||
|
||||
(use-modules (gnucash main) (g-wrapped gw-gnc)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (gnucash report account-piecharts))
|
||||
@ -25,14 +24,4 @@
|
||||
(use-modules (gnucash report register))
|
||||
(use-modules (gnucash report transaction))
|
||||
|
||||
(define (gnc:show-register-report . rest)
|
||||
(apply gnc:apply-register-report
|
||||
(cons gnc:report-window (cons #f rest))))
|
||||
|
||||
(define (gnc:print-register-report . rest)
|
||||
(apply gnc:apply-register-report
|
||||
(cons gnc:print-report (cons #f rest))))
|
||||
|
||||
(define (gnc:show-invoice-report . rest)
|
||||
(apply gnc:apply-register-report
|
||||
(cons gnc:report-window (cons #t rest))))
|
||||
(define gnc:register-report-create gnc:register-report-create-internal)
|
||||
|
Loading…
Reference in New Issue
Block a user