Customiziing GtkTextView cut/copy/paste

I am trying to set up a custom handler for cut/copy/paste in a GtkTextView widget.

I can setup call backs for “cut-clipboard”, “copy-clipboard” and “paste-clipboard” like …

g_signal_connect( myTextView, "cut-clipboard", G_CALLBACK(CB_txtview_Cut), NULL);

The callbacks are called but then also the default handler.

How can I disable the calling of the default handler?

Sounds like g_signal_stop_emission* is what you are looking for.

Yes, g_signal_stop_emission (actually g_signal_stop_emission_by_name) works.

I had assumed that it would permanently prevent my callback from being called by the signal but it does just stop the default for that instance of the signal (when executed in the callback).

You can replace the default handler with an empty callback function that does nothing by using g_signal_override_class_handler. However, this would have effect for all instances of GtkTextView in your application.

Yes, that won’t help here but I’ll use it elsewhere!

To add onto the existing suggestions, can’t you simply subclass GtkTextView and override the following virtual methods?

To me, that seems like the most straightforward option to override class behavior.