]> git.0d.be Git - empathy.git/commitdiff
Use audio-input-microphone-muted-symbolic when the mic is muted
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 15 Jun 2012 14:59:27 +0000 (16:59 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 18 Jun 2012 08:28:35 +0000 (10:28 +0200)
It's clearer that way.

https://bugzilla.gnome.org/show_bug.cgi?id=678167

libempathy-gtk/empathy-images.h
src/empathy-call-window.c
src/empathy-call-window.ui

index 884c5714bdd9752a9e67750c9d63a2fc59a7ac42..8ee40f2a926b863a317a8ed5be15cfb53406a3b2 100644 (file)
@@ -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"
index 6286cab573e8daff61f70897ca3c7cfcb59b8ea8..9cb96afc38f738e253bf460f6c6d47496d72f9d8 100644 (file)
@@ -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");
index 7149a3e8b3bfd9947ed946abddbe8f8609b01307..a66a05825fa0954bbc3763f92b378bdfb47b11b4 100644 (file)
                       </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">