totem r5337 - in trunk: . src src/backend



Author: hadess
Date: Sat Apr  5 10:45:39 2008
New Revision: 5337
URL: http://svn.gnome.org/viewvc/totem?rev=5337&view=rev

Log:
2008-04-05  Bastien Nocera  <hadess hadess net>

	* src/backend/bacon-video-widget-xine.c
	(bacon_video_widget_get_subtitled): If the subtitle
	file isn't local, try to get its local FUSE path via
	GVFS (Closes: #520910)
	* src/totem-uri.c (totem_add_subtitle): Allow loading remote
	subtitles for all the backends



Modified:
   trunk/ChangeLog
   trunk/src/backend/bacon-video-widget-xine.c
   trunk/src/totem-uri.c

Modified: trunk/src/backend/bacon-video-widget-xine.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-xine.c	(original)
+++ trunk/src/backend/bacon-video-widget-xine.c	Sat Apr  5 10:45:39 2008
@@ -40,6 +40,7 @@
 #include <X11/X.h>
 #include <X11/Xlib.h>
 /* gtk+/gnome */
+#include <gio/gio.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
@@ -2248,8 +2249,25 @@
 static char *
 bacon_video_widget_get_subtitled (const char *mrl, const char *subtitle_uri)
 {
-	g_return_val_if_fail (g_str_has_prefix (subtitle_uri, "file://"), NULL);
-	return g_strdup_printf ("%s#subtitle:%s", mrl, subtitle_uri + strlen ("file://"));
+	GFile *file;
+	char *local_path, *local_uri, *retval;
+
+	file = g_file_new_for_uri (subtitle_uri);
+	local_path = g_file_get_path (file);
+	g_object_unref (file);
+
+	if (local_path == NULL)
+		return NULL;
+
+	local_uri = g_filename_to_uri (local_path, NULL, NULL);
+	g_free (local_path);
+	if (local_uri == NULL)
+		return NULL;
+
+	retval = g_strdup_printf ("%s#subtitle:%s", mrl, local_uri + strlen ("file://"));
+	g_free (local_uri);
+
+	return retval;
 }
 
 static void

Modified: trunk/src/totem-uri.c
==============================================================================
--- trunk/src/totem-uri.c	(original)
+++ trunk/src/totem-uri.c	Sat Apr  5 10:45:39 2008
@@ -490,7 +490,7 @@
 					  GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
 					  NULL);
 	gtk_dialog_set_default_response (GTK_DIALOG (fs), GTK_RESPONSE_ACCEPT);
-	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), TRUE);
+	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), FALSE);
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fs), filter_all);
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fs), filter_subs);
 	gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (fs), filter_subs);
@@ -516,10 +516,7 @@
 	totem_add_default_dirs (GTK_FILE_CHOOSER (fs));
 
 	if (gtk_dialog_run (GTK_DIALOG (fs)) == GTK_RESPONSE_ACCEPT) {
-		char *filename;
-		filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fs));
-		subtitle = g_filename_to_uri (filename, NULL, NULL);
-		g_free(filename);		
+		subtitle = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (fs));
 	}
 
 	gtk_widget_destroy (fs);



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