diff pidgin/gtksound.c @ 29244:22b8a92fb5ee

Adds attention UI to Pidgin (can send attentions using a menu item) API to "fire" an attention on a conversation, triggering signals. Currently gtksound is set up to use the alert sound for received and sent attentions. Refs #2788
author Marcus Lundblad <ml@update.uu.se>
date Mon, 20 Oct 2008 18:44:06 +0000
parents c767bcb40b36
children d855ff9cf839
line wrap: on
line diff
--- a/pidgin/gtksound.c	Thu Oct 16 22:20:52 2008 +0000
+++ b/pidgin/gtksound.c	Mon Oct 20 18:44:06 2008 +0000
@@ -70,7 +70,9 @@
 	{N_("Others talk in chat"), "chat_msg_recv", "receive.wav"},
 	/* this isn't a terminator, it's the buddy pounce default sound event ;-) */
 	{NULL, "pounce_default", "alert.wav"},
-	{N_("Someone says your username in chat"), "nick_said", "alert.wav"}
+	{N_("Someone says your username in chat"), "nick_said", "alert.wav"},
+	{N_("Attention received"), "got_attention", "alert.wav"},
+	{N_("Attention sent"), "sent_attention", "alert.wav"}
 };
 
 static gboolean
@@ -215,6 +217,20 @@
 		play_conv_event(conv, event);
 }
 
+static void
+sent_attention_cb(PurpleAccount *account, const char *who, 
+	PurpleConversation *conv, guint type, PurpleSoundEventID event)
+{
+	play_conv_event(conv, event);
+}
+
+static void
+got_attention_cb(PurpleAccount *account, const char *who, 
+	PurpleConversation *conv, guint type, PurpleSoundEventID event)
+{
+	play_conv_event(conv, event);
+}
+
 /*
  * We mute sounds for the 10 seconds after you log in so that
  * you don't get flooded with sounds when the blist shows all
@@ -294,6 +310,10 @@
 	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", "");
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE);
 	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", "");
+	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE);
+	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", "");
+	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE);
+	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", "");
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
 	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/command", "");
@@ -340,6 +360,12 @@
 	purple_signal_connect(conv_handle, "received-chat-msg",
 						gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
 						GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
+	purple_signal_connect(conv_handle, "sent-attention", gtk_sound_handle,
+						PURPLE_CALLBACK(sent_attention_cb),
+						  GINT_TO_POINTER(PURPLE_SOUND_SEND_ATTENTION));
+	purple_signal_connect(conv_handle, "got-attention", gtk_sound_handle,
+						PURPLE_CALLBACK(got_attention_cb),
+						  GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION));
 }
 
 static void