totem r5020 - in trunk: . src/backend



Author: hadess
Date: Sun Jan 13 10:23:03 2008
New Revision: 5020
URL: http://svn.gnome.org/viewvc/totem?rev=5020&view=rev

Log:
2008-01-13  Bastien Nocera  <hadess hadess net>

	* src/backend/bacon-video-widget-xine.c: (xine_event):
	Check the title passed from xine-lib for UTF-8 correctness
	(Closes: #497175)



Modified:
   trunk/ChangeLog
   trunk/src/backend/bacon-video-widget-xine.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	Sun Jan 13 10:23:03 2008
@@ -1477,12 +1477,27 @@
 		break;
 	case XINE_EVENT_UI_SET_TITLE:
 		ui_data = event->data;
+		data = NULL;
 
-		data = g_new0 (signal_data, 1);
-		data->signal = TITLE_CHANGE_ASYNC;
-		data->msg = g_strdup (ui_data->str);
-		g_async_queue_push (bvw->priv->queue, data);
-		g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
+		if (g_utf8_validate (ui_data->str, -1, NULL) == FALSE) {
+			char *utf8;
+
+			g_warning ("Metadata for updated title not in UTF-8 for mrl '%s'", type, bvw->com->mrl);
+			utf8 = g_locale_to_utf8 (ui_data->str, -1, NULL, NULL, NULL);
+			if (utf8 != NULL) {
+				data = g_new0 (signal_data, 1);
+				data->msg = utf8;
+			}
+		} else {
+			data = g_new0 (signal_data, 1);
+			data->msg = g_strdup (ui_data->str);
+		}
+
+		if (data != NULL) {
+			data->signal = TITLE_CHANGE_ASYNC;
+			g_async_queue_push (bvw->priv->queue, data);
+			g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
+		}
 		break;
 	case XINE_EVENT_PROGRESS:
 		prg = event->data;



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