Is there a way to "Clear all contents/delete all transactions" for a fresh start?

John Ralls jralls at ceridwen.us
Fri Nov 4 15:20:03 EDT 2016


> On Nov 4, 2016, at 9:39 AM, Derek Atkins <warlord at mit.edu> wrote:
> 
> John Ralls <jralls at ceridwen.us> writes:
> 
>>> On Nov 4, 2016, at 7:29 AM, Derek Atkins <warlord at mit.edu> wrote:
>>> 
>>> John Ralls <jralls at ceridwen.us> writes:
>>> 
>>>> That would require that he start from the command line by specifying
>>>> the path to the executable, which doesn't engage Launch Services and
>>>> so doesn't send the NSApplicationOpenFile notification (the one that
>>>> GnuCash doesn't know how to interpret). The `open` command doesn't
>>>> pass command-line arguments, it is equivalent to double-clicking on
>>>> the file in Finder so it would pass NSApplicationOpenFile if you ran
>>>> `open foo.gnucash` on the command line.
>>> 
>>> So.... how hard would it be to get GnuCash to handle the
>>> NSApplicationOpenFile notification?  I'm curious what it would
>>> entail/require, as I have no idea.
>> 
>> ATM we initialize the OSX application object and start the CFRunLoop
>> in gnc_main_window_show_all_windows(). We'd need to split that so that
>> we initialize it in inner_main() and register a handler for the
>> g_signal "NSApplicationOpenFile". The hard part is dealing with the
>> race between opening the default file and handling the signal.
> 
> It's too bad that it's sent as a signal...  I don't know how to handle
> that race condition.  Is there some other signal that would signify that
> we're NOT going to receive one,?  Or can we "solve" the race by making an
> assumption that the signal would arrive within some (short) period of
> time?
> 
> I guess this is a bad assumption by Apple that apps default the opening
> empty.

Sort of, there's also applicationShouldOpenEmptyFile and applicationOpenEmptyFile, presumably sent if there is no file indicated by LaunchServices.

No, it's a mismatch between the way startup is managed in Cocoa and Gtk+. Unsurprisingly neither AppKit nor Gtk is designed with integration between the two in mind.

Regards,
John Ralls




More information about the gnucash-user mailing list