QIF doc pages

Charles Day cedayiv at gmail.com
Tue Mar 25 00:15:45 EDT 2008


On Wed, Mar 12, 2008 at 11:07 PM, Charles Day <cedayiv at gmail.com> wrote:

> On Sat, Mar 8, 2008 at 4:54 PM, Charles Day <cedayiv at gmail.com> wrote:
>
> > On Thu, Feb 28, 2008 at 1:14 PM, Andreas Köhler <andi5.py at gmx.net>
> > wrote:
> >
> > > Hi Charles,
> > >
> > > Am Donnerstag, den 28.02.2008, 12:50 -0800 schrieb Charles Day:
> > > > On Thu, Feb 28, 2008 at 11:50 AM, Derek Atkins <warlord at mit.edu>
> > > wrote:
> > > >
> > > > > "Charles Day" <cedayiv at gmail.com> writes:
> > > > >
> > > > > > OK, that's sounds like what Ian is also saying, and that sounds
> > > good to
> > > > > me
> > > > > > too. So under which of the following conditions would a new
> > > account tab
> > > > > be
> > > > > > automatically created and displayed after the QIF import
> > > finishes?
> > > > > >   (a) the QIF import is launched though the "new user" dialog
> > > > > >   (b) no accounts exist prior to import (and no Accounts tab
> > > exists
> > > > > either)
> > > > > >   (c) any others?
> > > > >
> > > > > I think anytime that the importer completes, regardless of how
> > > it's
> > > > > called, iff there is no Account Tree Page.
> > > > >
> > > >
> > > > What's the easiest way to test for an existing Account tab?
> > > >
> > > > After that, creating the new accounts tab seems pretty easy:
> > > >   GncPluginPage *page;
> > > >
> > > >   page = gnc_plugin_page_account_tree_new();
> > > >   gnc_main_window_open_page(NULL, page);
> > > >
> > > > -Charles
> > >
> > > maybe something like
> > >
> > > gnc_find_first_gui_component(PLUGIN_PAGE_ACCT_TREE_CM_CLASS, [...])
> > > as can be seen in
> > > src/business/business-gnome/dialog-invoice.c:gnc_invoice_new_page()
> > >
> >
> > Andreas, I have tried the following code but I cannot get it to compile
> > because PLUGIN_PAGE_ACCT_TREE_CM_CLASS is only defined inside gnome/gnc-
> > plugin-page-account-tree.c. If it were defined in a .h instead, then
> > obviously I could just #include it. Should I move the definition to
> > gnome/gnc-plugin-page-account-tree.h or does this break some design
> > goal?  Or is there another way to determine whether an account tab is
> > already open?
> >
> >   GncPluginPage *page;
> >
> >   /* Open an account tab in the main window if one doesn't exist
> > already. */
> >   if (!gnc_find_first_gui_component(PLUGIN_PAGE_ACCT_TREE_CM_CLASS,
> > NULL, NULL))
> >   {
> >     page = gnc_plugin_page_account_tree_new();
> >     gnc_main_window_open_page(NULL, page);
> >   }
> >
> > Thanks,
> > Charles
> >
> >
> I took another stab at this, using a completely different approach
> (below). It seems to work perfectly, but since this is my first time using
> this particular method, I hope that one of you could point out anything that
> looks obviously wrong or seems inappropriate. If I don't hear anything back
> in the next week, I'll just go ahead and commit it.
>

Since no one responded and it seems to work like a charm, I went ahead and
committed this as r17047 with backport requested.

-Charles


>   GncPluginPage *page;
>   gboolean acct_tree_found = FALSE;
>
>   /* Open an account tab in the main window if one doesn't exist already.
> */
>   gnc_main_window_foreach_page(gnc_ui_qif_import_check_acct_tree,
>                                &acct_tree_found);
>   if (!acct_tree_found)
>   {
>     page = gnc_plugin_page_account_tree_new();
>     gnc_main_window_open_page(NULL, page);
>   }
>
> And that function I'm passing to gnc_main_window_foreach_page() is defined
> as:
>
> static void
> gnc_ui_qif_import_check_acct_tree(GncPluginPage *page, gpointer user_data)
> {
>   gboolean *found = user_data;
>
>   if (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(page) && found)
>     *found = TRUE;
> }
>
> Cheers,
> Charles
>
>
>
> >
> >
> > > Please note that there are other situations we lack an account tree as
> > > well, e.g.
> > >
> > > (1) open new window with account tree page (window > new window with
> > > page), then close that window... i am not sure whether that situation
> > > survives a restart though
> > > (2) cancel hierarchy druid or do not spawn it on "file > new" at all
> > >
> > > Maybe those could be handled equally well?
> > >
> > > Thanks,
> > > -- andi5
> > >
> > >
> >
>


More information about the gnucash-devel mailing list