[totem] Fix "Radio group does not contain an action with value '-2'" warning



commit 8ebd5f533cf1d30c8a149cbc4a2a3223c9438c46
Author: Bastien Nocera <hadess hadess net>
Date:   Tue May 19 15:55:03 2009 +0100

    Fix "Radio group does not contain an action with value '-2'" warning
    
    2009-05-19  Bastien Nocera  <hadess hadess net>
    
    	* src/backend/bacon-video-widget-gst-0.10.c
    	(bacon_video_widget_get_languages),
    	(bacon_video_widget_get_language): Fix API, -2 was for
    	"no audio" track, which we don't really want to support,
    	avoids warnings when there's only one audio track.
    	Also avoid showing the redundant "Auto" and "AUDIO 0" tracks
    	when there's only one audio track
---
 ChangeLog                                 |   10 ++++++++++
 src/backend/bacon-video-widget-gst-0.10.c |   25 +++++++++++++++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 05d4859..a5d9508 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-19  Bastien Nocera  <hadess hadess net>
+
+	* src/backend/bacon-video-widget-gst-0.10.c
+	(bacon_video_widget_get_languages),
+	(bacon_video_widget_get_language): Fix API, -2 was for
+	"no audio" track, which we don't really want to support,
+	avoids warnings when there's only one audio track.
+	Also avoid showing the redundant "Auto" and "AUDIO 0" tracks
+	when there's only one audio track
+
 2009-05-16  Bastien Nocera  <hadess hadess net>
 
 	* src/totem-options.c (totem_options_register_remote_commands):
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index fa3847c..57854bf 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -2393,11 +2393,23 @@ bacon_video_widget_get_subtitles (BaconVideoWidget * bvw)
 GList *
 bacon_video_widget_get_languages (BaconVideoWidget * bvw)
 {
+  GList *list;
+
   g_return_val_if_fail (bvw != NULL, NULL);
   g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), NULL);
   g_return_val_if_fail (bvw->priv->play != NULL, NULL);
 
-  return get_lang_list_for_type (bvw, "AUDIO");
+  list = get_lang_list_for_type (bvw, "AUDIO");
+
+  /* When we have only one language, we don't need to show
+   * any languages, we default to the only track */
+  if (g_list_length (list) == 1) {
+    g_free (list->data);
+    g_list_free (list);
+    list = NULL;
+  }
+
+  return list;
 }
 
 /**
@@ -2406,7 +2418,7 @@ bacon_video_widget_get_languages (BaconVideoWidget * bvw)
  *
  * Returns the index of the current audio language.
  *
- * If the widget is not playing, or the default language is in use, %-2 will be returned.
+ * If the widget is not playing, or the default language is in use, %-1 will be returned.
  *
  * Return value: the audio language index
  **/
@@ -2415,15 +2427,12 @@ bacon_video_widget_get_language (BaconVideoWidget * bvw)
 {
   int language = -1;
 
-  g_return_val_if_fail (bvw != NULL, -2);
-  g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), -2);
-  g_return_val_if_fail (bvw->priv->play != NULL, -2);
+  g_return_val_if_fail (bvw != NULL, -1);
+  g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), -1);
+  g_return_val_if_fail (bvw->priv->play != NULL, -1);
 
   g_object_get (G_OBJECT (bvw->priv->play), "current-audio", &language, NULL);
 
-  if (language == -1)
-    language = -2;
-
   return language;
 }
 



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