]> git.0d.be Git - empathy.git/commitdiff
move sound functions to EmpathySoundManager methods
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 30 Nov 2010 10:24:20 +0000 (11:24 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 30 Nov 2010 10:24:20 +0000 (11:24 +0100)
libempathy-gtk/empathy-sound-manager.c
libempathy-gtk/empathy-sound-manager.h
src/empathy-call-window.c
src/empathy-chat-window.c
src/empathy-event-manager.c
src/empathy-main-window.c

index 8d51f7391049431599f2b11bd85b25db288d7123..d0da9e54cc1725a983733e143150cdce76e365c1 100644 (file)
@@ -148,14 +148,16 @@ finally:
 }
 
 /**
 }
 
 /**
- * empathy_sound_stop:
+ * empathy_sound_manager_stop:
+ * @self: a #EmpathySoundManager
  * @sound_id: The #EmpathySound to stop playing.
  *
  * Stop playing a sound. If it has been stated in loop with
  * empathy_sound_start_playing(), it will also stop replaying.
  */
 void
  * @sound_id: The #EmpathySound to stop playing.
  *
  * Stop playing a sound. If it has been stated in loop with
  * empathy_sound_start_playing(), it will also stop replaying.
  */
 void
-empathy_sound_stop (EmpathySound sound_id)
+empathy_sound_manager_stop (EmpathySoundManager *self,
+    EmpathySound sound_id)
 {
   EmpathySoundEntry *entry;
 
 {
   EmpathySoundEntry *entry;
 
@@ -232,7 +234,8 @@ failed:
 }
 
 /**
 }
 
 /**
- * empathy_sound_play_full:
+ * empathy_sound_manager_play_full:
+ * @self: a #EmpathySoundManager
  * @widget: The #GtkWidget from which the sound is originating.
  * @sound_id: The #EmpathySound to play.
  * @callback: The #ca_finish_callback_t function that will be called when the
  * @widget: The #GtkWidget from which the sound is originating.
  * @sound_id: The #EmpathySound to play.
  * @callback: The #ca_finish_callback_t function that will be called when the
@@ -253,8 +256,11 @@ failed:
  *               otherwise.
  */
 gboolean
  *               otherwise.
  */
 gboolean
-empathy_sound_play_full (GtkWidget *widget, EmpathySound sound_id,
-  ca_finish_callback_t callback, gpointer user_data)
+empathy_sound_manager_play_full (EmpathySoundManager *self,
+    GtkWidget *widget,
+    EmpathySound sound_id,
+    ca_finish_callback_t callback,
+    gpointer user_data)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   g_return_val_if_fail (sound_id < LAST_EMPATHY_SOUND, FALSE);
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   g_return_val_if_fail (sound_id < LAST_EMPATHY_SOUND, FALSE);
@@ -272,22 +278,25 @@ empathy_sound_play_full (GtkWidget *widget, EmpathySound sound_id,
 }
 
 /**
 }
 
 /**
- * empathy_sound_play:
+ * empathy_sound_manager_play:
+ * @self: a #EmpathySoundManager
  * @widget: The #GtkWidget from which the sound is originating.
  * @sound_id: The #EmpathySound to play.
  *
  * @widget: The #GtkWidget from which the sound is originating.
  * @sound_id: The #EmpathySound to play.
  *
- * Plays a sound. See %empathy_sound_play_full for details.'
+ * Plays a sound. See %empathy_sound_manager_play_full for details.'
  *
  * Return value: %TRUE if the sound has successfully started playing, %FALSE
  *               otherwise.
  */
 gboolean
  *
  * Return value: %TRUE if the sound has successfully started playing, %FALSE
  *               otherwise.
  */
 gboolean
-empathy_sound_play (GtkWidget *widget, EmpathySound sound_id)
+empathy_sound_manager_play (EmpathySoundManager *self,
+    GtkWidget *widget,
+    EmpathySound sound_id)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   g_return_val_if_fail (sound_id < LAST_EMPATHY_SOUND, FALSE);
 
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   g_return_val_if_fail (sound_id < LAST_EMPATHY_SOUND, FALSE);
 
-  return empathy_sound_play_full (widget, sound_id, NULL, NULL);
+  return empathy_sound_manager_play_full (self, widget, sound_id, NULL, NULL);
 }
 
 static void playing_finished_cb (ca_context *c, guint id, int error_code,
 }
 
 static void playing_finished_cb (ca_context *c, guint id, int error_code,
@@ -362,7 +371,8 @@ repeating_sounds_item_delete (gpointer data)
 }
 
 /**
 }
 
 /**
- * empathy_sound_start_playing:
+ * empathy_sound_manager_start_playing:
+ * @self: a #EmpathySoundManager
  * @widget: The #GtkWidget from which the sound is originating.
  * @sound_id: The #EmpathySound to play.
  * @timeout_before_replay: The amount of time, in milliseconds, between two
  * @widget: The #GtkWidget from which the sound is originating.
  * @sound_id: The #EmpathySound to play.
  * @timeout_before_replay: The amount of time, in milliseconds, between two
@@ -376,7 +386,9 @@ repeating_sounds_item_delete (gpointer data)
  * Return value: %TRUE if the sound has successfully started playing.
  */
 gboolean
  * Return value: %TRUE if the sound has successfully started playing.
  */
 gboolean
-empathy_sound_start_playing (GtkWidget *widget, EmpathySound sound_id,
+empathy_sound_manager_start_playing (EmpathySoundManager *self,
+    GtkWidget *widget,
+    EmpathySound sound_id,
     guint timeout_before_replay)
 {
   EmpathyRepeatableSound *repeatable_sound;
     guint timeout_before_replay)
 {
   EmpathyRepeatableSound *repeatable_sound;
index ca112e2d9f69b10dab90f1f588cec9ae0fc1bcae..99e96c5715d2ec223fc70b907f75618bc647de25 100644 (file)
@@ -68,14 +68,23 @@ GType empathy_sound_manager_get_type (void) G_GNUC_CONST;
 
 EmpathySoundManager * empathy_sound_manager_dup_singleton (void);
 
 
 EmpathySoundManager * empathy_sound_manager_dup_singleton (void);
 
-gboolean empathy_sound_play (GtkWidget *widget, EmpathySound sound_id);
-void empathy_sound_stop (EmpathySound sound_id);
+gboolean empathy_sound_manager_play (EmpathySoundManager *self,
+    GtkWidget *widget,
+    EmpathySound sound_id);
 
 
-gboolean empathy_sound_start_playing (GtkWidget *widget, EmpathySound sound_id,
+void empathy_sound_manager_stop (EmpathySoundManager *self,
+    EmpathySound sound_id);
+
+gboolean empathy_sound_manager_start_playing (EmpathySoundManager *self,
+    GtkWidget *widget,
+    EmpathySound sound_id,
     guint timeout_before_replay);
 
     guint timeout_before_replay);
 
-gboolean empathy_sound_play_full (GtkWidget *widget, EmpathySound sound_id,
-    ca_finish_callback_t callback, gpointer user_data);
+gboolean empathy_sound_manager_play_full (EmpathySoundManager *self,
+    GtkWidget *widget,
+    EmpathySound sound_id,
+    ca_finish_callback_t callback,
+    gpointer user_data);
 
 G_END_DECLS
 
 
 G_END_DECLS
 
index 4d2d99c2711640de16717673cf592b0d7d02c305..6a0c24aadd08b622c55c3d177e2bb9d9eba56217 100644 (file)
@@ -221,6 +221,8 @@ struct _EmpathyCallWindowPriv
   gboolean start_call_when_playing;
   /* TRUE if we requested to set the pipeline in the playing state */
   gboolean pipeline_playing;
   gboolean start_call_when_playing;
   /* TRUE if we requested to set the pipeline in the playing state */
   gboolean pipeline_playing;
+
+  EmpathySoundManager *sound_mgr;
 };
 
 #define GET_PRIV(o) \
 };
 
 #define GET_PRIV(o) \
@@ -810,7 +812,7 @@ empathy_call_window_set_state_connecting (EmpathyCallWindow *window)
   priv->call_state = CONNECTING;
 
   if (priv->outgoing)
   priv->call_state = CONNECTING;
 
   if (priv->outgoing)
-    empathy_sound_start_playing (GTK_WIDGET (window),
+    empathy_sound_manager_start_playing (priv->sound_mgr, GTK_WIDGET (window),
         EMPATHY_SOUND_PHONE_OUTGOING, MS_BETWEEN_RING);
 }
 
         EMPATHY_SOUND_PHONE_OUTGOING, MS_BETWEEN_RING);
 }
 
@@ -1225,6 +1227,8 @@ empathy_call_window_init (EmpathyCallWindow *self)
   g_object_ref (priv->ui_manager);
   g_object_unref (gui);
 
   g_object_ref (priv->ui_manager);
   g_object_unref (gui);
 
+  priv->sound_mgr = empathy_sound_manager_dup_singleton ();
+
   empathy_geometry_bind (GTK_WINDOW (self), "call-window");
 }
 
   empathy_geometry_bind (GTK_WINDOW (self), "call-window");
 }
 
@@ -1761,6 +1765,8 @@ empathy_call_window_dispose (GObject *object)
       priv->contact = NULL;
     }
 
       priv->contact = NULL;
     }
 
+  tp_clear_object (&priv->sound_mgr);
+
   /* release any references held by the object here */
   if (G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose)
     G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose (object);
   /* release any references held by the object here */
   if (G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose)
     G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose (object);
@@ -1913,7 +1919,8 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
   could_reset_pipeline = empathy_call_window_reset_pipeline (self);
 
   if (priv->call_state == CONNECTING)
   could_reset_pipeline = empathy_call_window_reset_pipeline (self);
 
   if (priv->call_state == CONNECTING)
-      empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
+      empathy_sound_manager_stop (priv->sound_mgr,
+          EMPATHY_SOUND_PHONE_OUTGOING);
 
   if (priv->call_state != REDIALING)
     priv->call_state = DISCONNECTED;
 
   if (priv->call_state != REDIALING)
     priv->call_state = DISCONNECTED;
@@ -2456,7 +2463,7 @@ empathy_call_window_connected (gpointer user_data)
   EmpathyTpCall *call;
   gboolean can_send_video;
 
   EmpathyTpCall *call;
   gboolean can_send_video;
 
-  empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
+  empathy_sound_manager_stop (priv->sound_mgr, EMPATHY_SOUND_PHONE_OUTGOING);
 
   can_send_video = priv->video_input != NULL && priv->contact != NULL &&
     empathy_contact_can_voip_video (priv->contact);
 
   can_send_video = priv->video_input != NULL && priv->contact != NULL &&
     empathy_contact_can_voip_video (priv->contact);
@@ -2884,7 +2891,7 @@ empathy_call_window_delete_cb (GtkWidget *widget, GdkEvent*event,
     }
 
   if (priv->call_state == CONNECTING)
     }
 
   if (priv->call_state == CONNECTING)
-    empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
+    empathy_sound_manager_stop (priv->sound_mgr, EMPATHY_SOUND_PHONE_OUTGOING);
 
   return FALSE;
 }
 
   return FALSE;
 }
index 97514e63dc2efe8c23ad08d68432bbc391e81e59..457be5b2d5b80a622b7ab5fab2fb8210a0615a4c 100644 (file)
@@ -115,6 +115,8 @@ typedef struct {
        GSettings *gsettings_chat;
        GSettings *gsettings_notif;
        GSettings *gsettings_ui;
        GSettings *gsettings_chat;
        GSettings *gsettings_notif;
        GSettings *gsettings_ui;
+
+       EmpathySoundManager *sound_mgr;
 } EmpathyChatWindowPriv;
 
 static GList *chat_windows = NULL;
 } EmpathyChatWindowPriv;
 
 static GList *chat_windows = NULL;
@@ -1402,7 +1404,7 @@ chat_window_new_message_cb (EmpathyChat       *chat,
        sender = empathy_message_get_sender (message);
 
        if (empathy_contact_is_user (sender)) {
        sender = empathy_message_get_sender (message);
 
        if (empathy_contact_is_user (sender)) {
-               empathy_sound_play (GTK_WIDGET (priv->dialog),
+               empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (priv->dialog),
                                    EMPATHY_SOUND_MESSAGE_OUTGOING);
        }
 
                                    EMPATHY_SOUND_MESSAGE_OUTGOING);
        }
 
@@ -1453,7 +1455,7 @@ chat_window_new_message_cb (EmpathyChat       *chat,
                        chat_window_set_highlight_room_tab_label (chat);
                }
 
                        chat_window_set_highlight_room_tab_label (chat);
                }
 
-               empathy_sound_play (GTK_WIDGET (priv->dialog),
+               empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (priv->dialog),
                    EMPATHY_SOUND_MESSAGE_INCOMING);
                chat_window_show_or_update_notification (window, message, chat);
        }
                    EMPATHY_SOUND_MESSAGE_INCOMING);
                chat_window_show_or_update_notification (window, message, chat);
        }
@@ -1873,6 +1875,7 @@ chat_window_finalize (GObject *object)
        g_object_unref (priv->gsettings_chat);
        g_object_unref (priv->gsettings_notif);
        g_object_unref (priv->gsettings_ui);
        g_object_unref (priv->gsettings_chat);
        g_object_unref (priv->gsettings_notif);
        g_object_unref (priv->gsettings_ui);
+       g_object_unref (priv->sound_mgr);
 
        if (priv->notification != NULL) {
                notify_notification_close (priv->notification, NULL);
 
        if (priv->notification != NULL) {
                notify_notification_close (priv->notification, NULL);
@@ -1988,6 +1991,8 @@ empathy_chat_window_init (EmpathyChatWindow *window)
        priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
        priv->chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
 
        priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
        priv->chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
 
+       priv->sound_mgr = empathy_sound_manager_dup_singleton ();
+
        priv->notebook = gtk_notebook_new ();
 
        g_signal_connect (priv->notebook, "create-window",
        priv->notebook = gtk_notebook_new ();
 
        g_signal_connect (priv->notebook, "create-window",
index 0877c2699a5a8625fe46b102dd3fe508335dedba..5516328ccaab9621b26d664250c9c59671c61f95 100644 (file)
@@ -85,6 +85,8 @@ typedef struct {
 
   GSettings *gsettings_notif;
   GSettings *gsettings_ui;
 
   GSettings *gsettings_notif;
   GSettings *gsettings_ui;
+
+  EmpathySoundManager *sound_mgr;
 } EmpathyEventManagerPriv;
 
 typedef struct _EventPriv EventPriv;
 } EmpathyEventManagerPriv;
 
 typedef struct _EventPriv EventPriv;
@@ -531,6 +533,7 @@ event_manager_chat_message_received_cb (EmpathyTpChat *tp_chat,
   const gchar     *msg;
   TpChannel       *channel;
   EventPriv       *event;
   const gchar     *msg;
   TpChannel       *channel;
   EventPriv       *event;
+  EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
 
   /* try to update the event if it's referring to a chat which is already in the
    * queue. */
 
   /* try to update the event if it's referring to a chat which is already in the
    * queue. */
@@ -550,7 +553,8 @@ event_manager_chat_message_received_cb (EmpathyTpChat *tp_chat,
         EMPATHY_IMAGE_NEW_MESSAGE, header, msg, approval,
         event_text_channel_process_func, NULL);
 
         EMPATHY_IMAGE_NEW_MESSAGE, header, msg, approval,
         event_text_channel_process_func, NULL);
 
-  empathy_sound_play (window, EMPATHY_SOUND_CONVERSATION_NEW);
+  empathy_sound_manager_play (priv->sound_mgr, window,
+      EMPATHY_SOUND_CONVERSATION_NEW);
 
   g_object_unref (window);
 }
 
   g_object_unref (window);
 }
@@ -571,7 +575,8 @@ event_manager_approval_done (EventManagerApproval *approval)
         {
           priv->ringing--;
           if (priv->ringing == 0)
         {
           priv->ringing--;
           if (priv->ringing == 0)
-            empathy_sound_stop (EMPATHY_SOUND_PHONE_INCOMING);
+            empathy_sound_manager_stop (priv->sound_mgr,
+                EMPATHY_SOUND_PHONE_INCOMING);
         }
     }
 
         }
     }
 
@@ -630,7 +635,7 @@ event_manager_media_channel_got_contact (EventManagerApproval *approval)
 
   priv->ringing++;
   if (priv->ringing == 1)
 
   priv->ringing++;
   if (priv->ringing == 1)
-    empathy_sound_start_playing (window,
+    empathy_sound_manager_start_playing (priv->sound_mgr, window,
         EMPATHY_SOUND_PHONE_INCOMING, MS_BETWEEN_RING);
 
   g_object_unref (window);
         EMPATHY_SOUND_PHONE_INCOMING, MS_BETWEEN_RING);
 
   g_object_unref (window);
@@ -735,6 +740,7 @@ display_invite_room_dialog (EventManagerApproval *approval)
   const gchar *invite_msg;
   gchar *msg;
   TpHandle self_handle;
   const gchar *invite_msg;
   gchar *msg;
   TpHandle self_handle;
+  EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
 
   self_handle = tp_channel_group_get_self_handle (approval->main_channel);
   tp_channel_group_get_local_pending_info (approval->main_channel, self_handle,
 
   self_handle = tp_channel_group_get_self_handle (approval->main_channel);
   tp_channel_group_get_local_pending_info (approval->main_channel, self_handle,
@@ -756,7 +762,8 @@ display_invite_room_dialog (EventManagerApproval *approval)
       EMPATHY_EVENT_TYPE_INVITATION, EMPATHY_IMAGE_GROUP_MESSAGE, msg,
       invite_msg, approval, event_room_channel_process_func, NULL);
 
       EMPATHY_EVENT_TYPE_INVITATION, EMPATHY_IMAGE_GROUP_MESSAGE, msg,
       invite_msg, approval, event_room_channel_process_func, NULL);
 
-  empathy_sound_play (window, EMPATHY_SOUND_CONVERSATION_NEW);
+  empathy_sound_manager_play (priv->sound_mgr, window,
+      EMPATHY_SOUND_CONVERSATION_NEW);
 
   g_free (msg);
   g_object_unref (window);
 
   g_free (msg);
   g_object_unref (window);
@@ -793,6 +800,7 @@ event_manager_ft_got_contact_cb (TpConnection *connection,
   EventManagerApproval *approval = (EventManagerApproval *) user_data;
   GtkWidget *window = empathy_main_window_dup ();
   char *header;
   EventManagerApproval *approval = (EventManagerApproval *) user_data;
   GtkWidget *window = empathy_main_window_dup ();
   char *header;
+  EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
 
   approval->contact = g_object_ref (contact);
 
 
   approval->contact = g_object_ref (contact);
 
@@ -804,7 +812,8 @@ event_manager_ft_got_contact_cb (TpConnection *connection,
       approval, event_channel_process_func, NULL);
 
   /* FIXME better sound for incoming file transfers ?*/
       approval, event_channel_process_func, NULL);
 
   /* FIXME better sound for incoming file transfers ?*/
-  empathy_sound_play (window, EMPATHY_SOUND_CONVERSATION_NEW);
+  empathy_sound_manager_play (priv->sound_mgr, window,
+      EMPATHY_SOUND_CONVERSATION_NEW);
 
   g_free (header);
   g_object_unref (window);
 
   g_free (header);
   g_object_unref (window);
@@ -1048,7 +1057,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
           TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
         {
           /* someone is logging off */
           TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
         {
           /* someone is logging off */
-          empathy_sound_play (window, EMPATHY_SOUND_CONTACT_DISCONNECTED);
+          empathy_sound_manager_play (priv->sound_mgr, window,
+              EMPATHY_SOUND_CONTACT_DISCONNECTED);
 
           if (g_settings_get_boolean (priv->gsettings_notif,
                 EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT))
 
           if (g_settings_get_boolean (priv->gsettings_notif,
                 EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT))
@@ -1068,7 +1078,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
             TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
         {
           /* someone is logging in */
             TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
         {
           /* someone is logging in */
-          empathy_sound_play (window, EMPATHY_SOUND_CONTACT_CONNECTED);
+          empathy_sound_manager_play (priv->sound_mgr, window,
+              EMPATHY_SOUND_CONTACT_CONNECTED);
 
           if (g_settings_get_boolean (priv->gsettings_notif,
                 EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN))
 
           if (g_settings_get_boolean (priv->gsettings_notif,
                 EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN))
@@ -1131,7 +1142,7 @@ event_manager_finalize (GObject *object)
   EmpathyEventManagerPriv *priv = GET_PRIV (object);
 
   if (priv->ringing > 0)
   EmpathyEventManagerPriv *priv = GET_PRIV (object);
 
   if (priv->ringing > 0)
-    empathy_sound_stop (EMPATHY_SOUND_PHONE_INCOMING);
+    empathy_sound_manager_stop (priv->sound_mgr, EMPATHY_SOUND_PHONE_INCOMING);
 
   g_slist_foreach (priv->events, (GFunc) event_free, NULL);
   g_slist_free (priv->events);
 
   g_slist_foreach (priv->events, (GFunc) event_free, NULL);
   g_slist_free (priv->events);
@@ -1141,6 +1152,7 @@ event_manager_finalize (GObject *object)
   g_object_unref (priv->approver);
   g_object_unref (priv->gsettings_notif);
   g_object_unref (priv->gsettings_ui);
   g_object_unref (priv->approver);
   g_object_unref (priv->gsettings_notif);
   g_object_unref (priv->gsettings_ui);
+  g_object_unref (priv->sound_mgr);
 }
 
 static void
 }
 
 static void
@@ -1196,6 +1208,8 @@ empathy_event_manager_init (EmpathyEventManager *manager)
   priv->gsettings_notif = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
   priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
 
   priv->gsettings_notif = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
   priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
 
+  priv->sound_mgr = empathy_sound_manager_dup_singleton ();
+
   priv->contact_manager = empathy_contact_manager_dup_singleton ();
   g_signal_connect (priv->contact_manager, "pendings-changed",
     G_CALLBACK (event_manager_pendings_changed_cb), manager);
   priv->contact_manager = empathy_contact_manager_dup_singleton ();
   g_signal_connect (priv->contact_manager, "pendings-changed",
     G_CALLBACK (event_manager_pendings_changed_cb), manager);
index 8b96618382b6cf656cfb44e0dd4ecd9dfdfaaf49..db5818c0c21a96a584c728168876830454fdfd28 100644 (file)
@@ -107,6 +107,7 @@ struct _EmpathyMainWindowPriv {
        TpAccountManager        *account_manager;
        EmpathyChatroomManager  *chatroom_manager;
        EmpathyEventManager     *event_manager;
        TpAccountManager        *account_manager;
        EmpathyChatroomManager  *chatroom_manager;
        EmpathyEventManager     *event_manager;
+       EmpathySoundManager     *sound_mgr;;
        guint                    flash_timeout_id;
        gboolean                 flash_on;
        gboolean                 empty;
        guint                    flash_timeout_id;
        gboolean                 flash_on;
        gboolean                 empty;
@@ -639,6 +640,8 @@ main_window_connection_changed_cb (TpAccount  *account,
                                   GHashTable *details,
                                   EmpathyMainWindow *window)
 {
                                   GHashTable *details,
                                   EmpathyMainWindow *window)
 {
+       EmpathyMainWindowPriv *priv = GET_PRIV (window);
+
        main_window_update_status (window);
 
        if (current == TP_CONNECTION_STATUS_DISCONNECTED &&
        main_window_update_status (window);
 
        if (current == TP_CONNECTION_STATUS_DISCONNECTED &&
@@ -647,12 +650,12 @@ main_window_connection_changed_cb (TpAccount  *account,
        }
 
        if (current == TP_CONNECTION_STATUS_DISCONNECTED) {
        }
 
        if (current == TP_CONNECTION_STATUS_DISCONNECTED) {
-               empathy_sound_play (GTK_WIDGET (window),
+               empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (window),
                                    EMPATHY_SOUND_ACCOUNT_DISCONNECTED);
        }
 
        if (current == TP_CONNECTION_STATUS_CONNECTED) {
                                    EMPATHY_SOUND_ACCOUNT_DISCONNECTED);
        }
 
        if (current == TP_CONNECTION_STATUS_CONNECTED) {
-               empathy_sound_play (GTK_WIDGET (window),
+               empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (window),
                                    EMPATHY_SOUND_ACCOUNT_CONNECTED);
 
                /* Account connected without error, remove error message if any */
                                    EMPATHY_SOUND_ACCOUNT_CONNECTED);
 
                /* Account connected without error, remove error message if any */
@@ -706,6 +709,7 @@ empathy_main_window_finalize (GObject *window)
        g_object_unref (priv->account_manager);
        g_object_unref (priv->individual_store);
        g_object_unref (priv->contact_manager);
        g_object_unref (priv->account_manager);
        g_object_unref (priv->individual_store);
        g_object_unref (priv->contact_manager);
+       g_object_unref (priv->sound_mgr);
        g_hash_table_destroy (priv->errors);
 
        /* disconnect all handlers of status-changed signal */
        g_hash_table_destroy (priv->errors);
 
        /* disconnect all handlers of status-changed signal */
@@ -1576,6 +1580,8 @@ empathy_main_window_init (EmpathyMainWindow *window)
        priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
        priv->gsettings_contacts = g_settings_new (EMPATHY_PREFS_CONTACTS_SCHEMA);
 
        priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
        priv->gsettings_contacts = g_settings_new (EMPATHY_PREFS_CONTACTS_SCHEMA);
 
+       priv->sound_mgr = empathy_sound_manager_dup_singleton ();
+
        gtk_window_set_title (GTK_WINDOW (window), _("Contact List"));
        gtk_window_set_role (GTK_WINDOW (window), "contact_list");
        gtk_window_set_default_size (GTK_WINDOW (window), 225, 325);
        gtk_window_set_title (GTK_WINDOW (window), _("Contact List"));
        gtk_window_set_role (GTK_WINDOW (window), "contact_list");
        gtk_window_set_default_size (GTK_WINDOW (window), 225, 325);