totem r5773 - in trunk: . src src/backend



Author: hadess
Date: Wed Oct 22 11:18:38 2008
New Revision: 5773
URL: http://svn.gnome.org/viewvc/totem?rev=5773&view=rev

Log:
2008-10-22  Bastien Nocera  <hadess hadess net>

	* src/backend/bacon-video-widget-gst-0.10.c
	(bacon_video_widget_get_video_property):
	* src/totem-preferences.c (totem_setup_preferences):
	Only display colour balance sliders that are available for
	the video adapter in use, hide the whole preference if
	nothing is available (Closes: #556009)



Modified:
   trunk/ChangeLog
   trunk/src/backend/bacon-video-widget-gst-0.10.c
   trunk/src/totem-preferences.c

Modified: trunk/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-gst-0.10.c	(original)
+++ trunk/src/backend/bacon-video-widget-gst-0.10.c	Wed Oct 22 11:18:38 2008
@@ -3717,6 +3717,8 @@
   g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 65535/2);
   
   g_mutex_lock (bvw->priv->lock);
+
+  ret = 0;
   
   if (bvw->priv->balance && GST_IS_COLOR_BALANCE (bvw->priv->balance))
     {
@@ -3740,11 +3742,14 @@
         GST_DEBUG ("channel %s: returning value %d", found_channel->label, ret);
         g_object_unref (found_channel);
         goto done;
+      } else {
+	ret = -1;
       }
     }
 
   /* value wasn't found, get from gconf */
-  ret = gconf_client_get_int (bvw->priv->gc, video_props_str[type], NULL);
+  if (ret == 0)
+    ret = gconf_client_get_int (bvw->priv->gc, video_props_str[type], NULL);
 
   GST_DEBUG ("nothing found for type %d, returning value %d from gconf key %s",
       type, ret, video_props_str[type]);

Modified: trunk/src/totem-preferences.c
==============================================================================
--- trunk/src/totem-preferences.c	(original)
+++ trunk/src/totem-preferences.c	Wed Oct 22 11:18:38 2008
@@ -509,13 +509,25 @@
 	GtkWidget *menu;
 	GtkAction *action;
 	gboolean show_visuals, auto_resize, is_local, deinterlace, lock_screensaver_on_audio;
-	int connection_speed, i;
+	int connection_speed;
+	guint i, hidden;
 	char *visual, *font, *encoding;
 	GList *list, *l;
 	BaconVideoWidgetAudioOutType audio_out;
 	GConfValue *value;
 	GObject *item;
 
+	static struct {
+		const char *name;
+		BaconVideoWidgetVideoProperty prop;
+		const char *label;
+	} props[4] = {
+		{ "tpw_contrast_scale", BVW_VIDEO_CONTRAST, "tpw_contrast_label" },
+		{ "tpw_saturation_scale", BVW_VIDEO_SATURATION, "tpw_saturation_label" },
+		{ "tpw_bright_scale", BVW_VIDEO_BRIGHTNESS, "tpw_brightness_label" },
+		{ "tpw_hue_scale", BVW_VIDEO_HUE, "tpw_hue_label" }
+	};
+
 	g_return_if_fail (totem->gc != NULL);
 
 	is_local = totem_display_is_local ();
@@ -633,8 +645,7 @@
 	item = gtk_builder_get_object (totem->xml, "tpw_visuals_type_combobox");
 
 	i = 0;
-	for (l = list; l != NULL; l = l->next)
-	{
+	for (l = list; l != NULL; l = l->next) {
 		const char *name = l->data;
 
 		gtk_combo_box_append_text (GTK_COMBO_BOX (item), name);
@@ -653,29 +664,28 @@
 	item = gtk_builder_get_object (totem->xml, "tpw_visuals_size_combobox");
 	gtk_combo_box_set_active (GTK_COMBO_BOX (item), i);
 
-	/* Brightness */
-	item = gtk_builder_get_object (totem->xml, "tpw_bright_scale");
-	i = bacon_video_widget_get_video_property (totem->bvw,
-			BVW_VIDEO_BRIGHTNESS);
-	gtk_range_set_value (GTK_RANGE (item), (gdouble) i);
-
-	/* Contrast */
-	item = gtk_builder_get_object (totem->xml, "tpw_contrast_scale");
-	i = bacon_video_widget_get_video_property (totem->bvw,
-			BVW_VIDEO_CONTRAST);
-	gtk_range_set_value (GTK_RANGE (item), (gdouble) i);
-
-	/* Saturation */
-	item = gtk_builder_get_object (totem->xml, "tpw_saturation_scale");
-	i = bacon_video_widget_get_video_property (totem->bvw,
-			BVW_VIDEO_SATURATION);
-	gtk_range_set_value (GTK_RANGE (item), (gdouble) i);
-
-	/* Hue */
-	item = gtk_builder_get_object (totem->xml, "tpw_hue_scale");
-	i = bacon_video_widget_get_video_property (totem->bvw,
-			BVW_VIDEO_HUE);
-	gtk_range_set_value (GTK_RANGE (item), (gdouble) i);
+	/* Brightness and all */
+	hidden = 0;
+	for (i = 0; i < G_N_ELEMENTS (props); i++) {
+		int value;
+		item = gtk_builder_get_object (totem->xml, props[i].name);
+		value = bacon_video_widget_get_video_property (totem->bvw,
+							       props[i].prop);
+		if (value >= 0)
+			gtk_range_set_value (GTK_RANGE (item), (gdouble) value);
+		else {
+			gtk_range_set_value (GTK_RANGE (item), (gdouble) 65535/2);
+			gtk_widget_hide (GTK_WIDGET (item));
+			item = gtk_builder_get_object (totem->xml, props[i].label);
+			gtk_widget_hide (GTK_WIDGET (item));
+			hidden++;
+		}
+	}
+
+	if (hidden == G_N_ELEMENTS (props)) {
+		item = gtk_builder_get_object (totem->xml, "tpw_bright_contr_vbox");
+		gtk_widget_hide (GTK_WIDGET (item));
+	}
 
 	/* Sound output type */
 	item = gtk_builder_get_object (totem->xml, "tpw_sound_output_combobox");



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