]> git.0d.be Git - empathy.git/commitdiff
Bind the volume button to the volume of the output
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Thu, 17 Nov 2011 19:45:39 +0000 (19:45 +0000)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 18 Nov 2011 17:49:56 +0000 (17:49 +0000)
src/empathy-call-window.c

index 22eadb772567f7ddfbe24a208669b7f403b258be..dc587e2d7c046dcbdea10981e9aada90178b3163 100644 (file)
@@ -167,6 +167,7 @@ struct _EmpathyCallWindowPriv
   GtkWidget *audio_call_button;
   GtkWidget *video_call_button;
   GtkWidget *mic_button;
+  GtkWidget *volume_button;
   GtkWidget *camera_button;
   GtkWidget *dialpad_button;
   GtkWidget *toolbar;
@@ -318,10 +319,6 @@ static void empathy_call_window_status_message (EmpathyCallWindow *window,
 static gboolean empathy_call_window_bus_message (GstBus *bus,
   GstMessage *message, gpointer user_data);
 
-static void
-empathy_call_window_volume_changed_cb (GtkScaleButton *button,
-  gdouble value, EmpathyCallWindow *window);
-
 static void
 empathy_call_window_show_hangup_button (EmpathyCallWindow *self,
     gboolean show)
@@ -1645,6 +1642,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "audiocall", &priv->audio_call_button,
     "videocall", &priv->video_call_button,
     "microphone", &priv->mic_button,
+    "volume", &priv->volume_button,
     "camera", &priv->camera_button,
     "hangup", &priv->hangup_button,
     "dialpad", &priv->dialpad_button,
@@ -1673,7 +1671,6 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "hangup", "clicked", empathy_call_window_hangup_cb,
     "audiocall", "clicked", empathy_call_window_audio_call_cb,
     "videocall", "clicked", empathy_call_window_video_call_cb,
-    "volume", "value-changed", empathy_call_window_volume_changed_cb,
     "camera", "toggled", empathy_call_window_camera_toggled_cb,
     "dialpad", "toggled", empathy_call_window_dialpad_cb,
     "menufullscreen", "activate", empathy_call_window_fullscreen_cb,
@@ -2873,6 +2870,11 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self,
       priv->audio_output = empathy_audio_sink_new ();
       g_object_ref_sink (priv->audio_output);
 
+      /* volume button to output volume linking */
+      g_object_bind_property (priv->audio_output, "volume",
+        priv->volume_button, "value",
+        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
       g_object_bind_property_full (content, "requested-output-volume",
         priv->audio_output, "volume",
         G_BINDING_DEFAULT,
@@ -4130,19 +4132,6 @@ empathy_call_window_status_message (EmpathyCallWindow *self,
   gtk_label_set_label (GTK_LABEL (self->priv->status_label), message);
 }
 
-static void
-empathy_call_window_volume_changed_cb (GtkScaleButton *button,
-  gdouble value, EmpathyCallWindow *window)
-{
-  EmpathyCallWindowPriv *priv = GET_PRIV (window);
-
-  if (priv->audio_output == NULL)
-    return;
-
-  empathy_audio_sink_set_volume (EMPATHY_GST_AUDIO_SINK (priv->audio_output),
-    value);
-}
-
 GtkUIManager *
 empathy_call_window_get_ui_manager (EmpathyCallWindow *window)
 {