diff src/gtkconv.c @ 9108:6a17b7e2e3b2

[gaim-migrate @ 9885] I did some more prefslashing. Test, discuss. I'll stay up for a bit. If nobody objects, let's tag and release. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 28 May 2004 05:53:34 +0000
parents 717d0e23f5fa
children 78189aad1457
line wrap: on
line diff
--- a/src/gtkconv.c	Fri May 28 05:39:33 2004 +0000
+++ b/src/gtkconv.c	Fri May 28 05:53:34 2004 +0000
@@ -3387,7 +3387,7 @@
 	gaim_gtkconv_update_buttons_by_protocol(conv);
 
 	/* Check if the buttons should be visible or not */
-	button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type");
+	button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
 	if (button_type == GAIM_BUTTON_NONE)
 		gtk_widget_hide(gtkconv->bbox);
 	else
@@ -3474,7 +3474,7 @@
 	gaim_gtkconv_update_buttons_by_protocol(conv);
 
 	/* Check if the buttons should be visible or not */
-	button_type = gaim_prefs_get_int("/gaim/gtk/conversations/chat/button_type");
+	button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
 	if (button_type == GAIM_BUTTON_NONE)
 		gtk_widget_hide(gtkconv->bbox);
 	else
@@ -4482,7 +4482,7 @@
 	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")) {
+		gaim_prefs_get_bool("/gaim/gtk/conversations/raise_on_events")) {
 
 		gaim_conv_window_raise(gaim_conversation_get_window(conv));
 	}
@@ -4546,7 +4546,8 @@
 
 	/* Raise the window, if specified in prefs. */
 	if (!(flags & GAIM_MESSAGE_NO_LOG) &&
-		gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) {
+	    /* we may want to change this */
+		gaim_prefs_get_bool("/gaim/gtk/conversations/raise_on_events")) {
 
 		gaim_conv_window_raise(gaim_conversation_get_window(conv));
 	}
@@ -4577,12 +4578,7 @@
 
 	win = gaim_conversation_get_window(conv);
 
-	if (!(flags & GAIM_MESSAGE_NO_LOG) &&
-	    ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT &&
-	      gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) ||
-	     (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
-	      gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) {
-
+	if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_prefs_get_bool("/gaim/gtk/conversations/raise_on_events")) {
 		gaim_conv_window_show(win);
 	}
 
@@ -5297,7 +5293,7 @@
 
 
 	vbox = gtk_vbox_new(FALSE, 0);
-	button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type");
+	button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
 	if(button_type == GAIM_BUTTON_NONE) {
 		gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), vbox, FALSE, FALSE, 0);
 		gtk_box_reorder_child(GTK_BOX(gtkconv->entrybox), vbox, 0);
@@ -5690,19 +5686,25 @@
 }
 
 static void
-im_button_type_pref_cb(const char *name, GaimPrefType type,
+button_type_pref_cb(const char *name, GaimPrefType type,
 					   gpointer value, gpointer data)
 {
 	GList *l;
 	GaimConversation *conv;
 	GaimGtkConversation *gtkconv;
 
-	for (l = gaim_get_ims(); l != NULL; l = l->next) {
+	for (l = gaim_get_conversations(); l != NULL; l = l->next) {
 		conv = (GaimConversation *)l->data;
 		gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-		setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send));
-		gaim_gtkconv_update_buddy_icon(conv);
+		switch (conv->type) {
+		case GAIM_CONV_IM:
+			setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send));
+			gaim_gtkconv_update_buddy_icon(conv);
+			break;
+		case GAIM_CONV_CHAT:
+			setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send));
+			break;
+		}
 	}
 }
 
@@ -5748,22 +5750,6 @@
 }
 
 static void
-chat_button_type_pref_cb(const char *name, GaimPrefType type,
-						 gpointer value, gpointer data)
-{
-	GList *l;
-	GaimConversation *conv;
-	GaimGtkConversation *gtkconv;
-
-	for (l = gaim_get_chats(); l != NULL; l = l->next) {
-		conv = (GaimConversation *)l->data;
-		gtkconv = GAIM_GTK_CONVERSATION(conv);
-
-		setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send));
-	}
-}
-
-static void
 conv_placement_pref_cb(const char *name, GaimPrefType type,
 					   gpointer value, gpointer data)
 {
@@ -5823,23 +5809,25 @@
 	gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE);
 	gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP);
+	gaim_prefs_add_int("/gaim/gtk/conversations/button_type",
+					   GAIM_BUTTON_TEXT_IMAGE);
+	gaim_prefs_add_bool("/gaim/gtk/conversations/raise_on_events", FALSE);
+	gaim_prefs_rename("/gaim/gtk/conversations/im/buton_type", "/gaim/gtk/conversations/button_type");
+	gaim_prefs_rename("/gaim/gtk/conversations/im/raise_on_events", "/gaim/gtk/conversations/raise_on_events");
+	
 
 	/* Conversations -> Chat */
 	gaim_prefs_add_none("/gaim/gtk/conversations/chat");
-	gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type",
-					   GAIM_BUTTON_TEXT_IMAGE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE);
 	gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410);
 	gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160);
 	gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50);
 
 	/* Conversations -> IM */
 	gaim_prefs_add_none("/gaim/gtk/conversations/im");
-	gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type",
-					   GAIM_BUTTON_TEXT_IMAGE);
+
 	gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE);
+
 	gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE);
 	gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410);
 	gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160);
@@ -5867,21 +5855,16 @@
 			conv_placement_pref_cb, NULL);
 	gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement");
 
-
+	gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type",
+								button_type_pref_cb, NULL);
 
 	/* IM callbacks */
-	gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type",
-								im_button_type_pref_cb, NULL);
 	gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons",
 								animate_buddy_icons_pref_cb, NULL);
 	gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons",
 								show_buddy_icons_pref_cb, NULL);
 
 
-	/* Chat callbacks */
-	gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type",
-								chat_button_type_pref_cb, NULL);
-
 	/**********************************************************************
 	 * Register signals
 	 **********************************************************************/