changeset 4818:1c371e4244d6

[gaim-migrate @ 5142] brought to you by the letter T and the number 0, I give you tabless conversation windows. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 18 Mar 2003 03:23:00 +0000
parents b4ca2cc6bed9
children 815afc71c8e4
files src/conversation.c src/gtkconv.c
diffstat 2 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Mar 18 03:03:58 2003 +0000
+++ b/src/conversation.c	Tue Mar 18 03:23:00 2003 +0000
@@ -904,7 +904,9 @@
 	 * Create a window if one does not exist. If it does, use the last
 	 * created window.
 	 */
-	if (windows == NULL) {
+	if (windows == NULL ||
+			(type == GAIM_CONV_IM && !(im_options & OPT_IM_ONE_WINDOW)) ||
+			(type == GAIM_CONV_CHAT && !(chat_options & OPT_CHAT_ONE_WINDOW))) {
 		struct gaim_window *win;
 
 		win = gaim_window_new();
--- a/src/gtkconv.c	Tue Mar 18 03:03:58 2003 +0000
+++ b/src/gtkconv.c	Tue Mar 18 03:23:00 2003 +0000
@@ -3326,6 +3326,8 @@
 	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos);
 	gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE);
 	gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook));
+	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE);
+
 	gtk_widget_show(gtkwin->notebook);
 
 	g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page",
@@ -3583,9 +3585,15 @@
 
 	gtk_widget_show(tab_cont);
 
-	/* Er, bug in notebooks? Switch to the page manually. */
-	if (gaim_window_get_conversation_count(win) == 1)
+	if (gaim_window_get_conversation_count(win) == 1) {
+		/* Er, bug in notebooks? Switch to the page manually. */
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0);
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook),
+				((conv_type == GAIM_CONV_IM && im_options & OPT_IM_ONE_WINDOW) ||
+				(conv_type == GAIM_CONV_CHAT && im_options & OPT_CHAT_ONE_WINDOW)));
+	} else {
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE);
+	}
 
 	if ((gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)) == 0) ||
 		(conv == g_list_nth_data(gaim_window_get_conversations(win), 0))) {
@@ -3609,7 +3617,9 @@
 	struct gaim_gtk_window *gtkwin;
 	struct gaim_gtk_conversation *gtkconv;
 	unsigned int index;
-
+	GaimConversationType conv_type;
+
+	conv_type = gaim_conversation_get_type(conv);
 	index = gaim_conversation_get_index(conv);
 
 	gtkwin  = GAIM_GTK_WINDOW(win);
@@ -3620,8 +3630,16 @@
 
 	gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index);
 
+	/* go back to tabless if need be */
+	if (gaim_window_get_conversation_count(win) <= 2) {
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook),
+				((conv_type == GAIM_CONV_IM && im_options & OPT_IM_ONE_WINDOW) ||
+				(conv_type == GAIM_CONV_CHAT && im_options & OPT_CHAT_ONE_WINDOW)));
+	}
+
+
 	/* If this window is setup with an inactive gc, regenerate the menu. */
-	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
+	if (conv_type == GAIM_CONV_IM &&
 		gaim_conversation_get_gc(conv) == NULL) {
 
 		generate_send_as_items(win, conv);