changeset 9251:45d2ad4ac1c1

[gaim-migrate @ 10050] Stu Tomlinson has provided a nice patch to move the separation of IM and Chat windows back into the core from the extplacement plugin. It's awesome to have crazy patch writers, and even better to have crazy patch writers who write what I want to write before I do it, thus saving me the effort. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 09 Jun 2004 20:47:07 +0000
parents ff8e380015e3
children fe9f4eee3dcb
files plugins/extplacement.c src/conversation.c src/gaimrc.c src/gtkprefs.c src/prefs.c
diffstat 5 files changed, 22 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/extplacement.c	Wed Jun 09 18:58:26 2004 +0000
+++ b/plugins/extplacement.c	Wed Jun 09 20:47:07 2004 +0000
@@ -25,23 +25,6 @@
 #include "gtkplugin.h"
 
 static void
-conv_placement_last_created_win_split(GaimConversation *conv)
-{
-	GaimConvWindow *win;
-
-	win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv));
-
-	if (win == NULL) {
-		win = gaim_conv_window_new();
-
-		gaim_conv_window_add_conversation(win, conv);
-		gaim_conv_window_show(win);
-	}
-	else
-		gaim_conv_window_add_conversation(win, conv);
-}
-
-static void
 conv_placement_by_number(GaimConversation *conv)
 {
 	GaimConvWindow *win = NULL;
@@ -82,8 +65,6 @@
 static gboolean
 plugin_load(GaimPlugin *plugin)
 {
-	gaim_conv_placement_add_fnc("im_chat", _("Separate IM and Chat windows"),
-							   &conv_placement_last_created_win_split);
 	gaim_conv_placement_add_fnc("number", _("By conversation count"),
 							   &conv_placement_by_number);
 	gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement");
@@ -93,7 +74,6 @@
 static gboolean
 plugin_unload(GaimPlugin *plugin)
 {
-	gaim_conv_placement_remove_fnc("im_chat");
 	gaim_conv_placement_remove_fnc("number");
 	gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement");
 	return TRUE;
--- a/src/conversation.c	Wed Jun 09 18:58:26 2004 +0000
+++ b/src/conversation.c	Wed Jun 09 20:47:07 2004 +0000
@@ -2230,14 +2230,25 @@
 {
 	GaimConvWindow *win;
 
-#if 0 /* Last-minute prefslash */
-	if (gaim_prefs_get_bool("/core/conversations/combine_chat_im"))
-		win = g_list_last(gaim_get_windows())->data;
+	win = g_list_last(gaim_get_windows())->data;
+
+	if (win == NULL) {
+		win = gaim_conv_window_new();
+
+		gaim_conv_window_add_conversation(win, conv);
+		gaim_conv_window_show(win);
+	}
 	else
-		win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv));
-#else
-	win = g_list_last(gaim_get_windows())->data;
-#endif
+		gaim_conv_window_add_conversation(win, conv);
+}
+
+/* This one places conversations in the last made window of the same type. */
+static void
+conv_placement_last_created_win_type(GaimConversation *conv)
+{
+	GaimConvWindow *win;
+
+	win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv));
 
 	if (win == NULL) {
 		win = gaim_conv_window_new();
@@ -2375,51 +2386,6 @@
 	conv_placement_new_window(conv);
 }
 
-#if 0 /* PREFSLASH04 */
-
-static void
-conv_placement_by_number(GaimConversation *conv)
-{
-	GaimConvWindow *win = NULL;
-
-	if (gaim_prefs_get_bool("/core/conversations/combine_chat_im"))
-		win = g_list_last(gaim_get_windows())->data;
-	else
-		win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv));
-
-	if (win == NULL) {
-		win = gaim_conv_window_new();
-
-		gaim_conv_window_add_conversation(win, conv);
-		gaim_conv_window_show(win);
-	} else {
-		int max_count = gaim_prefs_get_int("/gaim/gtk/conversations/placement_number");
-		int count = gaim_conv_window_get_conversation_count(win);
-
-		if (count < max_count)
-			gaim_conv_window_add_conversation(win, conv);
-		else {
-			GList *l = NULL;
-
-			for (l = gaim_get_windows(); l != NULL; l = l->next) {
-				win = (GaimConvWindow *)l->data;
-
-				count = gaim_conv_window_get_conversation_count(win);
-				if (count < max_count) {
-					gaim_conv_window_add_conversation(win, conv);
-					return;
-				}
-			}
-			win = gaim_conv_window_new();
-
-			gaim_conv_window_add_conversation(win, conv);
-			gaim_conv_window_show(win);
-		}
-	}
-}
-
-#endif
-
 static ConvPlacementData *
 get_conv_placement_data(const char *id)
 {
@@ -2457,6 +2423,8 @@
 	{
 		add_conv_placement_fnc("last", _("Last created window"),
 							   conv_placement_last_created_win);
+		add_conv_placement_fnc("im_chat", _("Separate IM and Chat windows"),
+							   conv_placement_last_created_win_type);
 		add_conv_placement_fnc("new", _("New window"),
 							   conv_placement_new_window);
 		add_conv_placement_fnc("group", _("By group"),
@@ -2603,7 +2571,6 @@
 	/* Conversations */
 	gaim_prefs_add_none("/core/conversations");
 	gaim_prefs_add_bool("/core/conversations/use_alias_for_title", TRUE);
-	gaim_prefs_add_bool("/core/conversations/combine_chat_im", FALSE);
 
 	/* Conversations -> Chat */
 	gaim_prefs_add_none("/core/conversations/chat");
--- a/src/gaimrc.c	Wed Jun 09 18:58:26 2004 +0000
+++ b/src/gaimrc.c	Wed Jun 09 20:47:07 2004 +0000
@@ -1004,8 +1004,6 @@
 			gaim_prefs_set_bool("/gaim/gtk/conversations/ignore_font_sizes",
 								convo_options & OPT_CONVO_IGNORE_SIZES);
 #endif
-			gaim_prefs_set_bool("/core/conversations/combine_chat_im",
-					convo_options & OPT_CONVO_COMBINE);
 			gaim_prefs_set_bool("/gaim/gtk/conversations/close_on_tabs",
 					!(convo_options & OPT_CONVO_NO_X_ON_TAB));
 		} else if (!strcmp(p->option, "im_options")) {
--- a/src/gtkprefs.c	Wed Jun 09 18:58:26 2004 +0000
+++ b/src/gtkprefs.c	Wed Jun 09 20:47:07 2004 +0000
@@ -1005,11 +1005,6 @@
 	if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"))
 		gtk_widget_set_sensitive(vbox2, FALSE);
 
-#if 0 /* PREFSLASH04 */
-	gaim_gtk_prefs_checkbox(_("Show IMs and chats in _same tabbed window"),
-							"/core/conversations/combine_chat_im", vbox2);
-#endif
-
 	gaim_gtk_prefs_checkbox(_("Show _close button on tabs"),
 							"/gaim/gtk/conversations/close_on_tabs", vbox2);
 
@@ -1024,18 +1019,12 @@
 	gtk_size_group_add_widget(sg, label);
 
 	names = gaim_conv_placement_get_options();
-	label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New window _placement:"),
+	label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New conversation _placement:"),
 			GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names);
 	gtk_size_group_add_widget(sg, label);
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 	g_list_free(names);
 
-#if 0 /* PREFSLASH04 */
- 	label = gaim_gtk_prefs_labeled_spin_button(vbox2, _("Number of conversations per window:"),
-	                                           "/gaim/gtk/conversations/placement_number",
-	                                           1, 50, sg);
-#endif
-
 	gtk_widget_show_all(ret);
 
 	return ret;
--- a/src/prefs.c	Wed Jun 09 18:58:26 2004 +0000
+++ b/src/prefs.c	Wed Jun 09 20:47:07 2004 +0000
@@ -990,4 +990,5 @@
 	gaim_prefs_remove("/core/conversations/im/show_login");
 	gaim_prefs_remove("/core/conversations/chat/show_join");
 	gaim_prefs_remove("/core/conversations/chat/show_leave");
+	gaim_prefs_remove("/core/conversations/combine_chat_im");
 }