diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-15 22:59:27 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-18 16:28:35 +0800 |
commit | 74d098cd8894f72321237e120267a5ec3f188b3f (patch) | |
tree | 515326d9ff97001b582df6da5b4e73bd3a2583f7 | |
parent | 22e50a5e325426d739ce11a63d1772b85285ecc8 (diff) | |
download | gsoc2013-empathy-74d098cd8894f72321237e120267a5ec3f188b3f.tar.gz gsoc2013-empathy-74d098cd8894f72321237e120267a5ec3f188b3f.tar.zst gsoc2013-empathy-74d098cd8894f72321237e120267a5ec3f188b3f.zip |
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
-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"> |