GtkTextView: how to stop default "paste-clipboard" handler ?



I've needed to override the default GtkTextView pasting code in order to support
pasting of formatted text.

My problem is that after adding the handler for "paste-clipboard" signal,
the same text is pasted twice:
- once as a formatted text,
- and once more as a plain text (I suspect this other copy is due to default signal handler).

My code goes like this:

g_signal_connect (G_OBJECT (textview1), "paste-clipboard", G_CALLBACK (on_paste1_activate), NULL);

void on_paste1_activate (GtkMenuItem *menuitem, gpointer user_data)
{
   //g_signal_stop_emission_by_name(textview1, "paste-clipboard");

//do my stuff here, paste will happen within the MyClipboardTargetsReceivedFunc GtkClipboard *clipboard = gtk_widget_get_clipboard (textview1, GDK_SELECTION_CLIPBOARD); gtk_clipboard_request_targets(clipboard, MyClipboardTargetsReceivedFunc, NULL);
}

It appears if I add the call to stop signal emission (see commented line), it actually kills my own handler instead of the system one.
The result is that only plain text copy is pasted now.

Can anyone recomend the way to kill the default handler for "paste-clipboard" signal ?



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