diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-11-30 18:24:20 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-11-30 18:24:20 +0800 |
commit | 81068bbf3ebd6c251f308d6d45e4dadf07432ea7 (patch) | |
tree | d17b2afe895a95156d753b6ccbb4b66196cb01b9 /src | |
parent | 8172bca03c6f85d7dcc0ff39f1a81ccfd719b08b (diff) | |
download | gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.tar gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.tar.gz gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.tar.bz2 gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.tar.lz gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.tar.xz gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.tar.zst gsoc2013-empathy-81068bbf3ebd6c251f308d6d45e4dadf07432ea7.zip |
move sound functions to EmpathySoundManager methods
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 15 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 9 | ||||
-rw-r--r-- | src/empathy-event-manager.c | 30 | ||||
-rw-r--r-- | src/empathy-main-window.c | 10 |
4 files changed, 48 insertions, 16 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 4d2d99c27..6a0c24aad 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -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; + + EmpathySoundManager *sound_mgr; }; #define GET_PRIV(o) \ @@ -810,7 +812,7 @@ empathy_call_window_set_state_connecting (EmpathyCallWindow *window) 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); } @@ -1225,6 +1227,8 @@ empathy_call_window_init (EmpathyCallWindow *self) 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"); } @@ -1761,6 +1765,8 @@ empathy_call_window_dispose (GObject *object) 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); @@ -1913,7 +1919,8 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, 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; @@ -2456,7 +2463,7 @@ empathy_call_window_connected (gpointer user_data) 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); @@ -2884,7 +2891,7 @@ empathy_call_window_delete_cb (GtkWidget *widget, GdkEvent*event, } 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; } diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 97514e63d..457be5b2d 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -115,6 +115,8 @@ typedef struct { GSettings *gsettings_chat; GSettings *gsettings_notif; GSettings *gsettings_ui; + + EmpathySoundManager *sound_mgr; } 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)) { - empathy_sound_play (GTK_WIDGET (priv->dialog), + empathy_sound_manager_play (priv->sound_mgr, GTK_WIDGET (priv->dialog), EMPATHY_SOUND_MESSAGE_OUTGOING); } @@ -1453,7 +1455,7 @@ chat_window_new_message_cb (EmpathyChat *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); } @@ -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->sound_mgr); 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->sound_mgr = empathy_sound_manager_dup_singleton (); + priv->notebook = gtk_notebook_new (); g_signal_connect (priv->notebook, "create-window", diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 0877c2699..5516328cc 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -85,6 +85,8 @@ typedef struct { GSettings *gsettings_notif; GSettings *gsettings_ui; + + EmpathySoundManager *sound_mgr; } 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; + EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); /* 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_sound_play (window, EMPATHY_SOUND_CONVERSATION_NEW); + empathy_sound_manager_play (priv->sound_mgr, window, + EMPATHY_SOUND_CONVERSATION_NEW); g_object_unref (window); } @@ -571,7 +575,8 @@ event_manager_approval_done (EventManagerApproval *approval) { 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) - 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); @@ -735,6 +740,7 @@ display_invite_room_dialog (EventManagerApproval *approval) 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, @@ -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_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); @@ -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; + EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); 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 ?*/ - 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); @@ -1048,7 +1057,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact, 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)) @@ -1068,7 +1078,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact, 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)) @@ -1131,7 +1142,7 @@ event_manager_finalize (GObject *object) 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); @@ -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->sound_mgr); } 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->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); diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 8b9661838..db5818c0c 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -107,6 +107,7 @@ struct _EmpathyMainWindowPriv { TpAccountManager *account_manager; EmpathyChatroomManager *chatroom_manager; EmpathyEventManager *event_manager; + EmpathySoundManager *sound_mgr;; guint flash_timeout_id; gboolean flash_on; gboolean empty; @@ -639,6 +640,8 @@ main_window_connection_changed_cb (TpAccount *account, GHashTable *details, EmpathyMainWindow *window) { + EmpathyMainWindowPriv *priv = GET_PRIV (window); + 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) { - 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_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 */ @@ -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->sound_mgr); 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->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); |