[referencer] Default folder for files

John Spray jcspray at icculus.org
Wed Oct 1 19:35:35 EDT 2008


On Thu, 2008-10-02 at 01:19 +0200, Miguel Pagano wrote:
> Hi all,
> 
> I'm starting to use Referencer and I was kindly surprised
> that I can throw in Referencer a link and Referencer will
> download the link for me and save it in "~/Downloaded Documents".
> I think it would be nice to have a property of each library
> to indicate where to download a file.

To quote my own code in DocumentView.C:
 610             /*
 611              * THIS IS ALL BOLLOCKS
 612              * Really we should just show the user a save dialog
and let him choose
 613              */
 614 
 615             Glib::ustring destinationdir;
 616             if (liburi) {
 617                 destinationdir =
 618                     liburi->get_scheme ()
 619                     + "://"
 620                     +   Glib::build_filename (
 621                         liburi->extract_dirname (),
 622                         _("Downloaded Documents"));

Apologies for the profanity, but it's accurately used :-)

> This can also be useful in other use case I have: I usually
> put the papers I read in some folder (v.g., "~/papers/cs").
> Then if I'd like to cite some which wasn't in the library,
> I add the paper to the library (by adding the file). And always
> Referencer launches the file chooser in ~, or worst in
> some folder like / or /usr/share/...

One of the features I'm halfway through implementing (shelved it in
favour of other more obscure projects a while back) is a "managed
directory" for a library where pdfs dropped in that directory are
automatically added -- this would also be where the downloaded documents
would drop.

> I've added manually an attribute "docs_home" that
> defines which is the folder where the files for this
> library are. Does this make sense for other people?

Yes, that's the right idea.  There is actually a <library_folder> tag in
the file format which isn't exposed anywhere because I'm a horrible
person and only got halfway through doing that piece of code.  I shipped
a release with the GUI bits for this hidden in order to get other bug
fixes out.

> Also, a more general question: how would be the best
> form of defining attributes for a library? From what I've
> seen, there is yet no attribute for the library. Is this because
> you think there shouldn't be any attribute associated with
> the library? Or is it just because you haven't  needed it yet?

I'm not sure in what sense you're using "attributes" -- currently there
are things like <manage_target> and the aforementioned <library_folder>
which map to the manage_target_ and library_folder_uri_ members of the
Library class in src/Library.h.  A more general mechanism would be
possible, but since special-case behaviour in the GUI is required for
anything like that I would question the utility of a generalised
mechanism -- I prefer to define XML tags rather than defining valid
values for a generic map.  But perhaps I'm not understanding you
correctly.

John




More information about the referencer mailing list