Mercurial > pidgin
changeset 12642:022bf81f4087
[gaim-migrate @ 14978]
--enable-fatal-asserts lead me to a small bug here. I discovered that I could let the GObject system manage the freeing callback, and saved a bunch of code.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 23 Dec 2005 12:47:02 +0000 |
parents | e0e8b0735c5a |
children | 29c034547358 |
files | plugins/spellchk.c |
diffstat | 1 files changed, 7 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/spellchk.c Fri Dec 23 12:02:01 2005 +0000 +++ b/plugins/spellchk.c Fri Dec 23 12:47:02 2005 +0000 @@ -282,10 +282,6 @@ buffer = gtk_text_view_get_buffer(spell->view); - g_signal_handlers_disconnect_matched(spell->view, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - spell); g_signal_handlers_disconnect_matched(buffer, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, @@ -548,14 +544,15 @@ } static void -spellchk_new_attach(GaimConversation *c) { +spellchk_new_attach(GaimConversation *conv) +{ spellchk *spell; GtkTextBuffer *buffer; GtkTextIter start, end; GaimGtkConversation *gtkconv; GtkTextView *view; - gtkconv = GAIM_GTK_CONVERSATION(c); + gtkconv = GAIM_GTK_CONVERSATION(conv); view = GTK_TEXT_VIEW(gtkconv->entry); @@ -567,10 +564,8 @@ spell = g_new0(spellchk, 1); spell->view = view; - g_object_set_data(G_OBJECT(view), SPELLCHK_OBJECT_KEY, spell); - - g_signal_connect_swapped(G_OBJECT(view), "destroy", - G_CALLBACK(spellchk_free), spell); + g_object_set_data_full(G_OBJECT(view), SPELLCHK_OBJECT_KEY, spell, + (GDestroyNotify)spellchk_free); buffer = gtk_text_view_get_buffer(view); @@ -597,17 +592,6 @@ 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; @@ -2030,7 +2014,8 @@ /* Detach from existing conversations */ for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) { - spellchk_detach((GaimConversation *)convs->data); + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)convs->data); + g_object_set_data(G_OBJECT(gtkconv->entry), SPELLCHK_OBJECT_KEY, NULL); } return TRUE;