Save to URI [Was: Re: gda-dev does not compile]
Mark Johnson
mrj001 at shaw.ca
Sat Dec 23 22:00:50 EST 2006
Phil Longstaff wrote:
>>First, I thought I had found something when I found the function
>>gtk_file_chooser_set_local_only, but the wretched dialog insists on
>>trying to display the directory of the entered URI when one clicks
>>Save. Naturally, such a directory does not exist. Entering
>>gda://AnActualConection results in an error.
>>
>>
>
>I found that function too and thought it would fix things, but it
>didn't.
>
>I didn't see an error. What I saw was that the returned file looked
>like /path.../gda%3A%2F%2FAnActualConection. I have some code which
>looks for "%3A%2F%2F" and then searches around for the URI that was
>entered. This works, but now means I need to add the sync function to
>the backend to blow away the current contents of the database and save
>the new contents. I should have this ready to commit in a few days.
>This will at least allow saving to a GDA database.
>
>
>
What version of gtk+ do you have? Mine is 2.8.20. This might account
for the different behaviour, but does not really help as neither works
for us.
I have attached a patch against gda-dev (svn 15247), which changes the
FileChooser to a FileSelection. It can be applied in the gda-dev
directory. You will need to pass -p1 to patch.
The dialog accepted a URL like gda://MyDatabaseConnection. However, as
you noted, it does not yet save anything. This code should help you to
work on that part.
I combined elements of the code from 1.8.12, gda-dev (different OK
Buttons), and an example from the gnome documentation (used to reduce
the number of callback functions compared to 1.8.12).
Note that filters did not work in 1.8.12 with the FileSelection; they
still don't work with this code either.
There are 4 type values that can be passed in. I was unable to find a
way to get the function called with "Import" type. Note that
"File->Import->QSF Import" puts up a FileSelection Dialog, but does not
call the gnc_file_dialog function in gnc-file.c. This suggests some
redundant code is now present.
This patch may also be useful in allowing users to enter URLs of the
postgres://XXX sort. I was unable to find an open bug related to this
problem. Let me know if there is somewhere else I should submit this
patch for the postgres problem. (I only found 2 bugs for this; both
closed - 332251 & 329802.)
Mark
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FileSelection.patch
Url: http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20061223/9b71a499/attachment.pl
More information about the gnucash-devel
mailing list