gaim/gaim

Parents bcf3ca74a8c7
Children 0ecebfbb23ca
"destroy-event" doesn't get this far when the window is closed, so the trans. data isn't cleaned up when the conv. window is closed. This causes crashes when we do try to clean up. So, we use the "deleting-conversation" signal and detect that the last conversation in the window is being deleted.
--- a/plugins/win32/transparency/win2ktrans.c Wed May 18 00:48:17 2005 -0400
+++ b/plugins/win32/transparency/win2ktrans.c Wed May 18 18:05:37 2005 -0400
@@ -163,16 +163,21 @@
return NULL;
}
-static gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
- slider_win *slidwin=NULL;
- /* Remove window from the window list */
- gaim_debug_info(WINTRANS_PLUGIN_ID, "Conv window destoyed.. removing from list\n");
+static void gaim_conversation_delete(GaimConversation *conv) {
+ GaimConvWindow *win = gaim_conversation_get_window(conv);
+ //If it is the last conversation in the window, get rid of the sliders
+ if (gaim_conv_window_get_conversation_count(win) == 1) {
+ GtkWidget *widget = GAIM_GTK_WINDOW(win)->window;
+ slider_win *slidwin = NULL;
- if((slidwin=find_slidwin(widget))) {
- window_list = g_list_remove(window_list, (gpointer)slidwin);
- g_free(slidwin);
+ /* Remove window from the window list */
+ gaim_debug_info(WINTRANS_PLUGIN_ID, "Conv window destoyed.. removing from list\n");
+
+ if ((slidwin=find_slidwin(widget))) {
+ window_list = g_list_remove(window_list, (gpointer)slidwin);
+ g_free(slidwin);
+ }
}
- return FALSE;
}
static void set_trans_option(GtkWidget *w, const char *pref) {
@@ -225,8 +230,6 @@
slidwin->win = win;
slidwin->slider = slider_box;
window_list = g_list_append(window_list, (gpointer)slidwin);
- /* Set callback to remove window from the list, if the window is destroyed */
- g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL);
}
}
@@ -345,6 +348,12 @@
plugin,
GAIM_CALLBACK(gaim_new_conversation),
NULL);
+ /* Set callback to remove window from the list, if the window is destroyed */
+ gaim_signal_connect(gaim_conversations_get_handle(),
+ "deleting-conversation",
+ plugin,
+ GAIM_CALLBACK(gaim_conversation_delete),
+ NULL);
gaim_signal_connect((void*)gaim_connections_get_handle(), "signed-on", plugin, GAIM_CALLBACK(blist_created), NULL);
MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );