summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald Bultje <rbultje@src.gnome.org>2005-08-10 17:51:57 +0000
committerRonald Bultje <rbultje@src.gnome.org>2005-08-10 17:51:57 +0000
commitc83de06e9ebd11361cf79eb786930acfd2719f89 (patch)
tree8ceac13dd144cd8f0c247ca8faaca8ab14280798
parent2b9876267593fc805c557090b34e92c80e0433d7 (diff)
downloadtotem-c83de06e9ebd11361cf79eb786930acfd2719f89.tar.gz
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* src/totem-uri.c: (totem_uri_get_subtitle_uri): Allow remove subtitles (#312808).
-rw-r--r--ChangeLog7
-rw-r--r--src/totem-uri.c28
2 files changed, 16 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cdf20015..f7c8a29f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-10 Michaƫl Arnauts <michael.arnauts@gmail.com>
+
+ Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * src/totem-uri.c: (totem_uri_get_subtitle_uri):
+ Allow remove subtitles (#312808).
+
2005-08-10 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* src/totem-mozilla-plugin.cpp:
diff --git a/src/totem-uri.c b/src/totem-uri.c
index 5189ac125..5bb0b57d0 100644
--- a/src/totem-uri.c
+++ b/src/totem-uri.c
@@ -150,12 +150,9 @@ static const char *subtitle_ext[] = {
char *
totem_uri_get_subtitle_uri (const char *uri)
{
- char *suffix, *subtitle, *full;
+ char *suffix, *subtitle;
guint len, i;
-
- if (g_str_has_prefix (uri, "file://") == FALSE) {
- return NULL;
- }
+ GnomeVFSURI *vfsuri;
if (strstr (uri, "#subtitle:") != NULL) {
return NULL;
@@ -166,27 +163,20 @@ totem_uri_get_subtitle_uri (const char *uri)
return NULL;
}
- full = NULL;
subtitle = g_strdup (uri);
suffix = subtitle + len - 4;
for (i = 0; i < G_N_ELEMENTS(subtitle_ext) ; i++) {
- char *fname;
-
memcpy (suffix + 1, subtitle_ext[i], 3);
- fname = g_filename_from_uri (subtitle, NULL, NULL);
- if (fname == NULL)
- continue;
-
- if (g_file_test (fname, G_FILE_TEST_IS_REGULAR) == FALSE) {
- g_free (fname);
- continue;
+ vfsuri = gnome_vfs_uri_new (subtitle);
+ if (vfsuri != NULL) {
+ if (gnome_vfs_uri_exists (vfsuri)) {
+ gnome_vfs_uri_unref (vfsuri);
+ return subtitle;
+ }
+ gnome_vfs_uri_unref (vfsuri);
}
-
- g_free (fname);
- return subtitle;
}
-
g_free (subtitle);
return NULL;
}