Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 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 | 82357fa4e6b8 |
children | f8292be3b45c |
comparison
equal
deleted
inserted
replaced
8629:fdff0f31002d | 8630:ff2c1e946a5c |
---|---|
4372 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, | 4372 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
4373 const char *message, GaimMessageFlags flags, | 4373 const char *message, GaimMessageFlags flags, |
4374 time_t mtime) | 4374 time_t mtime) |
4375 { | 4375 { |
4376 GaimGtkConversation *gtkconv; | 4376 GaimGtkConversation *gtkconv; |
4377 GaimConvWindow *gaimwin; | |
4378 GaimGtkWindow *gtkwin; | |
4379 gboolean has_focus; | |
4377 | 4380 |
4378 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4381 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4382 gaimwin = gaim_conversation_get_window(conv); | |
4383 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4384 | |
4385 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4379 | 4386 |
4380 if (!(flags & GAIM_MESSAGE_NO_LOG) && | 4387 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
4381 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { | 4388 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
4382 | 4389 |
4383 gaim_conv_window_raise(gaim_conversation_get_window(conv)); | 4390 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
4384 } | 4391 } |
4385 | 4392 |
4386 /* Play a sound, if specified in prefs. */ | 4393 /* Play a sound, if specified in prefs. */ |
4387 if (gtkconv->make_sound) { | 4394 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
4395 gaim_prefs_get_bool("/gaim/gtk/sound/silent_focus") && has_focus)) { | |
4388 if (flags & GAIM_MESSAGE_RECV) { | 4396 if (flags & GAIM_MESSAGE_RECV) { |
4389 if (gtkconv->u.im->a_virgin && | 4397 if (gtkconv->u.im->a_virgin && |
4390 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { | 4398 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4391 | 4399 |
4392 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); | 4400 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4407 static void | 4415 static void |
4408 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, | 4416 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
4409 const char *message, GaimMessageFlags flags, time_t mtime) | 4417 const char *message, GaimMessageFlags flags, time_t mtime) |
4410 { | 4418 { |
4411 GaimGtkConversation *gtkconv; | 4419 GaimGtkConversation *gtkconv; |
4420 GaimConvWindow *gaimwin; | |
4421 GaimGtkWindow *gtkwin; | |
4422 gboolean has_focus; | |
4412 | 4423 |
4413 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4424 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4425 gaimwin = gaim_conversation_get_window(conv); | |
4426 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4427 | |
4428 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4414 | 4429 |
4415 /* Play a sound, if specified in prefs. */ | 4430 /* Play a sound, if specified in prefs. */ |
4416 if (gtkconv->make_sound) { | 4431 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
4432 gaim_prefs_get_bool("/gaim/gtk/sound/silent_focus") && has_focus)) { | |
4417 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) | 4433 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4418 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); | 4434 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
4419 else if (flags & GAIM_MESSAGE_RECV) { | 4435 else if (flags & GAIM_MESSAGE_RECV) { |
4420 if ((flags & GAIM_MESSAGE_NICK) && | 4436 if ((flags & GAIM_MESSAGE_NICK) && |
4421 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && | 4437 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |