diff options
-rw-r--r-- | libempathy-gtk/empathy-images.h | 2 | ||||
-rw-r--r-- | src/empathy-call-window.c | 39 | ||||
-rw-r--r-- | src/empathy-call-window.ui | 3 |
3 files changed, 32 insertions, 12 deletions
diff --git a/libempathy-gtk/empathy-images.h b/libempathy-gtk/empathy-images.h index 884c5714b..8ee40f2a9 100644 --- a/libempathy-gtk/empathy-images.h +++ b/libempathy-gtk/empathy-images.h @@ -48,6 +48,8 @@ G_BEGIN_DECLS #define EMPATHY_IMAGE_AVATAR_DEFAULT "avatar-default-symbolic" /* FIXME: need a better icon! */ #define EMPATHY_IMAGE_EDIT_MESSAGE "format-text-direction-ltr" +#define EMPATHY_IMAGE_MIC "audio-input-microphone-symbolic" +#define EMPATHY_IMAGE_MIC_MUTED "audio-input-microphone-muted-symbolic" #define EMPATHY_IMAGE_CALL "call-start" #define EMPATHY_IMAGE_CALL_MISSED "call-stop" 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 @@ -1539,6 +1545,16 @@ empathy_call_window_start_ringing (EmpathyCallWindow *self, } 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) { EmpathyCallWindowPriv *priv; @@ -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 @@ </object> </child> <child> - <object class="GtkToggleButton" id="microphone"> + <object class="GtkButton" id="microphone"> <property name="visible">True</property> - <property name="active">True</property> <property name="tooltip_text" translatable="yes">Toggle audio transmission</property> <child> <object class="GtkImage" id="microphone_icon"> |