gtk_signal_emit_stop seems to get confused



I don't seem to be able to stop the insert-text signal if I also block my
signal handler.

What I'm trying to achieve here is that the user enters say an &, we
intersept it, stop the signal, stop our signal handler from being emited a
second time, re-insert the escaped text ( & ) this time allowing
handlers further up to deal with escaped text, and then re-enable our
handler.

But the first signal isn't being stoped resulting in duplicate text ( ie
rather than & we get && ).

If I comment out everything after the gtk_signal_emit_stop the signal gets
stoped and no text is ever displayed.

Here is my function 

void 
char_entered_cb(GtkWidget *widget,
               gchar *newText,
               gint newTextLength,
               gint *position,
               gpointer userData)
{
        XmlTextEntry *self;
        gchar *escapedText;

        self = XML_TEXT_ENTRY (userData);
        escapedText = escape_text (self, 
                                   g_strndup( newText, newTextLength),
                                   newTextLength);
        gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), 
                              "insert-text");
        gtk_signal_handler_block (GTK_OBJECT (widget),
                                  self->signalHandler);
        gtk_editable_insert_text (GTK_EDITABLE (widget), 
                                  escapedText,
                                  strlen (escapedText),
                                  position);
        gtk_signal_handler_unblock (GTK_OBJECT (widget),
                                    self->signalHandler);
}

Can anyone see why this dosen't work?

This is the last bug before I release the first version of my program onto
the world and it has me completly stuck :( so any help is massively
appreciated. 


rob





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]