Re: Non-editable textview paste
- From: "muppet" <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: Non-editable textview paste
- Date: Thu, 30 Jun 2005 14:56:36 -0400 (EDT)
Thomas Christensen said:
I was wondering if anybody could give me a pointer to how to catch a
paste (non-clipboard primarily), in a textview.
I'm guessing that you want to catch a paste and redirect it to some other
destination, which will eventually modify the textbuffer on its own. But the
"non-clipboard primarily" makes me wonder if perhaps you mean "i just want to
know whenever the buffer is modified"; if that's the case, you can just listen
to the "changed" or "insert-text" signals on the TextBuffer.
I have tried the 'clipboard-paste' signal but is doesn't get triggered
on a plain (middle-mouse) paste, and it's not applicable anyways since
my textview is editable => 0.
The selections are different; middle button paste is the PRIMARY, while Ctrl+V
is CLIPBOARD. Inside GtkTextView, the 'paste-clipboard' signal handles the
CLIPBOARD selection, and the 'button-press-event' handler fetches and inserts
the PRIMARY selection when button==2.
Both of these eventually wind up down in gtk_text_buffer_insert_interactive()
with default_editable==FALSE (since you've set your treeview to non-editable)
and thus do nothing.
Any hints would be well received.
The paste-clipboard and button-press-event signals fire regardless of whether
the view is editable, so you can still hook up to them and do stuff.
muppet <scott at asofyet dot org>
] [Thread Prev