[totem] main: Remove unused functions in totem-uri



commit 3d0d54fe79858c006990e6e42f16809c7d16c708
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Apr 21 21:43:55 2012 +0100

    main: Remove unused functions in totem-uri

 src/totem-uri.c |  167 -------------------------------------------------------
 src/totem-uri.h |    1 -
 2 files changed, 0 insertions(+), 168 deletions(-)
---
diff --git a/src/totem-uri.c b/src/totem-uri.c
index a95f9e8..6166da2 100644
--- a/src/totem-uri.c
+++ b/src/totem-uri.c
@@ -317,173 +317,6 @@ totem_uri_is_subtitle (const char *uri)
 	return FALSE;
 }
 
-static inline gboolean
-totem_uri_exists (const char *uri)
-{
-	GFile *file = g_file_new_for_uri (uri);
-	if (file != NULL) {
-		if (g_file_query_exists (file, NULL)) {
-			g_object_unref (file);
-			return TRUE;
-		}
-		g_object_unref (file);
-	}
-	return FALSE;
-}
-
-static char *
-totem_uri_get_subtitle_for_uri (const char *uri)
-{
-	char *subtitle;
-	guint len, i;
-	gint suffix;
-
-	g_return_val_if_fail (uri != NULL, NULL);
-
-	/* Find the filename suffix delimiter */
-	len = strlen (uri);
-	for (suffix = len - 1; suffix > 0; suffix--) {
-		if (uri[suffix] == G_DIR_SEPARATOR ||
-		    (uri[suffix] == '/')) {
-			/* This filename has no extension; we'll need to 
-			 * add one */
-			suffix = len;
-			break;
-		}
-		if (uri[suffix] == '.') {
-			/* Found our extension marker */
-			break;
-		}
-	}
-	if (suffix < 0)
-		return NULL;
-
-	/* Generate a subtitle string with room at the end to store the
-	 * 3 character extensions for which we want to search */
-	subtitle = g_malloc0 (suffix + 4 + 1);
-	g_return_val_if_fail (subtitle != NULL, NULL);
-	g_strlcpy (subtitle, uri, suffix + 4 + 1);
-	g_strlcpy (subtitle + suffix, ".???", 5);
-
-	/* Search for any files with one of our known subtitle extensions */
-	for (i = 0; i < G_N_ELEMENTS (subtitle_ext) ; i++) {
-		char *subtitle_ext_upper;
-		memcpy (subtitle + suffix + 1, subtitle_ext[i], 3);
-
-		if (totem_uri_exists (subtitle))
-			return subtitle;
-
-		/* Check with upper-cased extension */
-		subtitle_ext_upper = g_ascii_strup (subtitle_ext[i], -1);
-		memcpy (subtitle + suffix + 1, subtitle_ext_upper, 3);
-		g_free (subtitle_ext_upper);
-
-		if (totem_uri_exists (subtitle))
-			return subtitle;
-	}
-	g_free (subtitle);
-	return NULL;
-}
-
-static char *
-totem_uri_get_subtitle_in_subdir (GFile *file, const char *subdir)
-{
-	char *filename, *subtitle, *full_path_str;
-	GFile *parent, *full_path, *directory;
-
-	/* Get the sibling directory @subdir of the file @file */
-	parent = g_file_get_parent (file);
-	directory = g_file_get_child (parent, subdir);
-	g_object_unref (parent);
-
-	/* Get the file of the same name as @file in the @subdir directory */
-	filename = g_file_get_basename (file);
-	full_path = g_file_get_child (directory, filename);
-	g_object_unref (directory);
-	g_free (filename);
-
-	/* Get the subtitles from that URI */
-	full_path_str = g_file_get_uri (full_path);
-	g_object_unref (full_path);
-	subtitle = totem_uri_get_subtitle_for_uri (full_path_str);
-	g_free (full_path_str);
-
-	return subtitle;
-}
-
-static char *
-totem_uri_get_cached_subtitle_for_uri (const char *uri)
-{
-	char *filename, *basename, *fake_filename, *fake_uri, *ret;
-
-	filename = g_filename_from_uri (uri, NULL, NULL);
-	if (filename == NULL)
-		return NULL;
-
-	basename = g_path_get_basename (filename);
-	g_free (filename);
-	if (basename == NULL || strcmp (basename, ".") == 0) {
-		g_free (basename);
-		return NULL;
-	}
-
-	fake_filename = g_build_filename (g_get_user_cache_dir (),
-				"totem",
-				"subtitles",
-				basename,
-				NULL);
-	g_free (basename);
-	fake_uri = g_filename_to_uri (fake_filename, NULL, NULL);
-	g_free (fake_filename);
-
-	ret = totem_uri_get_subtitle_for_uri (fake_uri);
-	g_free (fake_uri);
-
-	return ret;
-}
-
-char *
-totem_uri_get_subtitle_uri (const char *uri)
-{
-	GFile *file;
-	char *subtitle;
-
-	if (g_str_has_prefix (uri, "http") != FALSE ||
-	    g_str_has_prefix (uri, "rtsp") != FALSE ||
-	    g_str_has_prefix (uri, "rtmp") != FALSE)
-		return NULL;
-
-	/* Has the user specified a subtitle file manually? */
-	if (strstr (uri, "#subtitle:") != NULL)
-		return NULL;
-
-	/* Does the file exist? */
-	file = g_file_new_for_uri (uri);
-	if (g_file_query_exists (file, NULL) != TRUE) {
-		g_object_unref (file);
-		return NULL;
-	}
-
-	/* Try in the cached subtitles directory */
-	subtitle = totem_uri_get_cached_subtitle_for_uri (uri);
-	if (subtitle != NULL) {
-		g_object_unref (file);
-		return subtitle;
-	}
-
-	/* Try in the current directory */
-	subtitle = totem_uri_get_subtitle_for_uri (uri);
-	if (subtitle != NULL) {
-		g_object_unref (file);
-		return subtitle;
-	}
-
-	subtitle = totem_uri_get_subtitle_in_subdir (file, "subtitles");
-	g_object_unref (file);
-
-	return subtitle;
-}
-
 char *
 totem_uri_escape_for_display (const char *uri)
 {
diff --git a/src/totem-uri.h b/src/totem-uri.h
index 57985a8..3581d62 100644
--- a/src/totem-uri.h
+++ b/src/totem-uri.h
@@ -41,7 +41,6 @@ gboolean	totem_is_block_device		(const char *uri);
 void		totem_setup_file_monitoring	(Totem *totem);
 void		totem_setup_file_filters	(void);
 void		totem_destroy_file_filters	(void);
-char *		totem_uri_get_subtitle_uri	(const char *uri);
 char *		totem_uri_escape_for_display	(const char *uri);
 GSList *	totem_add_files			(GtkWindow *parent,
 						 const char *path);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]