totem r5376 - in trunk: . src/backend



Author: hadess
Date: Tue Apr 29 16:22:06 2008
New Revision: 5376
URL: http://svn.gnome.org/viewvc/totem?rev=5376&view=rev

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

	* src/backend/bacon-video-widget-gst-0.10.c
	(bacon_video_widget_open_with_subtitle):
	Use GIO to get 1) a nice URI, 2) or a local fuse path
	if giosrc isn't available (Closes: #528762)



Modified:
   trunk/ChangeLog
   trunk/src/backend/bacon-video-widget-gst-0.10.c

Modified: trunk/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-gst-0.10.c	(original)
+++ trunk/src/backend/bacon-video-widget-gst-0.10.c	Tue Apr 29 16:22:06 2008
@@ -2628,6 +2628,7 @@
     const gchar * mrl, const gchar *subtitle_uri, GError ** error)
 {
   GstMessage *err_msg = NULL;
+  GFile *file;
   gboolean ret;
 
   g_return_val_if_fail (bvw != NULL, FALSE);
@@ -2652,23 +2653,19 @@
 
   /* this allows non-URI type of files in the thumbnailer and so on */
   g_free (bvw->com->mrl);
-  if (mrl[0] == '/') {
-    bvw->com->mrl = g_strdup_printf ("file://%s", mrl);
-  } else {
-    if (strchr (mrl, ':')) {
-      bvw->com->mrl = g_strdup (mrl);
-    } else {
-      gchar *cur_dir = g_get_current_dir ();
+  file = g_file_new_for_commandline_arg (mrl);
 
-      if (!cur_dir) {
-        g_set_error (error, BVW_ERROR, BVW_ERROR_GENERIC,
-                     _("Failed to retrieve working directory"));
-        return FALSE;
-      }
-      bvw->com->mrl = g_strdup_printf ("file://%s/%s", cur_dir, mrl);
-      g_free (cur_dir);
-    }
-  }
+  /* If giosrc isn't available, try to get the MRL's local path */
+  if (gst_default_registry_check_feature_version ("giosrc", 0, 10, 0) != FALSE)
+    bvw->com->mrl = g_file_get_uri (file);
+  else
+    bvw->com->mrl = g_file_get_path (file);
+
+  g_object_unref (file);
+
+  /* No path? Choke on your errors already! */
+  if (bvw->com->mrl == NULL)
+    bvw->com->mrl = g_strdup (mrl);
 
   if (g_str_has_prefix (mrl, "icy:") != FALSE) {
     /* Handle "icy://" URLs from QuickTime */



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