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



Unfortunately this does not help.
There is also a context menu for text view that contains the "Copy"/"Paste" items.

Is there an alternative way? Is it not possible to prevent the default handler for this ?

Regards,
 Miroslav

----- Original Message ----- From: "Micah Carrick" <email micahcarrick com>
To: "Miroslav Rajcic" <rajcic sokrates hr>
Cc: <gtk-app-devel-list gnome org>
Sent: Tuesday, May 13, 2008 4:32 PM
Subject: Re: GtkTextView: how to stop default "paste-clipboard" handler ?


You may have to instead catch the Ctrl+V keybinding from within a handler for "key-press-event" and return TRUE to prevent further processing.

- Micah Carrick

 Developer - http://www.micahcarrick.com
 GTK+ Forums - http://www.gtkforums.com


Miroslav Rajcic wrote:
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]