From 74d098cd8894f72321237e120267a5ec3f188b3f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 15 Jun 2012 16:59:27 +0200 Subject: Use audio-input-microphone-muted-symbolic when the mic is muted It's clearer that way. https://bugzilla.gnome.org/show_bug.cgi?id=678167 --- src/empathy-call-window.c | 39 +++++++++++++++++++++++++++++---------- src/empathy-call-window.ui | 3 +-- 2 files changed, 30 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 6286cab57..9cb96afc3 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -164,6 +164,7 @@ struct _EmpathyCallWindowPriv GtkWidget *audio_call_button; GtkWidget *video_call_button; GtkWidget *mic_button; + GtkWidget *microphone_icon; GtkWidget *volume_button; GtkWidget *camera_button; GtkWidget *dialpad_button; @@ -473,6 +474,17 @@ audio_input_mute_notify_cb (GObject *obj, GParamSpec *spec, if (muted && self->priv->transitions) clutter_state_set_state (self->priv->transitions, "fade-in"); + if (muted) + { + gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->microphone_icon), + EMPATHY_IMAGE_MIC_MUTED, GTK_ICON_SIZE_MENU); + } + else + { + gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->microphone_icon), + EMPATHY_IMAGE_MIC, GTK_ICON_SIZE_MENU); + } + empathy_call_window_update_timer (self); } @@ -487,12 +499,6 @@ create_audio_input (EmpathyCallWindow *self) g_signal_connect (priv->audio_input, "notify::mute", G_CALLBACK (audio_input_mute_notify_cb), self); - - g_object_bind_property (priv->mic_button, "active", - priv->audio_input, "mute", - G_BINDING_BIDIRECTIONAL | - G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE); - } static void @@ -1538,6 +1544,16 @@ empathy_call_window_start_ringing (EmpathyCallWindow *self, tp_add_dispatch_operation_context_accept (context); } +static void +mic_button_clicked (GtkWidget *button, + EmpathyCallWindow *self) +{ + /* Toggle the muted state. We rely on audio_input_mute_notify_cb to update + * the icon. */ + empathy_audio_src_set_mute (EMPATHY_GST_AUDIO_SRC (self->priv->audio_input), + !self->priv->muted); +} + static void empathy_call_window_init (EmpathyCallWindow *self) { @@ -1569,6 +1585,7 @@ empathy_call_window_init (EmpathyCallWindow *self) "audiocall", &priv->audio_call_button, "videocall", &priv->video_call_button, "microphone", &priv->mic_button, + "microphone_icon", &priv->microphone_icon, "volume", &priv->volume_button, "camera", &priv->camera_button, "hangup", &priv->hangup_button, @@ -1625,6 +1642,9 @@ empathy_call_window_init (EmpathyCallWindow *self) g_signal_connect (priv->camera_monitor, "removed", G_CALLBACK (empathy_call_window_camera_removed_cb), self); + g_signal_connect (priv->mic_button, "clicked", + G_CALLBACK (mic_button_clicked), self); + g_mutex_init (&priv->lock); gtk_container_add (GTK_CONTAINER (self), top_vbox); @@ -2557,8 +2577,8 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, gtk_widget_set_sensitive (priv->mic_button, FALSE); /* Be sure that the mic button is enabled */ - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (priv->mic_button), TRUE); + empathy_audio_src_set_mute ( + EMPATHY_GST_AUDIO_SRC (self->priv->audio_input), TRUE); if (priv->camera_state == CAMERA_STATE_ON) { @@ -2847,8 +2867,7 @@ empathy_call_window_update_timer (gpointer user_data) if (priv->call_state == HELD) status = _("On hold"); - else if (!gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON (priv->mic_button))) + else if (priv->muted) status = _("Mute"); else status = _("Duration"); diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index 7149a3e8b..a66a05825 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -286,9 +286,8 @@ - + True - True Toggle audio transmission -- cgit v1.2.3