diff options
author | Bastien Nocera <hadess@hadess.net> | 2012-08-20 18:21:08 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2012-08-21 15:13:14 +0100 |
commit | 645482961c46296785b19ce4093dae59519347f9 (patch) | |
tree | 08db6252f9a9cb6fac7d4bf1e8116489ea361f50 | |
parent | 6e99611698215a91c44400446cd1cac8afc3928b (diff) | |
download | totem-645482961c46296785b19ce4093dae59519347f9.tar.gz |
backend: Get the target URI for trash and recent items
So that we know where they actually are.
-rw-r--r-- | src/backend/bacon-video-widget.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c index 8e19d1309..cca9bbd8b 100644 --- a/src/backend/bacon-video-widget.c +++ b/src/backend/bacon-video-widget.c @@ -3449,6 +3449,21 @@ done: return ret; } +static char * +get_target_uri (GFile *file) +{ + GFileInfo *info; + char *target; + + 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_strdup (g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI)); + g_object_unref (info); + + return target; +} + /** * bacon_video_widget_open: * @bvw: a #BaconVideoWidget @@ -3489,10 +3504,19 @@ bacon_video_widget_open (BaconVideoWidget * bvw, * or we're trying to read from an archive or ObexFTP */ if (g_file_has_uri_scheme (file, "archive") != FALSE || g_file_has_uri_scheme (file, "obex") != FALSE || - g_file_has_uri_scheme (file, "ftp") != FALSE) + g_file_has_uri_scheme (file, "ftp") != FALSE) { path = NULL; - else + } else if (g_file_has_uri_scheme (file, "trash") != FALSE || + g_file_has_uri_scheme (file, "recent") != FALSE) { + path = get_target_uri (file); + if (path == NULL) + path = g_file_get_path (file); + else + GST_DEBUG ("Found target location '%s' for original MRL '%s'", + GST_STR_NULL (path), mrl); + } else { path = g_file_get_path (file); + } if (path) { bvw->priv->mrl = g_filename_to_uri (path, NULL, NULL); g_free (path); |