display book path in report

Derek Atkins derek at ihtfp.com
Fri Feb 17 16:36:12 EST 2017


There is a C API, gnc_get_current_session() defined in gnc-session.h which
you could wrap in engine.i to get gnc-get-current-session, which you could
then use to get call qof-session-get-url.

It would be a small change to engine.i to wrap the function.  Just copy
the existing wrappers for e.g. gnc_get_current_book().

-derek

On Fri, February 17, 2017 4:23 pm, Sébastien de Menten wrote:
> If only I knew how to do this ! I can't find the proper documentation ...
> help much appreciated !
>
> On Feb 17, 2017 22:14, "Derek Atkins" <derek at ihtfp.com> wrote:
>
>> Actually, qof-session-get-url is already wrapped in the engine module.
>> Also, there is already a (gnc-get-current-book).  So all you need to do
>> is
>> find (or add) an API to get the current session from the current book.
>>
>> -derek
>>
>> On Fri, February 17, 2017 4:01 pm, Sébastien de Menten wrote:
>> > I can access a function named qof-session-get-url which expects a
>> session.
>> > However, to get a session, I can only see a qof-session-new that
>> creates
>> a
>> > new session. There is a gnc_get_current_session function but I can't
>> find
>> > how to integrate it in the swig-engine.c file that is generated by
>> swig.
>> >
>> > On Fri, Feb 17, 2017 at 4:56 PM, Derek Atkins <warlord at mit.edu> wrote:
>> >
>> >> Hard to say. I don't know what other dependencies would need to be
>> >> brought
>> >> in.
>> >> You'd certainly need to rebuild GnuCash!
>> >>
>> >> -derek
>> >>
>> >> Sébastien de Menten <sdementen at gmail.com> writes:
>> >>
>> >> > Is it complex to add it ?
>> >> >
>> >> > On Feb 16, 2017 16:11, "Derek Atkins" <warlord at mit.edu> wrote:
>> >> >
>> >> >     OOPS.  You are correct.
>> >> >     There is no scheme binding for this API.
>> >> >     Sorry.
>> >> >
>> >> >     -derek
>> >> >
>> >> >     Sébastien de Menten <sdementen at gmail.com> writes:
>> >> >
>> >> >     > I went to look for the file you mentioned and I see it
>> sitting
>> >> in
>> >> the
>> >> >     python
>> >> >     > bindings folder so I am not sure it is used for scheme.
>> >> >     >
>> >> >     > On Feb 15, 2017 19:54, "Derek Atkins" <derek at ihtfp.com>
>> wrote:
>> >> >     >
>> >> >     >     Hi,
>> >> >     >
>> >> >     >     I see it included in gnucash_core.i, so I would guess the
>> >> >     gnucash-core
>> >> >     >     module.
>> >> >     >
>> >> >     >     -derek
>> >> >     >
>> >> >     >     On Wed, February 15, 2017 1:40 pm, Sébastien de Menten
>> >> wrote:
>> >> >     >     > Nice !
>> >> >     >     > Do you know in which scheme module are these functions
>> >> located ?
>> >> >     What
>> >> >     >     > extra
>> >> >     >     > (use-modules xxx) should I add at the beginning of my
>> >> report
>> >> >     >     > budget-balance-sheet.scm ?
>> >> >     >     >
>> >> >     >     > On Feb 15, 2017 16:52, "Derek Atkins" <warlord at mit.edu>
>> >> wrote:
>> >> >     >     >
>> >> >     >     >> Sébastien de Menten <sdementen at gmail.com> writes:
>> >> >     >     >>
>> >> >     >     >> > hello,
>> >> >     >     >> >
>> >> >     >     >> > Is it possible to have the path of the gnucash book
>> >> >     >     >> (c:\...\mybook.gnucash)
>> >> >     >     >> > displayed in the reports so that I can easily
>> identify
>> >> to
>> >> which
>> >> >     book
>> >> >     >     a
>> >> >     >     >> > report relates (e.g. once printed) ?
>> >> >     >     >>
>> >> >     >     >> You could use qof_session_get_file_path() and/or
>> >> >     qof_session_get_url()
>> >> >     >     >> to obtain that information from the current session.
>> >> C.f.
>> >> >     >     >> http://code.gnucash.org/docs/MAINT/group__Backend.html#
>> >> >     >     >> gaef36a80fef74a21750fe98ba24a2e19c
>> >> >     >     >>
>> >> >     >     >> > sebastien
>> >> >     >     >>
>> >> >     >     >> > Please remember to CC this list on all your replies.
>> >> >     >     >> > You can do this by using Reply-To-List or Reply-All.
>> >> >     >     >>
>> >> >     >     >> -derek
>> >> >     >     >>
>> >> >     >     >> --
>> >> >     >     >>        Derek Atkins, SB '93 MIT EE, SM '95 MIT Media
>> >> Laboratory
>> >> >     >     >>        Member, MIT Student Information Processing
>> Board
>> >> (SIPB)
>> >> >     >     >>        URL: http://web.mit.edu/warlord/    PP-ASEL-IA
>> >>  N1NWH
>> >> >     >     >>        warlord at MIT.EDU                        PGP key
>> >> available
>> >> >     >     >>
>> >> >     >     >
>> >> >     >
>> >> >     >     --
>> >> >     >            Derek Atkins                 617-623-3745
>> >> >     >            derek at ihtfp.com             www.ihtfp.com
>> >> >     >            Computer and Internet Security Consultant
>> >> >     >
>> >> >
>> >> >     --
>> >> >            Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
>> >> >            Member, MIT Student Information Processing Board  (SIPB)
>> >> >            URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
>> >> >            warlord at MIT.EDU                        PGP key available
>> >> >
>> >>
>> >> --
>> >>        Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
>> >>        Member, MIT Student Information Processing Board  (SIPB)
>> >>        URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
>> >>        warlord at MIT.EDU                        PGP key available
>> >>
>> >
>>
>>
>> --
>>        Derek Atkins                 617-623-3745
>>        derek at ihtfp.com             www.ihtfp.com
>>        Computer and Internet Security Consultant
>>
>>
>


-- 
       Derek Atkins                 617-623-3745
       derek at ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant



More information about the gnucash-devel mailing list