totem r5836 - in trunk: . bindings/python src src/plugins/properties



Author: hadess
Date: Mon Dec  8 11:43:54 2008
New Revision: 5836
URL: http://svn.gnome.org/viewvc/totem?rev=5836&view=rev

Log:
2008-12-08  Bastien Nocera  <hadess hadess net>

	* bindings/python/totem.defs:
	* src/plugins/properties/totem-movie-properties.c
	(totem_movie_properties_plugin_metadata_updated):
	* src/totem-object.c (totem_object_class_init),
	(totem_metadata_updated):
	* src/totem.c (totem_get_nice_name_for_stream),
	(on_channels_change_event), (on_got_metadata_event):
	* src/totem.h:
	* src/totemobject-marshal.list: Fix the metadata-updated
	signal to actually pass data, add track number to its
	arguments (Closes: #562788)



Modified:
   trunk/ChangeLog
   trunk/bindings/python/totem.defs
   trunk/src/plugins/properties/totem-movie-properties.c
   trunk/src/totem-object.c
   trunk/src/totem.c
   trunk/src/totem.h
   trunk/src/totemobject-marshal.list

Modified: trunk/bindings/python/totem.defs
==============================================================================
--- trunk/bindings/python/totem.defs	(original)
+++ trunk/bindings/python/totem.defs	Mon Dec  8 11:43:54 2008
@@ -190,6 +190,7 @@
     '("const-char*" "artist")
     '("const-char*" "title")
     '("const-char*" "album")
+    '("guint" "track_num")
   )
 )
 

Modified: trunk/src/plugins/properties/totem-movie-properties.c
==============================================================================
--- trunk/src/plugins/properties/totem-movie-properties.c	(original)
+++ trunk/src/plugins/properties/totem-movie-properties.c	Mon Dec  8 11:43:54 2008
@@ -126,6 +126,7 @@
 						const char *artist, 
 						const char *title, 
 						const char *album,
+						guint track_num,
 						TotemMoviePropertiesPlugin *plugin)
 {
 	if (artist == NULL && title == NULL && album == NULL) {

Modified: trunk/src/totem-object.c
==============================================================================
--- trunk/src/totem-object.c	(original)
+++ trunk/src/totem-object.c	Mon Dec  8 11:43:54 2008
@@ -130,8 +130,8 @@
 				G_SIGNAL_RUN_LAST,
 				G_STRUCT_OFFSET (TotemObjectClass, metadata_updated),
 				NULL, NULL,
-				totemobject_marshal_VOID__STRING_STRING_STRING,
-				G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+				totemobject_marshal_VOID__STRING_STRING_STRING_UINT,
+				G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT);
 }
 
 static void
@@ -441,14 +441,16 @@
 totem_metadata_updated (TotemObject *totem,
 			const char *artist,
 			const char *title,
-			const char *album)
+			const char *album,
+			guint track_num)
 {
 	g_signal_emit (G_OBJECT (totem),
 		       totem_table_signals[METADATA_UPDATED],
 		       0,
 		       artist,
 		       title,
-		       album);
+		       album,
+		       track_num);
 }
 
 GQuark

Modified: trunk/src/totem.c
==============================================================================
--- trunk/src/totem.c	(original)
+++ trunk/src/totem.c	Mon Dec  8 11:43:54 2008
@@ -953,38 +953,53 @@
 static char *
 totem_get_nice_name_for_stream (Totem *totem)
 {
-	char *title, *artist, *retval;
-	int tracknum;
+	GValue title_value = { 0, };
+	GValue album_value = { 0, };
+	GValue artist_value = { 0, };
 	GValue value = { 0, };
+	char *retval;
+	int tracknum;
 
-	bacon_video_widget_get_metadata (totem->bvw, BVW_INFO_TITLE, &value);
-	title = g_value_dup_string (&value);
-	g_value_unset (&value);
-
-	if (title == NULL)
-		return NULL;
-
-	bacon_video_widget_get_metadata (totem->bvw, BVW_INFO_ARTIST, &value);
-	artist = g_value_dup_string (&value);
-	g_value_unset (&value);
-
-	if (artist == NULL)
-		return title;
-
+	bacon_video_widget_get_metadata (totem->bvw, BVW_INFO_TITLE, &title_value);
+	bacon_video_widget_get_metadata (totem->bvw, BVW_INFO_ARTIST, &artist_value);
+	bacon_video_widget_get_metadata (totem->bvw, BVW_INFO_ALBUM, &album_value);
 	bacon_video_widget_get_metadata (totem->bvw,
 					 BVW_INFO_TRACK_NUMBER,
 					 &value);
+
 	tracknum = g_value_get_int (&value);
 	g_value_unset (&value);
 
+	totem_metadata_updated (totem,
+				g_value_get_string (&artist_value),
+				g_value_get_string (&title_value),
+				g_value_get_string (&album_value),
+				tracknum);
+
+	if (g_value_get_string (&title_value) == NULL) {
+		retval = NULL;
+		goto bail;
+	}
+	if (g_value_get_string (&artist_value) == NULL) {
+		retval = g_value_dup_string (&title_value);
+		goto bail;
+	}
+
 	if (tracknum != 0) {
 		retval = g_strdup_printf ("%02d. %s - %s",
-				tracknum, artist, title);
+					  tracknum,
+					  g_value_get_string (&artist_value),
+					  g_value_get_string (&title_value));
 	} else {
-		retval = g_strdup_printf ("%s - %s", artist, title);
+		retval = g_strdup_printf ("%s - %s",
+					  g_value_get_string (&artist_value),
+					  g_value_get_string (&title_value));
 	}
-	g_free (artist);
-	g_free (title);
+
+bail:
+	g_value_unset (&album_value);
+	g_value_unset (&artist_value);
+	g_value_unset (&title_value);
 
 	return retval;
 }
@@ -1706,8 +1721,6 @@
 	/* updated stream info (new song) */
 	name = totem_get_nice_name_for_stream (totem);
 
-	totem_metadata_updated (totem, NULL, NULL, NULL);
-
 	if (name != NULL) {
 		update_mrl_label (totem, name);
 		totem_playlist_set_title
@@ -1734,8 +1747,6 @@
 {
         char *name = NULL;
 	
-	totem_metadata_updated (totem, NULL, NULL, NULL);
-
 	name = totem_get_nice_name_for_stream (totem);
 
 	if (name != NULL) {

Modified: trunk/src/totem.h
==============================================================================
--- trunk/src/totem.h	(original)
+++ trunk/src/totem.h	Mon Dec  8 11:43:54 2008
@@ -105,7 +105,8 @@
 	void (*metadata_updated)		(Totem *totem,
 						 const char *artist,
 						 const char *title,
-						 const char *album);
+						 const char *album,
+						 guint track_num);
 } TotemObjectClass;
 
 GType	totem_object_get_type			(void);
@@ -117,7 +118,8 @@
 void	totem_metadata_updated			(TotemObject *totem,
 						 const char *artist,
 						 const char *title,
-						 const char *album);
+						 const char *album,
+						 guint track_num);
 
 void	totem_action_exit			(Totem *totem) G_GNUC_NORETURN;
 void	totem_action_play			(Totem *totem);

Modified: trunk/src/totemobject-marshal.list
==============================================================================
--- trunk/src/totemobject-marshal.list	(original)
+++ trunk/src/totemobject-marshal.list	Mon Dec  8 11:43:54 2008
@@ -1 +1 @@
-VOID:STRING,STRING,STRING
+VOID:STRING,STRING,STRING,UINT



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