Mercurial > pidgin.yaz
comparison pidgin/gtkimhtml.c @ 26893:c791a82b5bb5
Avoid adding several callbacks on repeated invocations of gtk_imhtml_set_editable.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sun, 03 May 2009 23:46:18 +0000 |
parents | 618255d76deb |
children | 3c06cd0e1717 |
comparison
equal
deleted
inserted
replaced
26892:55736bd691e2 | 26893:c791a82b5bb5 |
---|---|
4418 /* | 4418 /* |
4419 * We need a visible caret for accessibility, so mouseless | 4419 * We need a visible caret for accessibility, so mouseless |
4420 * people can highlight stuff. | 4420 * people can highlight stuff. |
4421 */ | 4421 */ |
4422 /* gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(imhtml), editable); */ | 4422 /* gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(imhtml), editable); */ |
4423 imhtml->editable = editable; | 4423 if (editable && !imhtml->editable) { |
4424 imhtml->format_functions = GTK_IMHTML_ALL; | |
4425 | |
4426 if (editable) | |
4427 { | |
4428 g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", | 4424 g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", |
4429 G_CALLBACK(mark_set_cb), imhtml); | 4425 G_CALLBACK(mark_set_cb), imhtml); |
4430 g_signal_connect(G_OBJECT(imhtml), "backspace", G_CALLBACK(smart_backspace_cb), NULL); | 4426 g_signal_connect(G_OBJECT(imhtml), "backspace", G_CALLBACK(smart_backspace_cb), NULL); |
4431 } | 4427 } else if (!editable && imhtml->editable) { |
4428 g_signal_handlers_disconnect_by_func(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), | |
4429 mark_set_cb, imhtml); | |
4430 g_signal_handlers_disconnect_by_func(G_OBJECT(imhtml), | |
4431 smart_backspace_cb, NULL); | |
4432 } | |
4433 | |
4434 imhtml->editable = editable; | |
4435 imhtml->format_functions = GTK_IMHTML_ALL; | |
4432 } | 4436 } |
4433 | 4437 |
4434 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo) | 4438 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo) |
4435 { | 4439 { |
4436 g_return_if_fail(imhtml != NULL); | 4440 g_return_if_fail(imhtml != NULL); |