Mercurial > pidgin.yaz
changeset 8630:ff2c1e946a5c
[gaim-migrate @ 9382]
Add an option for "No sounds when conversation has focus"
Thanks goes to nosnilmot, I think
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 11 Apr 2004 16:09:06 +0000 |
parents | fdff0f31002d |
children | 7b8f2818f38a |
files | src/gtkconv.c src/gtkprefs.c src/gtksound.c |
diffstat | 3 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Sun Apr 11 03:27:11 2004 +0000 +++ b/src/gtkconv.c Sun Apr 11 16:09:06 2004 +0000 @@ -4374,8 +4374,15 @@ time_t mtime) { GaimGtkConversation *gtkconv; + GaimConvWindow *gaimwin; + GaimGtkWindow *gtkwin; + gboolean has_focus; gtkconv = GAIM_GTK_CONVERSATION(conv); + gaimwin = gaim_conversation_get_window(conv); + gtkwin = GAIM_GTK_WINDOW(gaimwin); + + g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { @@ -4384,7 +4391,8 @@ } /* Play a sound, if specified in prefs. */ - if (gtkconv->make_sound) { + if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && + gaim_prefs_get_bool("/gaim/gtk/sound/silent_focus") && has_focus)) { if (flags & GAIM_MESSAGE_RECV) { if (gtkconv->u.im->a_virgin && gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { @@ -4409,11 +4417,19 @@ const char *message, GaimMessageFlags flags, time_t mtime) { GaimGtkConversation *gtkconv; + GaimConvWindow *gaimwin; + GaimGtkWindow *gtkwin; + gboolean has_focus; gtkconv = GAIM_GTK_CONVERSATION(conv); + gaimwin = gaim_conversation_get_window(conv); + gtkwin = GAIM_GTK_WINDOW(gaimwin); + + g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); /* Play a sound, if specified in prefs. */ - if (gtkconv->make_sound) { + if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && + gaim_prefs_get_bool("/gaim/gtk/sound/silent_focus") && has_focus)) { if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); else if (flags & GAIM_MESSAGE_RECV) {
--- a/src/gtkprefs.c Sun Apr 11 03:27:11 2004 +0000 +++ b/src/gtkprefs.c Sun Apr 11 16:09:06 2004 +0000 @@ -1536,6 +1536,8 @@ vbox = gaim_gtk_make_frame (ret, _("Sound Options")); gaim_gtk_prefs_checkbox(_("_No sounds when you log in"), "/gaim/gtk/sound/silent_signon", vbox); + gaim_gtk_prefs_checkbox(_("No sounds when conversation has _focus"), + "/gaim/gtk/sound/silent_focus", vbox); gaim_gtk_prefs_checkbox(_("_Sounds while away"), "/core/sound/while_away", vbox);
--- a/src/gtksound.c Sun Apr 11 03:27:11 2004 +0000 +++ b/src/gtksound.c Sun Apr 11 16:09:06 2004 +0000 @@ -108,6 +108,7 @@ gaim_prefs_add_bool("/gaim/gtk/sound/enabled/pounce_default", TRUE); gaim_prefs_add_string("/gaim/gtk/sound/file/pounce_default", ""); gaim_prefs_add_bool("/gaim/gtk/sound/silent_signon", TRUE); + gaim_prefs_add_bool("/gaim/gtk/sound/silent_focus", FALSE); gaim_prefs_add_string("/gaim/gtk/sound/command", ""); gaim_prefs_add_string("/gaim/gtk/sound/method", "automatic");