summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-02-29 18:17:22 +0100
committerBastien Nocera <hadess@hadess.net>2016-02-29 18:18:40 +0100
commit34b6876587506c57aba0c6ad98fb7f5e14229e6b (patch)
tree9ea6216b5714dda61decf104feaddb41eebc0b10
parentf1d2c8458579926f1a5684d3c73116769353f8db (diff)
downloadnautilus-sendto-34b6876587506c57aba0c6ad98fb7f5e14229e6b.tar.gz
main: Fix handling of files in Recent or in the Trash
Look up the target URI for files that fail to return a local file path for g_file_get_path() calls. https://bugzilla.gnome.org/show_bug.cgi?id=758988
-rw-r--r--src/nautilus-sendto.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/nautilus-sendto.c b/src/nautilus-sendto.c
index 8d618b9..c7963e2 100644
--- a/src/nautilus-sendto.c
+++ b/src/nautilus-sendto.c
@@ -434,6 +434,34 @@ escape_ampersands_and_commas (const char *url)
return str;
}
+static char *
+get_target_filename (GFile *file)
+{
+ GFileInfo *info;
+ const char *target;
+ GFile *new_file;
+ char *ret;
+
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ if (info == NULL)
+ return NULL;
+
+ target = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
+ if (target == NULL) {
+ g_object_unref (info);
+ return NULL;
+ }
+
+ new_file = g_file_new_for_uri (target);
+ g_object_unref (info);
+
+ ret = g_file_get_path (new_file);
+ g_object_unref (new_file);
+
+ return ret;
+}
+
+
static void
nautilus_sendto_init (NautilusSendto *nst)
{
@@ -450,8 +478,11 @@ nautilus_sendto_init (NautilusSendto *nst)
file = g_file_new_for_commandline_arg (filenames[i]);
filename = g_file_get_path (file);
if (filename == NULL) {
- g_object_unref (file);
- continue;
+ filename = get_target_filename (file);
+ if (filename == NULL) {
+ g_object_unref (file);
+ continue;
+ }
}
/* Get the mime-type, and whether the file is readable */