changeset 19991:f1bcba415a4b

merge of '2510b3bdf51be7bd339aca4a39ec86bf73c6716c' and 'f7c31ba459e2ad06a7d5866a8591aa46f4cda7c2'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 13 Sep 2007 02:17:31 +0000
parents 6dcab2412c22 (current diff) 959b3aaba0b6 (diff)
children e4dc98b8e140
files
diffstat 3 files changed, 56 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Sep 13 01:25:22 2007 +0000
+++ b/ChangeLog	Thu Sep 13 02:17:31 2007 +0000
@@ -10,7 +10,8 @@
 	* Option to show protocol icons in the buddy list, from the
 	  Buddies > Show menu (Justin Heiner)
 	* Ability to build with native, non-X11 GTK+ on OSX (Anders
-   	  Hasselqvist)
+	  Hasselqvist)
+	* Remember the 'Enable Sounds' setting for a conversation
 
 	Finch:
 	* Per-conversation mute and logging options (accessible from the menu)
--- a/finch/gntconv.c	Thu Sep 13 01:25:22 2007 +0000
+++ b/finch/gntconv.c	Thu Sep 13 02:17:31 2007 +0000
@@ -63,6 +63,25 @@
 		const char *message, PurpleMessageFlags flags, time_t mtime);
 static void generate_send_to_menu(FinchConv *ggc);
 
+static PurpleBlistNode *
+get_conversation_blist_node(PurpleConversation *conv)
+{
+	PurpleBlistNode *node = NULL;
+
+	switch (purple_conversation_get_type(conv)) {
+		case PURPLE_CONV_TYPE_IM:
+			node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
+			node = node ? node->parent : NULL;
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
+			break;
+		default:
+			break;
+	}
+	return node;
+}
+
 static void
 send_typing_notification(GntWidget *w, FinchConv *ggconv)
 {
@@ -391,7 +410,10 @@
 toggle_sound_cb(GntMenuItem *item, gpointer ggconv)
 {
 	FinchConv *fc = ggconv;
+	PurpleBlistNode *node = get_conversation_blist_node(fc->active_conv);
 	fc->flags ^= FINCH_CONV_NO_SOUND;
+	if (node)
+		purple_blist_node_set_bool(node, "gnt-mute-sound", !!(fc->flags & FINCH_CONV_NO_SOUND));
 }
 
 static void
@@ -547,6 +569,7 @@
 	PurpleConversationType type;
 	PurpleConversation *cc;
 	PurpleAccount *account;
+	PurpleBlistNode *convnode = NULL;
 
 	if (ggc)
 		return;
@@ -653,7 +676,9 @@
 		g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc);
 	}
 
-	if (!finch_sound_is_enabled())
+	convnode = get_conversation_blist_node(conv);
+	if ((convnode && purple_blist_node_get_bool(convnode, "gnt-mute-sound")) ||
+			!finch_sound_is_enabled())
 		ggc->flags |= FINCH_CONV_NO_SOUND;
 
 	gg_create_menu(ggc);
--- a/pidgin/gtkconv.c	Thu Sep 13 01:25:22 2007 +0000
+++ b/pidgin/gtkconv.c	Thu Sep 13 02:17:31 2007 +0000
@@ -183,6 +183,25 @@
 	return &col;
 }
 
+static PurpleBlistNode *
+get_conversation_blist_node(PurpleConversation *conv)
+{
+	PurpleBlistNode *node = NULL;
+
+	switch (purple_conversation_get_type(conv)) {
+		case PURPLE_CONV_TYPE_IM:
+			node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
+			node = node ? node->parent : NULL;
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
+			break;
+		default:
+			break;
+	}
+	return node;
+}
+
 /**************************************************************************
  * Callbacks
  **************************************************************************/
@@ -1379,6 +1398,7 @@
 	PidginWindow *win = data;
 	PurpleConversation *conv;
 	PidginConversation *gtkconv;
+	PurpleBlistNode *node;
 
 	conv = pidgin_conv_window_get_active_conversation(win);
 
@@ -1389,6 +1409,9 @@
 
 	gtkconv->make_sound =
 		gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+	node = get_conversation_blist_node(conv);
+	if (node)
+		purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound);
 }
 
 static void
@@ -2948,7 +2971,7 @@
 
 		if (gtkconv != NULL)
 			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
-			                               TRUE);
+			                               gtkconv->make_sound);
 		gtk_widget_set_sensitive(win->menu.sounds, TRUE);
 
 	}
@@ -4927,6 +4950,7 @@
 	PurpleConversationType conv_type = purple_conversation_get_type(conv);
 	GtkWidget *pane = NULL;
 	GtkWidget *tab_cont;
+	PurpleBlistNode *convnode;
 
 	if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
 		conv->ui_data = gtkconv;
@@ -5004,7 +5028,9 @@
 	gtk_container_add(GTK_CONTAINER(tab_cont), pane);
 	gtk_widget_show(pane);
 
-	gtkconv->make_sound = TRUE;
+	convnode = get_conversation_blist_node(conv);
+	if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound"))
+		gtkconv->make_sound = TRUE;
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"))
 		gtk_widget_show(gtkconv->toolbar);