Closed Bug 797349 Opened 12 years ago Closed 12 years ago

Save originating URI in GIO for downloaded files

Categories

(Toolkit :: Downloads API, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: jhorak, Assigned: jhorak)

References

(Depends on 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

From https://bugzilla.redhat.com/show_bug.cgi?id=862269 : It would be nice if firefox could save the original uri for downloaded files. This is pretty easy to do with GIO using gvfs metadata. I implemented this in webkit: https://bugs.webkit.org/show_bug.cgi?id=95188 Its a pretty trivial patch, so it should be easy to add to firefox too. We want to use this to e.g. show the original location in the download directory in nautilus.
Please have a look.
Attachment #667478 - Flags: review?(neil)
Comment on attachment 667478 [details] [diff] [review] Save uri for downloaded files patch v1 Sadly there isn't enough context to show this but you have added your code in a path used only when the "add to recent documents" preference is enabled. >+ (gpointer)source_uri.BeginReading(), Use .get() when you want a null-terminated string. (Use BeginReading() when you have a const nsACString& and don't need it to be null-terminated.)
Attachment #667478 - Flags: review?(neil) → review-
Posting fixed patch. Thanks for quick review.
Assignee: nobody → jhorak
Attachment #667478 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #667852 - Flags: review?(neil)
+ gchar* uri = g_filename_to_uri(NS_ConvertUTF16toUTF8(path).get(), + NULL, NULL); + GFile* gio_file = g_file_new_for_uri(uri); Why not use g_file_new_for_path() instead?
(In reply to Alexander Larsson from comment #4) > + gchar* uri = g_filename_to_uri(NS_ConvertUTF16toUTF8(path).get(), > + NULL, NULL); > + GFile* gio_file = g_file_new_for_uri(uri); > > Why not use g_file_new_for_path() instead? Okay, looks better, thanks.
Attachment #667852 - Attachment is obsolete: true
Attachment #667852 - Flags: review?(neil)
Attachment #667888 - Flags: review?(neil)
(In reply to jhorak from comment #0) > We want to use this to e.g. show the original location in the download > directory in nautilus. So, Nautilus doesn't do that yet? How can I verify that the patch works?
(In reply to neil@parkwaycc.co.uk from comment #6) > (In reply to jhorak from comment #0) > > We want to use this to e.g. show the original location in the download > > directory in nautilus. > > So, Nautilus doesn't do that yet? How can I verify that the patch works? From http://blogs.gnome.org/alexl/category/gio/ something like: gvfs-info -a "metadata::*" downloaded_file
Yeah, that should work.
Comment on attachment 667888 [details] [diff] [review] Save uri for downloaded files patch v3 $ gvfs-info -a "metadata::*" ~/Downloads/comm-central_fedora-debug_test-xpcshell-bm18-tests1-linux-build259.txt.gz attributes: metadata::download-uri: http://ftp.mozilla.org/pub/mozilla.org/thunderbird/tinderbox-builds/comm-central-linux-debug/1349387487/comm-central_fedora-debug_test-xpcshell-bm18-tests1-linux-build259.txt.gz metadata::nautilus-icon-position: metadata::screen: >+ // Storing source URI for later display in file manager by using GIO Nit: possible slight improvement to comment grammar: // Use GIO to store the source URI for later display in the file manager.
Attachment #667888 - Flags: review?(neil) → review+
Fixed grammar, review+ from previous comment. Thanks.
Attachment #667888 - Attachment is obsolete: true
Attachment #669050 - Flags: review+
Attachment #669050 - Flags: checkin?
Pushed to try server for testing: https://tbpl.mozilla.org/?tree=Try&rev=e57970061793 I'll push to inbound if all goes well.
Flags: in-testsuite-
Summary: Save originating uri for downloaded files → Save originating URI in GIO for downloaded files
Attachment #669050 - Flags: checkin? → checkin+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Depends on: 860213
Depends on: 1058177
Depends on: 1060067
See Also: → 1535950
See Also: → 1590061
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: