changeset 11964:5db4ae4c94a1

[gaim-migrate @ 14255] sf patch #1347710, from Levi Bard Make text repl detach from existing conversations on unload committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 04 Nov 2005 01:30:52 +0000
parents d8787960e398
children bcdc6eba1700
files plugins/iconaway.c plugins/spellchk.c
diffstat 2 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/iconaway.c	Fri Nov 04 01:29:58 2005 +0000
+++ b/plugins/iconaway.c	Fri Nov 04 01:30:52 2005 +0000
@@ -43,7 +43,7 @@
 static void
 iconify_windows(GaimAccount *account, char *state, char *message, void *data)
 {
-#if 0 /* STATUS */
+#if 0 /* XXX TODO STATUS */
 	GaimConvWindow *win;
 	GList *windows;
 	GaimConnection *gc;
@@ -70,7 +70,7 @@
 			gtk_window_iconify(GTK_WINDOW(gtkwin->window));
 		}
 	}
-#endif /* STATUS */
+#endif /* XXX TODO STATUS */
 }
 
 /*
--- a/plugins/spellchk.c	Fri Nov 04 01:29:58 2005 +0000
+++ b/plugins/spellchk.c	Fri Nov 04 01:30:52 2005 +0000
@@ -264,6 +264,8 @@
 {
 	GtkTextBuffer *buffer;
 
+	g_return_if_fail(spell != NULL);
+
 	buffer = gtk_text_view_get_buffer(spell->view);
 
 	g_signal_handlers_disconnect_matched(spell->view,
@@ -581,6 +583,17 @@
 	return;
 }
 
+static void
+spellchk_detach(GaimConversation *conv)
+{
+	GaimGtkConversation *gtkconv;
+	spellchk *spell;
+
+	gtkconv = GAIM_GTK_CONVERSATION(conv);
+	spell = g_object_steal_data(G_OBJECT(gtkconv->entry), SPELLCHK_OBJECT_KEY);
+	spellchk_free(spell);
+}
+
 static int buf_get_line(char *ibuf, char **buf, int *position, int len)
 {
 	int pos = *position;
@@ -1938,6 +1951,20 @@
 	return TRUE;
 }
 
+static gboolean
+plugin_unload(GaimPlugin *plugin)
+{
+	GList *convs;
+
+	/* Detach from existing conversations */
+	for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next)
+	{
+		spellchk_detach((GaimConversation *)convs->data);
+	}
+
+	return TRUE;
+}
+
 static GtkWidget *
 get_config_frame(GaimPlugin *plugin)
 {
@@ -2108,7 +2135,7 @@
 	"Eric Warmenhoven <eric@warmenhoven.org>",
 	GAIM_WEBSITE,
 	plugin_load,
-	NULL,
+	plugin_unload,
 	NULL,
 	&ui_info,
 	NULL,