pidgin.vv: 9d4b47ab: Move volume levels for media to the medi...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Apr 3 02:50:43 EDT 2009


-----------------------------------------------------------------
Revision: 9d4b47ab943b9c382e4bd0fa205f1619f56e353d
Ancestor: 1b3dfcb2ede766f818c99f09ca04b0ad433f48ff
Author: maiku at soc.pidgin.im
Date: 2009-04-03T02:25:30
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/9d4b47ab943b9c382e4bd0fa205f1619f56e353d

Modified files:
        pidgin/gtkmedia.c pidgin/gtkprefs.c

ChangeLog: 

Move volume levels for media to the media window.

-------------- next part --------------
============================================================
--- pidgin/gtkmedia.c	563cffc2a35bfeda0020ac40d040964aee5e2500
+++ pidgin/gtkmedia.c	4bfb995c65b975c21867ac6685dc53c01c4b0fae
@@ -583,6 +583,24 @@ static void
 }
 
 static void
+pidgin_media_input_volume_changed(GtkRange *range, PurpleMedia *media)
+{
+	double val = (double)gtk_range_get_value(GTK_RANGE(range));
+	purple_prefs_set_int("/purple/media/audio/volume/input", val);
+	val /= 10.0;
+	purple_media_set_input_volume(media, NULL, val);
+}
+
+static void
+pidgin_media_output_volume_changed(GtkRange *range, PurpleMedia *media)
+{
+	double val = (double)gtk_range_get_value(GTK_RANGE(range));
+	purple_prefs_set_int("/purple/media/audio/volume/output", val);
+	val /= 10.0;
+	purple_media_set_output_volume(media, NULL, NULL, val);
+}
+
+static void
 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid)
 {
 	PurpleMediaManager *manager = purple_media_get_manager(media);
@@ -695,6 +713,19 @@ pidgin_media_ready_cb(PurpleMedia *media
 	}
 
 	if (type & PURPLE_MEDIA_RECV_AUDIO) {
+		GtkWidget *volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0);
+		gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0);
+		gtk_range_set_value(GTK_RANGE(volume),
+				purple_prefs_get_int(
+				"/purple/media/audio/volume/output"));
+		gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE);
+		g_signal_connect (G_OBJECT(volume), "value-changed",
+				G_CALLBACK(pidgin_media_output_volume_changed),
+				media);
+		gtk_box_pack_end(GTK_BOX(recv_widget),
+				volume, FALSE, FALSE, 0);
+		gtk_widget_show(volume);
+
 		gtkmedia->priv->recv_progress = gtk_progress_bar_new();
 		gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 320, 10);
 		gtk_box_pack_end(GTK_BOX(recv_widget),
@@ -702,7 +733,22 @@ pidgin_media_ready_cb(PurpleMedia *media
 		gtk_widget_show(gtkmedia->priv->recv_progress);
 	}
 	if (type & PURPLE_MEDIA_SEND_AUDIO) {
-		GstElement *media_src = purple_media_get_src(media, sid);
+		GstElement *media_src;
+		GtkWidget *volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0);
+		gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0);
+		gtk_range_set_value(GTK_RANGE(volume),
+				purple_prefs_get_int(
+				"/purple/media/audio/volume/input"));
+				gtk_scale_set_draw_value(volume, FALSE);
+		gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE);
+		g_signal_connect (G_OBJECT(volume), "value-changed",
+				G_CALLBACK (pidgin_media_input_volume_changed),
+				media);
+		gtk_box_pack_end(GTK_BOX(send_widget),
+				volume, FALSE, FALSE, 0);
+		gtk_widget_show(volume);
+
+		media_src = purple_media_get_src(media, sid);
 		gtkmedia->priv->send_level = gst_bin_get_by_name(
 				GST_BIN(media_src), "sendlevel");
 
============================================================
--- pidgin/gtkprefs.c	142872e6d57e1bff2095556035342ac1757f5863
+++ pidgin/gtkprefs.c	4e374e4fe0364c46d63e069313a61604b8607cd1
@@ -2634,34 +2634,6 @@ media_plugin_changed_cb(const gchar *nam
 	gtk_widget_show_all(hbox);
 }
 
-static void
-prefs_media_input_volume_changed(GtkRange *range)
-{
-	double val = (double)gtk_range_get_value(GTK_RANGE(range));
-	GList *medias = purple_media_manager_get_media(purple_media_manager_get());
-	purple_prefs_set_int("/purple/media/audio/volume/input", val);
-
-	val /= 10.0;
-	for (; medias; medias = g_list_next(medias)) {
-		PurpleMedia *media = PURPLE_MEDIA(medias->data);
-		purple_media_set_input_volume(media, NULL, val);
-	}
-}
-
-static void
-prefs_media_output_volume_changed(GtkRange *range)
-{
-	double val = (double)gtk_range_get_value(GTK_RANGE(range));
-	GList *medias = purple_media_manager_get_media(purple_media_manager_get());
-	purple_prefs_set_int("/purple/media/audio/volume/output", val);
-
-	val /= 10.0;
-	for (; medias; medias = g_list_next(medias)) {
-		PurpleMedia *media = PURPLE_MEDIA(medias->data);
-		purple_media_set_output_volume(media, NULL, NULL, val);
-	}
-}
-
 static GtkWidget *
 media_page()
 {
@@ -2739,38 +2711,6 @@ media_page()
 	gtk_size_group_add_widget(sg, dd);
 	gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5);
 
-	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	/* Input Volume */
-	sw = gtk_hscale_new_with_range(0.0, 100.0, 5.0);
-	gtk_range_set_increments(GTK_RANGE(sw), 5.0, 25.0);
-	gtk_range_set_value(GTK_RANGE(sw),
-			purple_prefs_get_int("/purple/media/audio/volume/input"));
-	g_signal_connect (G_OBJECT (sw), "format-value",
-			  G_CALLBACK (prefs_sound_volume_format),
-			  NULL);
-	g_signal_connect (G_OBJECT (sw), "value-changed",
-			  G_CALLBACK (prefs_media_input_volume_changed),
-			  NULL);
-	pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Volume:"), sg, sw, TRUE, NULL);
-
-	vbox = pidgin_make_frame (ret, _("Audio Output"));
-	gtk_size_group_add_widget(sg2, vbox);
-
-	/* Output Volume */
-	sw = gtk_hscale_new_with_range(0.0, 100.0, 5.0);
-	gtk_range_set_increments(GTK_RANGE(sw), 5.0, 25.0);
-	gtk_range_set_value(GTK_RANGE(sw),
-			purple_prefs_get_int("/purple/media/audio/volume/output"));
-	g_signal_connect (G_OBJECT (sw), "format-value",
-			  G_CALLBACK (prefs_sound_volume_format),
-			  NULL);
-	g_signal_connect (G_OBJECT (sw), "value-changed",
-			  G_CALLBACK (prefs_media_output_volume_changed),
-			  NULL);
-	pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Volume:"), sg, sw, TRUE, NULL);
-
 	gtk_widget_show_all(ret);
 
 	return ret;


More information about the Commits mailing list