diff -ur work/gaim-0.68/src/conversation.c work-fixed/gaim-0.68/src/conversation.c --- work/gaim-0.68/src/conversation.c 2003-08-27 21:18:49.000000000 -0400 +++ work-fixed/gaim-0.68/src/conversation.c 2003-09-21 22:06:29.826719936 -0400 @@ -934,10 +936,9 @@ gaim_conversation_autoset_title(conv); /* - * Create a window if one does not exist. If it does, use the last - * created window. + * Create a new window if conversation tabbing is disabled */ - if (windows == NULL) { + if (windows == NULL || ! gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { GaimWindow *win; win = gaim_window_new(); @@ -2786,3 +2787,54 @@ { gaim_signals_unregister_by_instance(gaim_conversations_get_handle()); } + +void gaim_tabstyle_update() +{ + GaimWindow * win = NULL; + + if(windows == NULL) + return; + + if(gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) + { + GaimWindow * win_iter = NULL; + /* consolidate all the windows into one */ + win = (GaimWindow *)windows->data; + while(windows->next != NULL) + { + win_iter = (GaimWindow *) windows->next->data; + while(windows->next != NULL && windows->next->data == win_iter) + { + /* removing the last conversation takes care of destroying/removing + the window */ + GaimConversation * conv = gaim_window_remove_conversation(win_iter, 0); + gaim_window_add_conversation(win, conv); + } + } + update_conv_indexes(win); + gaim_window_show(win); + } + else + { + GList * check = windows; + /* expand all tabbed windows. There should be only one (if any), + but we might as well handle the case that this isn't true. */ + /* note here that since gaim_window_new appends the new window to + the end of the windows GList, these windows will be checked as well. + Of course, they will only have one conversation, so the loop will not + get executed, but rather only update_conv_indexes and gaim_window_show */ + while(check != NULL) + { + win = (GaimWindow *) check->data; + while(gaim_window_get_conversation_count(win) > 1) + { + GaimWindow * t_win = gaim_window_new(); + gaim_window_add_conversation(t_win, gaim_window_remove_conversation(win, 1)); + } + update_conv_indexes(win); + gaim_window_show(win); + + check = check->next; + } + } +} diff -ur work/gaim-0.68/src/conversation.h work-fixed/gaim-0.68/src/conversation.h --- work/gaim-0.68/src/conversation.h 2003-08-25 10:12:25.000000000 -0400 +++ work-fixed/gaim-0.68/src/conversation.h 2003-09-21 19:49:30.000000000 -0400 @@ -1250,6 +1250,11 @@ */ void gaim_conversations_uninit(void); +/** + * Changes to and from tabbed and untabbed chatting + */ +void gaim_tabstyle_update(void); + /*@}*/ #ifdef __cplusplus diff -ur work/gaim-0.68/src/gtkprefs.c work-fixed/gaim-0.68/src/gtkprefs.c --- work/gaim-0.68/src/gtkprefs.c 2003-08-25 11:42:38.000000000 -0400 +++ work-fixed/gaim-0.68/src/gtkprefs.c 2003-09-21 19:49:58.000000000 -0400 @@ -47,6 +47,9 @@ /* XXX for grab_url */ #include "gaim.h" +/* for gaim_tabstyle_update() */ +#include "conversation.h" + #define PROXYHOST 0 #define PROXYPORT 1 #define PROXYUSER 2 @@ -2445,6 +2448,8 @@ button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); gtk_size_group_add_widget(sg, button); g_signal_connect_swapped(G_OBJECT(button), "clicked", + G_CALLBACK(gaim_tabstyle_update), prefs); + g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_destroy), prefs); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button);