totem r5019 - in branches/gnome-2-20: . src/backend



Author: hadess
Date: Sun Jan 13 10:22:28 2008
New Revision: 5019
URL: http://svn.gnome.org/viewvc/totem?rev=5019&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:
   branches/gnome-2-20/ChangeLog
   branches/gnome-2-20/src/backend/bacon-video-widget-xine.c

Modified: branches/gnome-2-20/src/backend/bacon-video-widget-xine.c
==============================================================================
--- branches/gnome-2-20/src/backend/bacon-video-widget-xine.c	(original)
+++ branches/gnome-2-20/src/backend/bacon-video-widget-xine.c	Sun Jan 13 10:22:28 2008
@@ -1465,12 +1465,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]