diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:45:51 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:45:51 +0800 |
commit | b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5 (patch) | |
tree | 0e9124d29e755b08b68fe1ea30cf92b87bd405d4 /src/empathy-chat-window.c | |
parent | 8861b950403401359bc76abde0d2b211f77f5352 (diff) | |
download | gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.tar gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.tar.gz gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.tar.bz2 gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.tar.lz gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.tar.xz gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.tar.zst gsoc2013-empathy-b7bbdc37baa74f46c99ea4299a34b7ea4b4053e5.zip |
Adapt Patryk's patch to trunk.
svn path=/trunk/; revision=2022
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r-- | src/empathy-chat-window.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index e0e9dae5d..b5e30d647 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -33,6 +33,7 @@ #include <gdk/gdkkeysyms.h> #include <glade/glade.h> #include <glib/gi18n.h> +#include <canberra-gtk.h> #include <telepathy-glib/util.h> #include <libmissioncontrol/mission-control.h> @@ -841,11 +842,34 @@ chat_window_new_message_cb (EmpathyChat *chat, EmpathyChatWindowPriv *priv; gboolean has_focus; gboolean needs_urgency; + gboolean action_sounds_enabled; + EmpathyContact *sender; priv = GET_PRIV (window); has_focus = empathy_chat_window_has_focus (window); + empathy_conf_get_bool (empathy_conf_get (), + EMPATHY_PREFS_INPUT_FEEDBACK_SOUNDS, + &action_sounds_enabled); + /* always play sounds if enabled, otherwise only play if chat is not in focus */ + if (action_sounds_enabled || !has_focus || priv->current_chat != chat) { + sender = empathy_message_get_sender(message); + if (empathy_contact_is_user (sender) != FALSE) { + ca_gtk_play_for_widget (GTK_WIDGET (priv->dialog), 0, + CA_PROP_EVENT_ID, "message-sent-instant", + CA_PROP_EVENT_DESCRIPTION, _("Sent an instant message"), + CA_PROP_APPLICATION_NAME, g_get_application_name (), + NULL); + } else { + ca_gtk_play_for_widget (GTK_WIDGET (priv->dialog), 0, + CA_PROP_EVENT_ID, "message-new-instant", + CA_PROP_EVENT_DESCRIPTION, _("Received an instant message"), + CA_PROP_APPLICATION_NAME, g_get_application_name (), + NULL); + } + } + if (has_focus && priv->current_chat == chat) { return; } |