[totem] Remove audio-output-type GSettings machinery from BaconVideoWidget



commit 769c0713d17471c8453fb39836d348ae06843b3b
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Dec 15 22:16:33 2010 +0000

    Remove audio-output-type GSettings machinery from BaconVideoWidget
    
    It belongs in totem-preferences.c.

 data/totem.ui                             |    1 -
 src/backend/bacon-video-widget-gst-0.10.c |   24 ++++++------------------
 src/totem-preferences.c                   |   18 +++++-------------
 3 files changed, 11 insertions(+), 32 deletions(-)
---
diff --git a/data/totem.ui b/data/totem.ui
index 60965b2..61f13f9 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -2044,7 +2044,6 @@
 				  <property name="model">tpw_sound_output_liststore</property>
 				  <property name="add_tearoffs">False</property>
 				  <property name="focus_on_click">True</property>
-				  <signal name="changed" handler="audio_out_menu_changed"/>
 				  <child>
 				    <object class="GtkCellRendererText" id="tpw_sound_output_cell"/>
 				    <attributes>
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 07c0289..208a5b6 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -3503,8 +3503,7 @@ bacon_video_widget_get_audio_out_type (BaconVideoWidget *bvw)
  * @bvw: a #BaconVideoWidget
  * @type: the new audio output type
  *
- * Sets the audio output type (number of speaker channels) in the video widget,
- * and stores it in GSettings.
+ * Sets the audio output type (number of speaker channels) in the video widget.
  **/
 void
 bacon_video_widget_set_audio_out_type (BaconVideoWidget *bvw,
@@ -3517,12 +3516,15 @@ bacon_video_widget_set_audio_out_type (BaconVideoWidget *bvw,
     return;
   else if (type == BVW_AUDIO_SOUND_AC3PASSTHRU)
     return;
+  else if (bvw->priv->use_type == BVW_USE_TYPE_METADATA || bvw->priv->use_type == BVW_USE_TYPE_CAPTURE) {
+    /* don't set up a filter for the speaker setup, anything is fine */
+    bvw->priv->speakersetup = -1;
+    return;
+  }
 
   bvw->priv->speakersetup = type;
   g_object_notify (G_OBJECT (bvw), "audio-output-type");
 
-  g_settings_set_enum (bvw->priv->settings, "audio-output-type", type);
-
   set_audio_filter (bvw);
 }
 
@@ -7122,20 +7124,6 @@ bacon_video_widget_new (int width, int height,
                       G_CALLBACK (got_new_video_sink_bin_element), bvw);
   }
 
-  /* audio out, if any */
-  value = g_settings_get_enum (bvw->priv->settings, "audio-output-type");
-  if (value > 0 &&
-      (type != BVW_USE_TYPE_METADATA && type != BVW_USE_TYPE_CAPTURE)) {
-    bvw->priv->speakersetup = value;
-    bacon_video_widget_set_audio_out_type (bvw, bvw->priv->speakersetup);
-  } else if (type == BVW_USE_TYPE_METADATA || type == BVW_USE_TYPE_CAPTURE) {
-    bvw->priv->speakersetup = -1;
-    /* don't set up a filter for the speaker setup, anything is fine */
-  } else {
-    bvw->priv->speakersetup = -1;
-    bacon_video_widget_set_audio_out_type (bvw, BVW_AUDIO_SOUND_STEREO);
-  }
-
   /* tv/conn (not used yet) */
   value = g_settings_get_enum (bvw->priv->settings, "connection-speed");
   if (value > 0) {
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index d43fe2c..edd4215 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -49,7 +49,6 @@ G_MODULE_EXPORT void checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Tot
 G_MODULE_EXPORT void audio_screensaver_button_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void visual_menu_changed (GtkComboBox *combobox, Totem *totem);
 G_MODULE_EXPORT void tpw_color_reset_clicked_cb (GtkButton *button, Totem *totem);
-G_MODULE_EXPORT void audio_out_menu_changed (GtkComboBox *combobox, Totem *totem);
 G_MODULE_EXPORT void font_set_cb (GtkFontButton * fb, Totem * totem);
 G_MODULE_EXPORT void encoding_set_cb (GtkComboBox *cb, Totem *totem);
 
@@ -206,15 +205,6 @@ tpw_color_reset_clicked_cb (GtkButton *button, Totem *totem)
 }
 
 void
-audio_out_menu_changed (GtkComboBox *combobox, Totem *totem)
-{
-	BvwAudioOutType audio_out;
-
-	audio_out = gtk_combo_box_get_active (combobox);
-	bacon_video_widget_set_audio_out_type (totem->bvw, audio_out);
-}
-
-void
 font_set_cb (GtkFontButton * fb, Totem * totem)
 {
 	const gchar *font;
@@ -301,7 +291,6 @@ totem_setup_preferences (Totem *totem)
 	guint i, hidden;
 	char *visual, *font, *encoding;
 	GList *list, *l;
-	BvwAudioOutType audio_out;
 	GObject *item;
 
 	static struct {
@@ -470,8 +459,11 @@ totem_setup_preferences (Totem *totem)
 
 	/* Sound output type */
 	item = gtk_builder_get_object (totem->xml, "tpw_sound_output_combobox");
-	audio_out = bacon_video_widget_get_audio_out_type (totem->bvw);
-	gtk_combo_box_set_active (GTK_COMBO_BOX (item), audio_out);
+	g_settings_bind (totem->settings, "audio-output-type", bvw, "audio-output-type",
+	                 G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY);
+	g_settings_bind_with_mapping (totem->settings, "audio-output-type", item, "active", G_SETTINGS_BIND_DEFAULT,
+	                              (GSettingsBindGetMapping) int_enum_get_mapping, (GSettingsBindSetMapping) int_enum_set_mapping,
+	                              g_type_class_ref (BVW_TYPE_AUDIO_OUT_TYPE), (GDestroyNotify) g_type_class_unref);
 
 	/* Subtitle font selection */
 	item = gtk_builder_get_object (totem->xml, "font_sel_button");



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