aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Tellier <jonathan.tellier@gmail.com>2009-08-07 03:01:09 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-08-07 19:27:10 +0800
commitb90d0d4a041ce3753b51a3cbf36142838d9e2876 (patch)
tree3d4dd0578561c082a1beec72332284a1a406cb31 /src
parentec6cebc3342d4b8777f690df0f687fc00d3d7122 (diff)
downloadgsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.tar
gsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.tar.gz
gsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.tar.bz2
gsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.tar.lz
gsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.tar.xz
gsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.tar.zst
gsoc2013-empathy-b90d0d4a041ce3753b51a3cbf36142838d9e2876.zip
Fixed a bug that caused the application to crash when input volume was
changed on a disconnected call.
Diffstat (limited to 'src')
-rw-r--r--src/empathy-call-window.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index f3219d483..2299549db 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -141,6 +141,7 @@ struct _EmpathyCallWindowPriv
gulong video_output_motion_handler_id;
gdouble volume;
+ GtkWidget *volume_scale;
GtkWidget *volume_progress_bar;
GtkAdjustment *audio_input_adj;
@@ -489,7 +490,10 @@ empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj,
EmpathyCallWindowPriv *priv = GET_PRIV (self);
gdouble volume;
- volume = gtk_adjustment_get_value (adj)/100.0;
+ if (priv->audio_input == NULL)
+ return;
+
+ volume = gtk_adjustment_get_value (adj)/100.0;
/* Don't store the volume because of muting */
if (volume > 0 || gtk_toggle_tool_button_get_active (
@@ -522,27 +526,27 @@ static GtkWidget *
empathy_call_window_create_audio_input (EmpathyCallWindow *self)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
- GtkWidget *hbox, *vbox, *scale, *label;
- GtkAdjustment *adj;
+ GtkWidget *hbox, *vbox, *label;
hbox = gtk_hbox_new (TRUE, 3);
vbox = gtk_vbox_new (FALSE, 3);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 3);
- scale = gtk_vscale_new_with_range (0, 150, 100);
- gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
+ priv->volume_scale = gtk_vscale_new_with_range (0, 150, 100);
+ gtk_range_set_inverted (GTK_RANGE (priv->volume_scale), TRUE);
label = gtk_label_new (_("Volume"));
- priv->audio_input_adj = adj = gtk_range_get_adjustment (GTK_RANGE (scale));
+ priv->audio_input_adj = gtk_range_get_adjustment (
+ GTK_RANGE (priv->volume_scale));
priv->volume = empathy_audio_src_get_volume (EMPATHY_GST_AUDIO_SRC
(priv->audio_input));
- gtk_adjustment_set_value (adj, priv->volume * 100);
+ gtk_adjustment_set_value (priv->audio_input_adj, priv->volume * 100);
- g_signal_connect (G_OBJECT (adj), "value-changed",
+ g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed",
G_CALLBACK (empathy_call_window_mic_volume_changed_cb), self);
- gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 3);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->volume_scale, TRUE, TRUE, 3);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 3);
priv->volume_progress_bar = gtk_progress_bar_new ();
@@ -1198,6 +1202,9 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self)
g_object_unref (priv->audio_input);
priv->audio_input = NULL;
+ g_signal_handlers_disconnect_by_func (priv->audio_input_adj,
+ empathy_call_window_mic_volume_changed_cb, self);
+
if (priv->audio_output != NULL)
g_object_unref (priv->audio_output);
priv->audio_output = NULL;
@@ -1272,6 +1279,9 @@ empathy_call_window_disconnected (EmpathyCallWindow *self)
FALSE);
gtk_action_set_sensitive (priv->show_preview, FALSE);
+ gtk_progress_bar_set_fraction (
+ GTK_PROGRESS_BAR (priv->volume_progress_bar), 0);
+
gtk_widget_hide (priv->video_output);
gtk_widget_show (priv->remote_user_avatar_widget);
@@ -1985,6 +1995,14 @@ empathy_call_window_restart_call (EmpathyCallWindow *window)
empathy_call_window_setup_remote_frame (bus, window);
empathy_call_window_setup_self_frame (bus, window);
+ g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed",
+ G_CALLBACK (empathy_call_window_mic_volume_changed_cb), window);
+
+ /* While the call was disconnected, the input volume might have changed.
+ * However, since the audio_input source was destroyed, its volume has not
+ * been updated during that time. That's why we manually update it here */
+ empathy_call_window_mic_volume_changed_cb (priv->audio_input_adj, window);
+
g_object_unref (bus);
gtk_widget_show_all (priv->content_hbox);